@formio/js 5.0.0-rc.85 → 5.0.0-rc.87

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +43 -13
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +23 -13
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  10. package/dist/formio.js +3 -3
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +37 -7
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/Webform.js +1 -1
  17. package/lib/cjs/Wizard.d.ts +1 -0
  18. package/lib/cjs/Wizard.js +12 -1
  19. package/lib/cjs/components/_classes/component/Component.d.ts +5 -0
  20. package/lib/cjs/components/_classes/component/Component.js +8 -1
  21. package/lib/cjs/components/datagrid/fixtures/comp10.d.ts +81 -0
  22. package/lib/cjs/components/datagrid/fixtures/comp10.js +87 -0
  23. package/lib/cjs/components/datagrid/fixtures/index.d.ts +1 -0
  24. package/lib/cjs/components/textarea/TextArea.d.ts +7 -0
  25. package/lib/cjs/components/textarea/TextArea.js +20 -0
  26. package/lib/mjs/Webform.js +1 -1
  27. package/lib/mjs/Wizard.d.ts +1 -0
  28. package/lib/mjs/Wizard.js +12 -1
  29. package/lib/mjs/components/_classes/component/Component.d.ts +5 -0
  30. package/lib/mjs/components/_classes/component/Component.js +8 -1
  31. package/lib/mjs/components/datagrid/fixtures/comp10.d.ts +81 -0
  32. package/lib/mjs/components/datagrid/fixtures/comp10.js +85 -0
  33. package/lib/mjs/components/datagrid/fixtures/index.d.ts +1 -0
  34. package/lib/mjs/components/textarea/TextArea.d.ts +7 -0
  35. package/lib/mjs/components/textarea/TextArea.js +20 -0
  36. package/package.json +2 -2
@@ -10,7 +10,7 @@
10
10
  * MIT licensed
11
11
  */
12
12
 
13
- /*! formiojs v5.0.0-rc.85 | https://unpkg.com/formiojs@5.0.0-rc.85/LICENSE.txt */
13
+ /*! formiojs v5.0.0-rc.87 | https://unpkg.com/formiojs@5.0.0-rc.87/LICENSE.txt */
14
14
 
15
15
  /**
16
16
  * @license
@@ -180,7 +180,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
180
180
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
181
181
 
182
182
  "use strict";
183
- eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.filterProcessInfo = exports.filterPostProcess = exports.filterProcess = exports.filterProcessSync = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst lodash_2 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst filterProcessSync = (context) => {\n const { scope, component } = context;\n let { value } = context;\n const absolutePath = (0, formUtil_1.getComponentAbsolutePath)(component);\n if (!scope.filter)\n scope.filter = {};\n if (value !== undefined) {\n const modelType = utils_1.Utils.getModelType(component);\n switch (modelType) {\n case 'dataObject':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: { data: {} }\n };\n break;\n case 'nestedArray':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: []\n };\n break;\n case 'object':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: (component.type === 'address') ? false : {}\n };\n break;\n default:\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n };\n break;\n }\n }\n};\nexports.filterProcessSync = filterProcessSync;\nconst filterProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.filterProcessSync)(context);\n});\nexports.filterProcess = filterProcess;\nconst filterPostProcess = (context) => {\n var _a;\n const { scope, submission } = context;\n const filtered = {};\n for (const path in scope.filter) {\n if (scope.filter[path].include) {\n let value = (0, lodash_2.get)(submission === null || submission === void 0 ? void 0 : submission.data, path);\n if (scope.filter[path].value) {\n if ((0, lodash_2.isObject)(value) && ((_a = scope.filter[path].value) === null || _a === void 0 ? void 0 : _a.data)) {\n value = Object.assign(Object.assign({}, value), scope.filter[path].value);\n }\n else {\n value = scope.filter[path].value;\n }\n }\n (0, lodash_1.set)(filtered, path, value);\n }\n }\n context.data = filtered;\n};\nexports.filterPostProcess = filterPostProcess;\nexports.filterProcessInfo = {\n name: 'filter',\n process: exports.filterProcess,\n processSync: exports.filterProcessSync,\n postProcess: exports.filterPostProcess,\n shouldProcess: (context) => true,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/filter/index.js?");
183
+ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.filterProcessInfo = exports.filterPostProcess = exports.filterProcess = exports.filterProcessSync = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst lodash_2 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst filterProcessSync = (context) => {\n const { scope, component } = context;\n let { value } = context;\n const absolutePath = (0, formUtil_1.getComponentAbsolutePath)(component);\n if (!scope.filter)\n scope.filter = {};\n if (value !== undefined) {\n const modelType = utils_1.Utils.getModelType(component);\n switch (modelType) {\n case 'dataObject':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: { data: {} }\n };\n break;\n case 'nestedArray':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: []\n };\n break;\n case 'nestedDataArray':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: Array.isArray(value) ? value.map(v => (Object.assign(Object.assign({}, v), { data: {} }))) : [],\n };\n break;\n case 'object':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: (component.type === 'address') ? false : {}\n };\n break;\n default:\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n };\n break;\n }\n }\n};\nexports.filterProcessSync = filterProcessSync;\nconst filterProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.filterProcessSync)(context);\n});\nexports.filterProcess = filterProcess;\nconst filterPostProcess = (context) => {\n var _a;\n const { scope, submission } = context;\n const filtered = {};\n for (const path in scope.filter) {\n if (scope.filter[path].include) {\n let value = (0, lodash_2.get)(submission === null || submission === void 0 ? void 0 : submission.data, path);\n if (scope.filter[path].value) {\n if ((0, lodash_2.isObject)(value) && ((_a = scope.filter[path].value) === null || _a === void 0 ? void 0 : _a.data)) {\n value = Object.assign(Object.assign({}, value), scope.filter[path].value);\n }\n else {\n value = scope.filter[path].value;\n }\n }\n (0, lodash_1.set)(filtered, path, value);\n }\n }\n context.data = filtered;\n};\nexports.filterPostProcess = filterPostProcess;\nexports.filterProcessInfo = {\n name: 'filter',\n process: exports.filterProcess,\n processSync: exports.filterProcessSync,\n postProcess: exports.filterPostProcess,\n shouldProcess: (context) => true,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/filter/index.js?");
184
184
 
185
185
  /***/ }),
186
186
 
@@ -565,7 +565,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
565
565
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
566
566
 
567
567
  "use strict";
568
- eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMultipleInfo = exports.validateMultipleSync = exports.validateMultiple = exports.shouldValidate = exports.emptyValueIsArray = exports.isEligible = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst isEligible = (component) => {\n // TODO: would be nice if this was type safe\n switch (component.type) {\n case 'hidden':\n case 'address':\n if (!component.multiple) {\n return false;\n }\n return true;\n case 'textarea':\n if (!component.as ||\n component.as !== 'json' ||\n (component.as === 'json' && !component.multiple)) {\n return false;\n }\n return true;\n // TODO: For backwards compatibility, skip multiple validation for select components until we can investigate\n // how this validation might break existing forms\n case 'select':\n return false;\n default:\n return true;\n }\n};\nexports.isEligible = isEligible;\nconst isTagsComponent = (component) => {\n return (component === null || component === void 0 ? void 0 : component.type) === 'tags';\n};\nconst emptyValueIsArray = (component) => {\n // TODO: How do we infer the data model of the compoennt given only its JSON? For now, we have to hardcode component types\n switch (component.type) {\n case 'datagrid':\n case 'editgrid':\n case 'tagpad':\n case 'sketchpad':\n case 'datatable':\n case 'dynamicWizard':\n case 'file':\n return true;\n case 'select':\n case 'textfield':\n return !!component.multiple;\n case 'tags':\n return component.storeas !== 'string';\n default:\n return true;\n }\n};\nexports.emptyValueIsArray = emptyValueIsArray;\nconst shouldValidate = (context) => {\n const { component } = context;\n if (!(0, exports.isEligible)(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMultiple = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMultipleSync)(context);\n});\nexports.validateMultiple = validateMultiple;\nconst validateMultipleSync = (context) => {\n var _a;\n const { component, value } = context;\n // Skip multiple validation if the component tells us to\n if (!(0, exports.isEligible)(component)) {\n return null;\n }\n const shouldBeMultipleArray = !!component.multiple;\n const isRequired = !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required);\n const underlyingValueShouldBeArray = (0, formUtil_1.getModelType)(component) === 'nestedArray' || (isTagsComponent(component) && component.storeas === 'array');\n const valueIsArray = Array.isArray(value);\n if (shouldBeMultipleArray) {\n if (valueIsArray && underlyingValueShouldBeArray) {\n if (value.length === 0) {\n return isRequired ? new error_1.FieldError('array_nonempty', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n // TODO: We need to be permissive here for file components, which have an array model type but don't have an underlying array value\n // (in other words, a file component's data object will always be a single array regardless of whether or not multiple is set)\n // In the future, we could consider checking the underlying value's type to determine if it should be an array\n // return Array.isArray(value[0]) ? null : new FieldError('array', { ...context, setting: true });\n return null;\n }\n else if (valueIsArray && !underlyingValueShouldBeArray) {\n if (value.length === 0) {\n return isRequired ? new error_1.FieldError('array_nonempty', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n return Array.isArray(value[0]) ? new error_1.FieldError('nonarray', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n else {\n const error = new error_1.FieldError('array', Object.assign(Object.assign({}, context), { setting: true }));\n // Null/undefined is ok if this value isn't required; anything else should fail\n return (0, lodash_1.isNil)(value) ? (isRequired ? error : null) : error;\n }\n }\n else {\n const canBeArray = (0, exports.emptyValueIsArray)(component) || underlyingValueShouldBeArray;\n if (!canBeArray && valueIsArray) {\n return new error_1.FieldError('nonarray', Object.assign(Object.assign({}, context), { setting: false }));\n }\n return null;\n }\n};\nexports.validateMultipleSync = validateMultipleSync;\nexports.validateMultipleInfo = {\n name: 'validateMultiple',\n process: exports.validateMultiple,\n fullValue: true,\n processSync: exports.validateMultipleSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMultiple.js?");
568
+ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMultipleInfo = exports.validateMultipleSync = exports.validateMultiple = exports.shouldValidate = exports.emptyValueIsArray = exports.isEligible = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst isEligible = (component) => {\n // TODO: would be nice if this was type safe\n switch (component.type) {\n case 'hidden':\n case 'address':\n if (!component.multiple) {\n return false;\n }\n return true;\n case 'textarea':\n if (!component.as ||\n component.as !== 'json' ||\n (component.as === 'json' && !component.multiple)) {\n return false;\n }\n return true;\n // TODO: For backwards compatibility, skip multiple validation for select components until we can investigate\n // how this validation might break existing forms\n case 'select':\n return false;\n default:\n return true;\n }\n};\nexports.isEligible = isEligible;\nconst isTagsComponent = (component) => {\n return (component === null || component === void 0 ? void 0 : component.type) === 'tags';\n};\nconst emptyValueIsArray = (component) => {\n // TODO: How do we infer the data model of the compoennt given only its JSON? For now, we have to hardcode component types\n switch (component.type) {\n case 'datagrid':\n case 'editgrid':\n case 'tagpad':\n case 'sketchpad':\n case 'datatable':\n case 'dynamicWizard':\n case 'file':\n return true;\n case 'select':\n case 'textfield':\n return !!component.multiple;\n case 'tags':\n return component.storeas !== 'string';\n default:\n return true;\n }\n};\nexports.emptyValueIsArray = emptyValueIsArray;\nconst shouldValidate = (context) => {\n const { component } = context;\n if (!(0, exports.isEligible)(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMultiple = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMultipleSync)(context);\n});\nexports.validateMultiple = validateMultiple;\nconst validateMultipleSync = (context) => {\n var _a;\n const { component, value } = context;\n // Skip multiple validation if the component tells us to\n if (!(0, exports.isEligible)(component)) {\n return null;\n }\n const shouldBeMultipleArray = !!component.multiple;\n const isRequired = !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required);\n const underlyingValueShouldBeArray = ['nestedArray', 'nestedDataArray'].indexOf((0, formUtil_1.getModelType)(component)) !== -1 || (isTagsComponent(component) && component.storeas === 'array');\n const valueIsArray = Array.isArray(value);\n if (shouldBeMultipleArray) {\n if (valueIsArray && underlyingValueShouldBeArray) {\n if (value.length === 0) {\n return isRequired ? new error_1.FieldError('array_nonempty', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n // TODO: We need to be permissive here for file components, which have an array model type but don't have an underlying array value\n // (in other words, a file component's data object will always be a single array regardless of whether or not multiple is set)\n // In the future, we could consider checking the underlying value's type to determine if it should be an array\n // return Array.isArray(value[0]) ? null : new FieldError('array', { ...context, setting: true });\n return null;\n }\n else if (valueIsArray && !underlyingValueShouldBeArray) {\n if (value.length === 0) {\n return isRequired ? new error_1.FieldError('array_nonempty', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n return Array.isArray(value[0]) ? new error_1.FieldError('nonarray', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n else {\n const error = new error_1.FieldError('array', Object.assign(Object.assign({}, context), { setting: true }));\n // Null/undefined is ok if this value isn't required; anything else should fail\n return (0, lodash_1.isNil)(value) ? (isRequired ? error : null) : error;\n }\n }\n else {\n const canBeArray = (0, exports.emptyValueIsArray)(component) || underlyingValueShouldBeArray;\n if (!canBeArray && valueIsArray) {\n return new error_1.FieldError('nonarray', Object.assign(Object.assign({}, context), { setting: false }));\n }\n return null;\n }\n};\nexports.validateMultipleSync = validateMultipleSync;\nexports.validateMultipleInfo = {\n name: 'validateMultiple',\n process: exports.validateMultiple,\n fullValue: true,\n processSync: exports.validateMultipleSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMultiple.js?");
569
569
 
570
570
  /***/ }),
571
571
 
@@ -598,7 +598,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
598
598
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
599
599
 
600
600
  "use strict";
601
- eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateRequiredInfo = exports.validateRequiredSync = exports.validateRequired = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst isAddressComponent = (component) => {\n return component.type === 'address';\n};\nconst isDayComponent = (component) => {\n return component.type === 'day';\n};\nconst isAddressComponentDataObject = (value) => {\n return value !== null && typeof value === 'object' && value.mode && value.address && typeof value.address === 'object';\n};\n// Checkboxes and selectboxes consider false to be falsy, whereas other components with\n// settable values (e.g. radio, select, datamap, container, etc.) consider it truthy\nconst isComponentThatCannotHaveFalseValue = (component) => {\n return component.type === 'checkbox' || component.type === 'selectboxes';\n};\nconst valueIsPresent = (value, considerFalseTruthy, isNestedDatatype) => {\n // Evaluate for 3 out of 6 falsy values (\"\", null, undefined), don't check for 0\n // and only check for false under certain conditions\n if (value === null || value === undefined || value === \"\" || (!considerFalseTruthy && value === false)) {\n return false;\n }\n // Evaluate for empty object\n else if ((0, util_1.isEmptyObject)(value)) {\n return false;\n }\n // Evaluate for empty array\n else if (Array.isArray(value) && value.length === 0) {\n return false;\n }\n // Recursively evaluate\n else if (typeof value === 'object' && !isNestedDatatype) {\n return Object.values(value).some((val) => valueIsPresent(val, considerFalseTruthy, isNestedDatatype));\n }\n return true;\n};\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n if (((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required) && !component.hidden) {\n return true;\n }\n return false;\n};\nexports.shouldValidate = shouldValidate;\nconst validateRequired = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateRequiredSync)(context);\n});\nexports.validateRequired = validateRequired;\nconst validateRequiredSync = (context) => {\n const error = new error_1.FieldError('required', Object.assign(Object.assign({}, context), { setting: true }));\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (isAddressComponent(component) && isAddressComponentDataObject(value)) {\n return (0, util_1.isEmptyObject)(value.address) ? error : Object.values(value.address).every((val) => !!val) ? null : error;\n }\n else if (isDayComponent(component) && value === '00/00/0000') {\n return error;\n }\n else if (isComponentThatCannotHaveFalseValue(component)) {\n return !valueIsPresent(value, false, (0, formUtil_1.isComponentNestedDataType)(component)) ? error : null;\n }\n return !valueIsPresent(value, true, (0, formUtil_1.isComponentNestedDataType)(component)) ? error : null;\n};\nexports.validateRequiredSync = validateRequiredSync;\nexports.validateRequiredInfo = {\n name: 'validateRequired',\n process: exports.validateRequired,\n processSync: exports.validateRequiredSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateRequired.js?");
601
+ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateRequiredInfo = exports.validateRequiredSync = exports.validateRequired = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst isAddressComponent = (component) => {\n return component.type === 'address';\n};\nconst isDayComponent = (component) => {\n return component.type === 'day';\n};\nconst isAddressComponentDataObject = (value) => {\n return value !== null && typeof value === 'object' && value.mode && value.address && typeof value.address === 'object';\n};\n// Checkboxes and selectboxes consider false to be falsy, whereas other components with\n// settable values (e.g. radio, select, datamap, container, etc.) consider it truthy\nconst isComponentThatCannotHaveFalseValue = (component) => {\n return component.type === 'checkbox' || component.type === 'selectboxes';\n};\nconst valueIsPresent = (value, considerFalseTruthy, isNestedDatatype) => {\n // Evaluate for 3 out of 6 falsy values (\"\", null, undefined), don't check for 0\n // and only check for false under certain conditions\n if (value === null || value === undefined || value === \"\" || (!considerFalseTruthy && value === false)) {\n return false;\n }\n // Evaluate for empty object\n else if ((0, util_1.isEmptyObject)(value)) {\n return false;\n }\n // Evaluate for empty array\n else if (Array.isArray(value) && value.length === 0) {\n return false;\n }\n // Recursively evaluate\n else if (typeof value === 'object' && !isNestedDatatype) {\n return Object.values(value).some((val) => valueIsPresent(val, considerFalseTruthy, isNestedDatatype));\n }\n // If value is an array, check it's children have value\n else if (Array.isArray(value) && value.length) {\n return (0, util_1.doesArrayDataHaveValue)(value);\n }\n return true;\n};\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n if (((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required) && !component.hidden) {\n return true;\n }\n return false;\n};\nexports.shouldValidate = shouldValidate;\nconst validateRequired = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateRequiredSync)(context);\n});\nexports.validateRequired = validateRequired;\nconst validateRequiredSync = (context) => {\n const error = new error_1.FieldError('required', Object.assign(Object.assign({}, context), { setting: true }));\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (isAddressComponent(component) && isAddressComponentDataObject(value)) {\n return (0, util_1.isEmptyObject)(value.address) ? error : Object.values(value.address).every((val) => !!val) ? null : error;\n }\n else if (isDayComponent(component) && value === '00/00/0000') {\n return error;\n }\n else if (isComponentThatCannotHaveFalseValue(component)) {\n return !valueIsPresent(value, false, (0, formUtil_1.isComponentNestedDataType)(component)) ? error : null;\n }\n return !valueIsPresent(value, true, (0, formUtil_1.isComponentNestedDataType)(component)) ? error : null;\n};\nexports.validateRequiredSync = validateRequiredSync;\nexports.validateRequiredInfo = {\n name: 'validateRequired',\n process: exports.validateRequired,\n processSync: exports.validateRequiredSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateRequired.js?");
602
602
 
603
603
  /***/ }),
604
604
 
@@ -686,7 +686,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
686
686
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
687
687
 
688
688
  "use strict";
689
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.interpolateErrors = exports.isObject = exports.isPromise = exports.toBoolean = exports.getComponentErrorField = exports.isEmptyObject = exports.isComponentProtected = exports.isComponentPersistent = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst i18n_1 = __webpack_require__(/*! ./i18n */ \"./node_modules/@formio/core/lib/process/validation/i18n/index.js\");\nfunction isComponentPersistent(component) {\n return component.persistent ? component.persistent : true;\n}\nexports.isComponentPersistent = isComponentPersistent;\nfunction isComponentProtected(component) {\n return component.protected ? component.protected : false;\n}\nexports.isComponentProtected = isComponentProtected;\nfunction isEmptyObject(obj) {\n return !!obj && Object.keys(obj).length === 0 && obj.constructor === Object;\n}\nexports.isEmptyObject = isEmptyObject;\nfunction getComponentErrorField(component, context) {\n const toInterpolate = component.errorLabel || component.label || component.placeholder || component.key;\n return utils_1.Evaluator.interpolate(toInterpolate, context);\n}\nexports.getComponentErrorField = getComponentErrorField;\nfunction toBoolean(value) {\n switch (typeof value) {\n case 'string':\n if (value === 'true' || value === '1') {\n return true;\n }\n else if (value === 'false' || value === '0') {\n return false;\n }\n else {\n throw `Cannot coerce string ${value} to boolean}`;\n }\n case 'boolean':\n return value;\n default:\n return !!value;\n }\n}\nexports.toBoolean = toBoolean;\nfunction isPromise(value) {\n return (value &&\n value.then &&\n typeof value.then === 'function' &&\n Object.prototype.toString.call(value) === '[object Promise]');\n}\nexports.isPromise = isPromise;\nfunction isObject(obj) {\n return typeof obj != null && (typeof obj === 'object' || typeof obj === 'function');\n}\nexports.isObject = isObject;\nconst getCustomErrorMessage = ({ errorKeyOrMessage, context }) => { var _a, _b; return ((_b = (_a = context.component) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b[errorKeyOrMessage]) || ''; };\n/**\n * Interpolates @formio/core errors so that they are compatible with the renderer\n * @param {FieldError[]} errors\n * @param firstPass\n * @returns {[]}\n */\nconst interpolateErrors = (errors, lang = 'en') => {\n return errors.map((error) => {\n const { errorKeyOrMessage, context } = error;\n const i18n = i18n_1.VALIDATION_ERRORS[lang] || {};\n const toInterpolate = getCustomErrorMessage(error) || i18n[errorKeyOrMessage] || errorKeyOrMessage;\n const paths = [];\n context.path.split('.').forEach((part) => {\n const match = part.match(/\\[([0-9]+)\\]$/);\n if (match) {\n paths.push(part.substring(0, match.index));\n paths.push(parseInt(match[1]));\n }\n else {\n paths.push(part);\n }\n });\n return {\n message: (0, utils_1.unescapeHTML)(utils_1.Evaluator.interpolateString(toInterpolate, context)),\n level: error.level,\n path: paths,\n context: {\n validator: error.ruleName,\n hasLabel: context.hasLabel,\n key: context.component.key,\n label: context.component.label || context.component.placeholder || context.component.key,\n path: context.path,\n value: context.value,\n setting: context.setting,\n index: context.index || 0\n }\n };\n });\n};\nexports.interpolateErrors = interpolateErrors;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/util.js?");
689
+ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.doesArrayDataHaveValue = exports.hasValue = exports.interpolateErrors = exports.isObject = exports.isPromise = exports.toBoolean = exports.getComponentErrorField = exports.isEmptyObject = exports.isComponentProtected = exports.isComponentPersistent = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst i18n_1 = __webpack_require__(/*! ./i18n */ \"./node_modules/@formio/core/lib/process/validation/i18n/index.js\");\nconst isEmpty_1 = __importDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\nconst isObject_1 = __importDefault(__webpack_require__(/*! lodash/isObject */ \"./node_modules/lodash/isObject.js\"));\nconst isPlainObject_1 = __importDefault(__webpack_require__(/*! lodash/isPlainObject */ \"./node_modules/lodash/isPlainObject.js\"));\nfunction isComponentPersistent(component) {\n return component.persistent ? component.persistent : true;\n}\nexports.isComponentPersistent = isComponentPersistent;\nfunction isComponentProtected(component) {\n return component.protected ? component.protected : false;\n}\nexports.isComponentProtected = isComponentProtected;\nfunction isEmptyObject(obj) {\n return !!obj && Object.keys(obj).length === 0 && obj.constructor === Object;\n}\nexports.isEmptyObject = isEmptyObject;\nfunction getComponentErrorField(component, context) {\n const toInterpolate = component.errorLabel || component.label || component.placeholder || component.key;\n return utils_1.Evaluator.interpolate(toInterpolate, context);\n}\nexports.getComponentErrorField = getComponentErrorField;\nfunction toBoolean(value) {\n switch (typeof value) {\n case 'string':\n if (value === 'true' || value === '1') {\n return true;\n }\n else if (value === 'false' || value === '0') {\n return false;\n }\n else {\n throw `Cannot coerce string ${value} to boolean}`;\n }\n case 'boolean':\n return value;\n default:\n return !!value;\n }\n}\nexports.toBoolean = toBoolean;\nfunction isPromise(value) {\n return (value &&\n value.then &&\n typeof value.then === 'function' &&\n Object.prototype.toString.call(value) === '[object Promise]');\n}\nexports.isPromise = isPromise;\nfunction isObject(obj) {\n return typeof obj != null && (typeof obj === 'object' || typeof obj === 'function');\n}\nexports.isObject = isObject;\nconst getCustomErrorMessage = ({ errorKeyOrMessage, context }) => { var _a, _b; return ((_b = (_a = context.component) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b[errorKeyOrMessage]) || ''; };\n/**\n * Interpolates @formio/core errors so that they are compatible with the renderer\n * @param {FieldError[]} errors\n * @param firstPass\n * @returns {[]}\n */\nconst interpolateErrors = (errors, lang = 'en') => {\n return errors.map((error) => {\n const { errorKeyOrMessage, context } = error;\n const i18n = i18n_1.VALIDATION_ERRORS[lang] || {};\n const toInterpolate = getCustomErrorMessage(error) || i18n[errorKeyOrMessage] || errorKeyOrMessage;\n const paths = [];\n context.path.split('.').forEach((part) => {\n const match = part.match(/\\[([0-9]+)\\]$/);\n if (match) {\n paths.push(part.substring(0, match.index));\n paths.push(parseInt(match[1]));\n }\n else {\n paths.push(part);\n }\n });\n return {\n message: (0, utils_1.unescapeHTML)(utils_1.Evaluator.interpolateString(toInterpolate, context)),\n level: error.level,\n path: paths,\n context: {\n validator: error.ruleName,\n hasLabel: context.hasLabel,\n key: context.component.key,\n label: context.component.label || context.component.placeholder || context.component.key,\n path: context.path,\n value: context.value,\n setting: context.setting,\n index: context.index || 0\n }\n };\n });\n};\nexports.interpolateErrors = interpolateErrors;\nconst hasValue = (value) => {\n if ((0, isObject_1.default)(value)) {\n return !(0, isEmpty_1.default)(value);\n }\n return (typeof value === 'number' && !Number.isNaN(value)) || !!value;\n};\nexports.hasValue = hasValue;\nconst doesArrayDataHaveValue = (dataValue = []) => {\n if (!Array.isArray(dataValue)) {\n return !!dataValue;\n }\n if (!dataValue.length) {\n return false;\n }\n const isArrayDataComponent = dataValue.every(isPlainObject_1.default);\n if (isArrayDataComponent) {\n return dataValue.some(value => Object.values(value).some(exports.hasValue));\n }\n return dataValue.some(exports.hasValue);\n};\nexports.doesArrayDataHaveValue = doesArrayDataHaveValue;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/util.js?");
690
690
 
691
691
  /***/ }),
692
692
 
@@ -1280,7 +1280,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
1280
1280
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1281
1281
 
1282
1282
  "use strict";
1283
- eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.checkSimpleConditional = exports.checkJsonConditional = exports.checkLegacyConditional = exports.checkCustomConditional = exports.conditionallyHidden = exports.isSimpleConditional = exports.isLegacyConditional = exports.isJSONConditional = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst operators_1 = __importDefault(__webpack_require__(/*! ./operators */ \"./node_modules/@formio/core/lib/utils/operators/index.js\"));\nconst isJSONConditional = (conditional) => {\n return conditional && conditional.json && (0, lodash_1.isObject)(conditional.json);\n};\nexports.isJSONConditional = isJSONConditional;\nconst isLegacyConditional = (conditional) => {\n return conditional && conditional.when;\n};\nexports.isLegacyConditional = isLegacyConditional;\nconst isSimpleConditional = (conditional) => {\n return conditional && conditional.conjunction && conditional.conditions;\n};\nexports.isSimpleConditional = isSimpleConditional;\nfunction conditionallyHidden(context) {\n const { scope, component, path } = context;\n if (scope.conditionals && path) {\n const hidden = (0, lodash_1.find)(scope.conditionals, (conditional) => {\n return conditional.path === path;\n });\n return hidden === null || hidden === void 0 ? void 0 : hidden.conditionallyHidden;\n }\n return false;\n}\nexports.conditionallyHidden = conditionallyHidden;\n/**\n * Check custom javascript conditional.\n *\n * @param component\n * @param custom\n * @param row\n * @param data\n * @returns {*}\n */\nfunction checkCustomConditional(condition, context, variable = 'show') {\n const { evalContext } = context;\n if (!condition) {\n return null;\n }\n const value = (0, jsonlogic_1.evaluate)(context, condition, variable, evalContext);\n if (value === null) {\n return null;\n }\n return value;\n}\nexports.checkCustomConditional = checkCustomConditional;\n/**\n * Checks the legacy conditionals.\n *\n * @param conditional\n * @param context\n * @param checkDefault\n * @returns\n */\nfunction checkLegacyConditional(conditional, context) {\n const { row, data, component } = context;\n if (!conditional || !(0, exports.isLegacyConditional)(conditional) || !conditional.when) {\n return null;\n }\n const value = (0, formUtil_1.getComponentActualValue)(component, conditional.when, data, row);\n const eq = String(conditional.eq);\n const show = String(conditional.show);\n if ((0, lodash_1.isObject)(value) && (0, lodash_1.has)(value, eq)) {\n return String(value[eq]) === show;\n }\n if (Array.isArray(value) && value.map(String).includes(eq)) {\n return show === 'true';\n }\n return (String(value) === eq) === (show === 'true');\n}\nexports.checkLegacyConditional = checkLegacyConditional;\n/**\n * Checks the JSON Conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkJsonConditional(conditional, context) {\n const { evalContext } = context;\n if (!conditional || !(0, exports.isJSONConditional)(conditional)) {\n return null;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n return jsonlogic_1.JSONLogicEvaluator.evaluate(conditional.json, evalContextValue);\n}\nexports.checkJsonConditional = checkJsonConditional;\n/**\n * Checks the simple conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkSimpleConditional(conditional, context) {\n const { component, data, row, instance, form, components = [] } = context;\n if (!conditional || !(0, exports.isSimpleConditional)(conditional)) {\n return null;\n }\n const { conditions = [], conjunction = 'all', show = true } = conditional;\n if (!conditions.length) {\n return null;\n }\n const conditionsResult = (0, lodash_1.filter)((0, lodash_1.map)(conditions, (cond) => {\n const { value: comparedValue, operator, component: conditionComponentPath } = cond;\n if (!conditionComponentPath) {\n // Ignore conditions if there is no component path.\n return null;\n }\n const conditionComponent = (0, formUtil_1.getComponent)((form === null || form === void 0 ? void 0 : form.components) || components, conditionComponentPath, true);\n const value = conditionComponent ? (0, formUtil_1.getComponentActualValue)(conditionComponent, conditionComponentPath, data, row) : null;\n const ConditionOperator = operators_1.default[operator];\n return ConditionOperator\n ? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponent, conditionComponentPath })\n : true;\n }), (res) => (res !== null));\n let result = false;\n switch (conjunction) {\n case 'any':\n result = (0, lodash_1.some)(conditionsResult, res => !!res);\n break;\n default:\n result = (0, lodash_1.every)(conditionsResult, res => !!res);\n }\n return show ? result : !result;\n}\nexports.checkSimpleConditional = checkSimpleConditional;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/conditions.js?");
1283
+ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.checkSimpleConditional = exports.checkJsonConditional = exports.checkLegacyConditional = exports.checkCustomConditional = exports.conditionallyHidden = exports.isSimpleConditional = exports.isLegacyConditional = exports.isJSONConditional = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst operators_1 = __importDefault(__webpack_require__(/*! ./operators */ \"./node_modules/@formio/core/lib/utils/operators/index.js\"));\nconst isJSONConditional = (conditional) => {\n return conditional && conditional.json && (0, lodash_1.isObject)(conditional.json);\n};\nexports.isJSONConditional = isJSONConditional;\nconst isLegacyConditional = (conditional) => {\n return conditional && conditional.when;\n};\nexports.isLegacyConditional = isLegacyConditional;\nconst isSimpleConditional = (conditional) => {\n return conditional && conditional.conjunction && conditional.conditions;\n};\nexports.isSimpleConditional = isSimpleConditional;\nfunction conditionallyHidden(context) {\n const { scope, component, path } = context;\n if (scope.conditionals && path) {\n const hidden = (0, lodash_1.find)(scope.conditionals, (conditional) => {\n return conditional.path === path;\n });\n return hidden === null || hidden === void 0 ? void 0 : hidden.conditionallyHidden;\n }\n return false;\n}\nexports.conditionallyHidden = conditionallyHidden;\n/**\n * Check custom javascript conditional.\n *\n * @param component\n * @param custom\n * @param row\n * @param data\n * @returns {*}\n */\nfunction checkCustomConditional(condition, context, variable = 'show') {\n const { evalContext } = context;\n if (!condition) {\n return null;\n }\n const value = (0, jsonlogic_1.evaluate)(context, condition, variable, evalContext);\n if (value === null) {\n return null;\n }\n return value;\n}\nexports.checkCustomConditional = checkCustomConditional;\n/**\n * Checks the legacy conditionals.\n *\n * @param conditional\n * @param context\n * @param checkDefault\n * @returns\n */\nfunction checkLegacyConditional(conditional, context) {\n const { row, data, component } = context;\n if (!conditional || !(0, exports.isLegacyConditional)(conditional) || !conditional.when) {\n return null;\n }\n const value = (0, formUtil_1.getComponentActualValue)(component, conditional.when, data, row);\n const eq = String(conditional.eq);\n const show = String(conditional.show);\n if ((0, lodash_1.isObject)(value) && (0, lodash_1.has)(value, eq)) {\n return String(value[eq]) === show;\n }\n if (Array.isArray(value) && value.map(String).includes(eq)) {\n return show === 'true';\n }\n return (String(value) === eq) === (show === 'true');\n}\nexports.checkLegacyConditional = checkLegacyConditional;\n/**\n * Checks the JSON Conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkJsonConditional(conditional, context) {\n const { evalContext } = context;\n if (!conditional || !(0, exports.isJSONConditional)(conditional)) {\n return null;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n return jsonlogic_1.JSONLogicEvaluator.evaluate(conditional.json, evalContextValue);\n}\nexports.checkJsonConditional = checkJsonConditional;\n/**\n * Checks the simple conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkSimpleConditional(conditional, context) {\n const { component, data, row, instance, form, components = [] } = context;\n if (!conditional || !(0, exports.isSimpleConditional)(conditional)) {\n return null;\n }\n const { conditions = [], conjunction = 'all', show = true } = conditional;\n if (!conditions.length) {\n return null;\n }\n const conditionsResult = (0, lodash_1.filter)((0, lodash_1.map)(conditions, (cond) => {\n const { value: comparedValue, operator, component: conditionComponentPath } = cond;\n if (!conditionComponentPath) {\n // Ignore conditions if there is no component path.\n return null;\n }\n const conditionComponent = (0, formUtil_1.getComponent)((form === null || form === void 0 ? void 0 : form.components) || components, conditionComponentPath, true);\n const value = conditionComponent ? (0, formUtil_1.getComponentActualValue)(conditionComponent, conditionComponentPath, data, row) : null;\n const ConditionOperator = operators_1.default[operator];\n return ConditionOperator\n ? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponent, conditionComponentPath, data })\n : true;\n }), (res) => (res !== null));\n let result = false;\n switch (conjunction) {\n case 'any':\n result = (0, lodash_1.some)(conditionsResult, res => !!res);\n break;\n default:\n result = (0, lodash_1.every)(conditionsResult, res => !!res);\n }\n return show ? result : !result;\n}\nexports.checkSimpleConditional = checkSimpleConditional;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/conditions.js?");
1284
1284
 
1285
1285
  /***/ }),
1286
1286
 
@@ -1335,7 +1335,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
1335
1335
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1336
1336
 
1337
1337
  "use strict";
1338
- eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.findComponents = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentFormPath = exports.componentDataPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES_OF_KNOWN_COMPONENTS = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst fast_json_patch_1 = __webpack_require__(/*! fast-json-patch */ \"./node_modules/fast-json-patch/index.mjs\");\nconst Evaluator_1 = __webpack_require__(/*! ./Evaluator */ \"./node_modules/@formio/core/lib/utils/Evaluator.js\");\n/**\n * Flatten the form components for data manipulation.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n *\n * @returns {Object}\n * The flattened components map.\n */\nfunction flattenComponents(components, includeAll = false) {\n const flattened = {};\n eachComponent(components, (component, path) => {\n flattened[path] = component;\n }, includeAll);\n return flattened;\n}\nexports.flattenComponents = flattenComponents;\nfunction guid() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nexports.guid = guid;\n/**\n * Make a filename guaranteed to be unique.\n * @param name\n * @param template\n * @param evalContext\n * @returns {string}\n */\nfunction uniqueName(name, template, evalContext) {\n template = template || \"{{fileName}}-{{guid}}\";\n //include guid in template anyway, to prevent overwriting issue if filename matches existing file\n if (!template.includes(\"{{guid}}\")) {\n template = `${template}-{{guid}}`;\n }\n const parts = name.split(\".\");\n let fileName = parts.slice(0, parts.length - 1).join(\".\");\n const extension = parts.length > 1 ? `.${(0, lodash_1.last)(parts)}` : \"\";\n //allow only 100 characters from original name to avoid issues with filename length restrictions\n fileName = fileName.substr(0, 100);\n evalContext = Object.assign(evalContext || {}, {\n fileName,\n guid: guid(),\n });\n //only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash\n const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\\-_ ]/g, \"-\");\n return uniqueName;\n}\nexports.uniqueName = uniqueName;\n/**\n * Defines model types for known components.\n * For now, these will be the only model types supported by the @formio/core library.\n *\n * nestedArray: for components that store their data as an array and have nested components.\n * array: for components that store their data as an array.\n * dataObject: for components that store their data in a nested { data: {} } object.\n * object: for components that store their data in an object.\n * map: for components that store their data in a map.\n * content: for components that do not store data.\n * string: for components that store their data as a string.\n * number: for components that store their data as a number.\n * boolean: for components that store their data as a boolean.\n * none: for components that do not store data and should not be included in the submission.\n * any: for components that can store any type of data.\n *\n */\nexports.MODEL_TYPES_OF_KNOWN_COMPONENTS = {\n nestedArray: [\n 'datagrid',\n 'editgrid',\n 'datatable',\n 'dynamicWizard',\n 'tagpad',\n ],\n dataObject: [\n 'form'\n ],\n object: [\n 'container',\n 'address',\n ],\n map: [\n 'datamap',\n ],\n content: [\n 'htmlelement',\n 'content'\n ],\n string: [\n 'textfield',\n 'textarea',\n 'password',\n 'email',\n 'url',\n 'phoneNumber',\n 'day',\n 'datetime',\n 'time',\n 'signature',\n ],\n number: [\n 'number',\n 'currency'\n ],\n boolean: [\n 'checkbox',\n 'radio',\n ],\n none: [\n 'table',\n 'well',\n 'columns',\n 'fieldset',\n 'panel',\n 'tabs'\n ],\n any: [\n 'survey',\n 'captcha',\n 'selectboxes',\n 'tags',\n 'select',\n 'hidden',\n 'button',\n 'datasource',\n 'sketchpad',\n 'reviewpage',\n 'file',\n ],\n};\nfunction getModelType(component) {\n // If the component JSON asserts a model type, use that.\n if (component.modelType) {\n return component.modelType;\n }\n // Otherwise, check for known component types.\n for (const type of Object.keys(exports.MODEL_TYPES_OF_KNOWN_COMPONENTS)) {\n if (exports.MODEL_TYPES_OF_KNOWN_COMPONENTS[type].includes(component.type)) {\n return type;\n }\n }\n // Otherwise check for components that assert no value.\n if ((component.input === false)) {\n return 'none';\n }\n // Otherwise default to any.\n return 'any';\n}\nexports.getModelType = getModelType;\nfunction getComponentAbsolutePath(component) {\n let paths = [component.path];\n while (component.parent) {\n component = component.parent;\n // We only need to do this for nested forms because they reset the data contexts for the children.\n if (getModelType(component) === 'dataObject') {\n paths[paths.length - 1] = `data.${paths[paths.length - 1]}`;\n paths.push(component.path);\n }\n }\n return paths.reverse().join('.');\n}\nexports.getComponentAbsolutePath = getComponentAbsolutePath;\nfunction getComponentPath(component, path) {\n const key = getComponentKey(component);\n if (!key) {\n return path;\n }\n if (!path) {\n return key;\n }\n if (path.match(new RegExp(`${key}$`))) {\n return path;\n }\n return (getModelType(component) === 'none') ? `${path}.${key}` : path;\n}\nexports.getComponentPath = getComponentPath;\nfunction isComponentNestedDataType(component) {\n return component.tree || getModelType(component) === 'nestedArray' ||\n getModelType(component) === 'dataObject' ||\n getModelType(component) === 'object' ||\n getModelType(component) === 'map';\n}\nexports.isComponentNestedDataType = isComponentNestedDataType;\nfunction componentPath(component, parentPath) {\n parentPath = component.parentPath || parentPath;\n const key = getComponentKey(component);\n if (!key) {\n // If the component does not have a key, then just always return the parent path.\n return parentPath || '';\n }\n return parentPath ? `${parentPath}.${key}` : key;\n}\nexports.componentPath = componentPath;\nconst componentDataPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n // See if we are a nested component.\n if (component.components && Array.isArray(component.components)) {\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (getModelType(component) === 'nestedArray') {\n return `${path}[0]`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n }\n return path;\n};\nexports.componentDataPath = componentDataPath;\nconst componentFormPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n};\nexports.componentFormPath = componentFormPath;\n// Async each component data.\nconst eachComponentDataAsync = (components_1, data_1, fn_1, ...args_1) => __awaiter(void 0, [components_1, data_1, fn_1, ...args_1], void 0, function* (components, data, fn, path = \"\", index, parent, includeAll = false) {\n if (!components || !data) {\n return;\n }\n return yield eachComponentAsync(components, (component, compPath, componentComponents, compParent) => __awaiter(void 0, void 0, void 0, function* () {\n const row = getContextualRowData(component, compPath, data);\n if ((yield fn(component, data, row, compPath, componentComponents, index, compParent)) === true) {\n return true;\n }\n if (isComponentNestedDataType(component)) {\n const value = (0, lodash_1.get)(data, compPath, data);\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, `${compPath}[${i}]`, i, component, includeAll);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row) && !includeAll) {\n // Tree components may submit empty objects; since we've already evaluated the parent tree/layout component, we won't worry about constituent elements\n return true;\n }\n if (getModelType(component) === 'dataObject') {\n // No need to bother processing all the children data if there is no data for this form or the reference value has not been loaded.\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) && (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form');\n const shouldProcessNestedFormData = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) ? !noReferenceAttached : (0, lodash_1.has)(data, component.path);\n if (shouldProcessNestedFormData) {\n // For nested forms, we need to reset the \"data\" and \"path\" objects for all of the children components, and then re-establish the data when it is done.\n const childPath = (0, exports.componentDataPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, null);\n yield (0, exports.eachComponentDataAsync)(component.components, childData, fn, '', index, component, includeAll);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, (0, exports.componentDataPath)(component, path, compPath), index, component, includeAll);\n }\n return true;\n }\n return false;\n }), true, path, parent);\n});\nexports.eachComponentDataAsync = eachComponentDataAsync;\nconst eachComponentData = (components, data, fn, path = \"\", index, parent, includeAll = false) => {\n if (!components || !data) {\n return;\n }\n return eachComponent(components, (component, compPath, componentComponents, compParent) => {\n const row = getContextualRowData(component, compPath, data);\n if (fn(component, data, row, compPath, componentComponents, index, compParent) === true) {\n return true;\n }\n if (isComponentNestedDataType(component)) {\n const value = (0, lodash_1.get)(data, compPath, data);\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n (0, exports.eachComponentData)(component.components, data, fn, `${compPath}[${i}]`, i, component, includeAll);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row) && !includeAll) {\n // Tree components may submit empty objects; since we've already evaluated the parent tree/layout component, we won't worry about constituent elements\n return true;\n }\n if (getModelType(component) === 'dataObject') {\n // No need to bother processing all the children data if there is no data for this form or the reference value has not been loaded.\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) && (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form');\n const shouldProcessNestedFormData = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) ? !noReferenceAttached : (0, lodash_1.has)(data, component.path);\n if (shouldProcessNestedFormData) {\n // For nested forms, we need to reset the \"data\" and \"path\" objects for all of the children components, and then re-establish the data when it is done.\n const childPath = (0, exports.componentDataPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, {});\n (0, exports.eachComponentData)(component.components, childData, fn, '', index, component, includeAll);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n (0, exports.eachComponentData)(component.components, data, fn, (0, exports.componentDataPath)(component, path, compPath), index, component, includeAll);\n }\n return true;\n }\n return false;\n }, true, path, parent);\n};\nexports.eachComponentData = eachComponentData;\nfunction getComponentKey(component) {\n if (component.type === 'checkbox' &&\n component.inputType === 'radio' &&\n component.name) {\n return component.name;\n }\n return component.key;\n}\nexports.getComponentKey = getComponentKey;\nfunction getContextualRowPath(component, path) {\n return path.replace(new RegExp(`\\.?${getComponentKey(component)}$`), '');\n}\nexports.getContextualRowPath = getContextualRowPath;\nfunction getContextualRowData(component, path, data) {\n const rowPath = getContextualRowPath(component, path);\n return rowPath ? (0, lodash_1.get)(data, rowPath, null) : data;\n}\nexports.getContextualRowData = getContextualRowData;\nfunction componentInfo(component) {\n const hasColumns = component.columns && Array.isArray(component.columns);\n const hasRows = component.rows && Array.isArray(component.rows);\n const hasComps = component.components && Array.isArray(component.components);\n const isContent = getModelType(component) === 'content';\n const isLayout = getModelType(component) === 'none';\n const isInput = !component.hasOwnProperty('input') || !!component.input;\n return {\n hasColumns,\n hasRows,\n hasComps,\n layout: hasColumns || hasRows || (hasComps && !isInput) || isLayout || isContent,\n iterable: hasColumns || hasRows || hasComps || isContent,\n };\n}\nexports.componentInfo = componentInfo;\n/**\n * Iterate through each component within a form.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Function} fn\n * The iteration function to invoke for each component.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n * @param {String} path\n * The current data path of the element. Example: data.user.firstName\n * @param {Object} parent\n * The parent object.\n */\nfunction eachComponent(components, fn, includeAll, path, parent) {\n if (!components)\n return;\n path = path || \"\";\n components.forEach((component) => {\n if (!component) {\n return;\n }\n const info = componentInfo(component);\n let noRecurse = false;\n // Keep track of parent references.\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n Object.defineProperty(component, 'parent', {\n enumerable: false,\n writable: true,\n value: JSON.parse(JSON.stringify(parent))\n });\n Object.defineProperty(component.parent, 'parent', {\n enumerable: false,\n writable: true,\n value: parent.parent\n });\n Object.defineProperty(component.parent, 'path', {\n enumerable: false,\n writable: true,\n value: parent.path\n });\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n Object.defineProperty(component, 'path', {\n enumerable: false,\n writable: true,\n value: componentPath(component, path)\n });\n if (includeAll || component.tree || !info.layout) {\n noRecurse = fn(component, component.path, components, parent);\n }\n if (!noRecurse) {\n if (info.hasColumns) {\n component.columns.forEach((column) => eachComponent(column.components, fn, includeAll, path, parent ? component : null));\n }\n else if (info.hasRows) {\n component.rows.forEach((row) => {\n if (Array.isArray(row)) {\n row.forEach((column) => eachComponent(column.components, fn, includeAll, path, parent ? component : null));\n }\n });\n }\n else if (info.hasComps) {\n eachComponent(component.components, fn, includeAll, (0, exports.componentFormPath)(component, path, component.path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponent = eachComponent;\n// Async each component.\nfunction eachComponentAsync(components_2, fn_1) {\n return __awaiter(this, arguments, void 0, function* (components, fn, includeAll = false, path = \"\", parent) {\n var _a, _b;\n if (!components)\n return;\n for (let i = 0; i < components.length; i++) {\n if (!components[i]) {\n continue;\n }\n let component = components[i];\n const info = componentInfo(component);\n // Keep track of parent references.\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n Object.defineProperty(component, 'parent', {\n enumerable: false,\n writable: true,\n value: JSON.parse(JSON.stringify(parent))\n });\n Object.defineProperty(component.parent, 'parent', {\n enumerable: false,\n writable: true,\n value: parent.parent\n });\n Object.defineProperty(component.parent, 'path', {\n enumerable: false,\n writable: true,\n value: parent.path\n });\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n Object.defineProperty(component, 'path', {\n enumerable: false,\n writable: true,\n value: componentPath(component, path)\n });\n if (includeAll || component.tree || !info.layout) {\n if (yield fn(component, component.path, components, parent)) {\n continue;\n }\n }\n if (info.hasColumns) {\n for (let j = 0; j < component.columns.length; j++) {\n yield eachComponentAsync((_a = component.columns[j]) === null || _a === void 0 ? void 0 : _a.components, fn, includeAll, path, parent ? component : null);\n }\n }\n else if (info.hasRows) {\n for (let j = 0; j < component.rows.length; j++) {\n let row = component.rows[j];\n if (Array.isArray(row)) {\n for (let k = 0; k < row.length; k++) {\n yield eachComponentAsync((_b = row[k]) === null || _b === void 0 ? void 0 : _b.components, fn, includeAll, path, parent ? component : null);\n }\n }\n }\n }\n else if (info.hasComps) {\n yield eachComponentAsync(component.components, fn, includeAll, (0, exports.componentFormPath)(component, path, component.path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponentAsync = eachComponentAsync;\n// Provided components, data, and a key, this will return the components data.\nfunction getComponentData(components, data, path) {\n const compData = { component: null, data: null };\n (0, exports.eachComponentData)(components, data, (component, data, row, compPath) => {\n if (compPath === path) {\n compData.component = component;\n compData.data = row;\n return true;\n }\n });\n return compData;\n}\nexports.getComponentData = getComponentData;\nfunction getComponentActualValue(component, compPath, data, row) {\n var _a;\n // The compPath here will NOT contain the indexes for DataGrids and EditGrids.\n //\n // a[0].b[2].c[3].d\n //\n // Because of this, we will need to determine our parent component path (not data path),\n // and find the \"row\" based comp path.\n //\n // a[0].b[2].c[3].d => a.b.c.d\n //\n let parentInputComponent = null;\n let parent = component;\n let rowPath = '';\n while (((_a = parent === null || parent === void 0 ? void 0 : parent.parent) === null || _a === void 0 ? void 0 : _a.path) && !parentInputComponent) {\n parent = parent.parent;\n if (parent.input) {\n parentInputComponent = parent;\n }\n }\n if (parentInputComponent) {\n const parentCompPath = parentInputComponent.path.replace(/\\[[0-9]+\\]/g, '');\n rowPath = compPath.replace(parentCompPath, '');\n rowPath = (0, lodash_1.trim)(rowPath, '. ');\n }\n let value = null;\n if (data) {\n value = (0, lodash_1.get)(data, compPath);\n }\n if (rowPath && row && (0, lodash_1.isNil)(value)) {\n value = (0, lodash_1.get)(row, rowPath);\n }\n if ((0, lodash_1.isNil)(value) || ((0, lodash_1.isObject)(value) && (0, lodash_1.isEmpty)(value))) {\n value = '';\n }\n return value;\n}\nexports.getComponentActualValue = getComponentActualValue;\n/**\n * Determine if a component is a layout component or not.\n *\n * @param {Object} component\n * The component to check.\n *\n * @returns {Boolean}\n * Whether or not the component is a layout component.\n */\nfunction isLayoutComponent(component) {\n return Boolean((component.columns && Array.isArray(component.columns)) ||\n (component.rows && Array.isArray(component.rows)) ||\n (component.components && Array.isArray(component.components)));\n}\nexports.isLayoutComponent = isLayoutComponent;\n/**\n * Matches if a component matches the query.\n *\n * @param component\n * @param query\n * @return {boolean}\n */\nfunction matchComponent(component, query) {\n if ((0, lodash_1.isString)(query)) {\n return (component.key === query) || (component.path === query);\n }\n else {\n let matches = false;\n (0, lodash_1.forOwn)(query, (value, key) => {\n matches = ((0, lodash_1.get)(component, key) === value);\n if (!matches) {\n return false;\n }\n });\n return matches;\n }\n}\nexports.matchComponent = matchComponent;\n/**\n * Get a component by its key\n *\n * @param {Object} components - The components to iterate.\n * @param {String|Object} key - The key of the component to get, or a query of the component to search.\n * @param {boolean} includeAll - Whether or not to include layout components.\n * @returns {Component} - The component that matches the given key, or undefined if not found.\n */\nfunction getComponent(components, key, includeAll = false) {\n let result;\n eachComponent(components, (component, path) => {\n if ((path === key) || (component.path === key) || (component.input && (component.key === key))) {\n result = component;\n return true;\n }\n }, includeAll);\n return result;\n}\nexports.getComponent = getComponent;\n/**\n * Finds a component provided a query of properties of that component.\n *\n * @param components\n * @param query\n * @return {*}\n */\nfunction searchComponents(components, query) {\n const results = [];\n eachComponent(components, (component) => {\n if (matchComponent(component, query)) {\n results.push(component);\n }\n }, true);\n return results;\n}\nexports.searchComponents = searchComponents;\n/**\n * Deprecated version of findComponents. Renamed to searchComponents.\n * @param {import('@formio/core').Component[]} components - The components to find components within.\n * @param {object} query - The query to use when searching for the components.\n * @returns {import('@formio/core').Component[]} - The result of the component that is found.\n */\nfunction findComponents(components, query) {\n console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');\n return searchComponents(components, query);\n}\nexports.findComponents = findComponents;\n/**\n * Remove a component by path.\n *\n * @param components\n * @param path\n */\nfunction removeComponent(components, path) {\n // Using _.unset() leave a null value. Use Array splice instead.\n // @ts-ignore\n var index = path.pop();\n if (path.length !== 0) {\n components = (0, lodash_1.get)(components, path);\n }\n components.splice(index, 1);\n}\nexports.removeComponent = removeComponent;\n/**\n * Returns if this component has a conditional statement.\n *\n * @param component - The component JSON schema.\n *\n * @returns {boolean} - TRUE - This component has a conditional, FALSE - No conditional provided.\n */\nfunction hasCondition(component) {\n return Boolean((component.customConditional) ||\n (component.conditional && (component.conditional.when ||\n component.conditional.json ||\n (component.conditional.conjunction && (0, lodash_1.isBoolean)(component.conditional.show) && !(0, lodash_1.isEmpty)(component.conditional.conditions)))));\n}\nexports.hasCondition = hasCondition;\n/**\n * Extension of standard #parseFloat(value) function, that also clears input string.\n *\n * @param {any} value\n * The value to parse.\n *\n * @returns {Number}\n * Parsed value.\n */\nfunction parseFloatExt(value) {\n return parseFloat((0, lodash_1.isString)(value)\n ? value.replace(/[^\\de.+-]/gi, '')\n : value);\n}\nexports.parseFloatExt = parseFloatExt;\n/**\n * Formats provided value in way how Currency component uses it.\n *\n * @param {any} value\n * The value to format.\n *\n * @returns {String}\n * Value formatted for Currency component.\n */\nfunction formatAsCurrency(value) {\n const parsedValue = parseFloatExt(value);\n if (isNaN(parsedValue)) {\n return '';\n }\n const parts = (0, lodash_1.round)(parsedValue, 2)\n .toString()\n .split('.');\n parts[0] = (0, lodash_1.chunk)(Array.from(parts[0]).reverse(), 3)\n .reverse()\n .map((part) => part\n .reverse()\n .join(''))\n .join(',');\n parts[1] = (0, lodash_1.pad)(parts[1], 2, '0');\n return parts.join('.');\n}\nexports.formatAsCurrency = formatAsCurrency;\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\nexports.escapeRegExCharacters = escapeRegExCharacters;\n/**\n * Get the value for a component key, in the given submission.\n *\n * @param {Object} submission\n * A submission object to search.\n * @param {String} key\n * A for components API key to search for.\n */\nfunction getValue(submission, key) {\n const search = (data) => {\n if ((0, lodash_1.isPlainObject)(data)) {\n if ((0, lodash_1.has)(data, key)) {\n return (0, lodash_1.get)(data, key);\n }\n let value = null;\n (0, lodash_1.forOwn)(data, (prop) => {\n const result = search(prop);\n if (!(0, lodash_1.isNil)(result)) {\n value = result;\n return false;\n }\n });\n return value;\n }\n else {\n return null;\n }\n };\n return search(submission.data);\n}\nexports.getValue = getValue;\n/**\n * Iterate over all components in a form and get string values for translation.\n * @param form\n */\nfunction getStrings(form) {\n const properties = ['label', 'title', 'legend', 'tooltip', 'description', 'placeholder', 'prefix', 'suffix', 'errorLabel', 'content', 'html'];\n const strings = [];\n eachComponent(form.components, (component) => {\n properties.forEach(property => {\n if (component.hasOwnProperty(property) && component[property]) {\n strings.push({\n key: component.key,\n type: component.type,\n property,\n string: component[property]\n });\n }\n });\n if ((!component.dataSrc || component.dataSrc === 'values') && component.hasOwnProperty('values') && Array.isArray(component.values) && component.values.length) {\n component.values.forEach((value, index) => {\n strings.push({\n key: component.key,\n property: `value[${index}].label`,\n string: component.values[index].label\n });\n });\n }\n // Hard coded values from Day component\n if (component.type === 'day') {\n [\n 'day',\n 'month',\n 'year',\n 'Day',\n 'Month',\n 'Year',\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n ].forEach(string => {\n strings.push({\n key: component.key,\n property: 'day',\n string,\n });\n });\n if (component.fields.day.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.day.placeholder',\n string: component.fields.day.placeholder,\n });\n }\n if (component.fields.month.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.month.placeholder',\n string: component.fields.month.placeholder,\n });\n }\n if (component.fields.year.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.year.placeholder',\n string: component.fields.year.placeholder,\n });\n }\n }\n if (component.type === 'editgrid') {\n const string = component.addAnother || 'Add Another';\n if (component.addAnother) {\n strings.push({\n key: component.key,\n property: 'addAnother',\n string,\n });\n }\n }\n if (component.type === 'select') {\n [\n 'loading...',\n 'Type to search'\n ].forEach(string => {\n strings.push({\n key: component.key,\n property: 'select',\n string,\n });\n });\n }\n }, true);\n return strings;\n}\nexports.getStrings = getStrings;\n// ?????????????????????????\n// questionable section\nfunction generateFormChange(type, data) {\n let change;\n switch (type) {\n case 'add':\n change = {\n op: 'add',\n key: data.component.key,\n container: data.parent.key, // Parent component\n path: data.path, // Path to container within parent component.\n index: data.index, // Index of component in parent container.\n component: data.component\n };\n break;\n case 'edit':\n change = {\n op: 'edit',\n key: data.originalComponent.key,\n patches: (0, fast_json_patch_1.compare)(data.originalComponent, data.component)\n };\n // Don't save if nothing changed.\n if (!change.patches.length) {\n change = null;\n }\n break;\n case 'remove':\n change = {\n op: 'remove',\n key: data.component.key,\n };\n break;\n }\n return change;\n}\nexports.generateFormChange = generateFormChange;\nfunction applyFormChanges(form, changes) {\n const failed = [];\n changes.forEach(function (change) {\n var found = false;\n switch (change.op) {\n case 'add':\n var newComponent = change.component;\n // Find the container to set the component in.\n findComponent(form.components, change.container, null, function (parent) {\n if (!change.container) {\n parent = form;\n }\n // A move will first run an add so remove any existing components with matching key before inserting.\n findComponent(form.components, change.key, null, function (component, path) {\n // If found, use the existing component. (If someone else edited it, the changes would be here)\n newComponent = component;\n removeComponent(form.components, path);\n });\n found = true;\n var container = (0, lodash_1.get)(parent, change.path);\n container.splice(change.index, 0, newComponent);\n });\n break;\n case 'remove':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n const oldComponent = (0, lodash_1.get)(form.components, path);\n if (oldComponent.key !== component.key) {\n path.pop();\n }\n removeComponent(form.components, path);\n });\n break;\n case 'edit':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n try {\n const oldComponent = (0, lodash_1.get)(form.components, path);\n const newComponent = (0, fast_json_patch_1.applyPatch)(component, change.patches).newDocument;\n if (oldComponent.key !== newComponent.key) {\n path.pop();\n }\n (0, lodash_1.set)(form.components, path, newComponent);\n }\n catch (err) {\n failed.push(change);\n }\n });\n break;\n case 'move':\n break;\n }\n if (!found) {\n failed.push(change);\n }\n });\n return {\n form,\n failed\n };\n}\nexports.applyFormChanges = applyFormChanges;\n/**\n* This function will find a component in a form and return the component AND THE PATH to the component in the form.\n* Path to the component is stored as an array of nested components and their indexes.The Path is being filled recursively\n* when you iterating through the nested structure.\n* If the component is not found the callback won't be called and function won't return anything.\n*\n* @param components\n* @param key\n* @param fn\n* @param path\n* @returns {*}\n*/\nfunction findComponent(components, key, path, fn) {\n if (!components)\n return;\n path = path || [];\n if (!key) {\n return fn(components);\n }\n components.forEach(function (component, index) {\n var newPath = path.slice();\n // Add an index of the component it iterates through in nested structure\n newPath.push(index);\n if (!component)\n return;\n if (component.hasOwnProperty('columns') && Array.isArray(component.columns)) {\n newPath.push('columns');\n component.columns.forEach(function (column, index) {\n var colPath = newPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n }\n if (component.hasOwnProperty('rows') && Array.isArray(component.rows)) {\n newPath.push('rows');\n component.rows.forEach(function (row, index) {\n var rowPath = newPath.slice();\n rowPath.push(index);\n row.forEach(function (column, index) {\n var colPath = rowPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n });\n }\n if (component.hasOwnProperty('components') && Array.isArray(component.components)) {\n newPath.push('components');\n findComponent(component.components, key, newPath, fn);\n }\n if (component.key === key) {\n //Final callback if the component is found\n fn(component, newPath, components);\n }\n });\n}\nexports.findComponent = findComponent;\nconst isCheckboxComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'checkbox';\nconst isDataGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datagrid';\nconst isEditGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'editgrid';\nconst isDataTableComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datatable';\nconst hasChildComponents = (component) => (component === null || component === void 0 ? void 0 : component.components) != null;\nconst isDateTimeComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datetime';\nconst isSelectBoxesComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'selectboxes';\nconst isTextAreaComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textarea';\nconst isTextFieldComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textfield';\nfunction getEmptyValue(component) {\n switch (component.type) {\n case 'textarea':\n case 'textfield':\n case 'time':\n case 'datetime':\n case 'day':\n return '';\n case 'datagrid':\n case 'editgrid':\n return [];\n default:\n return null;\n }\n}\nexports.getEmptyValue = getEmptyValue;\nconst replaceBlanks = (value) => {\n const nbsp = '<p>&nbsp;</p>';\n const br = '<p><br></p>';\n const brNbsp = '<p><br>&nbsp;</p>';\n const regExp = new RegExp(`^${nbsp}|${nbsp}$|^${br}|${br}$|^${brNbsp}|${brNbsp}$`, 'g');\n return typeof value === 'string' ? value.replace(regExp, '').trim() : value;\n};\nfunction trimBlanks(value) {\n if (!value) {\n return value;\n }\n if (Array.isArray(value)) {\n value = value.map((val) => replaceBlanks(val));\n }\n else {\n value = replaceBlanks(value);\n }\n return value;\n}\nfunction isValueEmpty(component, value) {\n const compValueIsEmptyArray = ((0, lodash_1.isArray)(value) && value.length === 1) ? (0, lodash_1.isEqual)(value[0], getEmptyValue(component)) : false;\n return value == null || value === '' || ((0, lodash_1.isArray)(value) && value.length === 0) || compValueIsEmptyArray;\n}\nfunction isComponentDataEmpty(component, data, path) {\n var _a;\n const value = (0, lodash_1.get)(data, path);\n if (isCheckboxComponent(component)) {\n return isValueEmpty(component, value) || value === false;\n }\n else if (isDataGridComponent(component) || isEditGridComponent(component) || isDataTableComponent(component) || hasChildComponents(component)) {\n if ((_a = component.components) === null || _a === void 0 ? void 0 : _a.length) {\n let childrenEmpty = true;\n // wrap component in an array to let eachComponentData handle introspection to child components (e.g. this will be different\n // for data grids versus nested forms, etc.)\n (0, exports.eachComponentData)([component], data, (thisComponent, data, row, path, components, index) => {\n if (component.key === thisComponent.key)\n return;\n if (!isComponentDataEmpty(thisComponent, data, path)) {\n childrenEmpty = false;\n }\n });\n return isValueEmpty(component, value) || childrenEmpty;\n }\n return isValueEmpty(component, value);\n }\n else if (isDateTimeComponent(component)) {\n return isValueEmpty(component, value) || value.toString() === 'Invalid date';\n }\n else if (isSelectBoxesComponent(component)) {\n let selectBoxEmpty = true;\n for (const key in value) {\n if (value[key]) {\n selectBoxEmpty = false;\n break;\n }\n }\n return isValueEmpty(component, value) || selectBoxEmpty;\n }\n else if (isTextAreaComponent(component)) {\n const isPlain = !component.wysiwyg && !component.editor;\n return isPlain ? typeof value === 'string' ? isValueEmpty(component, value.trim()) : isValueEmpty(component, value) : isValueEmpty(component, trimBlanks(value));\n }\n else if (isTextFieldComponent(component)) {\n if (component.allowMultipleMasks && !!component.inputMasks && !!component.inputMasks.length) {\n return isValueEmpty(component, value) || (component.multiple ? value.length === 0 : (!value.maskName || !value.value));\n }\n return isValueEmpty(component, value === null || value === void 0 ? void 0 : value.toString().trim());\n }\n return isValueEmpty(component, value);\n}\nexports.isComponentDataEmpty = isComponentDataEmpty;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil.js?");
1338
+ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.findComponents = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentFormPath = exports.componentDataPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES_OF_KNOWN_COMPONENTS = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst fast_json_patch_1 = __webpack_require__(/*! fast-json-patch */ \"./node_modules/fast-json-patch/index.mjs\");\nconst Evaluator_1 = __webpack_require__(/*! ./Evaluator */ \"./node_modules/@formio/core/lib/utils/Evaluator.js\");\n/**\n * Flatten the form components for data manipulation.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n *\n * @returns {Object}\n * The flattened components map.\n */\nfunction flattenComponents(components, includeAll = false) {\n const flattened = {};\n eachComponent(components, (component, path) => {\n flattened[path] = component;\n }, includeAll);\n return flattened;\n}\nexports.flattenComponents = flattenComponents;\nfunction guid() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nexports.guid = guid;\n/**\n * Make a filename guaranteed to be unique.\n * @param name\n * @param template\n * @param evalContext\n * @returns {string}\n */\nfunction uniqueName(name, template, evalContext) {\n template = template || \"{{fileName}}-{{guid}}\";\n //include guid in template anyway, to prevent overwriting issue if filename matches existing file\n if (!template.includes(\"{{guid}}\")) {\n template = `${template}-{{guid}}`;\n }\n const parts = name.split(\".\");\n let fileName = parts.slice(0, parts.length - 1).join(\".\");\n const extension = parts.length > 1 ? `.${(0, lodash_1.last)(parts)}` : \"\";\n //allow only 100 characters from original name to avoid issues with filename length restrictions\n fileName = fileName.substr(0, 100);\n evalContext = Object.assign(evalContext || {}, {\n fileName,\n guid: guid(),\n });\n //only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash\n const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\\-_ ]/g, \"-\");\n return uniqueName;\n}\nexports.uniqueName = uniqueName;\n/**\n * Defines model types for known components.\n * For now, these will be the only model types supported by the @formio/core library.\n *\n * nestedArray: for components that store their data as an array and have nested components.\n * nestedDataArray: for components that store their data as an array and have nested components, but keeps the value of nested components inside 'data' property.\n * array: for components that store their data as an array.\n * dataObject: for components that store their data in a nested { data: {} } object.\n * object: for components that store their data in an object.\n * map: for components that store their data in a map.\n * content: for components that do not store data.\n * string: for components that store their data as a string.\n * number: for components that store their data as a number.\n * boolean: for components that store their data as a boolean.\n * none: for components that do not store data and should not be included in the submission.\n * any: for components that can store any type of data.\n *\n */\nexports.MODEL_TYPES_OF_KNOWN_COMPONENTS = {\n nestedArray: [\n 'datagrid',\n 'editgrid',\n 'datatable',\n 'dynamicWizard',\n ],\n nestedDataArray: [\n 'tagpad',\n ],\n dataObject: [\n 'form'\n ],\n object: [\n 'container',\n 'address',\n ],\n map: [\n 'datamap',\n ],\n content: [\n 'htmlelement',\n 'content'\n ],\n string: [\n 'textfield',\n 'textarea',\n 'password',\n 'email',\n 'url',\n 'phoneNumber',\n 'day',\n 'datetime',\n 'time',\n 'signature',\n ],\n number: [\n 'number',\n 'currency'\n ],\n boolean: [\n 'checkbox',\n 'radio',\n ],\n none: [\n 'table',\n 'well',\n 'columns',\n 'fieldset',\n 'panel',\n 'tabs'\n ],\n any: [\n 'survey',\n 'captcha',\n 'selectboxes',\n 'tags',\n 'select',\n 'hidden',\n 'button',\n 'datasource',\n 'sketchpad',\n 'reviewpage',\n 'file',\n ],\n};\nfunction getModelType(component) {\n // If the component JSON asserts a model type, use that.\n if (component.modelType) {\n return component.modelType;\n }\n // Otherwise, check for known component types.\n for (const type of Object.keys(exports.MODEL_TYPES_OF_KNOWN_COMPONENTS)) {\n if (exports.MODEL_TYPES_OF_KNOWN_COMPONENTS[type].includes(component.type)) {\n return type;\n }\n }\n // Otherwise check for components that assert no value.\n if ((component.input === false)) {\n return 'none';\n }\n // Otherwise default to any.\n return 'any';\n}\nexports.getModelType = getModelType;\nfunction getComponentAbsolutePath(component) {\n let paths = [component.path];\n while (component.parent) {\n component = component.parent;\n // We only need to do this for nested forms because they reset the data contexts for the children.\n if (getModelType(component) === 'dataObject') {\n paths[paths.length - 1] = `data.${paths[paths.length - 1]}`;\n paths.push(component.path);\n }\n }\n return paths.reverse().join('.');\n}\nexports.getComponentAbsolutePath = getComponentAbsolutePath;\nfunction getComponentPath(component, path) {\n const key = getComponentKey(component);\n if (!key) {\n return path;\n }\n if (!path) {\n return key;\n }\n if (path.match(new RegExp(`${key}$`))) {\n return path;\n }\n return (getModelType(component) === 'none') ? `${path}.${key}` : path;\n}\nexports.getComponentPath = getComponentPath;\nfunction isComponentNestedDataType(component) {\n return component.tree || getModelType(component) === 'nestedArray' ||\n getModelType(component) === 'nestedDataArray' ||\n getModelType(component) === 'dataObject' ||\n getModelType(component) === 'object' ||\n getModelType(component) === 'map';\n}\nexports.isComponentNestedDataType = isComponentNestedDataType;\nfunction componentPath(component, parentPath) {\n parentPath = component.parentPath || parentPath;\n const key = getComponentKey(component);\n if (!key) {\n // If the component does not have a key, then just always return the parent path.\n return parentPath || '';\n }\n return parentPath ? `${parentPath}.${key}` : key;\n}\nexports.componentPath = componentPath;\nconst componentDataPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n // See if we are a nested component.\n if (component.components && Array.isArray(component.components)) {\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (getModelType(component) === 'nestedArray') {\n return `${path}[0]`;\n }\n if (getModelType(component) === 'nestedDataArray') {\n return `${path}[0].data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n }\n return path;\n};\nexports.componentDataPath = componentDataPath;\nconst componentFormPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n};\nexports.componentFormPath = componentFormPath;\n// Async each component data.\nconst eachComponentDataAsync = (components_1, data_1, fn_1, ...args_1) => __awaiter(void 0, [components_1, data_1, fn_1, ...args_1], void 0, function* (components, data, fn, path = \"\", index, parent, includeAll = false) {\n if (!components || !data) {\n return;\n }\n return yield eachComponentAsync(components, (component, compPath, componentComponents, compParent) => __awaiter(void 0, void 0, void 0, function* () {\n const row = getContextualRowData(component, compPath, data);\n if ((yield fn(component, data, row, compPath, componentComponents, index, compParent)) === true) {\n return true;\n }\n if (isComponentNestedDataType(component)) {\n const value = (0, lodash_1.get)(data, compPath, data);\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const nestedComponentPath = getModelType(component) === 'nestedDataArray' ? `${compPath}[${i}].data` : `${compPath}[${i}]`;\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, nestedComponentPath, i, component, includeAll);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row) && !includeAll) {\n // Tree components may submit empty objects; since we've already evaluated the parent tree/layout component, we won't worry about constituent elements\n return true;\n }\n if (getModelType(component) === 'dataObject') {\n // No need to bother processing all the children data if there is no data for this form or the reference value has not been loaded.\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) && (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form');\n const shouldProcessNestedFormData = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) ? !noReferenceAttached : (0, lodash_1.has)(data, component.path);\n if (shouldProcessNestedFormData) {\n // For nested forms, we need to reset the \"data\" and \"path\" objects for all of the children components, and then re-establish the data when it is done.\n const childPath = (0, exports.componentDataPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, null);\n yield (0, exports.eachComponentDataAsync)(component.components, childData, fn, '', index, component, includeAll);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, (0, exports.componentDataPath)(component, path, compPath), index, component, includeAll);\n }\n return true;\n }\n return false;\n }), true, path, parent);\n});\nexports.eachComponentDataAsync = eachComponentDataAsync;\nconst eachComponentData = (components, data, fn, path = \"\", index, parent, includeAll = false) => {\n if (!components || !data) {\n return;\n }\n return eachComponent(components, (component, compPath, componentComponents, compParent) => {\n const row = getContextualRowData(component, compPath, data);\n if (fn(component, data, row, compPath, componentComponents, index, compParent) === true) {\n return true;\n }\n if (isComponentNestedDataType(component)) {\n const value = (0, lodash_1.get)(data, compPath, data);\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const nestedComponentPath = getModelType(component) === 'nestedDataArray' ? `${compPath}[${i}].data` : `${compPath}[${i}]`;\n (0, exports.eachComponentData)(component.components, data, fn, nestedComponentPath, i, component, includeAll);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row) && !includeAll) {\n // Tree components may submit empty objects; since we've already evaluated the parent tree/layout component, we won't worry about constituent elements\n return true;\n }\n if (getModelType(component) === 'dataObject') {\n // No need to bother processing all the children data if there is no data for this form or the reference value has not been loaded.\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) && (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form');\n const shouldProcessNestedFormData = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) ? !noReferenceAttached : (0, lodash_1.has)(data, component.path);\n if (shouldProcessNestedFormData) {\n // For nested forms, we need to reset the \"data\" and \"path\" objects for all of the children components, and then re-establish the data when it is done.\n const childPath = (0, exports.componentDataPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, {});\n (0, exports.eachComponentData)(component.components, childData, fn, '', index, component, includeAll);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n (0, exports.eachComponentData)(component.components, data, fn, (0, exports.componentDataPath)(component, path, compPath), index, component, includeAll);\n }\n return true;\n }\n return false;\n }, true, path, parent);\n};\nexports.eachComponentData = eachComponentData;\nfunction getComponentKey(component) {\n if (component.type === 'checkbox' &&\n component.inputType === 'radio' &&\n component.name) {\n return component.name;\n }\n return component.key;\n}\nexports.getComponentKey = getComponentKey;\nfunction getContextualRowPath(component, path) {\n return path.replace(new RegExp(`\\.?${getComponentKey(component)}$`), '');\n}\nexports.getContextualRowPath = getContextualRowPath;\nfunction getContextualRowData(component, path, data) {\n const rowPath = getContextualRowPath(component, path);\n return rowPath ? (0, lodash_1.get)(data, rowPath, null) : data;\n}\nexports.getContextualRowData = getContextualRowData;\nfunction componentInfo(component) {\n const hasColumns = component.columns && Array.isArray(component.columns);\n const hasRows = component.rows && Array.isArray(component.rows);\n const hasComps = component.components && Array.isArray(component.components);\n const isContent = getModelType(component) === 'content';\n const isLayout = getModelType(component) === 'none';\n const isInput = !component.hasOwnProperty('input') || !!component.input;\n return {\n hasColumns,\n hasRows,\n hasComps,\n layout: hasColumns || hasRows || (hasComps && !isInput) || isLayout || isContent,\n iterable: hasColumns || hasRows || hasComps || isContent,\n };\n}\nexports.componentInfo = componentInfo;\n/**\n * Iterate through each component within a form.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Function} fn\n * The iteration function to invoke for each component.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n * @param {String} path\n * The current data path of the element. Example: data.user.firstName\n * @param {Object} parent\n * The parent object.\n */\nfunction eachComponent(components, fn, includeAll, path, parent) {\n if (!components)\n return;\n path = path || \"\";\n components.forEach((component) => {\n if (!component) {\n return;\n }\n const info = componentInfo(component);\n let noRecurse = false;\n // Keep track of parent references.\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n Object.defineProperty(component, 'parent', {\n enumerable: false,\n writable: true,\n value: JSON.parse(JSON.stringify(parent))\n });\n Object.defineProperty(component.parent, 'parent', {\n enumerable: false,\n writable: true,\n value: parent.parent\n });\n Object.defineProperty(component.parent, 'path', {\n enumerable: false,\n writable: true,\n value: parent.path\n });\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n Object.defineProperty(component, 'path', {\n enumerable: false,\n writable: true,\n value: componentPath(component, path)\n });\n if (includeAll || component.tree || !info.layout) {\n noRecurse = fn(component, component.path, components, parent);\n }\n if (!noRecurse) {\n if (info.hasColumns) {\n component.columns.forEach((column) => eachComponent(column.components, fn, includeAll, path, parent ? component : null));\n }\n else if (info.hasRows) {\n component.rows.forEach((row) => {\n if (Array.isArray(row)) {\n row.forEach((column) => eachComponent(column.components, fn, includeAll, path, parent ? component : null));\n }\n });\n }\n else if (info.hasComps) {\n eachComponent(component.components, fn, includeAll, (0, exports.componentFormPath)(component, path, component.path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponent = eachComponent;\n// Async each component.\nfunction eachComponentAsync(components_2, fn_1) {\n return __awaiter(this, arguments, void 0, function* (components, fn, includeAll = false, path = \"\", parent) {\n var _a, _b;\n if (!components)\n return;\n for (let i = 0; i < components.length; i++) {\n if (!components[i]) {\n continue;\n }\n let component = components[i];\n const info = componentInfo(component);\n // Keep track of parent references.\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n Object.defineProperty(component, 'parent', {\n enumerable: false,\n writable: true,\n value: JSON.parse(JSON.stringify(parent))\n });\n Object.defineProperty(component.parent, 'parent', {\n enumerable: false,\n writable: true,\n value: parent.parent\n });\n Object.defineProperty(component.parent, 'path', {\n enumerable: false,\n writable: true,\n value: parent.path\n });\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n Object.defineProperty(component, 'path', {\n enumerable: false,\n writable: true,\n value: componentPath(component, path)\n });\n if (includeAll || component.tree || !info.layout) {\n if (yield fn(component, component.path, components, parent)) {\n continue;\n }\n }\n if (info.hasColumns) {\n for (let j = 0; j < component.columns.length; j++) {\n yield eachComponentAsync((_a = component.columns[j]) === null || _a === void 0 ? void 0 : _a.components, fn, includeAll, path, parent ? component : null);\n }\n }\n else if (info.hasRows) {\n for (let j = 0; j < component.rows.length; j++) {\n let row = component.rows[j];\n if (Array.isArray(row)) {\n for (let k = 0; k < row.length; k++) {\n yield eachComponentAsync((_b = row[k]) === null || _b === void 0 ? void 0 : _b.components, fn, includeAll, path, parent ? component : null);\n }\n }\n }\n }\n else if (info.hasComps) {\n yield eachComponentAsync(component.components, fn, includeAll, (0, exports.componentFormPath)(component, path, component.path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponentAsync = eachComponentAsync;\n// Provided components, data, and a key, this will return the components data.\nfunction getComponentData(components, data, path) {\n const compData = { component: null, data: null };\n (0, exports.eachComponentData)(components, data, (component, data, row, compPath) => {\n if (compPath === path) {\n compData.component = component;\n compData.data = row;\n return true;\n }\n });\n return compData;\n}\nexports.getComponentData = getComponentData;\nfunction getComponentActualValue(component, compPath, data, row) {\n var _a;\n // The compPath here will NOT contain the indexes for DataGrids and EditGrids.\n //\n // a[0].b[2].c[3].d\n //\n // Because of this, we will need to determine our parent component path (not data path),\n // and find the \"row\" based comp path.\n //\n // a[0].b[2].c[3].d => a.b.c.d\n //\n let parentInputComponent = null;\n let parent = component;\n let rowPath = '';\n while (((_a = parent === null || parent === void 0 ? void 0 : parent.parent) === null || _a === void 0 ? void 0 : _a.path) && !parentInputComponent) {\n parent = parent.parent;\n if (parent.input) {\n parentInputComponent = parent;\n }\n }\n if (parentInputComponent) {\n const parentCompPath = parentInputComponent.path.replace(/\\[[0-9]+\\]/g, '');\n rowPath = compPath.replace(parentCompPath, '');\n rowPath = (0, lodash_1.trim)(rowPath, '. ');\n }\n let value = null;\n if (data) {\n value = (0, lodash_1.get)(data, compPath);\n }\n if (rowPath && row && (0, lodash_1.isNil)(value)) {\n value = (0, lodash_1.get)(row, rowPath);\n }\n if ((0, lodash_1.isNil)(value) || ((0, lodash_1.isObject)(value) && (0, lodash_1.isEmpty)(value))) {\n value = '';\n }\n return value;\n}\nexports.getComponentActualValue = getComponentActualValue;\n/**\n * Determine if a component is a layout component or not.\n *\n * @param {Object} component\n * The component to check.\n *\n * @returns {Boolean}\n * Whether or not the component is a layout component.\n */\nfunction isLayoutComponent(component) {\n return Boolean((component.columns && Array.isArray(component.columns)) ||\n (component.rows && Array.isArray(component.rows)) ||\n (component.components && Array.isArray(component.components)));\n}\nexports.isLayoutComponent = isLayoutComponent;\n/**\n * Matches if a component matches the query.\n *\n * @param component\n * @param query\n * @return {boolean}\n */\nfunction matchComponent(component, query) {\n if ((0, lodash_1.isString)(query)) {\n return (component.key === query) || (component.path === query);\n }\n else {\n let matches = false;\n (0, lodash_1.forOwn)(query, (value, key) => {\n matches = ((0, lodash_1.get)(component, key) === value);\n if (!matches) {\n return false;\n }\n });\n return matches;\n }\n}\nexports.matchComponent = matchComponent;\n/**\n * Get a component by its key\n *\n * @param {Object} components - The components to iterate.\n * @param {String|Object} key - The key of the component to get, or a query of the component to search.\n * @param {boolean} includeAll - Whether or not to include layout components.\n * @returns {Component} - The component that matches the given key, or undefined if not found.\n */\nfunction getComponent(components, key, includeAll = false) {\n let result;\n eachComponent(components, (component, path) => {\n if ((path === key) || (component.path === key) || (component.input && (component.key === key))) {\n result = component;\n return true;\n }\n }, includeAll);\n return result;\n}\nexports.getComponent = getComponent;\n/**\n * Finds a component provided a query of properties of that component.\n *\n * @param components\n * @param query\n * @return {*}\n */\nfunction searchComponents(components, query) {\n const results = [];\n eachComponent(components, (component) => {\n if (matchComponent(component, query)) {\n results.push(component);\n }\n }, true);\n return results;\n}\nexports.searchComponents = searchComponents;\n/**\n * Deprecated version of findComponents. Renamed to searchComponents.\n * @param {import('@formio/core').Component[]} components - The components to find components within.\n * @param {object} query - The query to use when searching for the components.\n * @returns {import('@formio/core').Component[]} - The result of the component that is found.\n */\nfunction findComponents(components, query) {\n console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');\n return searchComponents(components, query);\n}\nexports.findComponents = findComponents;\n/**\n * Remove a component by path.\n *\n * @param components\n * @param path\n */\nfunction removeComponent(components, path) {\n // Using _.unset() leave a null value. Use Array splice instead.\n // @ts-ignore\n var index = path.pop();\n if (path.length !== 0) {\n components = (0, lodash_1.get)(components, path);\n }\n components.splice(index, 1);\n}\nexports.removeComponent = removeComponent;\n/**\n * Returns if this component has a conditional statement.\n *\n * @param component - The component JSON schema.\n *\n * @returns {boolean} - TRUE - This component has a conditional, FALSE - No conditional provided.\n */\nfunction hasCondition(component) {\n return Boolean((component.customConditional) ||\n (component.conditional && (component.conditional.when ||\n component.conditional.json ||\n (component.conditional.conjunction && (0, lodash_1.isBoolean)(component.conditional.show) && !(0, lodash_1.isEmpty)(component.conditional.conditions)))));\n}\nexports.hasCondition = hasCondition;\n/**\n * Extension of standard #parseFloat(value) function, that also clears input string.\n *\n * @param {any} value\n * The value to parse.\n *\n * @returns {Number}\n * Parsed value.\n */\nfunction parseFloatExt(value) {\n return parseFloat((0, lodash_1.isString)(value)\n ? value.replace(/[^\\de.+-]/gi, '')\n : value);\n}\nexports.parseFloatExt = parseFloatExt;\n/**\n * Formats provided value in way how Currency component uses it.\n *\n * @param {any} value\n * The value to format.\n *\n * @returns {String}\n * Value formatted for Currency component.\n */\nfunction formatAsCurrency(value) {\n const parsedValue = parseFloatExt(value);\n if (isNaN(parsedValue)) {\n return '';\n }\n const parts = (0, lodash_1.round)(parsedValue, 2)\n .toString()\n .split('.');\n parts[0] = (0, lodash_1.chunk)(Array.from(parts[0]).reverse(), 3)\n .reverse()\n .map((part) => part\n .reverse()\n .join(''))\n .join(',');\n parts[1] = (0, lodash_1.pad)(parts[1], 2, '0');\n return parts.join('.');\n}\nexports.formatAsCurrency = formatAsCurrency;\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\nexports.escapeRegExCharacters = escapeRegExCharacters;\n/**\n * Get the value for a component key, in the given submission.\n *\n * @param {Object} submission\n * A submission object to search.\n * @param {String} key\n * A for components API key to search for.\n */\nfunction getValue(submission, key) {\n const search = (data) => {\n if ((0, lodash_1.isPlainObject)(data)) {\n if ((0, lodash_1.has)(data, key)) {\n return (0, lodash_1.get)(data, key);\n }\n let value = null;\n (0, lodash_1.forOwn)(data, (prop) => {\n const result = search(prop);\n if (!(0, lodash_1.isNil)(result)) {\n value = result;\n return false;\n }\n });\n return value;\n }\n else {\n return null;\n }\n };\n return search(submission.data);\n}\nexports.getValue = getValue;\n/**\n * Iterate over all components in a form and get string values for translation.\n * @param form\n */\nfunction getStrings(form) {\n const properties = ['label', 'title', 'legend', 'tooltip', 'description', 'placeholder', 'prefix', 'suffix', 'errorLabel', 'content', 'html'];\n const strings = [];\n eachComponent(form.components, (component) => {\n properties.forEach(property => {\n if (component.hasOwnProperty(property) && component[property]) {\n strings.push({\n key: component.key,\n type: component.type,\n property,\n string: component[property]\n });\n }\n });\n if ((!component.dataSrc || component.dataSrc === 'values') && component.hasOwnProperty('values') && Array.isArray(component.values) && component.values.length) {\n component.values.forEach((value, index) => {\n strings.push({\n key: component.key,\n property: `value[${index}].label`,\n string: component.values[index].label\n });\n });\n }\n // Hard coded values from Day component\n if (component.type === 'day') {\n [\n 'day',\n 'month',\n 'year',\n 'Day',\n 'Month',\n 'Year',\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n ].forEach(string => {\n strings.push({\n key: component.key,\n property: 'day',\n string,\n });\n });\n if (component.fields.day.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.day.placeholder',\n string: component.fields.day.placeholder,\n });\n }\n if (component.fields.month.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.month.placeholder',\n string: component.fields.month.placeholder,\n });\n }\n if (component.fields.year.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.year.placeholder',\n string: component.fields.year.placeholder,\n });\n }\n }\n if (component.type === 'editgrid') {\n const string = component.addAnother || 'Add Another';\n if (component.addAnother) {\n strings.push({\n key: component.key,\n property: 'addAnother',\n string,\n });\n }\n }\n if (component.type === 'select') {\n [\n 'loading...',\n 'Type to search'\n ].forEach(string => {\n strings.push({\n key: component.key,\n property: 'select',\n string,\n });\n });\n }\n }, true);\n return strings;\n}\nexports.getStrings = getStrings;\n// ?????????????????????????\n// questionable section\nfunction generateFormChange(type, data) {\n let change;\n switch (type) {\n case 'add':\n change = {\n op: 'add',\n key: data.component.key,\n container: data.parent.key, // Parent component\n path: data.path, // Path to container within parent component.\n index: data.index, // Index of component in parent container.\n component: data.component\n };\n break;\n case 'edit':\n change = {\n op: 'edit',\n key: data.originalComponent.key,\n patches: (0, fast_json_patch_1.compare)(data.originalComponent, data.component)\n };\n // Don't save if nothing changed.\n if (!change.patches.length) {\n change = null;\n }\n break;\n case 'remove':\n change = {\n op: 'remove',\n key: data.component.key,\n };\n break;\n }\n return change;\n}\nexports.generateFormChange = generateFormChange;\nfunction applyFormChanges(form, changes) {\n const failed = [];\n changes.forEach(function (change) {\n var found = false;\n switch (change.op) {\n case 'add':\n var newComponent = change.component;\n // Find the container to set the component in.\n findComponent(form.components, change.container, null, function (parent) {\n if (!change.container) {\n parent = form;\n }\n // A move will first run an add so remove any existing components with matching key before inserting.\n findComponent(form.components, change.key, null, function (component, path) {\n // If found, use the existing component. (If someone else edited it, the changes would be here)\n newComponent = component;\n removeComponent(form.components, path);\n });\n found = true;\n var container = (0, lodash_1.get)(parent, change.path);\n container.splice(change.index, 0, newComponent);\n });\n break;\n case 'remove':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n const oldComponent = (0, lodash_1.get)(form.components, path);\n if (oldComponent.key !== component.key) {\n path.pop();\n }\n removeComponent(form.components, path);\n });\n break;\n case 'edit':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n try {\n const oldComponent = (0, lodash_1.get)(form.components, path);\n const newComponent = (0, fast_json_patch_1.applyPatch)(component, change.patches).newDocument;\n if (oldComponent.key !== newComponent.key) {\n path.pop();\n }\n (0, lodash_1.set)(form.components, path, newComponent);\n }\n catch (err) {\n failed.push(change);\n }\n });\n break;\n case 'move':\n break;\n }\n if (!found) {\n failed.push(change);\n }\n });\n return {\n form,\n failed\n };\n}\nexports.applyFormChanges = applyFormChanges;\n/**\n* This function will find a component in a form and return the component AND THE PATH to the component in the form.\n* Path to the component is stored as an array of nested components and their indexes.The Path is being filled recursively\n* when you iterating through the nested structure.\n* If the component is not found the callback won't be called and function won't return anything.\n*\n* @param components\n* @param key\n* @param fn\n* @param path\n* @returns {*}\n*/\nfunction findComponent(components, key, path, fn) {\n if (!components)\n return;\n path = path || [];\n if (!key) {\n return fn(components);\n }\n components.forEach(function (component, index) {\n var newPath = path.slice();\n // Add an index of the component it iterates through in nested structure\n newPath.push(index);\n if (!component)\n return;\n if (component.hasOwnProperty('columns') && Array.isArray(component.columns)) {\n newPath.push('columns');\n component.columns.forEach(function (column, index) {\n var colPath = newPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n }\n if (component.hasOwnProperty('rows') && Array.isArray(component.rows)) {\n newPath.push('rows');\n component.rows.forEach(function (row, index) {\n var rowPath = newPath.slice();\n rowPath.push(index);\n row.forEach(function (column, index) {\n var colPath = rowPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n });\n }\n if (component.hasOwnProperty('components') && Array.isArray(component.components)) {\n newPath.push('components');\n findComponent(component.components, key, newPath, fn);\n }\n if (component.key === key) {\n //Final callback if the component is found\n fn(component, newPath, components);\n }\n });\n}\nexports.findComponent = findComponent;\nconst isCheckboxComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'checkbox';\nconst isDataGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datagrid';\nconst isEditGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'editgrid';\nconst isAddressComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'address';\nconst isDataTableComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datatable';\nconst hasChildComponents = (component) => (component === null || component === void 0 ? void 0 : component.components) != null;\nconst isDateTimeComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datetime';\nconst isSelectBoxesComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'selectboxes';\nconst isTextAreaComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textarea';\nconst isTextFieldComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textfield';\nfunction getEmptyValue(component) {\n switch (component.type) {\n case 'textarea':\n case 'textfield':\n case 'time':\n case 'datetime':\n case 'day':\n return '';\n case 'datagrid':\n case 'editgrid':\n return [];\n default:\n return null;\n }\n}\nexports.getEmptyValue = getEmptyValue;\nconst replaceBlanks = (value) => {\n const nbsp = '<p>&nbsp;</p>';\n const br = '<p><br></p>';\n const brNbsp = '<p><br>&nbsp;</p>';\n const regExp = new RegExp(`^${nbsp}|${nbsp}$|^${br}|${br}$|^${brNbsp}|${brNbsp}$`, 'g');\n return typeof value === 'string' ? value.replace(regExp, '').trim() : value;\n};\nfunction trimBlanks(value) {\n if (!value) {\n return value;\n }\n if (Array.isArray(value)) {\n value = value.map((val) => replaceBlanks(val));\n }\n else {\n value = replaceBlanks(value);\n }\n return value;\n}\nfunction isValueEmpty(component, value) {\n const compValueIsEmptyArray = ((0, lodash_1.isArray)(value) && value.length === 1) ? (0, lodash_1.isEqual)(value[0], getEmptyValue(component)) : false;\n return value == null || value === '' || ((0, lodash_1.isArray)(value) && value.length === 0) || compValueIsEmptyArray;\n}\nfunction isComponentDataEmpty(component, data, path, valueCond) {\n var _a;\n const value = (0, lodash_1.isNil)(valueCond) ? (0, lodash_1.get)(data, path) : valueCond;\n if (isCheckboxComponent(component)) {\n return isValueEmpty(component, value) || value === false;\n }\n else if (isAddressComponent(component)) {\n if (Object.keys(value).length === 0) {\n return true;\n }\n return !Object.values(value).some(Boolean);\n }\n else if (isDataGridComponent(component) || isEditGridComponent(component) || isDataTableComponent(component) || hasChildComponents(component)) {\n if ((_a = component.components) === null || _a === void 0 ? void 0 : _a.length) {\n let childrenEmpty = true;\n // wrap component in an array to let eachComponentData handle introspection to child components (e.g. this will be different\n // for data grids versus nested forms, etc.)\n (0, exports.eachComponentData)([component], data, (thisComponent, data, row, path, components, index) => {\n if (component.key === thisComponent.key)\n return;\n if (!isComponentDataEmpty(thisComponent, data, path)) {\n childrenEmpty = false;\n }\n });\n return isValueEmpty(component, value) || childrenEmpty;\n }\n return isValueEmpty(component, value);\n }\n else if (isDateTimeComponent(component)) {\n return isValueEmpty(component, value) || value.toString() === 'Invalid date';\n }\n else if (isSelectBoxesComponent(component)) {\n let selectBoxEmpty = true;\n for (const key in value) {\n if (value[key]) {\n selectBoxEmpty = false;\n break;\n }\n }\n return isValueEmpty(component, value) || selectBoxEmpty;\n }\n else if (isTextAreaComponent(component)) {\n const isPlain = !component.wysiwyg && !component.editor;\n return isPlain ? typeof value === 'string' ? isValueEmpty(component, value.trim()) : isValueEmpty(component, value) : isValueEmpty(component, trimBlanks(value));\n }\n else if (isTextFieldComponent(component)) {\n if (component.allowMultipleMasks && !!component.inputMasks && !!component.inputMasks.length) {\n return isValueEmpty(component, value) || (component.multiple ? value.length === 0 : (!value.maskName || !value.value));\n }\n return isValueEmpty(component, value === null || value === void 0 ? void 0 : value.toString().trim());\n }\n return isValueEmpty(component, value);\n}\nexports.isComponentDataEmpty = isComponentDataEmpty;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil.js?");
1339
1339
 
1340
1340
  /***/ }),
1341
1341
 
@@ -1511,7 +1511,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
1511
1511
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1512
1512
 
1513
1513
  "use strict";
1514
- eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst ConditionOperator_1 = __importDefault(__webpack_require__(/*! ./ConditionOperator */ \"./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js\"));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nclass IsEmptyValue extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'isEmpty';\n }\n static get displayedName() {\n return 'Is Empty';\n }\n static get requireValue() {\n return false;\n }\n execute({ value, instance, conditionComponentPath }) {\n const isEmptyValue = (0, lodash_1.isEmpty)(value);\n if (instance && instance.root) {\n const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);\n return conditionTriggerComponent ? conditionTriggerComponent.isEmpty() : isEmptyValue;\n }\n return isEmptyValue;\n }\n getResult(options) {\n return this.execute(options);\n }\n}\nexports[\"default\"] = IsEmptyValue;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/operators/IsEmptyValue.js?");
1514
+ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst formUtil_1 = __webpack_require__(/*! ../formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\nconst ConditionOperator_1 = __importDefault(__webpack_require__(/*! ./ConditionOperator */ \"./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js\"));\nclass IsEmptyValue extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'isEmpty';\n }\n static get displayedName() {\n return 'Is Empty';\n }\n static get requireValue() {\n return false;\n }\n execute({ value, conditionComponentPath, data, conditionComponent }) {\n return (0, formUtil_1.isComponentDataEmpty)(conditionComponent, data, conditionComponentPath, value);\n }\n getResult(options) {\n return this.execute(options);\n }\n}\nexports[\"default\"] = IsEmptyValue;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/operators/IsEmptyValue.js?");
1515
1515
 
1516
1516
  /***/ }),
1517
1517
 
@@ -2379,6 +2379,16 @@ eval("var baseIsNative = __webpack_require__(/*! ./_baseIsNative */ \"./node_mod
2379
2379
 
2380
2380
  /***/ }),
2381
2381
 
2382
+ /***/ "./node_modules/lodash/_getPrototype.js":
2383
+ /*!**********************************************!*\
2384
+ !*** ./node_modules/lodash/_getPrototype.js ***!
2385
+ \**********************************************/
2386
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2387
+
2388
+ eval("var overArg = __webpack_require__(/*! ./_overArg */ \"./node_modules/lodash/_overArg.js\");\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n\n\n//# sourceURL=webpack://Formio/./node_modules/lodash/_getPrototype.js?");
2389
+
2390
+ /***/ }),
2391
+
2382
2392
  /***/ "./node_modules/lodash/_getRawTag.js":
2383
2393
  /*!*******************************************!*\
2384
2394
  !*** ./node_modules/lodash/_getRawTag.js ***!
@@ -3009,6 +3019,16 @@ eval("/* module decorator */ module = __webpack_require__.nmd(module);\nvar root
3009
3019
 
3010
3020
  /***/ }),
3011
3021
 
3022
+ /***/ "./node_modules/lodash/isEmpty.js":
3023
+ /*!****************************************!*\
3024
+ !*** ./node_modules/lodash/isEmpty.js ***!
3025
+ \****************************************/
3026
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
3027
+
3028
+ eval("var baseKeys = __webpack_require__(/*! ./_baseKeys */ \"./node_modules/lodash/_baseKeys.js\"),\n getTag = __webpack_require__(/*! ./_getTag */ \"./node_modules/lodash/_getTag.js\"),\n isArguments = __webpack_require__(/*! ./isArguments */ \"./node_modules/lodash/isArguments.js\"),\n isArray = __webpack_require__(/*! ./isArray */ \"./node_modules/lodash/isArray.js\"),\n isArrayLike = __webpack_require__(/*! ./isArrayLike */ \"./node_modules/lodash/isArrayLike.js\"),\n isBuffer = __webpack_require__(/*! ./isBuffer */ \"./node_modules/lodash/isBuffer.js\"),\n isPrototype = __webpack_require__(/*! ./_isPrototype */ \"./node_modules/lodash/_isPrototype.js\"),\n isTypedArray = __webpack_require__(/*! ./isTypedArray */ \"./node_modules/lodash/isTypedArray.js\");\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\nfunction isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = isEmpty;\n\n\n//# sourceURL=webpack://Formio/./node_modules/lodash/isEmpty.js?");
3029
+
3030
+ /***/ }),
3031
+
3012
3032
  /***/ "./node_modules/lodash/isFunction.js":
3013
3033
  /*!*******************************************!*\
3014
3034
  !*** ./node_modules/lodash/isFunction.js ***!
@@ -3049,6 +3069,16 @@ eval("/**\n * Checks if `value` is object-like. A value is object-like if it's n
3049
3069
 
3050
3070
  /***/ }),
3051
3071
 
3072
+ /***/ "./node_modules/lodash/isPlainObject.js":
3073
+ /*!**********************************************!*\
3074
+ !*** ./node_modules/lodash/isPlainObject.js ***!
3075
+ \**********************************************/
3076
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
3077
+
3078
+ eval("var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ \"./node_modules/lodash/_baseGetTag.js\"),\n getPrototype = __webpack_require__(/*! ./_getPrototype */ \"./node_modules/lodash/_getPrototype.js\"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ \"./node_modules/lodash/isObjectLike.js\");\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n\n\n//# sourceURL=webpack://Formio/./node_modules/lodash/isPlainObject.js?");
3079
+
3080
+ /***/ }),
3081
+
3052
3082
  /***/ "./node_modules/lodash/isSymbol.js":
3053
3083
  /*!*****************************************!*\
3054
3084
  !*** ./node_modules/lodash/isSymbol.js ***!