@bolttech/form-engine 0.1.9 → 0.2.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.
- package/CHANGELOG.md +14 -0
- package/README.md +112 -52
- package/asFormField-175b1a63.js +2 -0
- package/asFormField-175b1a63.js.map +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/react.js +1 -1
- package/src/adapters/react/types.d.ts +3 -2
- package/src/core/constants/events.d.ts +1 -0
- package/src/core/handlers/flows.d.ts +2 -1
- package/src/core/handlers/form/steps.d.ts +1 -1
- package/src/core/types/index.d.ts +3 -2
- package/types.js.map +1 -1
- package/asFormField-4a8116fd.js +0 -2
- package/asFormField-4a8116fd.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.2.1](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.2.0...form-engine-0.2.1) (2023-08-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* implementing set step function and fix validations test ([37aee66](http://bitbucket.org/gofrank/bolttech-frontend/commit/37aee667160a73a15fd805e55d7b5ab6c96f91d0))
|
|
11
|
+
|
|
12
|
+
## [0.2.0](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.1.9...form-engine-0.2.0) (2023-08-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* select index on step back or forward ([c651570](http://bitbucket.org/gofrank/bolttech-frontend/commit/c651570ab0a6c378310a79799910ceb5891f1c7f))
|
|
18
|
+
|
|
5
19
|
## [0.1.9](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.1.8...form-engine-0.1.9) (2023-08-01)
|
|
6
20
|
|
|
7
21
|
## [0.1.8](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.1.7...form-engine-0.1.8) (2023-08-01)
|
package/README.md
CHANGED
|
@@ -2,36 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
Achieve form logic reusage with forms expressed in json format.
|
|
4
4
|
|
|
5
|
-
> version 0.1
|
|
5
|
+
> version 0.2.1
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
1. [Basic setup](#markdown-header-basic-setup)
|
|
10
10
|
2. [Step by step](#markdown-header-step-by-step)
|
|
11
11
|
3. [Form Features](#markdown-header-available-features)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
3.2.1. [Available formatters](#markdown-header-formatters)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
- 3.1. [Validations - Allow form to run validations in the field](#markdown-header-validations)
|
|
13
|
+
- 3.1.1. [Named Validations](#markdown-header-validations)
|
|
14
|
+
- 3.1.2. [Error Messages](#markdown-header-validations)
|
|
15
|
+
- 3.1.3. [Available Validations](#markdown-header-validations)
|
|
16
|
+
- 3.2. [Filters - Allow only what you want in the field](#markdown-header-filters)
|
|
17
|
+
- 3.2.1. [Available formatters](#markdown-header-formatters)
|
|
18
|
+
- 3.3. [Formatters - Style your field value with formatters](#markdown-header-formatters)
|
|
19
|
+
- 3.4. [Masks - Modify the field value, while maintaining the original with masks](#markdown-header-masks)
|
|
20
|
+
- 3.4.1. [Available Masks](#markdown-header-formatters)
|
|
21
|
+
- 3.5. [Visibility conditions - Configure when to show hide/components](#markdown-header-visibility-conditions)
|
|
22
|
+
- 3.6. [Clear fields](#markdown-header-clear-fields)
|
|
23
|
+
- 3.7. [Api - Make api calls on certain form events](#markdown-header-api)
|
|
24
|
+
- 3.8. [Data binding - Allow to have dynamic data in the form, binding and subscribing to form changes](#markdown-header-data-binding)
|
|
25
|
+
- 3.8.1. [Scopes](#markdown-header-scope)
|
|
26
|
+
- 3.8.2. [Templates](#markdown-header-templates)
|
|
27
|
+
- 3.8.3. [varOps](#markdown-header-varops)
|
|
28
|
+
- 3.9. [State - Define component state](#markdown-header-state)
|
|
29
|
+
- 3.10. [Group](#markdown-header-group)
|
|
30
|
+
- 3.11. [Steps](#markdown-header-form-step)
|
|
30
31
|
4. [React](#markdown-header-react-components)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
- 4.1. [FormProvider - Provider to configure the form with component mappings](#markdown-header-react-formprovider)
|
|
33
|
+
- 4.2. [Form - Component to render a form based on a schema and listen to some events](#markdown-header-react-form)
|
|
34
|
+
- 4.3. [useForm hook- Allo to connect to any form in the page](#markdown-header-react-useform)
|
|
35
|
+
- 4.4. [asFormField HOC- Leverage form features but keep the control of your component](#markdown-header-react-asFormField-HOC)
|
|
35
36
|
|
|
36
37
|
## **Basic setup**
|
|
37
38
|
|
|
@@ -355,7 +356,6 @@ You have several formatters. THe following example shows splitter that is a more
|
|
|
355
356
|
}
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
|
-
|
|
359
359
|
```
|
|
360
360
|
|
|
361
361
|
The above example will split your word in position 2 and 5, adding there the `/`. This will give you a date format like `10/10/1987` (you would have to limit the input length. More on that on FILTERS)
|
|
@@ -412,7 +412,9 @@ This example will let you do just that. Only numbers and max length of 4
|
|
|
412
412
|
Refer to the types on `TSchema`
|
|
413
413
|
|
|
414
414
|
## Visibility conditions
|
|
415
|
+
|
|
415
416
|
### Field level
|
|
417
|
+
|
|
416
418
|
Sometimes you want to hide other fields based on certain conditions.
|
|
417
419
|
|
|
418
420
|
That is what this feature does.
|
|
@@ -472,10 +474,7 @@ You can also for each visibility condition, apply it to multiple field names wit
|
|
|
472
474
|
"validations": {
|
|
473
475
|
"value": "Yes"
|
|
474
476
|
},
|
|
475
|
-
"fieldNames": [
|
|
476
|
-
"targetFieldOne",
|
|
477
|
-
"targetFieldTwo"
|
|
478
|
-
]
|
|
477
|
+
"fieldNames": ["targetFieldOne", "targetFieldTwo"]
|
|
479
478
|
}
|
|
480
479
|
]
|
|
481
480
|
}
|
|
@@ -485,6 +484,7 @@ You can also for each visibility condition, apply it to multiple field names wit
|
|
|
485
484
|
**NOTE** - When the field is hidden using this feature, the form will not try to validate it and will not be accounted to the general form state
|
|
486
485
|
|
|
487
486
|
### Form Level
|
|
487
|
+
|
|
488
488
|
You can also use those in form level.
|
|
489
489
|
|
|
490
490
|
```javascript
|
|
@@ -516,8 +516,9 @@ You can also use those in form level.
|
|
|
516
516
|
```
|
|
517
517
|
|
|
518
518
|
in the above example we are applying the rule:
|
|
519
|
+
|
|
519
520
|
- in form mount we will hide the value when the `roofUpdatedYear` equals to the iVar `roofUpdated`
|
|
520
|
-
- in each field change we will hide the value when the `roofUpdatedYear` equals to
|
|
521
|
+
- in each field change we will hide the value when the `roofUpdatedYear` equals to `abc`
|
|
521
522
|
|
|
522
523
|
## Clear Fields
|
|
523
524
|
|
|
@@ -555,9 +556,7 @@ Just like before, you can specify multiple fields with `fields` key for the same
|
|
|
555
556
|
"validations": {
|
|
556
557
|
"value": "Yes"
|
|
557
558
|
},
|
|
558
|
-
"fields": [
|
|
559
|
-
"targetValue"
|
|
560
|
-
],
|
|
559
|
+
"fields": ["targetValue"],
|
|
561
560
|
"clearedValue": false
|
|
562
561
|
}
|
|
563
562
|
]
|
|
@@ -589,7 +588,7 @@ The above example will make form to call the API specified when the field where
|
|
|
589
588
|
### Keys
|
|
590
589
|
|
|
591
590
|
| key | type | Description |
|
|
592
|
-
|
|
591
|
+
| ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
593
592
|
| blockRequestWhenInvalid | boolean | Specify if this call should be blocked when the field is invalid (due to validations) |
|
|
594
593
|
| method | string | HTTP verb. Get, Post, Put or delete |
|
|
595
594
|
| url | string | The api url |
|
|
@@ -659,7 +658,7 @@ The subscription is done using the template first keys. In this case `fields` an
|
|
|
659
658
|
For templating to work, form relies on scope. The definition of scope is just a datastructures that has multiple keys each one with their context. The following table explain the namespaces
|
|
660
659
|
|
|
661
660
|
| namespace | description |
|
|
662
|
-
|
|
661
|
+
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
663
662
|
| global | This namespace contains all the data that comes from the client implementing the Form and is injected in iVars |
|
|
664
663
|
| fields | Automatically generated scope. This namespace contains all the fields with everything that is done in them per field. Eg: value, errors, visible, mask etc. Refer to the types for more info |
|
|
665
664
|
| api | This scope is where you can store the api responses with the api scope key. |
|
|
@@ -670,14 +669,14 @@ Templating basically allows a given component to subscribe to any scope change,
|
|
|
670
669
|
|
|
671
670
|
```json
|
|
672
671
|
{
|
|
672
|
+
"name": "make",
|
|
673
|
+
"component": "dropdown",
|
|
674
|
+
"props": {
|
|
675
|
+
"id": "make",
|
|
673
676
|
"name": "make",
|
|
674
|
-
"
|
|
675
|
-
"
|
|
676
|
-
|
|
677
|
-
"name": "make",
|
|
678
|
-
"label": "Make",
|
|
679
|
-
"placeholder": "",
|
|
680
|
-
"options": "${api.makes.data||[]}"
|
|
677
|
+
"label": "Make",
|
|
678
|
+
"placeholder": "",
|
|
679
|
+
"options": "${api.makes.data||[]}"
|
|
681
680
|
}
|
|
682
681
|
}
|
|
683
682
|
```
|
|
@@ -912,6 +911,68 @@ Say you have two checkboxes and want the selected value. You can use `group` for
|
|
|
912
911
|
|
|
913
912
|
This example will store the selected value of the checkbox in the `checkedGroup` and will then be sent to the client.
|
|
914
913
|
|
|
914
|
+
## Form Step
|
|
915
|
+
|
|
916
|
+
In the form it is possible to use it as steps. With this it is possible to have more than one form in just one schema.
|
|
917
|
+
|
|
918
|
+
For example, if you implement something like:
|
|
919
|
+
|
|
920
|
+
```js
|
|
921
|
+
{
|
|
922
|
+
components: [
|
|
923
|
+
{ component: '', name: 'step1', children: [] },
|
|
924
|
+
{ component: '', name: 'step2', children: [] },
|
|
925
|
+
{ component: '', name: 'step3', children: [] },
|
|
926
|
+
];
|
|
927
|
+
}
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
You can control the go back and forth event from the [onClick](#props) event of a button inside one of the forms using the form reference.
|
|
931
|
+
Or Simply using the form reference in a button outside the form, for example:
|
|
932
|
+
|
|
933
|
+
```js
|
|
934
|
+
{
|
|
935
|
+
const ref = useRef < TFormRefActions > null;
|
|
936
|
+
|
|
937
|
+
return (
|
|
938
|
+
<Form id="form" ref={ref} onClick={() => ref.current?.stepForward()} />
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// --------------------- OR --------------------- //
|
|
943
|
+
|
|
944
|
+
{
|
|
945
|
+
const ref = useRef < TFormRefActions > null;
|
|
946
|
+
|
|
947
|
+
return (
|
|
948
|
+
<>
|
|
949
|
+
<Form id="form" ref={ref} />
|
|
950
|
+
<button onClick={ref.current?.stepBack()} />
|
|
951
|
+
</>
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
However, it is possible to choose which step you want to go or go back, using the numerical index or simply the name of the step you want, for example:
|
|
957
|
+
|
|
958
|
+
```js
|
|
959
|
+
() => ref.current?.stepForward(2);
|
|
960
|
+
// --------------- OR -------------- //
|
|
961
|
+
() => ref.current?.stepForward('step3');
|
|
962
|
+
|
|
963
|
+
() => ref.current?.stepBack(0);
|
|
964
|
+
// --------------- OR -------------- //
|
|
965
|
+
() => ref.current?.stepBack('step1');
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
Additionally, you can use a `step` method provided by form reference to easily set a desired step using the `onFormMount` event. For example:
|
|
969
|
+
|
|
970
|
+
```js
|
|
971
|
+
<Form ref={ref} schema={schema} onFormMount={() => ref.current?.step(1)} />
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
Remembering that this method has a mandatory index parameter, which can either be the step index number in the array or simply its defined string name in the schema.
|
|
975
|
+
|
|
915
976
|
# React Components
|
|
916
977
|
|
|
917
978
|
## React `<FormProvider />`
|
|
@@ -921,7 +982,7 @@ React context that lets you provide configuration information to your applicatio
|
|
|
921
982
|
### Props
|
|
922
983
|
|
|
923
984
|
| Prop | Type | Description |
|
|
924
|
-
|
|
985
|
+
| ------------ | ------------- | ------------------------------------------------------------- |
|
|
925
986
|
| mapper | TMapper | Allow you to map your own components to be used with the form |
|
|
926
987
|
| propsMapping | TPropsMapping | Map your component props names with the form functionalities |
|
|
927
988
|
|
|
@@ -958,12 +1019,12 @@ const App = () => {
|
|
|
958
1019
|
};
|
|
959
1020
|
```
|
|
960
1021
|
|
|
961
|
-
You now can use in your [form](#react-form) the mapped components with names `inputForm` and `dropdownForm`.
|
|
1022
|
+
You now can use in your [form](#react-form-) the mapped components with names `inputForm` and `dropdownForm`.
|
|
962
1023
|
|
|
963
1024
|
Also note the data in `propsMapping`. There you can map up to five form functionalities per component
|
|
964
1025
|
|
|
965
1026
|
| Key | Functionality |
|
|
966
|
-
|
|
1027
|
+
| --------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
967
1028
|
| getValue | The name of your component prop that will give back the selected value. |
|
|
968
1029
|
| setValue | Prop name that receives the value |
|
|
969
1030
|
| setErrorMessage | Component prop name to receive an error message in case this field will have error and error message is configured |
|
|
@@ -1006,7 +1067,7 @@ After configuring the provider, `<Form />` components lets you render a form
|
|
|
1006
1067
|
### Props
|
|
1007
1068
|
|
|
1008
1069
|
| Prop | Type | Description |
|
|
1009
|
-
|
|
1070
|
+
| --------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1010
1071
|
| disable | boolean | Disable all form inputs. It will use the default htm disable attribute |
|
|
1011
1072
|
| group | string | Form group identifier. Used be able to group several forms and then get data with useGroupForm. One will be generated as default if omitted |
|
|
1012
1073
|
| id | string | Form identified. One will be generated as default if omitted |
|
|
@@ -1024,7 +1085,7 @@ After configuring the provider, `<Form />` components lets you render a form
|
|
|
1024
1085
|
| onStep | callback(TFormValues) | Called when a form step changed |
|
|
1025
1086
|
| onLog | callback(TLoggingEvent) | Called on each log, if the logging is enabled |
|
|
1026
1087
|
| onScopeChange | onScopeChange?(scope: TScope, namespace: string, key: string): void; | Called everything scope change with the changing information (namespace and key) and the changed scope |
|
|
1027
|
-
|
|
|
1088
|
+
| onClick | onClick(TFormValues, TField) | Callback function that runs on each component click |
|
|
1028
1089
|
| onFieldRehydrate | onFieldRehydrate?(values: TFormValues, component: TComponent, field: TField): void | This callback is called whenever some form field was rehydrated |
|
|
1029
1090
|
| renderLoading | renderLoading?(): ReactElement; | Component to render while the schema has not rendered |
|
|
1030
1091
|
| onFormMount | onFormMount?(values: TFormValues): void; | Called when the form finished mounted |
|
|
@@ -1049,7 +1110,7 @@ Exposed hook that allows you to connect to any form by the formId in any part of
|
|
|
1049
1110
|
You can use the following arguments to tho hook
|
|
1050
1111
|
|
|
1051
1112
|
| Prop | Type | Description |
|
|
1052
|
-
|
|
1113
|
+
| -------- | -------- | ----------------------------------------- |
|
|
1053
1114
|
| formId | string | The id of the form you want to connect to |
|
|
1054
1115
|
| onValid | callback | Called whenever form validation changes |
|
|
1055
1116
|
| onData | callback | Called whenever data changes |
|
|
@@ -1058,7 +1119,7 @@ You can use the following arguments to tho hook
|
|
|
1058
1119
|
And it will provide you the following
|
|
1059
1120
|
|
|
1060
1121
|
| Prop | Type | Description |
|
|
1061
|
-
|
|
1122
|
+
| -------- | -------- | ----------------------------------------------------------------------------------------------- |
|
|
1062
1123
|
| configs | object | One object with all the form configurations |
|
|
1063
1124
|
| submit | function | Function that lets you call the submit on the form. After, the onSubmit callback will be called |
|
|
1064
1125
|
| formData | function | Lets you get the most up-to-date form date |
|
|
@@ -1101,7 +1162,6 @@ In the following example `useForm` hooks are used to connect to multiple forms t
|
|
|
1101
1162
|
}
|
|
1102
1163
|
```
|
|
1103
1164
|
|
|
1104
|
-
|
|
1105
1165
|
## React `useForm()`
|
|
1106
1166
|
|
|
1107
1167
|
Similar to `useForm`
|
|
@@ -1111,7 +1171,7 @@ Similar to `useForm`
|
|
|
1111
1171
|
You can use the following arguments to tho hook
|
|
1112
1172
|
|
|
1113
1173
|
| Prop | Type | Description |
|
|
1114
|
-
|
|
1174
|
+
| -------- | --------------- | --------------------------------------------------------- |
|
|
1115
1175
|
| ids | array of string | The ids we want to listen to |
|
|
1116
1176
|
| group | string | A string to identify the form group we want to connect to |
|
|
1117
1177
|
| onValid | callback | Called whenever form validation changes |
|
|
@@ -1121,7 +1181,7 @@ You can use the following arguments to tho hook
|
|
|
1121
1181
|
And it will provide you the following
|
|
1122
1182
|
|
|
1123
1183
|
| Prop | Type | Description |
|
|
1124
|
-
|
|
1184
|
+
| -------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1125
1185
|
| configs | object | One object with all the form configurations |
|
|
1126
1186
|
| submit | function | Function that lets you call the submit on the form. After, the onSubmit callback will be called |
|
|
1127
1187
|
| formData | function({aggregate}) | Lets you get the most up-to-date form date in two ways. Aggregate the forms data in a single object or split by the several forms in the group or identified by the id |
|
|
@@ -1169,4 +1229,4 @@ In the following example `useForm` hooks are used to connect to multiple forms t
|
|
|
1169
1229
|
)
|
|
1170
1230
|
```
|
|
1171
1231
|
|
|
1172
|
-
The above example will connect to main-form with `useForm` and to a form group (logical) with `useFormGroup`
|
|
1232
|
+
The above example will connect to main-form with `useForm` and to a form group (logical) with `useFormGroup`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),e=require("react");require("./types.js");var r=require("credit-card-type");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=n(e),i=n(r),a=function(t,e,r){return e?t+"/"+e+(r?"/"+r:""):t},u=function(t){return new RegExp("^(".concat(t,").*$"),"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_CLICK:"ON_FIELD_CLICK",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",NAVIGATE_STEP:"NAVIGATE_STEP",NAVIGATE_STEP_FORWARD:"NAVIGATE_STEP_FORWARD",NAVIGATE_STEP_BACK:"NAVIGATE_STEP_BACK",VALIDATE_FORM:"VALIDATE_FORM",LOG:"LOG"},s="default_form_id",l="default_form_hook_id";function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return d(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,e)}(t,e)||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(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var p,v,h=function(){var t=f(e.useState(0),2),r=t[0],n=t[1];return[r,function(){return n((function(t){return t+1}))}]};function y(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function b(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(a,u)}c((n=n.apply(t,e||[])).next())}))}function m(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function g(t,e,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 e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,r):o?o.value=r:e.set(t,r),r}function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function E(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */E=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),u=new N(o||[]);return n(a,"_invoke",{value:S(t,r,u)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f={};function d(){}function p(){}function v(){}var h={};c(h,i,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(k([])));b&&b!==e&&r.call(b,i)&&(h=b);var m=v.prototype=d.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function o(n,i,a,u){var c=l(t[n],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==O(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,u)}),(function(t){o("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return o("throw",t,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function S(t,e,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 x()}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=l(t,e,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(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:x}}function x(){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"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(_.prototype),c(_.prototype,a,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,u,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,N.prototype={constructor:N,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(o=n.key,i=void 0,i=function(t,e){if("object"!==O(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(o,"string"),"symbol"===O(i)?i:String(i)),n)}var o,i}var S,j=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p.set(this,void 0),v.set(this,{}),this.debounceTime=50,this.debounce=function(t){var e=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")[t]&&clearTimeout(m(n,v,"f")[t]),m(n,v,"f")[t]=setTimeout((function(){clearTimeout(m(n,v,"f")[t]),r(t())}),e)})));case 1:case"end":return r.stop()}}),r)})))},g(this,p,e,"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 e,r,n;return e=t,r=[{key:"subscribe",value:function(t,e){this.subscriptions[t]&&this.subscriptions[t](),this.subscriptions[t]=m(this,p,"f").subscribe(t,e)}},{key:"subscribeBulk",value:function(t,e){var r=this;t.forEach((function(t){return r.subscribe(t,e)}))}},{key:"publish",value:function(t,e){m(this,p,"f").publish(t,e)}},{key:"publishFor",value:function(t){var e=this;return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return b(e,void 0,void 0,E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m(this,p,"f").publish(t,r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}}},{key:"logError",value:function(t,e,r,n){m(this,p,"f").logError(t,e,r,n)}},{key:"logInfo",value:function(t,e,r,n){m(this,p,"f").logInfo(t,e,r,n)}}],r&&_(e.prototype,r),n&&_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function A(t,e,r){return(e=k(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function N(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,k(n.key),n)}}function k(t){var e=function(t,e){if("object"!==w(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==w(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===w(e)?e:String(e)}function x(t,e){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},x(t,e)}function F(t){var e=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(t){return!1}}();return function(){var r,n=I(t);if(e){var o=I(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===w(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return L(t)}(this,r)}}function L(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},I(t)}p=new WeakMap,v=new WeakMap;var T=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&x(t,e)}(i,j);var e,r,n,o=F(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),S.set(L(e),{global:{},api:{},hooks:{},configs:{},fields:{}}),e}return e=i,r=[{key:"scope",get:function(){return m(this,S,"f")||{}}},{key:"getGlobalScope",value:function(t,e){return t&&!e&&this.scope[t]?this.scope[t]:t&&e&&this.scope[t]?this.scope[t][e]:m(this,S,"f")}},{key:"initialScope",set:function(t){g(this,S,t||m(this,S,"f"),"f")}},{key:"globalScope",set:function(t){var e=t.namespace,r=t.key,n=t.data;r||(m(this,S,"f")[e]=n),r&&!m(this,S,"f")[e]&&(m(this,S,"f")[e]=A({},r,n)),m(this,S,"f")[e]&&r&&(m(this,S,"f")[e]=Object.assign(Object.assign({},m(this,S,"f")[e]),A({},r,n)));var o=r?a("ON_SCOPE_CHANGE",e,r):u(a("ON_SCOPE_CHANGE",e,r));this.publish(o,{scope:this.scope,namespace:e,key:r}),this.publish("ON_SCOPE_CHANGE")}}],r&&N(e.prototype,r),n&&N(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function C(t){return function(t){if(Array.isArray(t))return R(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(t,e)}(t)||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 R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function P(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==D(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==D(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===D(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}S=new WeakMap;var M=function(t,e,r){var n=e.split(".");if(1===n.length)return Object.assign(Object.assign({},t),P({},e,r));return function t(e,n){var o=C(e);o.splice(0,1);var i=1!==e.length?t(o,n?n[e[0]]:{}):r;return Object.assign(Object.assign({},n),P({},e[0],i))}(n,t)},V=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split(".").reduce((function(t,e){return(t||{})[e]}),t)};function G(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return U(t,e)}(t,e)||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 U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var B=function(t,e){var r=H(t.toString()),n=i.default(r);return[(null==e?void 0:e.length)?null==n?void 0:n.filter((function(t){var r=t.type;return e.some((function(t){return t===r}))}))[0]:n[0],r]},H=function(t){return null==t?void 0:t.replace(/ /g,"")},Y=function(t,e){return e?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=e.reduce((function(t,r,n){var o=G(t,2),i=o[0],a=o[1],u=r-(e[n-1]||0);return["".concat(i,"([0-9]{0,").concat(u,"})"),"".concat(a,"$").concat(n+1," ")]}),["",""]),n=G(r,2),o=n[0],i=n[1];return t.replace(new RegExp(o),i).trim()}(t.slice(0,null==e?void 0:e.lengths[0]),e.gaps):t.slice(0,19)};function z(t){if("string"!=typeof t)return!1;try{var e=JSON.parse(t),r=Object.prototype.toString.call(e);return"[object Object]"===r||"[object Array]"===r}catch(t){return!1}}function $(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return W(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(t,e)}(t,e)||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 W(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var J=function(t){var e=t.value,r=t.formatterValue;if(!e)return e;var n="",o=0;return r.forEach((function(t,i){var a=0===i?i:r[i-1].position+1;e[t.position]==t.value&&o++,n+=e.slice(a,t.position)})),n+=e.slice(n.length+o)},K={splitter:function(t){var e=t.value,r=t.formatterValue;if(!e)return e;var n=J({value:e,formatterValue:r});return r.forEach((function(t){t.position>=e.length||(n=n.slice(0,t.position)+t.value+n.slice(t.position,null==n?void 0:n.length))})),n},undo_splitter:J,capitalize:function(t){var e=t.value;return e?e.charAt(0).toUpperCase()+e.slice(1):e},upperCase:function(t){var e=t.value;return e?e.toUpperCase():e},gapsCreditCard:function(t){var e=t.value,r=t.formatterValue;if(e){var n=$(B(e,r),2),o=n[0],i=n[1];return Y(i,o)}}},q=function(t,e,r){var n=t;return Object.keys(e).forEach((function(t){var o=e[t],i=K[r?"undo_".concat(t):t];i&&(n=i({value:n,formatterValue:o}))})),n},Z=function(t){var e=t.value,r=void 0===e?"":e,n=t.maskValue,o=r;return n.forEach((function(t){var e=t.to,n=void 0===e?o.length:e,i=t.mask,a=t.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},Q={generic:Z,cardNumber:function(t){var e=t.value;return Z({value:e,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(t){var e=t.value;return Z({value:e,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(t){return t.value.replace(/[^\dA-Z]/g,"").replace(/(.{4})/g,"$1 ").trim()},cardDate:function(t){var e=t.value.replace(/\D/g,""),r=e.slice(0,2);return e.length>=5?"".concat(r,"/").concat(e.slice(2,4)):e.length>=3?"".concat(r,"/").concat(e.slice(2)):e},currencyMask:function(t){var e=t.value,r=void 0===e?"":e,n=t.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(t){var e=t.value.replace(/\D/g,""),r=e.slice(0,2);return e.length>=5?"".concat(r,"-").concat(e.slice(2,9)):e.length>=3?"".concat(r,"-").concat(e.slice(2)):e},replaceAll:function(t){var e=t.value,r=void 0===e?"":e,n=t.maskValue;return n&&"string"==typeof r?("number"==typeof n&&(n=null==n?void 0:n.toString()),new Array(r.length+1).join(n)):r}};function X(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==tt(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===tt(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return rt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(t,e)}(t,e)||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 rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var nt=function(t){var e=t.value,r=t.validationValue,n=new RegExp(r);return{fail:!n.test(e)}},ot=function(t){var e=t.value,r=void 0===e?"":e,n=t.validationValue.some((function(t){var e=t.to,n=t.from,o=t.validations,i=r.substring(e,n);return ut(at(i,o))}));return{fail:n}},it={conditions:function(t){var e=t.value,r=void 0===e?"":e,n=t.validationValue;if(!n)return{fail:!1};var o=function(t){if(t.forceDefinedOrigin&&void 0===t.origin||t.forceDefinedTarget&&void 0===t.target)return{fail:!1};var e=void 0===t.origin?r:t.origin,n=void 0===t.target?r:t.target;return{"!==":(e||r)!==(n||r),"===":(e||r)===(n||r),"<":(e||r)<(n||r),">":(e||r)>(n||r),"<=":(e||r)<=(n||r),">=":(e||r)>=(n||r)}[t.condition]};return{fail:{and:function(){return!!n.set.every(o)},or:function(){return!!n.set.some(o)}}[n.rule]()}},date:function(t){var e,r,n,o,i=t.value,a=void 0===i?"":i,u=t.validationValue;if(!(null===(e=null==u?void 0:u.target)||void 0===e?void 0:e.value)&&!(null===(r=null==u?void 0:u.origin)||void 0===r?void 0:r.intervals))return{fail:!1};var c={DDMMYYYY:function(t){var e=t.split(t.includes("/")?"/":"-");return"".concat(e[1],"/").concat(e[0],"/").concat(e[2])},YYYYMMDD:function(t){var e=t.split(t.includes("/")?"/":"-");return"".concat(e[1],"/").concat(e[2],"/").concat(e[0])},YYYYDDMM:function(t){var e=t.split(t.includes("/")?"/":"-");return"".concat(e[2],"/").concat(e[1],"/").concat(e[0])},MMDDYYYY:function(t){return t},timestamp:function(t){return new Date(t).toString()}},s=u.origin.value||a,l=new Date(c[null==u?void 0:u.origin.format](s).toString()),f=(null===(n=null==u?void 0:u.target)||void 0===n?void 0:n.format)?new Date(c[null===(o=null==u?void 0:u.target)||void 0===o?void 0:o.format](u.target.value).toString()):new Date;if(u.origin.intervals){f=function(t,e){var r={years:function(t,e){return new Date(t.setUTCFullYear(t.getUTCFullYear()+e))},months:function(t,e){return new Date(t.setUTCMonth(t.getUTCMonth()+e))},days:function(t,e){return new Date(t.setDate(t.getUTCDate()+e))}};return Object.keys(e).reduce((function(t,n){return r[n](t,e[n])}),new Date(t))}(l,u.origin.intervals);var d=new Date;l=new Date("".concat(d.getUTCMonth()+1,"/").concat(d.getUTCDate(),"/").concat(d.getUTCFullYear()))}if(u.onlyValidDate&&(!(f instanceof Date&&isFinite(f))||!(f instanceof Date&&isFinite(l))||s.length<8))return{fail:!0};var p=l.getTime(),v=f.getTime();return{fail:{">":p>v,">=":p>=v,"<":p<v,"<=":p<=v,"===":p===v,"!==":p!==v}[null==u?void 0:u.operator]}},length:function(t){var e=t.value,r=t.validationValue,n=e;return"string"!=typeof n&&(n=null==e?void 0:e.toString()),{fail:!e||(null==n?void 0:n.length)===r}},greaterThan:function(t){var e=t.value,r=t.validationValue;return{fail:!e||parseInt(e)<=parseInt(r)}},maxLength:function(t){var e=t.value,r=void 0===e?"":e,n=t.validationValue,o=r;return Number.isInteger(o)&&(o=r.toString()),{fail:o.length>n}},minLength:function(t){var e=t.value,r=void 0===e?"":e,n=t.validationValue,o=r;return Number.isInteger(o)&&(o=r.toString()),{fail:o.length<n}},required:function(t){var e=t.value;return{fail:t.validationValue&&!e}},value:function(t){var e=t.value;return{fail:e!==t.validationValue}},regex:nt,hasNoExtraSpaces:function(t){var e=t.value;return{fail:nt({value:e,validationValue:"^[A-Za-z0-9.-]+(?: +[A-Za-z0-9.-]+)*$",errorMessage:""}).fail}},isCreditCard:function(t){var e,r,n=t.value,o=t.validationValue;if(!n)return{fail:!0};var i=et(B(n,o),1)[0];return{fail:!i,metadata:{typeCard:null==i?void 0:i.type,creditCardCC:null===(e=null==i?void 0:i.code)||void 0===e?void 0:e.name,creditCardCCSize:null===(r=null==i?void 0:i.code)||void 0===r?void 0:r.size}}},isCreditCardAndLength:function(t){var e=t.value,r=t.validationValue;if(!e)return{fail:!0};var n=et(B(e,r),2),o=n[0],i=n[1];return{fail:o&&!o.lengths.includes(i.length)}},isCreditCodeMatch:function(t){var e,r=t.value,n=t.validationValue;if(!r)return{fail:!0};var o=et(B(n.numberCard,n.availableOptions),1)[0];return{fail:(null===(e=null==o?void 0:o.code)||void 0===e?void 0:e.size)!==r.length}},onlyLetters:function(t){var e=t.value;return{fail:!/^[a-zA-Z\s]*$/.test(e)}},notAllowSpaces:function(t){var e=t.value;return{fail:/\s/.test(e)}},callback:function(t){var e=t.value,r=(0,t.validationValue)(e);return{message:r.errorMessage,fail:r.fail}},isNumber:function(t){var e=t.value;return{fail:!!e&&!/^[0-9\s]*$/.test(e)}},customValidation:function(t){var e=t.value,r=t.validationValue;return ot({value:e,validationValue:r})},notEmpty:function(t){return{fail:!t.value.trim().length}},numericRange:function(t){var e=t.value,r=t.validationValue,n=String(e).replace(/[^0-9]/g,"");return{fail:!n||!Number.isInteger(parseInt(n.toString()))||+n>r.end||+n<r.start}},email:function(t){var e=t.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(e)}},lessThan:function(t){var e=t.value,r=t.validationValue;return{fail:!e||parseInt(e)>=parseInt(r)}},sequentialNumber:function(t){var e=t.value,r=String(e).replace(/[^0-9]/g,"");return{fail:!(-1==="0123456789".indexOf(r)&&-1==="9876543210".indexOf(r))}},repeatedNumbers:function(t){var e=t.value,r=String(e).replace(/[^0-9]/g,"");return{fail:/\b(\d)\1+\b/gm.test(r)}},url:function(t){var e=t.value;return{fail:!/[(http(s)?)://(www.)?a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/gi.test(e)}},path:function(t){var e=t.value,r=t.validationValue,n=function(t){var n=V(e,t);if(r.preventUnMountValidation&&!(t in e))return{fail:!1};var o,i,a=at(n,r);return i={fail:!1},(o=a)?Object.keys(o).reduce((function(t,e){return o[e].fail?o[e]:t}),i):i};return Array.isArray(r.paths)?r.paths.reduce((function(t,e){var r=n(e);return r.fail?r:t}),{}):n(r.path)},isInTheList:function(t){var e=t.value,r=t.validationValue;return e&&Array.isArray(r)?{fail:!r.some((function(t){return t===e||JSON.stringify(t)===e}))}:{fail:!0}},fields:function(t){var e=t.values,r=t.validationValue;return{fail:null==r?void 0:r.set[r.rule]((function(t){var r;return ut(at(null===(r=e[t.fieldName])||void 0===r?void 0:r.value,t.validations))}))}},customNameRule:function(t){var e=t.value,r=t.validationValue;return"object"!==tt(r)?{fail:!1}:{fail:ut(at(e,r))}}},at=function(t,e){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(e).forEach((function(i){var a=e[i],u=it[i];u||(u=it.customNameRule);var c=r[i]||r.default,s=u({value:t,validationValue:a,errorMessage:c,values:n});o=Object.assign(Object.assign({},o),X({},i,Object.assign(Object.assign({},s),{validationValue:a,message:c})))})),o},ut=function(t){return!!t&&!!Object.keys(t).find((function(e){return t&&t[e].fail}),[])},ct=Object.freeze({__proto__:null,concatenate:function(t,e){return t+e},add:function(t,e){return((parseInt(t)||0)+(parseInt(e)||0)).toString()},subtract:function(t,e){return parseInt(t)-parseInt(e)},replaceAll:function(t,e,r){return t.replace(new RegExp(e,"g"),r)}}),st=Object.freeze({__proto__:null,handler:function(t){var e=t.field,r=t.data;e.data.changed=!0,e.data.metadata=r.metadata,e.value=r.parsedEventValue}}),lt=Object.freeze({__proto__:null,handler:function(t){var e,r,n,o,i,u,c,s,l=t.form,f=t.field;f.subscribe(a("ON_SCOPE_CHANGE","configs","disable"),(function(){return f.rehydrate()})),f.data.mounted=!0;var d=f.component.props,p=(void 0===d?{}:d)[null===(e=f.mappings)||void 0===e?void 0:e.setValue],v=f.component.group&&V(l.initialValues,f.component.group),h=V(l.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===(s=null===(o=null===(n=l.formData.form)||void 0===n?void 0:n.steps)||void 0===o?void 0:o.data[null===(c=null===(u=null===(i=l.formData)||void 0===i?void 0:i.form)||void 0===u?void 0:u.steps)||void 0===c?void 0:c.index])||void 0===s?void 0:s.formatted[f.component.name])||h}}),ft=Object.freeze({__proto__:null,handler:function(t){t.field.data.blured=!0}}),dt=Object.freeze({__proto__:null,handler:function(t){var e=t.field;e.data=Object.assign(Object.assign({},e.data),{focused:!0})}});function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function vt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==pt(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===pt(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){return function(t){if(Array.isArray(t))return yt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return yt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yt(t,e)}(t)||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 yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var bt="${",mt="}",gt="||",Ot=function(t){return/\$\{(.*)\}.*/g.test(t)},Et="varOps.",_t=")",St="(",jt=",",wt=function(t){return t.includes(Et)},At=Object.freeze({__proto__:null,handler:function(t){var e=t.field,r=t.form,n=function(){if(e){var t=e.component,r=t.children,n=t.wrapper,o=y(t,["children","wrapper"]),a=Object.assign({},i(o));e.scopedComponent=Object.assign(Object.assign(Object.assign({},o),a),{children:r,wrapper:n})}},o=function t(o){var i=(o=o.toString()).lastIndexOf(bt);if(-1===i)return o;var u=o.substring(i+bt.length,o.length),c=u.substring(0,u.indexOf(mt)),s=c.length,l="",f=c.split(gt);f.length>1&&(c=f[0],l=V(e.scope.getGlobalScope(),f[1])||f[1]),e&&function(t){var r,o,i,u,c=!(null===(u=null===(i=null===(o=null===(r=e.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(e.component.name)),s=t[0].split(".");c&&e.subscribe(a("ON_SCOPE_CHANGE",s[0],s[1]),(function(){n(),e.rehydrate()}))}(f);var d=V(r.scope.getGlobalScope(),c),p=void 0===d?l:d;if("string"!=typeof p&&0===i)return p;try{p=JSON.stringify(p).replace(/^"(.*)"$/,"$1")}catch(t){}var v=o.substring(0,i)+p+o.substring(i+s+bt.length+mt.length,o.length);return wt(v)&&!Ot(v)?v.replace(/([^\s]+)/g,(function(t){if(!wt(t))return t;var e=function(t){return ct[t.split(Et)[1].split(St)[0]]}(t);return e?e.apply(void 0,ht(function(t){return t.split(Et)[1].split(St)[1].split(_t)[0].split(jt)}(t))):void 0})):t(v)},i=function t(e){if("string"==typeof e)return o(e);if("number"==typeof e)return e;var r=Object.assign({},e);return Object.keys(r).reduce((function(e,n){if(null===r[n])return e;if(Array.isArray(r[n]))return Object.assign(Object.assign({},e),vt({},n,r[n].map(t)));if("object"===pt(r[n]))return Object.assign(Object.assign({},e),vt({},n,Object.assign({},t(Object.assign({},r[n])))));if("string"!=typeof r[n])return Object.assign(Object.assign({},e),vt({},n,r[n]));if(!Ot(r[n]))return Object.assign(Object.assign({},e),vt({},n,r[n]));var i=o(r[n]);try{z(i)&&(i=JSON.parse(i))}catch(t){}return Object.assign(Object.assign({},e),vt({},n,i))}),{})};n(),function(){var t=r.schema||{};t.components;var e=y(t,["components"]),n=i(e);r.scopedSchema=n,r.rehydrate()}()}});function Nt(t){return Nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nt(t)}function kt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */kt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),u=new w(o||[]);return n(a,"_invoke",{value:E(t,r,u)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;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!==e&&r.call(b,i)&&(h=b);var m=v.prototype=d.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function o(n,i,a,u){var c=l(t[n],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==Nt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,u)}),(function(t){o("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return o("throw",t,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function E(t,e,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=l(t,e,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 _(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function A(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};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"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(O.prototype),c(O.prototype,a,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,u,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=A,w.prototype={constructor:w,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}var xt=Object.freeze({__proto__:null,handler:function(t){var e=t.field,r=t.form;return t.eventReducedSchema.api.forEach((function(t){var n,o=e.scope,i=at(e.data.value,t.preConditions||{},e.scopedComponent.errorMessages,null===(n=null==r?void 0:r.formData)||void 0===n?void 0:n.fields);e.fieldHasError(i)||t.blockRequestWhenInvalid&&e.fieldValidationsHaveError(!1)||(o.globalScope={namespace:"api",key:t.scope,data:{loading:!0}},e.debounce((function(){return fetch(t.url,Object.assign(Object.assign({method:t.method},t.body&&{body:JSON.stringify(t.body)}),{headers:t.headers||{"Content-type":"application/json; charset=UTF-8"}})).then((function(t){var e=t.json();if(t.status>=400)throw e;return e})).then((function(e){o.globalScope={namespace:"api",key:t.scope,data:Object.assign({loading:!1,response:e},e)}})).catch((function(e){return b(void 0,void 0,void 0,kt().mark((function r(){var n;return kt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e;case 2:n=r.sent,o.globalScope={namespace:"api",key:t.scope,data:{loading:!1,error:!0,err:n}};case 4:case"end":return r.stop()}}),r)})))}))}),t.debounceTime||200))}))},events:function(t){return Object.keys(t.api||{})}});function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Lt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==Ft(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==Ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===Ft(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function It(t){return function(t){if(Array.isArray(t))return Tt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Tt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tt(t,e)}(t)||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 Tt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Dt=Object.freeze({__proto__:null,handler:function(t){var e=t.form,r=t.field,n=function(t){var n;return Object.keys(t).reduce((function(t,n){var o,i,a,u,c,s=e.fields[n],l=s.data;if(!s||!s.data.visible||!s.data.name)return t;var f="";(null===(o=s.component)||void 0===o?void 0:o.group)&&(r&&r.component.name===s.component.name||!r&&!e.formData.formatted[s.component.group])&&(f=s.component.group);var d=f||n,p=void 0===l.value?e.initialValues[n]||(null===(i=e.schema)||void 0===i?void 0:i.formattedDataDefaults)&&(null===(a=e.schema)||void 0===a?void 0:a.formattedDataDefaults[n]):l.value;return{erroredFields:s.fieldHasError()?[].concat(It(t.erroredFields),[n]):t.erroredFields,predictableErroredFields:s.fieldValidationsHaveError()?[].concat(It(t.predictableErroredFields),[n]):t.predictableErroredFields,fields:Object.assign(Object.assign({},t.fields),Lt({},n,l)),filteredFields:(null===(c=null===(u=e.schema)||void 0===u?void 0:u.filteredFields)||void 0===c?void 0:c.includes(d))?Object.assign(Object.assign(Object.assign({},t.filteredFields),void 0===p?{}:Lt({},d,p)),f?Lt({},f,p||t.formatted[f]):{}):t.filteredFields,formatted:Object.assign(Object.assign(Object.assign({},t.formatted),void 0===(null==l?void 0:l.value)||l.ignore?{}:M(t.formatted,n,null==l?void 0:l.value)||Lt({},n,p)),f?Lt({},f,p||t.formatted[f]):{})}}),{predictableErroredFields:[],erroredFields:[],fields:{},formatted:Object.assign({},null===(n=e.schema)||void 0===n?void 0:n.formattedDataDefaults),filteredFields:{}})},o=n(e.fields),i=n(e.steps[e.step.index]||{}),a=Object.assign(Object.assign({},o),{form:{scope:e.scope.getGlobalScope(),steps:Object.assign(Object.assign({},e.step),{data:Lt({},e.step.index,i),isValid:!i.predictableErroredFields.length}),isValid:!o.predictableErroredFields.length,messages:function(t){var r;return(null===(r=e.schema)||void 0===r?void 0:r.messages)?Object.keys(e.schema.messages).reduce((function(r,n){var o,i,a,u=V(t,n);return(null===(o=e.schema)||void 0===o?void 0:o.messages)&&(null===(i=e.schema)||void 0===i?void 0:i.messages[n])&&((null===(a=e.schema.messages[n].values)||void 0===a?void 0:a.includes(u))||e.schema.messages[n].value===u||e.schema.messages[n].required&&!u)?[].concat(It(r),[e.schema.messages[n].name]):r}),[]):[]}(Object.assign(Object.assign({},e.initialValues),o.formatted))}});return e.formData=a,a}}),Ct=Object.freeze({__proto__:null,handler:function(t){var e=t.form,r=t.eventReducedSchema;null==r||r.clearFields.forEach((function(t){t.fields.forEach((function(r){var n=e.fields[r];if(n){if(!t.validations)return n.value=t.clearedValue,void n.rehydrate();var o=at(n.value,t.validations);n.fieldHasError(o)&&(n.value=t.clearedValue,n.rehydrate())}}))}))},events:function(t){return Object.keys(t.clearFields||{})}});function Rt(t){return function(t){if(Array.isArray(t))return Pt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Pt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pt(t,e)}(t)||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 Pt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Mt=Object.freeze({__proto__:null,handler:function(t){var e,r=t.form,n=t.field;null===(e=t.eventReducedSchema.visibilityConditions)||void 0===e||e.forEach((function(t){Rt(t.fieldNames||[t.fieldName]).forEach((function(e){if(e){var o=n.fieldHasError(at(n.value,t.validations));r.fields[e]?(r.fields[e].visibility=!o,r.fields[e].rehydrate()):n.subscribe(a("ON_FIELD_MOUNT",e),(function(){r.fields[e].visibility=!o,r.fields[e].rehydrate()}))}}))}))},events:function(t){return Object.keys(t.visibilityConditions||{})}});function Vt(t){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(t)}var Gt=Object.freeze({__proto__:null,handler:function(t){var e,r,n,o,i,a,u=t.field,c=t.data.event,s=void 0,l=void 0,f={number:function(){var t;return parseInt(null===(t=null==c?void 0:c.target)||void 0===t?void 0:t.value)},checkbox:function(){var t;return!!(null===(t=null==c?void 0:c.target)||void 0===t?void 0:t.checked)}};s=f[null===(e=null==c?void 0:c.target)||void 0===e?void 0:e.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"!==Vt(c)||"string"==typeof c||"number"==typeof c)&&(s=c),(null==c?void 0:c.id)&&(s=null==c?void 0:c.id,l=c),(null==c?void 0:c.options)&&(s=null==c?void 0:c.options);var d=(null==s?void 0:s.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:s,metadata:l,isDeletingValue:d}}}),Ut=Object.freeze({__proto__:null,handler:function(t){var e=t.data,r=t.field,n=t.eventReducedSchema.formatters;n&&!e.isDeletingValue&&(r.data.value=q(r.data.value,n))},events:function(t){return Object.keys((null==t?void 0:t.formatters)||[])}});function Bt(t){return Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bt(t)}function Ht(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(o=n.key,i=void 0,i=function(t,e){if("object"!==Bt(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==Bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(o,"string"),"symbol"===Bt(i)?i:String(i)),n)}var o,i}function Yt(t){var e=Wt();return function(){var r,n=Kt(t);if(e){var o=Kt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===Bt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function zt(t){var e="function"==typeof Map?new Map:void 0;return zt=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return $t(t,arguments,Kt(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Jt(n,t)},zt(t)}function $t(t,e,r){return $t=Wt()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Jt(o,r.prototype),o},$t.apply(null,arguments)}function Wt(){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(t){return!1}}function Jt(t,e){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jt(t,e)}function Kt(t){return Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(t)}var qt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jt(t,e)}(i,zt(Error));var e,r,n,o=Yt(i);function i(t,e){var r,n=e.breaksObservingChain;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(r=o.call(this)).breaksObservingChain=!1,r.message=t,r.breaksObservingChain=n,r}return e=i,r&&Ht(e.prototype,r),n&&Ht(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(),Zt=Object.freeze({__proto__:null,handler:function(t){var e=t.field,r=t.data,n=t.eventReducedSchema.formatters,o=e.scopedComponent,i=o.errorMessages,a=o.filter;if(a&&r.parsedEventValue&&!r.isDeletingValue){var u=n&&q(r.parsedEventValue,n,!0)||r.parsedEventValue,c=at(u,a,i);if(e.fieldHasError(c))throw new qt("Filter applied ".concat(JSON.stringify(a)),{breaksObservingChain:!0})}}}),Qt=Object.freeze({__proto__:null,handler:function(t){var e=t.field,r=t.eventReducedSchema.masks;r&&(e.data.mask=(null==r?void 0:r.cleanMask)?void 0:function(t,e){var r=t;return Object.keys(e).forEach((function(t){var n=e[t],o=Q[t];o&&(r=o({value:r,maskValue:n}))})),r}(e.data.value,r))},events:function(t){return Object.keys(t.masks||{})}}),Xt=Object.freeze({__proto__:null,handler:function(t){var e=t.field,r=t.eventReducedSchema.validations,n=t.form;if(r){var o=at(e.data.value,r,e.scopedComponent.errorMessages,n.formData.fields);e.fieldHasError(o)!==e.fieldHasError()&&e.publish("ON_FIELD_VALIDATION_TOGGLE",{field:e.data}),e.errors=o,e.data.failedErrorMessages=e.getFieldErrorMessages(e.data)}},events:function(t){return Object.keys(t.validations||{})}}),te=Object.freeze({__proto__:null,handler:function(t){var e=t.form;return{setScope:function(t){return e.scope.globalScope=t}}}});function ee(t){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(t)}function re(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==ee(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===ee(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ne=Object.freeze({__proto__:null,handler:function(t){var e,r=t.form,n=t.event,o=t.payload,i=(re(e={},c.NAVIGATE_STEP_BACK,r.step.index-1),re(e,c.NAVIGATE_STEP_FORWARD,r.step.index+1),e),a=r.schema.components,u=i[n],s=o.constructor===Object?a[i[n]]:"string"==typeof o?(u=a.findIndex((function(t){return t.name===o})),a.find((function(t){return t.name===o}))):(u=o,a[o]);r.step=s?Object.assign(Object.assign({},r.step),{numSteps:a.length,navigated:!!s,index:s?u:r.step.index,currentStepSchema:s||r.step.currentStepSchema}):Object.assign(Object.assign({},r.step),{navigated:!1})}});function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function ie(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==oe(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===oe(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ae=Object.freeze({__proto__:null,handler:function(t){var e,r=t.form,n=t.payload,o=(e=function(t){if(t&&Object.keys(t).length&&(t.scopeBlurredChildren||t.scopeChangedChildren||t.childrenScope))return Object.keys(r.fields).filter((function(e){var n;return(null==t?void 0:t.scopeBlurredChildren)&&r.fields[e].data.blured||(null==t?void 0:t.scopeChangedChildren)&&r.fields[e].data.changed||(null===(n=null==t?void 0:t.childrenScope)||void 0===n?void 0:n.includes(e))}))}(n))?Object.keys(r.fields).reduce((function(t,n){return e.includes(n)?Object.assign(Object.assign({},t),ie({},n,r.fields[n])):t}),{}):r.fields;Object.keys(o).forEach((function(t){o[t].fieldValidationsHaveError(!0)&&o[t].rehydrate()}))}});function ue(t){return function(t){if(Array.isArray(t))return ce(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return ce(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ce(t,e)}(t)||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 ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var se=Object.freeze({__proto__:null,handler:function(t){var e,r=t.form,n=t.formEventDirectives;null===(e=null==n?void 0:n.visibilityConditions)||void 0===e||e.forEach((function(t){ue(t.fieldNames||[t.fieldName]).forEach((function(e){if(e){var n=r.fields[e];r.fields[e].visibility=null==n?void 0:n.fieldHasError(at(n.value,t.validations)),r.fields[e].rehydrate()}}))}))},events:function(t){return Object.keys((null==t?void 0:t.visibilityConditions)||{})}});function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function fe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==le(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===le(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var de="${",pe="}",ve="||",he=Object.freeze({__proto__:null,handler:function(t){var e,r=t.form,n=function t(e){var n=(e=e.toString()).lastIndexOf(de);if(-1===n)return e;var o=e.substring(n+de.length,e.length),i=o.substring(0,o.indexOf(pe)),a=i.length,u="",c=i.split(ve);c.length>1&&(i=c[0],u=V(r.scope.getGlobalScope(),c[1])||c[1]);var s=V(r.scope.getGlobalScope(),i),l=void 0===s?u:s;if("string"!=typeof l&&0===n)return l;try{l=JSON.stringify(l).replace(/^"(.*)"$/,"$1")}catch(t){}return t(e.substring(0,n)+l+e.substring(n+a+de.length+pe.length,e.length))};r.scopedSchema=Object.assign(Object.assign({},r.schema),function t(e){if("string"==typeof e)return n(e);if("number"==typeof e)return e;var r=Object.assign({},e);return Object.keys(r).reduce((function(e,o){if(null===r[o])return e;if(Array.isArray(r[o]))return Object.assign(Object.assign({},e),fe({},o,r[o].map(t)));if("object"===le(r[o]))return Object.assign(Object.assign({},e),fe({},o,Object.assign({},t(Object.assign({},r[o])))));if("string"!=typeof r[o])return Object.assign(Object.assign({},e),fe({},o,r[o]));if(!function(t){return/\$\{(.*)\}.*/g.test(t)}(r[o]))return Object.assign(Object.assign({},e),fe({},o,r[o]));var i=n(r[o]);try{z(i)&&(i=JSON.parse(i))}catch(t){}return Object.assign(Object.assign({},e),fe({},o,i))}),{})}({visibilityConditions:null===(e=null==r?void 0:r.schema)||void 0===e?void 0:e.visibilityConditions}))}});function ye(t){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(t)}function be(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==ye(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===ye(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var me,ge,Oe,Ee,_e=function(t,e,r){var n=e();Object.keys(n).forEach((function(e){n[e].forEach((function(n){if(n.events){var o=n.events(r);if(Array.isArray(o)&&!o.includes(e))return}t.subscribe(a(e,null==r?void 0:r.name),n.handler)}))}))},Se=function(){var t;return be(t={},"ON_FIELD_MOUNT",[At,lt,xt,Xt,Ut,Mt,Ct,Qt,Dt]),be(t,"ON_FIELD_CHANGE",[Gt,Zt,st,Xt,Ut,xt,Mt,Ct,Dt,Qt]),be(t,"ON_FIELD_REHYDRATE",[Xt]),be(t,"ON_FIELD_BLUR",[ft,Ut,Qt,Xt,xt,Mt,Ct,Dt]),be(t,"ON_FIELD_FOCUS",[dt,Qt]),t},je=function(){var t;return be(t={},"ON_SCOPE_CHANGE",[he,se]),be(t,"ON_FORM_MOUNT",[At,te,ne,ae,se]),be(t,"VALIDATE_FORM",[ae]),be(t,"ON_FORM_SUBMIT",[te]),be(t,"ON_FORM_UN_MOUNT",[te]),be(t,"NAVIGATE_STEP",[ne]),be(t,"NAVIGATE_STEP_BACK",[ne]),be(t,"NAVIGATE_STEP_FORWARD",[ne]),be(t,u("ON_SCOPE_CHANGE"),[se,At]),be(t,"ON_FORM_REHYDRATE",[se]),be(t,"ON_FIELD_CHANGE",[se]),t};function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function Ae(t){return function(t){if(Array.isArray(t))return Ne(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ne(t,e)}(t)||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 Ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ke(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xe(n.key),n)}}function xe(t){var e=function(t,e){if("object"!==we(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===we(e)?e:String(e)}function Fe(t,e){return Fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fe(t,e)}function Le(t){var e=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(t){return!1}}();return function(){var r,n=Te(t);if(e){var o=Te(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===we(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ie(t)}(this,r)}}function Ie(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Te(t){return Te=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Te(t)}var De,Ce,Re,Pe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fe(t,e)}(i,j);var e,r,n,o=Le(i);function i(t,e,r,n){var a,u,c;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),a=o.call(this,t),me.set(Ie(a),void 0),ge.set(Ie(a),void 0),Oe.set(Ie(a),void 0),Ee.set(Ie(a),void 0),a.scopedComponent=e,g(Ie(a),ge,e,"f"),g(Ie(a),Ee,r,"f"),a.scope=n,g(Ie(a),me,{blured:!1,changed:!1,mounted:!1,focused:!1,errors:{},failedErrorMessages:[],visible:!(null===(u=e.state)||void 0===u?void 0:u.hidden),ignore:null===(c=e.state)||void 0===c?void 0:c.ignoreValue,name:e.name},"f"),_e(t,Se,e),a}return e=i,r=[{key:"value",get:function(){return m(this,Ee,"f").setValue&&m(this,ge,"f").props&&this.scopedComponent.props&&void 0!==this.scopedComponent.props[m(this,Ee,"f").setValue]&&this.scopedComponent.props[m(this,Ee,"f").setValue]!==m(this,ge,"f").props[m(this,Ee,"f").setValue]?this.scopedComponent.props[m(this,Ee,"f").setValue]:m(this,me,"f").mask||m(this,me,"f").value},set:function(t){m(this,me,"f").value=t,this.scope.globalScope={namespace:"fields",key:m(this,ge,"f").name,data:m(this,me,"f")}}},{key:"component",get:function(){return m(this,ge,"f")}},{key:"data",get:function(){return m(this,me,"f")},set:function(t){g(this,me,Object.assign(Object.assign({},m(this,me,"f")),t),"f"),this.scope.globalScope={namespace:"fields",key:m(this,ge,"f").name,data:m(this,me,"f")}}},{key:"visibility",set:function(t){m(this,me,"f").visible=t}},{key:"scopedComponent",get:function(){return m(this,Oe,"f")},set:function(t){g(this,Oe,t,"f")}},{key:"errors",get:function(){return m(this,me,"f").errors},set:function(t){m(this,me,"f").errors=t,this.scope.globalScope={namespace:"fields",key:m(this,ge,"f").name,data:m(this,me,"f")}}},{key:"props",get:function(){var t,e=this;if(!this.scopedComponent.name||!m(this,Ee,"f"))return this.scopedComponent.props;var r={getValue:function(t){e.publish(a("ON_FIELD_CHANGE",e.component.name),{event:t}),e.publish("ON_FIELD_CHANGE",{component:e.component.name,event:t})},onBlur:function(t){return e.publish(a("ON_FIELD_BLUR",e.component.name),{event:t})},onClick:function(t){return e.publish(a("ON_FIELD_CLICK",e.component.name),{event:t})},onFocus:function(t){return e.publish(a("ON_FIELD_FOCUS",e.component.name),{event:t})},setValue:this.value,setErrorMessage:this.getFieldErrorMessages()[0],setErrorState:this.fieldHasError()};return Object.keys(m(this,Ee,"f")).reduce((function(t,n){return void 0===r[n]?t:Object.assign(Object.assign({},t),function(t,e,r){return(e=xe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},m(e,Ee,"f")[n],r[n]))}),Object.assign({disabled:null===(t=this.scope.scope.configs)||void 0===t?void 0:t.disable},m(this,Oe,"f").props))}},{key:"mappings",get:function(){return m(this,Ee,"f")}},{key:"getFieldErrorMessages",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m(this,me,"f");return e.errors?Object.keys(e.errors).reduce((function(r,n){var o=e.errors;return(void 0===o?{}:o)[n].fail&&t.scopedComponent.errorMessages?[].concat(Ae(r),[t.scopedComponent.errorMessages[n]||t.scopedComponent.errorMessages.default]):r}),[]):[]}},{key:"fieldHasError",value:function(t){return t||(t=m(this,me,"f").errors||{}),!!Object.keys(t).find((function(e){return t&&t[e].fail}),[])}},{key:"fieldValidationsHaveError",value:function(t){var e=this;return!(!m(this,Oe,"f").validations||!m(this,me,"f").visible||!Object.keys(m(this,Oe,"f").validations).find((function(r){var n=m(e,Oe,"f"),o=n.validations,i=void 0===o?{}:o,a=n.errorMessages,u=at(m(e,me,"f").value,i[r],a);return t&&(e.errors=u),e.fieldHasError(u)})))}},{key:"eventReducedSchema",value:function(t){return{api:m(this,Oe,"f").api&&m(this,Oe,"f").api[t],clearFields:m(this,Oe,"f").clearFields&&m(this,Oe,"f").clearFields[t],formatters:m(this,Oe,"f").formatters&&m(this,Oe,"f").formatters[t],masks:m(this,Oe,"f").masks&&m(this,Oe,"f").masks[t],validations:m(this,Oe,"f").validations&&m(this,Oe,"f").validations[t],visibilityConditions:m(this,Oe,"f").visibilityConditions&&m(this,Oe,"f").visibilityConditions[t]}}},{key:"rehydrate",value:function(){this.publish(a("ON_FIELD_REHYDRATE",m(this,ge,"f").name),{checksum:JSON.stringify(this.data)+JSON.stringify(this.scopedComponent)+JSON.stringify(this.scope.scope.configs)})}}],r&&ke(e.prototype,r),n&&ke(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Me(t){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(t)}function Ve(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ge(n.key),n)}}function Ge(t){var e=function(t,e){if("object"!==Me(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==Me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===Me(e)?e:String(e)}function Ue(t,e){return Ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ue(t,e)}function Be(t){var e=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(t){return!1}}();return function(){var r,n=Ye(t);if(e){var o=Ye(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===Me(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return He(t)}(this,r)}}function He(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ye(t){return Ye=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ye(t)}me=new WeakMap,ge=new WeakMap,Oe=new WeakMap,Ee=new WeakMap;var ze,$e,We=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ue(t,e)}(i,j);var e,r,n,o=Be(i);function i(t,e,r,n,a,u){var c;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),c=o.call(this,e),De.set(He(c),{}),Ce.set(He(c),void 0),Re.set(He(c),void 0),c.steps={},g(He(c),Ce,e,"f"),c.schema=n,c.scopedSchema=n,c.scope=r,c.formId=t,c.initialValues=null==a?void 0:a.initialValues,c.group=u,g(He(c),Re,{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(He(c),Re,"f"),isValid:!1,messages:[]}},_e(e,je,n),c}return e=i,r=[{key:"step",get:function(){return m(this,Re,"f")},set:function(t){g(this,Re,t,"f")}},{key:"fields",get:function(){return m(this,De,"f")||{}}},{key:"eventReducedSchema",value:function(t){var e=this;return this.scopedSchema?Object.keys(this.scopedSchema).reduce((function(r,n){return e.scopedSchema[n]?Object.assign(Object.assign({},r),function(t,e,r){return(e=Ge(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},n,e.scopedSchema[n][t])):r}),{}):{}}},{key:"getFieldInstance",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.name=t.name||t.component+"_"+JSON.stringify(t.props),this.steps[m(this,Re,"f").index]||(this.steps[m(this,Re,"f").index]={}),this.fields[t.name]||(this.fields[t.name]=new Pe(m(this,Ce,"f"),t,e,this.scope),this.steps[m(this,Re,"f").index][t.name]=this.fields[t.name]),this.fields[t.name]}},{key:"rehydrate",value:function(){var t=this.scopedSchema;t.components;var e=y(t,["components"]);this.publish("ON_FORM_REHYDRATE",{checksum:JSON.stringify(e)})}},{key:"destroyField",value:function(t){m(this,De,"f")[t]&&(delete m(this,De,"f")[t],delete this.steps[m(this,Re,"f").index][t])}}],r&&Ve(e.prototype,r),n&&Ve(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Je(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Qe(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Ke(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ke=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),u=new w(o||[]);return n(a,"_invoke",{value:E(t,r,u)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;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!==e&&r.call(b,i)&&(h=b);var m=v.prototype=d.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function o(n,i,a,u){var c=l(t[n],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==tr(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,u)}),(function(t){o("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return o("throw",t,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function E(t,e,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=l(t,e,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 _(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function A(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};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"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(O.prototype),c(O.prototype,a,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,u,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=A,w.prototype={constructor:w,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function qe(t,e,r){return(e=or(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ze(t){return function(t){if(Array.isArray(t))return Xe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Qe(t)||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 Qe(t,e){if(t){if("string"==typeof t)return Xe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xe(t,e):void 0}}function Xe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function tr(t){return tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tr(t)}function er(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,or(n.key),n)}}function nr(t,e,r){return e&&rr(t.prototype,e),r&&rr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function or(t){var e=function(t,e){if("object"!==tr(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===tr(e)?e:String(e)}De=new WeakMap,Ce=new WeakMap,Re=new WeakMap,function(t){t.OBSERVER="OBSERVER",t.REACT_FIELD_ADAPTER="REACT FIELD ADAPTER",t.FIELD_HANDLER="FIELD HANDLER"}(ze||(ze={}));var ir=function(){function t(){er(this,t),this.workers={},this.getFormInstance=this.getFormInstance.bind(this),this.getGroupFormsIds=this.getGroupFormsIds.bind(this)}return nr(t,[{key:"getGroupFormsIds",value:function(t){var e=this;return Object.keys(this.workers||{}).filter((function(r){return e.workers[r].group===t}),[])}},{key:"getFormInstance",value:function(){var t,e,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,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 ar(n,null===(e=null===(t=null==o?void 0:o.initialScope)||void 0===t?void 0:t.configs)||void 0===e?void 0:e.enableLogging),a=new T(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 We(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]}}]),t}(),ar=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];er(this,t),this.regexBasedEvents={},this.events={},this.history={},$e.set(this,(function(t){var e=t.event,n=t.data,o=t.payload,i=function(t){return t.split("/")[1]||""}(e),a=cr(r.namespace,null==n?void 0:n.opts),u=a.fields[i],c=function(t){return Array.isArray(t.split("/"))?t.split("/")[0]:t}(e);return{eventReducedSchema:u&&u.eventReducedSchema(c),formEventDirectives:a&&a.eventReducedSchema(c),namespace:r.namespace,coreEvent:c,form:a,field:u,event:e,data:n,payload:o}})),this.namespace=e,this.enableLogging=n}return nr(t,[{key:"runForRegexBasedEvent",value:function(t,e){for(var r=!1,n=0,o=Object.keys(this.events);n<o.length;n++){var i=o[n];(r=t.test(i))&&e(i)}return r}},{key:"handleRegexSubscription",value:function(t,e){var r=this;this.runForRegexBasedEvent(t,(function(t){return r.subscribe(t,e)}))||(this.regexBasedEvents[t]={regex:t,handlers:Array.isArray(this.events[t])?[].concat(Ze(this.events[t]),[e]):[e]})}},{key:"subscribe",value:function(t,e){var r=this;return"object"===tr(t)?(this.handleRegexSubscription(t,e),function(){}):(this.events=Object.assign(Object.assign({},this.events),qe({},t,Array.isArray(this.events[t])?[].concat(Ze(this.events[t]),[e]):[e])),function(){r.unsubscribe(t,e)})}},{key:"unsubscribe",value:function(t,e){this.events=Object.assign(Object.assign({},this.events),qe({},t,this.events[t].filter((function(t){return t!==e}))))}},{key:"isAsyncFunction",value:function(t){var e=t.toString().trim();return!!("AsyncFunction"===t[Symbol.toStringTag]||"AsyncFunction"==t.constructor.name||e.match(/^async /)||e.match(/return _ref[^\\.]*\.apply/)||t instanceof Promise)}},{key:"publish",value:function(t,e){return b(this,void 0,void 0,Ke().mark((function r(){var n,o,i,a=this;return Ke().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(null==e?void 0:e.checksum)||this.history[t]!==(null==e?void 0:e.checksum)){r.next=2;break}return r.abrupt("return");case 2:if(this.history[t]=null==e?void 0:e.checksum,"object"!==tr(t)){r.next=6;break}return this.runForRegexBasedEvent(t,(function(t){return a.publish(t,e)})),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(t)){r.next=13;break}return r.next=13,this.publishForEvents(t,e,qe({},t,this.regexBasedEvents[i].handlers));case 13:n++,r.next=7;break;case 16:return r.abrupt("return",this.publishForEvents(t,e,this.events));case 17:case"end":return r.stop()}}),r,this)})))}},{key:"publishForEvents",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return b(this,void 0,void 0,Ke().mark((function n(){var o,i,a,u,c,s=this;return Ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r[t]){n.next=2;break}return n.abrupt("return",{});case 2:o={},i=Je(r[t]),n.prev=4,u=Ke().mark((function r(){var n,i,u;return Ke().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(s,$e,"f").call(s,{data:Object.assign(Object.assign({},e),o),payload:e,event:t,namespace:s.namespace}),!s.isAsyncFunction(n)){r.next=12;break}return r.next=9,n(i,(function(){return s.unsubscribe(t,n)}));case 9:r.t0=r.sent,r.next=13;break;case 12:r.t0=n(i,(function(){return s.unsubscribe(t,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 qt&&r.t1.breaksObservingChain)){r.next=22;break}return s.logError(ze.OBSERVER,t,"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"!==tr(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),cr(this.namespace).formData));case 23:case"end":return n.stop()}}),n,this,[[4,16,19,22]])})))}},{key:"logError",value:function(t,e,r,n){this.enableLogging&&"LOG"!==e&&this.publish("LOG",{level:"error",data:{event:e,error:n},action:r,flow:t})}},{key:"logInfo",value:function(t,e,r,n){this.enableLogging&&"LOG"!==e&&this.publish("LOG",{level:"info",data:Object.assign({event:e},n),action:r,flow:t})}}]),t}();$e=new WeakMap;var ur=new ir,cr=ur.getFormInstance;ur.getGroupFormsIds;const sr=({children:r,component:n,wrapper:o,propsMapping:i={},formId:u,onMount:c,onChange:s,onFocus:l,onBlur:f,onClick:d,onRehydrate:p})=>{const[v,y]=h(),[b,m]=h(),[g,O]=h(),[E,_]=h(),[S,j]=h(),w=e.useMemo((()=>cr(u).getFieldInstance(n,i)),[]),A=e.useMemo((()=>o),[o]);return e.useMemo((()=>{w.publish(a("ON_FIELD_MOUNT",n.name)),c(w.data)}),[]),e.useEffect((()=>{b&&p(w.data)}),[b]),e.useEffect((()=>{v&&s(w.data)}),[v]),e.useEffect((()=>{g&&f(w.data)}),[g]),e.useEffect((()=>{E&&l(w.data)}),[E]),e.useEffect((()=>{S&&d(w.data)}),[S]),e.useEffect((()=>w.subscribe(a("ON_FIELD_REHYDRATE",n.name),(()=>m()))),[]),e.useEffect((()=>w.subscribe(a("ON_FIELD_BLUR",n.name),(()=>O()))),[]),e.useEffect((()=>w.subscribe(a("ON_FIELD_CHANGE",n.name),(()=>y()))),[]),e.useEffect((()=>w.subscribe(a("ON_FIELD_FOCUS",n.name),(()=>_()))),[]),e.useEffect((()=>w.subscribe(a("ON_FIELD_CLICK",n.name),(()=>j()))),[]),w.data.visible&&w.data.mounted?t.jsx(A,Object.assign({},w.props,{children:r})):null},lr=e.forwardRef(((e,r)=>t.jsx("input",{ref:r,type:"submit",style:{display:"none"}})));lr.displayName="Submit";const fr=e.createContext({});fr.displayName="FormContext";const dr=o.default.forwardRef((({autoComplete:r,hooks:n,iVars:i,id:a=s,submitOnValidOnly:l=!0,initialValues:f={},className:d,schema:p,group:v,onData:h,onSubmit:y,onBlur:b,onClick:m,onFormMount:g,onFieldMount:O,onStep:E,onFocus:_,onLog:S,onScopeChange:j,onFieldRehydrate:w,renderFieldWrapper:A,disable:N},k)=>{var x;const[,F]=e.useReducer((t=>t+1),0),L=e.useRef(null),I=e.useRef(null),{mapper:T,propsMapping:D}=e.useContext(fr),C=e.useMemo((()=>cr(a,{group:v,schema:p,newInstance:!0,initialScope:{configs:Object.assign(Object.assign({},null==p?void 0:p.configs),{enableLogging:!!S,disable:N}),global:Object.assign(Object.assign({},null==p?void 0:p.iVars),i)},initialValues:f})),[]);e.useEffect((()=>{C.publish("ON_FORM_MOUNT")}),[]);const R=e.useMemo((()=>T.step?T.step.component:o.default.Fragment),[]),P=e.useMemo((()=>{if(!C.step.currentStepSchema)return;const e=(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=t.jsx(sr,Object.assign({component:r,wrapper:u,propsMapping:D[r.component]||D.__default__,formId:a,onMount:t=>{O&&O(C.formData,r,t)},onRehydrate:t=>{w&&w(C.formData,r,t)},onChange:t=>{h&&h(C.formData,r,t)},onBlur:t=>{b&&b(C.formData,r,t)},onClick:t=>{m&&m(C.formData,t)},onFocus:t=>{_&&_(C.formData,r,Object.assign(Object.assign({},t),{schemaLocation:{step:C.step.index,depth:n,index:o}}))}},{children:Array.isArray(r.children)?e(r,n++):r.children}),`${C.step.index}_${n}_${r.name}_${r.component}_${o}`);return A?A(r,c):c}))};return e(C.step.currentStepSchema)}),[C.step.index,a]);return e.useEffect((()=>{C.scope.globalScope={namespace:"configs",data:{disable:N}}}),[N]),e.useEffect((()=>{g&&g(C.formData)}),[]),e.useEffect((()=>{C.scope.globalScope={namespace:"configs",data:{disable:N}}}),[N]),e.useEffect((()=>{C.scope.globalScope={namespace:"global",data:Object.assign(Object.assign({},null==p?void 0:p.iVars),i)}}),[JSON.stringify(i)]),e.useEffect((()=>C.subscribe("ON_FORM_REHYDRATE",(()=>{F()}))),[]),e.useEffect((()=>C.subscribe("LOG",(({data:t})=>S&&S(t)))),[]),e.useMemo((()=>C.subscribe(u("ON_SCOPE_CHANGE"),(t=>j&&j(C.scope.scope,t.data.namespace,t.data.key)))),[]),e.useEffect((()=>C.subscribe("ON_FORM_SUBMIT",(({data:t})=>{const e=(null==n?void 0:n.preSubmit)&&(null==n?void 0:n.preSubmit(C.formData));!C.formData.form.isValid&&l||y&&y(t.event,Object.assign(Object.assign({},C.formData),{formatted:Object.assign(Object.assign({},C.formData.formatted),e)}))}))),[]),e.useEffect((()=>C.subscribeBulk([c.NAVIGATE_STEP_BACK,c.NAVIGATE_STEP_FORWARD,c.NAVIGATE_STEP],(()=>{E&&E(C.formData),F()}))),[]),e.useImperativeHandle(k,(()=>({values:()=>C.formData,step:C.publishFor(c.NAVIGATE_STEP),stepForward:C.publishFor(c.NAVIGATE_STEP_FORWARD),stepBack:C.publishFor(c.NAVIGATE_STEP_BACK),validateForm:C.publishFor(c.VALIDATE_FORM),submit:()=>{var t;return null===(t=I.current)||void 0===t?void 0:t.click()},schema:p})),[]),t.jsxs("form",Object.assign({action:C.scopedSchema.action,method:C.scopedSchema.method,className:d,ref:L,autoComplete:r,onSubmit:t=>{C.publish(c.ON_FORM_SUBMIT,{event:t})}},{children:[t.jsx(R,Object.assign({},null===(x=C.step.currentStepSchema)||void 0===x?void 0:x.props,{children:P})),t.jsx(lr,{ref:I})]}))})),pr=o.default.forwardRef(((e,r)=>e.schema?t.jsx(dr,Object.assign({},e,{ref:r})):e.renderLoading?e.renderLoading():t.jsx(t.Fragment,{})));exports.ALL_NAMESPACE_EVENTS=u,exports.BUILD_EVENT=a,exports.CoreEvents=c,exports.FormProvider=({children:e,mapper:r,propsMapping:n})=>t.jsx(fr.Provider,Object.assign({value:{mapper:r,propsMapping:n}},{children:e})),exports.SchemaGuard=pr,exports.asFormField=({Comp:r,propsMapping:n})=>o=>{var{name:i,validations:u,errorMessages:c,masks:s,filter:f,formatters:d,visibilityConditions:p,formId:v=l,visibility:b=!0,value:m}=o,g=y(o,["name","validations","errorMessages","masks","filter","formatters","visibilityConditions","formId","visibility","value"]);const[,O]=h(),E=e.useMemo((()=>({state:{hidden:!b},component:"",name:i,validations:u,errorMessages:c,masks:s,filter:f,visibilityConditions:p,formatters:d})),[c,i,f,d,s,u,p]),_=e.useMemo((()=>cr(v).getFieldInstance(E,n)),[]);return e.useMemo((()=>{_.subscribeBulk([a("ON_FIELD_MOUNT",E.name),a("ON_FIELD_REHYDRATE",E.name)],O)}),[]),e.useMemo((()=>{_.subscribe(a("ON_FIELD_CHANGE",E.name),(({data:t})=>{O(),g[n.getValue]&&g[n.getValue](t.event,_.data)}))}),[g[n.getValue]]),e.useMemo((()=>{_.subscribe(a("ON_FIELD_BLUR",E.name),(({data:t})=>{O(),g[n.onBlur]&&g[n.onBlur](t.event)}))}),[g[n.onBlur]]),e.useMemo((()=>{_.subscribe(a("ON_FIELD_FOCUS",E.name),(({data:t})=>{O(),g[n.onFocus]&&g[n.onFocus](t.event)}))}),[g[n.onFocus]]),e.useEffect((()=>{void 0!==m&&(_.value=m,_.rehydrate())}),[m]),e.useEffect((()=>{_.visibility=b,_.rehydrate()}),[b]),e.useEffect((()=>()=>cr(v).destroyField(i)),[]),_.data.visible?t.jsx(r,Object.assign({},g,_.props)):t.jsx(t.Fragment,{})},exports.useForm=({onValid:t,onData:r,onSubmit:n,id:o=l,ids:i})=>{const a=(t,e)=>{e&&(i?i.map((r=>cr(r).subscribe(t,(({data:t})=>e(cr(r).formData,{field:t.field}))))):cr(o).subscribe(t,e))},s=()=>i?i.reduce(((t,e)=>Object.keys(t).reduce(((r,n)=>Object.assign(Object.assign({},r),{[n]:Object.assign(Object.assign({},t[n]),cr(e).formData[n])})),{})),{formatted:{},erroredFields:{},fields:{},form:{},predictableErroredFields:{},filteredFields:{}}):cr(o).formData,f=e.useCallback((()=>{let t=cr(o).formData;i&&(t=i.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:cr(e).formData})),{})),r&&r(t)}),[r,t]);e.useEffect((()=>a("ON_FIELD_VALIDATION_TOGGLE",t)),[t]),e.useEffect((()=>a(u(c.ON_FIELD_CHANGE),f)),[r,t]),e.useEffect((()=>a(u(c.ON_FIELD_REHYDRATE),f)),[r,t]),e.useEffect((()=>a(c.ON_FORM_SUBMIT,(()=>{n&&n(s())}))),[n]);return{submitForm:()=>cr(i?i[0]:o).publish(c.ON_FORM_SUBMIT),formData:s}};
|
|
2
|
+
//# sourceMappingURL=asFormField-175b1a63.js.map
|