@formio/js 5.0.0-rc.40 → 5.0.0-rc.42
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.builder.css +2 -2
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +2 -2
- package/dist/formio.form.js +114 -37
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +7 -7
- package/dist/formio.full.css +2 -2
- package/dist/formio.full.js +115 -38
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +7 -7
- package/dist/formio.js +76 -4
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +13 -1
- package/dist/formio.utils.js +48 -4
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -3
- package/lib/cjs/Embed.js +11 -11
- package/lib/cjs/Form.js +32 -1
- package/lib/cjs/Webform.js +1 -1
- package/lib/cjs/WebformBuilder.js +18 -2
- package/lib/cjs/components/datagrid/DataGrid.js +1 -1
- package/lib/cjs/components/datetime/fixtures/comp13.js +118 -0
- package/lib/cjs/components/datetime/fixtures/index.js +3 -1
- package/lib/cjs/components/form/Form.js +27 -3
- package/lib/cjs/components/radio/Radio.js +13 -0
- package/lib/cjs/providers/storage/util.js +2 -2
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/cjs/widgets/CalendarWidget.js +8 -0
- package/lib/mjs/Form.js +32 -1
- package/lib/mjs/Webform.js +1 -1
- package/lib/mjs/WebformBuilder.js +17 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/datetime/fixtures/comp13.js +116 -0
- package/lib/mjs/components/datetime/fixtures/index.js +2 -1
- package/lib/mjs/components/form/Form.js +25 -2
- package/lib/mjs/components/radio/Radio.js +16 -0
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/widgets/CalendarWidget.js +8 -0
- package/package.json +11 -11
package/dist/formio.form.js
CHANGED
@@ -19,6 +19,17 @@
|
|
19
19
|
return /******/ (function() { // webpackBootstrap
|
20
20
|
/******/ var __webpack_modules__ = ({
|
21
21
|
|
22
|
+
/***/ "../core/lib/error/DereferenceError.js":
|
23
|
+
/*!*********************************************!*\
|
24
|
+
!*** ../core/lib/error/DereferenceError.js ***!
|
25
|
+
\*********************************************/
|
26
|
+
/***/ (function(__unused_webpack_module, exports) {
|
27
|
+
|
28
|
+
"use strict";
|
29
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.DereferenceError = void 0;\nclass DereferenceError extends Error {\n}\nexports.DereferenceError = DereferenceError;\n;\n\n\n//# sourceURL=webpack://Formio/../core/lib/error/DereferenceError.js?");
|
30
|
+
|
31
|
+
/***/ }),
|
32
|
+
|
22
33
|
/***/ "../core/lib/error/FieldError.js":
|
23
34
|
/*!***************************************!*\
|
24
35
|
!*** ../core/lib/error/FieldError.js ***!
|
@@ -48,7 +59,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
48
59
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
49
60
|
|
50
61
|
"use strict";
|
51
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./FieldError */ \"../core/lib/error/FieldError.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ValidatorError */ \"../core/lib/error/ValidatorError.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/../core/lib/error/index.js?");
|
62
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./FieldError */ \"../core/lib/error/FieldError.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ValidatorError */ \"../core/lib/error/ValidatorError.js\"), exports);\n__exportStar(__webpack_require__(/*! ./DereferenceError */ \"../core/lib/error/DereferenceError.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/../core/lib/error/index.js?");
|
52
63
|
|
53
64
|
/***/ }),
|
54
65
|
|
@@ -81,7 +92,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
81
92
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
82
93
|
|
83
94
|
"use strict";
|
84
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\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.Component = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst Components_1 = __webpack_require__(/*! ../Components */ \"../core/lib/experimental/base/Components.js\");\nconst template_1 = __webpack_require__(/*! ../../template */ \"../core/lib/experimental/template/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"../core/lib/utils/index.js\");\nconst dom = __importStar(__webpack_require__(/*! ../../../utils/dom */ \"../core/lib/utils/dom.js\"));\nconst sanitize_1 = __webpack_require__(/*! ../../../utils/sanitize */ \"../core/lib/utils/sanitize.js\");\nconst model_1 = __webpack_require__(/*! ../../model */ \"../core/lib/experimental/model/index.js\");\nfunction Component(props = {}) {\n props = (0, lodash_1.merge)({\n type: 'component',\n template: false,\n schema: {\n persistent: true,\n protected: false,\n }\n }, props);\n props.schema.type = props.type;\n const ModelClass = props.model || model_1.Model;\n return function (BaseClass) {\n return class ExtendedComponent extends ModelClass(props)(BaseClass) {\n constructor() {\n super(...arguments);\n /**\n * Boolean to let us know if this component is attached to the DOM or not.\n */\n this.attached = false;\n /**\n * The DOM element references used for component logic.\n */\n this.refs = {};\n /**\n * The template to render for this component.\n */\n this.template = props.template;\n /**\n * An array of attached listeners.\n */\n this.attachedListeners = [];\n }\n get defaultOptions() {\n return {\n language: 'en',\n namespace: 'formio'\n };\n }\n get defaultTemplate() {\n return (ctx) => `<span>${ctx.t('Unknown Component')}</span>`;\n }\n /**\n * Interpolate a template string.\n * @param template - The template string to interpolate.\n * @param context - The context variables to pass to the interpolation.\n */\n interpolate(template, context) {\n return utils_1.Evaluator.interpolate(template, context);\n }\n /**\n * The rendering context.\n * @param context - The existing contexts from parent classes.\n */\n renderContext(context = {}) {\n if (super.renderContext) {\n return super.renderContext(context);\n }\n return context;\n }\n /**\n * Performs an evaluation using the evaluation context of this component.\n *\n * @param func\n * @param args\n * @param ret\n * @param tokenize\n * @return {*}\n */\n evaluate(func, args = {}, ret = '', tokenize = false) {\n return utils_1.Evaluator.evaluate(func, this.evalContext(args), ret, tokenize);\n }\n /**\n * Renders this component as an HTML string.\n */\n render(context = {}) {\n if (super.render) {\n return super.render(context);\n }\n return this.renderTemplate((this.template || this.component.type), this.renderContext(context));\n }\n /**\n * Returns the template references.\n */\n getRefs() {\n if (super.getRefs) {\n return super.getRefs();\n }\n return {};\n }\n /**\n * Loads the elemement references.\n * @param element\n */\n loadRefs(element) {\n const refs = this.getRefs();\n for (const ref in refs) {\n if (refs[ref] === 'single') {\n this.refs[ref] = element.querySelector(`[ref=\"${ref}\"]`);\n }\n else {\n this.refs[ref] = element.querySelectorAll(`[ref=\"${ref}\"]`);\n }\n }\n }\n /**\n * Renders the component and then attaches this component to the HTMLElement.\n * @param element\n */\n attach(element) {\n const _super = Object.create(null, {\n attach: { get: () => super.attach }\n });\n return __awaiter(this, void 0, void 0, function* () {\n if (this.element && !element) {\n element = this.element;\n }\n if (!element) {\n return this;\n }\n const parent = element.parentNode;\n if (!parent) {\n return this;\n }\n const index = Array.prototype.indexOf.call(parent.children, element);\n element.outerHTML = String(this.sanitize(this.render()));\n element = parent.children[index];\n this.element = element;\n this.loadRefs(this.element);\n if (_super.attach) {\n yield _super.attach.call(this, element);\n }\n this.attached = true;\n return this;\n });\n }\n /**\n * Redraw this component.\n * @returns\n */\n redraw() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.element) {\n this.clear();\n return this.attach();\n }\n });\n }\n /**\n * Sanitize an html string.\n *\n * @param string\n * @returns {*}\n */\n sanitize(dirty) {\n return (0, sanitize_1.sanitize)(dirty, this.options);\n }\n /**\n * Get all available translations.\n */\n get translations() {\n if (this.options.language &&\n this.options.i18n &&\n this.options.i18n[this.options.language]) {\n return this.options.i18n[this.options.language];\n }\n return {};\n }\n /**\n * Tranlation method to translate a string being rendered.\n * @param str\n */\n t(str) {\n if (this.translations[str]) {\n return this.translations[str];\n }\n return str;\n }\n /**\n * The evaluation context for interpolations.\n * @param extend\n */\n evalContext(extend = {}) {\n return Object.assign({\n instance: this,\n component: this.component,\n options: this.options,\n row: this.data,\n data: this.root ? this.root.data : this.data,\n rowIndex: this.rowIndex,\n value: () => this.dataValue,\n t: (str) => this.t(str)\n }, extend);\n }\n /**\n * Render a template with provided context.\n * @param name\n * @param ctx\n */\n renderTemplate(name, ctx = {}) {\n return template_1.Template.render(name, this.evalContext(ctx), 'html', this.defaultTemplate);\n }\n /**\n * Determines if the value of this component is redacted from the user as if it is coming from the server, but is protected.\n *\n * @return {boolean|*}\n */\n isValueRedacted() {\n return (this.component.protected ||\n !this.component.persistent ||\n (this.component.persistent === 'client-only'));\n }\n /**\n * Sets the data value and updates the view representation.\n * @param value\n */\n setValue(value) {\n let changed = false;\n if (super.setValue) {\n changed = super.setValue(value);\n }\n return this.updateValue(value) || changed;\n }\n /**\n * Returns the main HTML Element for this component.\n */\n getElement() {\n return this.element;\n }\n /**\n * Remove all event handlers.\n */\n detach() {\n this.refs = {};\n this.attached = false;\n this.removeAttachedListeners();\n if (super.detach) {\n super.detach();\n }\n }\n /**\n * Clear an element.\n */\n clear() {\n this.detach();\n dom.empty(this.getElement());\n if (super.clear) {\n super.clear();\n }\n }\n /**\n * Appends an element to this component.\n * @param element\n */\n append(element) {\n dom.appendTo(element, this.element);\n }\n /**\n * Prepends an element to this component.\n * @param element\n */\n prepend(element) {\n dom.prependTo(element, this.element);\n }\n /**\n * Removes an element from this component.\n * @param element\n */\n removeChild(element) {\n dom.removeChildFrom(element, this.element);\n }\n /**\n * Wrapper method to add an event listener to an HTML element.\n *\n * @param obj\n * The DOM element to add the event to.\n * @param type\n * The event name to add.\n * @param func\n * The callback function to be executed when the listener is triggered.\n * @param persistent\n * If this listener should persist beyond \"destroy\" commands.\n */\n addEventListener(obj, type, func) {\n if (!obj) {\n return;\n }\n if ('addEventListener' in obj) {\n obj.addEventListener(type, func, false);\n }\n else if ('attachEvent' in obj) {\n obj.attachEvent(`on${type}`, func);\n }\n this.attachedListeners.push({ obj, type, func });\n return this;\n }\n /**\n * Remove all the attached listeners.\n */\n removeAttachedListeners() {\n this.attachedListeners.forEach((item) => this.removeEventListener(item.obj, item.type, item.func));\n this.attachedListeners = [];\n }\n /**\n * Remove an event listener from the object.\n *\n * @param obj\n * @param type\n */\n removeEventListener(obj, type, func) {\n if (obj) {\n obj.removeEventListener(type, func);\n }\n return this;\n }\n };\n };\n}\nexports.Component = Component;\n// Add the default component.\nComponents_1.Components.addDecorator(Component, 'component');\nComponents_1.Components.addComponent(Component()(), 'component');\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/base/component/Component.js?");
|
95
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\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.Component = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst Components_1 = __webpack_require__(/*! ../Components */ \"../core/lib/experimental/base/Components.js\");\nconst template_1 = __webpack_require__(/*! ../../template */ \"../core/lib/experimental/template/index.js\");\nconst Evaluator_1 = __webpack_require__(/*! ../../../utils/Evaluator */ \"../core/lib/utils/Evaluator.js\");\nconst dom = __importStar(__webpack_require__(/*! ../../../utils/dom */ \"../core/lib/utils/dom.js\"));\nconst sanitize_1 = __webpack_require__(/*! ../../../utils/sanitize */ \"../core/lib/utils/sanitize.js\");\nconst model_1 = __webpack_require__(/*! ../../model */ \"../core/lib/experimental/model/index.js\");\nfunction Component(props = {}) {\n props = (0, lodash_1.merge)({\n type: 'component',\n template: false,\n schema: {\n persistent: true,\n protected: false,\n }\n }, props);\n props.schema.type = props.type;\n const ModelClass = props.model || model_1.Model;\n return function (BaseClass) {\n return class ExtendedComponent extends ModelClass(props)(BaseClass) {\n constructor() {\n super(...arguments);\n /**\n * Boolean to let us know if this component is attached to the DOM or not.\n */\n this.attached = false;\n /**\n * The DOM element references used for component logic.\n */\n this.refs = {};\n /**\n * The template to render for this component.\n */\n this.template = props.template;\n /**\n * An array of attached listeners.\n */\n this.attachedListeners = [];\n }\n get defaultOptions() {\n return {\n language: 'en',\n namespace: 'formio'\n };\n }\n get defaultTemplate() {\n return (ctx) => `<span>${ctx.t('Unknown Component')}</span>`;\n }\n /**\n * Interpolate a template string.\n * @param template - The template string to interpolate.\n * @param context - The context variables to pass to the interpolation.\n */\n interpolate(template, context) {\n return Evaluator_1.Evaluator.interpolate(template, context);\n }\n /**\n * The rendering context.\n * @param context - The existing contexts from parent classes.\n */\n renderContext(context = {}) {\n if (super.renderContext) {\n return super.renderContext(context);\n }\n return context;\n }\n /**\n * Performs an evaluation using the evaluation context of this component.\n *\n * @param func\n * @param args\n * @param ret\n * @param tokenize\n * @return {*}\n */\n evaluate(func, args = {}, ret = '', tokenize = false) {\n return Evaluator_1.Evaluator.evaluate(func, this.evalContext(args), ret, tokenize);\n }\n /**\n * Renders this component as an HTML string.\n */\n render(context = {}) {\n if (super.render) {\n return super.render(context);\n }\n return this.renderTemplate((this.template || this.component.type), this.renderContext(context));\n }\n /**\n * Returns the template references.\n */\n getRefs() {\n if (super.getRefs) {\n return super.getRefs();\n }\n return {};\n }\n /**\n * Loads the elemement references.\n * @param element\n */\n loadRefs(element) {\n const refs = this.getRefs();\n for (const ref in refs) {\n if (refs[ref] === 'single') {\n this.refs[ref] = element.querySelector(`[ref=\"${ref}\"]`);\n }\n else {\n this.refs[ref] = element.querySelectorAll(`[ref=\"${ref}\"]`);\n }\n }\n }\n /**\n * Renders the component and then attaches this component to the HTMLElement.\n * @param element\n */\n attach(element) {\n const _super = Object.create(null, {\n attach: { get: () => super.attach }\n });\n return __awaiter(this, void 0, void 0, function* () {\n if (this.element && !element) {\n element = this.element;\n }\n if (!element) {\n return this;\n }\n const parent = element.parentNode;\n if (!parent) {\n return this;\n }\n const index = Array.prototype.indexOf.call(parent.children, element);\n element.outerHTML = String(this.sanitize(this.render()));\n element = parent.children[index];\n this.element = element;\n this.loadRefs(this.element);\n if (_super.attach) {\n yield _super.attach.call(this, element);\n }\n this.attached = true;\n return this;\n });\n }\n /**\n * Redraw this component.\n * @returns\n */\n redraw() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.element) {\n this.clear();\n return this.attach();\n }\n });\n }\n /**\n * Sanitize an html string.\n *\n * @param string\n * @returns {*}\n */\n sanitize(dirty) {\n return (0, sanitize_1.sanitize)(dirty, this.options);\n }\n /**\n * Get all available translations.\n */\n get translations() {\n if (this.options.language &&\n this.options.i18n &&\n this.options.i18n[this.options.language]) {\n return this.options.i18n[this.options.language];\n }\n return {};\n }\n /**\n * Tranlation method to translate a string being rendered.\n * @param str\n */\n t(str) {\n if (this.translations[str]) {\n return this.translations[str];\n }\n return str;\n }\n /**\n * The evaluation context for interpolations.\n * @param extend\n */\n evalContext(extend = {}) {\n return Object.assign({\n instance: this,\n component: this.component,\n options: this.options,\n row: this.data,\n data: this.root ? this.root.data : this.data,\n rowIndex: this.rowIndex,\n value: () => this.dataValue,\n t: (str) => this.t(str)\n }, extend);\n }\n /**\n * Render a template with provided context.\n * @param name\n * @param ctx\n */\n renderTemplate(name, ctx = {}) {\n return template_1.Template.render(name, this.evalContext(ctx), 'html', this.defaultTemplate);\n }\n /**\n * Determines if the value of this component is redacted from the user as if it is coming from the server, but is protected.\n *\n * @return {boolean|*}\n */\n isValueRedacted() {\n return (this.component.protected ||\n !this.component.persistent ||\n (this.component.persistent === 'client-only'));\n }\n /**\n * Sets the data value and updates the view representation.\n * @param value\n */\n setValue(value) {\n let changed = false;\n if (super.setValue) {\n changed = super.setValue(value);\n }\n return this.updateValue(value) || changed;\n }\n /**\n * Returns the main HTML Element for this component.\n */\n getElement() {\n return this.element;\n }\n /**\n * Remove all event handlers.\n */\n detach() {\n this.refs = {};\n this.attached = false;\n this.removeAttachedListeners();\n if (super.detach) {\n super.detach();\n }\n }\n /**\n * Clear an element.\n */\n clear() {\n this.detach();\n dom.empty(this.getElement());\n if (super.clear) {\n super.clear();\n }\n }\n /**\n * Appends an element to this component.\n * @param element\n */\n append(element) {\n dom.appendTo(element, this.element);\n }\n /**\n * Prepends an element to this component.\n * @param element\n */\n prepend(element) {\n dom.prependTo(element, this.element);\n }\n /**\n * Removes an element from this component.\n * @param element\n */\n removeChild(element) {\n dom.removeChildFrom(element, this.element);\n }\n /**\n * Wrapper method to add an event listener to an HTML element.\n *\n * @param obj\n * The DOM element to add the event to.\n * @param type\n * The event name to add.\n * @param func\n * The callback function to be executed when the listener is triggered.\n * @param persistent\n * If this listener should persist beyond \"destroy\" commands.\n */\n addEventListener(obj, type, func) {\n if (!obj) {\n return;\n }\n if ('addEventListener' in obj) {\n obj.addEventListener(type, func, false);\n }\n else if ('attachEvent' in obj) {\n obj.attachEvent(`on${type}`, func);\n }\n this.attachedListeners.push({ obj, type, func });\n return this;\n }\n /**\n * Remove all the attached listeners.\n */\n removeAttachedListeners() {\n this.attachedListeners.forEach((item) => this.removeEventListener(item.obj, item.type, item.func));\n this.attachedListeners = [];\n }\n /**\n * Remove an event listener from the object.\n *\n * @param obj\n * @param type\n */\n removeEventListener(obj, type, func) {\n if (obj) {\n obj.removeEventListener(type, func);\n }\n return this;\n }\n };\n };\n}\nexports.Component = Component;\n// Add the default component.\nComponents_1.Components.addDecorator(Component, 'component');\nComponents_1.Components.addComponent(Component()(), 'component');\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/base/component/Component.js?");
|
85
96
|
|
86
97
|
/***/ }),
|
87
98
|
|
@@ -234,7 +245,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
234
245
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
235
246
|
|
236
247
|
"use strict";
|
237
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\
|
248
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__webpack_require__(/*! core-js/features/object/from-entries */ \"../core/node_modules/core-js/features/object/from-entries.js\");\nconst sdk_1 = __webpack_require__(/*! ../sdk */ \"../core/lib/sdk/index.js\");\nconst utils_1 = __webpack_require__(/*! ../utils */ \"../core/lib/utils/index.js\");\nconst base_1 = __webpack_require__(/*! ./base */ \"../core/lib/experimental/base/index.js\");\nconst template_1 = __webpack_require__(/*! ./template */ \"../core/lib/experimental/template/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst components_1 = __importDefault(__webpack_require__(/*! ./components */ \"../core/lib/experimental/components/index.js\"));\nconst modules_1 = __importDefault(__webpack_require__(/*! ../modules */ \"../core/lib/modules/index.js\"));\nclass FormioCore extends sdk_1.Formio {\n static usePlugin(key, plugin) {\n switch (key) {\n case 'options':\n if (!sdk_1.Formio.options) {\n return;\n }\n sdk_1.Formio.options = (0, lodash_1.merge)(sdk_1.Formio.options, plugin);\n break;\n case 'templates':\n if (!sdk_1.Formio.Templates) {\n return;\n }\n const current = sdk_1.Formio.Templates.framework || 'bootstrap';\n for (const framework of Object.keys(plugin)) {\n sdk_1.Formio.Templates.extendTemplate(framework, plugin[framework]);\n }\n if (plugin[current]) {\n sdk_1.Formio.Templates.current = plugin[current];\n }\n break;\n case 'components':\n if (!sdk_1.Formio.Components) {\n return;\n }\n sdk_1.Formio.Components.setComponents(plugin);\n break;\n case 'framework':\n if (!sdk_1.Formio.Templates) {\n return;\n }\n sdk_1.Formio.Templates.framework = plugin;\n break;\n case 'fetch':\n for (const name of Object.keys(plugin)) {\n sdk_1.Formio.registerPlugin(plugin[name], name);\n }\n break;\n case 'rules':\n if (!sdk_1.Formio.Rules) {\n return;\n }\n sdk_1.Formio.Rules.addRules(plugin);\n break;\n case 'evaluator':\n if (!sdk_1.Formio.Evaluator) {\n return;\n }\n sdk_1.Formio.Evaluator.registerEvaluator(plugin);\n break;\n default:\n console.log('Unknown plugin option', key);\n }\n }\n static useModule(module) {\n // Sanity check.\n if (typeof module !== 'object') {\n return;\n }\n for (const key of Object.keys(module)) {\n FormioCore.usePlugin(key, module[key]);\n }\n }\n /**\n * Allows passing in plugins as multiple arguments or an array of plugins.\n *\n * Formio.plugins(plugin1, plugin2, etc);\n * Formio.plugins([plugin1, plugin2, etc]);\n */\n static use(...mods) {\n mods.forEach((mod) => {\n if (Array.isArray(mod)) {\n mod.forEach(p => FormioCore.useModule(p));\n }\n else {\n FormioCore.useModule(mod);\n }\n });\n }\n}\nFormioCore.Components = base_1.Components;\nFormioCore.render = base_1.render;\nFormioCore.Evaluator = utils_1.Evaluator;\nFormioCore.Utils = utils_1.Utils;\nFormioCore.Templates = template_1.Template;\nexports[\"default\"] = FormioCore;\nFormioCore.use(components_1.default);\nFormioCore.use(modules_1.default);\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/core.js?");
|
238
249
|
|
239
250
|
/***/ }),
|
240
251
|
|
@@ -245,7 +256,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
245
256
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
246
257
|
|
247
258
|
"use strict";
|
248
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./
|
259
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = void 0;\nconst core_1 = __importDefault(__webpack_require__(/*! ./core */ \"../core/lib/experimental/core.js\"));\nexports.Formio = core_1.default;\n__exportStar(__webpack_require__(/*! ./base */ \"../core/lib/experimental/base/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./model */ \"../core/lib/experimental/model/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./components */ \"../core/lib/experimental/components/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./template */ \"../core/lib/experimental/template/index.js\"), exports);\nexports[\"default\"] = core_1.default;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/index.js?");
|
249
260
|
|
250
261
|
/***/ }),
|
251
262
|
|
@@ -267,7 +278,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
267
278
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
268
279
|
|
269
280
|
"use strict";
|
270
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Model = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst EventEmitter_1 = __webpack_require__(/*! ./EventEmitter */ \"../core/lib/experimental/model/EventEmitter.js\");\nfunction Model(props = {}) {\n if (!props.schema) {\n props.schema = {};\n }\n if (!props.schema.key) {\n props.schema.key = '';\n }\n return function (BaseClass) {\n return class BaseModel extends (0, EventEmitter_1.EventEmitter)(BaseClass) {\n /**\n * The default JSON schema\n * @param extend\n */\n static schema() {\n return props.schema;\n }\n /**\n * @constructor\n * @param component\n * @param options\n * @param data\n */\n constructor(component = {}, options = {}, data = {}) {\n super(component, options, data);\n this.component = component;\n this.options = options;\n this.data = data;\n /**\n * The root entity.\n */\n this.root = null;\n this.id = `e${Math.random().toString(36).substring(7)}`;\n this.component = (0, lodash_1.merge)({}, this.defaultSchema, this.component);\n this.options = Object.assign(Object.assign({}, this.defaultOptions), this.options);\n if (!this.options.noInit) {\n this.init();\n }\n }\n get defaultOptions() {\n return {};\n }\n get defaultSchema() {\n return BaseModel.schema();\n }\n /**\n * Initializes the entity.\n */\n init() {\n this.hook('init');\n }\n /**\n * Return the errors from validation for this component.\n */\n get errors() {\n return this.validator.errors;\n }\n /**\n * The empty value for this component.\n *\n * @return {null}\n */\n get emptyValue() {\n return null;\n }\n /**\n * Checks to see if this components value is empty.\n *\n * @param value\n * @returns\n */\n isEmpty(value = this.dataValue) {\n const isEmptyArray = ((0, lodash_1.isArray)(value) && value.length === 1) ? (0, lodash_1.isEqual)(value[0], this.emptyValue) : false;\n return value == null || value.length === 0 || (0, lodash_1.isEqual)(value, this.emptyValue) || isEmptyArray;\n }\n /**\n * Returns the data value for this component.\n */\n get dataValue() {\n return (0, lodash_1.get)(this.data, this.component.key);\n }\n /**\n * Sets the datavalue for this component.\n */\n set dataValue(value) {\n if (this.component.key) {\n (0, lodash_1.set)(this.data, this.component.key, value);\n }\n }\n /**\n * Determine if this component has changed values.\n *\n * @param value - The value to compare against the current value.\n */\n hasChanged(value) {\n return String(value) !== String(this.dataValue);\n }\n /**\n * Updates the data model value\n * @param value The value to update within this component.\n * @return boolean true if the value has changed.\n */\n updateValue(value) {\n const changed = this.hasChanged(value);\n this.dataValue = value;\n if (changed) {\n // Bubble a change event.\n this.bubble('change', value);\n }\n return changed;\n }\n /**\n * Get the model value.\n * @returns\n */\n getValue() {\n return this.dataValue;\n }\n /**\n * Allow for options to hook into the functionality of this entity.\n * @return {*}\n */\n hook(name, ...args) {\n if (this.options &&\n this.options.hooks &&\n this.options.hooks[name]) {\n return this.options.hooks[name].apply(this, args);\n }\n else {\n // If this is an async hook instead of a sync.\n const fn = (typeof args[args.length - 1] === 'function') ? args[args.length - 1] : null;\n if (fn) {\n return fn(null, args[1]);\n }\n else {\n return args[1];\n }\n }\n }\n };\n };\n}\nexports.Model = Model;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/model/Model.js?");
|
281
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Model = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst EventEmitter_1 = __webpack_require__(/*! ./EventEmitter */ \"../core/lib/experimental/model/EventEmitter.js\");\nfunction Model(props = {}) {\n if (!props.schema) {\n props.schema = {};\n }\n if (!props.schema.key) {\n props.schema.key = '';\n }\n return function (BaseClass) {\n return class BaseModel extends (0, EventEmitter_1.EventEmitter)(BaseClass) {\n /**\n * The default JSON schema\n * @param extend\n */\n static schema() {\n return props.schema;\n }\n /**\n * @constructor\n * @param component\n * @param options\n * @param data\n */\n constructor(component = {}, options = {}, data = {}) {\n super(component, options, data);\n this.component = component;\n this.options = options;\n this.data = data;\n /**\n * The root entity.\n */\n this.root = null;\n this.id = `e${Math.random().toString(36).substring(7)}`;\n this.component = (0, lodash_1.merge)({}, this.defaultSchema, this.component);\n this.options = Object.assign(Object.assign({}, this.defaultOptions), this.options);\n if (!this.options.noInit) {\n this.init();\n }\n }\n get defaultOptions() {\n return {};\n }\n get defaultSchema() {\n return BaseModel.schema();\n }\n /**\n * Initializes the entity.\n */\n init() {\n this.hook('init');\n }\n /**\n * Return the errors from validation for this component.\n */\n get errors() {\n return this.validator.errors;\n }\n /**\n * The empty value for this component.\n *\n * @return {null}\n */\n get emptyValue() {\n return null;\n }\n /**\n * Checks to see if this components value is empty.\n *\n * @param value\n * @returns\n */\n isEmpty(value = this.dataValue) {\n const isEmptyArray = ((0, lodash_1.isArray)(value) && value.length === 1) ? (0, lodash_1.isEqual)(value[0], this.emptyValue) : false;\n return value == null || value.length === 0 || (0, lodash_1.isEqual)(value, this.emptyValue) || isEmptyArray;\n }\n /**\n * Returns the data value for this component.\n */\n get dataValue() {\n return this.component.key ? (0, lodash_1.get)(this.data, this.component.key) : this.data;\n }\n /**\n * Sets the datavalue for this component.\n */\n set dataValue(value) {\n if (this.component.key) {\n (0, lodash_1.set)(this.data, this.component.key, value);\n }\n }\n /**\n * Determine if this component has changed values.\n *\n * @param value - The value to compare against the current value.\n */\n hasChanged(value) {\n return String(value) !== String(this.dataValue);\n }\n /**\n * Updates the data model value\n * @param value The value to update within this component.\n * @return boolean true if the value has changed.\n */\n updateValue(value) {\n const changed = this.hasChanged(value);\n this.dataValue = value;\n if (changed) {\n // Bubble a change event.\n this.bubble('change', value);\n }\n return changed;\n }\n /**\n * Get the model value.\n * @returns\n */\n getValue() {\n return this.dataValue;\n }\n /**\n * Allow for options to hook into the functionality of this entity.\n * @return {*}\n */\n hook(name, ...args) {\n if (this.options &&\n this.options.hooks &&\n this.options.hooks[name]) {\n return this.options.hooks[name].apply(this, args);\n }\n else {\n // If this is an async hook instead of a sync.\n const fn = (typeof args[args.length - 1] === 'function') ? args[args.length - 1] : null;\n if (fn) {\n return fn(null, args[1]);\n }\n else {\n return args[1];\n }\n }\n }\n };\n };\n}\nexports.Model = Model;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/model/Model.js?");
|
271
282
|
|
272
283
|
/***/ }),
|
273
284
|
|
@@ -278,7 +289,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
278
289
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
279
290
|
|
280
291
|
"use strict";
|
281
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.NestedArrayModel = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst NestedDataModel_1 = __webpack_require__(/*! ./NestedDataModel */ \"../core/lib/experimental/model/NestedDataModel.js\");\nfunction NestedArrayModel(props = {}) {\n return function (BaseClass) {\n return class BaseNestedArrayModel extends (0, NestedDataModel_1.NestedDataModel)(props)(BaseClass) {\n get defaultValue() {\n return [];\n }\n /**\n * Returns a row of componments at the provided index.\n * @param index The index of the row to return\n */\n row(index) {\n return (index < this.rows.length) ? this.rows[index] : [];\n }\n /**\n * Removes a row and detatches all components within that row.\n *\n * @param index The index of the row to remove.\n */\n removeRow(index) {\n this.row(index).forEach((comp) => this.removeComponent(comp));\n this.dataValue.splice(index, 1);\n this.rows.splice(index, 1);\n }\n /**\n * Adds a new row of components.\n *\n * @param data The data context to pass to this row of components.\n */\n addRow(data = {}, index = 0) {\n const rowData = data;\n this.dataValue[index] = rowData;\n this.createRowComponents(rowData, index);\n }\n /**\n * Sets the data for a specific row of components.\n * @param rowData The data to set\n * @param index The index of the rows to set the data within.\n */\n setRowData(rowData, index) {\n var _a;\n this.dataValue[index] = rowData;\n (_a = this.row(index)) === null || _a === void 0 ? void 0 : _a.forEach((comp) => (comp.data = rowData));\n }\n /**\n * Determines if the data within a row has changed.\n *\n * @param rowData\n * @param index\n */\n rowChanged(rowData, index) {\n var _a;\n let changed = false;\n (_a = this.row(index)) === null || _a === void 0 ? void 0 : _a.forEach((comp) => {\n const hasChanged = comp.hasChanged((0, lodash_1.get)(rowData, comp.component.key));\n changed = hasChanged || changed;\n if (hasChanged) {\n comp.bubble('change', comp);\n }\n });\n return changed;\n }\n /**\n * Creates all components for each row.\n * @param data\n * @returns\n */\n createComponents(data) {\n this.rows = [];\n let added = [];\n this.eachRowValue(data, (row, index) => {\n added = added.concat(this.createRowComponents(row, index));\n });\n return added;\n }\n /**\n * Creates a new row of components.\n *\n * @param data The data context to pass along to this row of components.\n */\n createRowComponents(data, index = 0) {\n const comps = super.createComponents(data, (comp) => {\n comp.rowIndex = index;\n });\n this.rows[index] = comps;\n return comps;\n }\n getIndexes(value) {\n if (super.getIndexes) {\n return super.getIndexes(value);\n }\n return {\n min: 0,\n max: (value.length - 1)\n };\n }\n eachRowValue(value, fn) {\n if (!value || !value.length) {\n return;\n }\n const indexes = this.getIndexes(value);\n for (let i = indexes.min; i <= indexes.max; i++) {\n fn(value[i], i);\n }\n }\n /**\n * The empty value for this component.\n *\n * @return {array}\n */\n get emptyValue() {\n return [];\n }\n /**\n * Returns the dataValue for this component.\n */\n get dataValue() {\n return (0, lodash_1.get)(this.data, this.component.key);\n }\n /**\n * Set the datavalue of an array component.\n *\n * @param value The value to set this component to.\n */\n set dataValue(value) {\n // Only set the value if it is an array.\n if (Array.isArray(value)) {\n // Get the current data value.\n const dataValue = this.dataValue;\n this.eachRowValue(value, (row, index) => {\n if (index >= dataValue.length) {\n this.addRow(row, index);\n }\n this.setRowData(row, index);\n });\n // Remove superfluous rows.\n if (dataValue.length > value.length) {\n for (let i = value.length; i < dataValue.length; i++) {\n this.removeRow(i);\n }\n }\n }\n }\n /**\n * Determine if this array component has changed.\n *\n * @param value\n */\n hasChanged(value) {\n const dataValue = this.dataValue;\n // If the length changes, then this compnent has changed.\n if (value.length !== dataValue.length) {\n this.emit('changed', this);\n return true;\n }\n let changed = false;\n this.eachRowValue(value, (rowData, index) => {\n changed = this.rowChanged(rowData, index) || changed;\n });\n return changed;\n }\n /**\n * Sets the value of an array component.\n *\n * @param value\n */\n setValue(value) {\n var changed = false;\n this.eachComponentValue(value, (comp, val) => {\n changed = comp.setValue(val) || changed;\n });\n return changed;\n }\n };\n };\n}\nexports.NestedArrayModel = NestedArrayModel;\n;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/model/NestedArrayModel.js?");
|
292
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.NestedArrayModel = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst NestedDataModel_1 = __webpack_require__(/*! ./NestedDataModel */ \"../core/lib/experimental/model/NestedDataModel.js\");\nfunction NestedArrayModel(props = {}) {\n return function (BaseClass) {\n return class BaseNestedArrayModel extends (0, NestedDataModel_1.NestedDataModel)(props)(BaseClass) {\n get defaultValue() {\n return [];\n }\n /**\n * Returns a row of componments at the provided index.\n * @param index The index of the row to return\n */\n row(index) {\n return (index < this.rows.length) ? this.rows[index] : [];\n }\n /**\n * Removes a row and detatches all components within that row.\n *\n * @param index The index of the row to remove.\n */\n removeRow(index) {\n this.row(index).forEach((comp) => this.removeComponent(comp));\n this.dataValue.splice(index, 1);\n this.rows.splice(index, 1);\n }\n /**\n * Adds a new row of components.\n *\n * @param data The data context to pass to this row of components.\n */\n addRow(data = {}, index = 0) {\n const rowData = data;\n this.dataValue[index] = rowData;\n this.createRowComponents(rowData, index);\n }\n /**\n * Sets the data for a specific row of components.\n * @param rowData The data to set\n * @param index The index of the rows to set the data within.\n */\n setRowData(rowData, index) {\n var _a;\n this.dataValue[index] = rowData;\n (_a = this.row(index)) === null || _a === void 0 ? void 0 : _a.forEach((comp) => (comp.data = rowData));\n }\n /**\n * Determines if the data within a row has changed.\n *\n * @param rowData\n * @param index\n */\n rowChanged(rowData, index) {\n var _a;\n let changed = false;\n (_a = this.row(index)) === null || _a === void 0 ? void 0 : _a.forEach((comp) => {\n const hasChanged = comp.hasChanged((0, lodash_1.get)(rowData, comp.component.key));\n changed = hasChanged || changed;\n if (hasChanged) {\n comp.bubble('change', comp);\n }\n });\n return changed;\n }\n /**\n * Creates all components for each row.\n * @param data\n * @returns\n */\n createComponents(data) {\n this.rows = [];\n let added = [];\n this.eachRowValue(data, (row, index) => {\n added = added.concat(this.createRowComponents(row, index));\n });\n return added;\n }\n /**\n * Creates a new row of components.\n *\n * @param data The data context to pass along to this row of components.\n */\n createRowComponents(data, index = 0) {\n const comps = super.createComponents(data, (comp) => {\n comp.rowIndex = index;\n });\n this.rows[index] = comps;\n return comps;\n }\n getIndexes(value) {\n if (super.getIndexes) {\n return super.getIndexes(value);\n }\n return {\n min: 0,\n max: (value.length - 1)\n };\n }\n eachRowValue(value, fn) {\n if (!value || !value.length) {\n return;\n }\n const indexes = this.getIndexes(value);\n for (let i = indexes.min; i <= indexes.max; i++) {\n fn(value[i], i);\n }\n }\n /**\n * The empty value for this component.\n *\n * @return {array}\n */\n get emptyValue() {\n return [];\n }\n /**\n * Returns the dataValue for this component.\n */\n get dataValue() {\n return this.component.key ? (0, lodash_1.get)(this.data, this.component.key) : this.data;\n }\n /**\n * Set the datavalue of an array component.\n *\n * @param value The value to set this component to.\n */\n set dataValue(value) {\n // Only set the value if it is an array.\n if (Array.isArray(value)) {\n // Get the current data value.\n const dataValue = this.dataValue;\n this.eachRowValue(value, (row, index) => {\n if (index >= dataValue.length) {\n this.addRow(row, index);\n }\n this.setRowData(row, index);\n });\n // Remove superfluous rows.\n if (dataValue.length > value.length) {\n for (let i = value.length; i < dataValue.length; i++) {\n this.removeRow(i);\n }\n }\n }\n }\n /**\n * Determine if this array component has changed.\n *\n * @param value\n */\n hasChanged(value) {\n const dataValue = this.dataValue;\n // If the length changes, then this compnent has changed.\n if (value.length !== dataValue.length) {\n this.emit('changed', this);\n return true;\n }\n let changed = false;\n this.eachRowValue(value, (rowData, index) => {\n changed = this.rowChanged(rowData, index) || changed;\n });\n return changed;\n }\n /**\n * Sets the value of an array component.\n *\n * @param value\n */\n setValue(value) {\n var changed = false;\n this.eachComponentValue(value, (comp, val) => {\n changed = comp.setValue(val) || changed;\n });\n return changed;\n }\n };\n };\n}\nexports.NestedArrayModel = NestedArrayModel;\n;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/model/NestedArrayModel.js?");
|
282
293
|
|
283
294
|
/***/ }),
|
284
295
|
|
@@ -289,7 +300,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
289
300
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
290
301
|
|
291
302
|
"use strict";
|
292
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.NestedDataModel = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst NestedModel_1 = __webpack_require__(/*! ./NestedModel */ \"../core/lib/experimental/model/NestedModel.js\");\nfunction NestedDataModel(props = {}) {\n return function (BaseClass) {\n return class BaseNestedDataModel extends (0, NestedModel_1.NestedModel)(props)(BaseClass) {\n get emptyValue() {\n return {};\n }\n get defaultValue() {\n return {};\n }\n /**\n * Get the component data.\n */\n componentData() {\n const compData = (0, lodash_1.get)(this.data, this.component.key, this.defaultValue);\n if (!Object.keys(compData).length) {\n (0, lodash_1.set)(this.data, this.component.key, compData);\n }\n return compData;\n }\n get dataValue() {\n return (0, lodash_1.get)(this.data, this.component.key);\n }\n set dataValue(value) {\n this.eachComponentValue(value, (comp, val) => (comp.dataValue = val));\n }\n };\n };\n}\nexports.NestedDataModel = NestedDataModel;\n;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/model/NestedDataModel.js?");
|
303
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.NestedDataModel = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst NestedModel_1 = __webpack_require__(/*! ./NestedModel */ \"../core/lib/experimental/model/NestedModel.js\");\nfunction NestedDataModel(props = {}) {\n return function (BaseClass) {\n return class BaseNestedDataModel extends (0, NestedModel_1.NestedModel)(props)(BaseClass) {\n get emptyValue() {\n return {};\n }\n get defaultValue() {\n return {};\n }\n /**\n * Get the component data.\n */\n componentData() {\n if (!this.component.key) {\n return this.data;\n }\n const compData = (0, lodash_1.get)(this.data, this.component.key, this.defaultValue);\n if (!Object.keys(compData).length) {\n (0, lodash_1.set)(this.data, this.component.key, compData);\n }\n return compData;\n }\n get dataValue() {\n return this.component.key ? (0, lodash_1.get)(this.data, this.component.key) : this.data;\n }\n set dataValue(value) {\n this.eachComponentValue(value, (comp, val) => (comp.dataValue = val));\n }\n };\n };\n}\nexports.NestedDataModel = NestedDataModel;\n;\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/model/NestedDataModel.js?");
|
293
304
|
|
294
305
|
/***/ }),
|
295
306
|
|
@@ -322,7 +333,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
322
333
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
323
334
|
|
324
335
|
"use strict";
|
325
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Template = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\n/**\n * Manages all the available templates which can be rendered.\n */\nclass Template {\n /**\n * Adds a collection of template frameworks to the renderer.\n * @param templates\n */\n static addTemplates(templates) {\n var framework = Template.framework;\n Template.templates = (0, lodash_1.merge)(Template.templates, templates);\n Template.framework = framework;\n }\n /**\n * Adds some templates to the existing template.\n * @param name\n * @param template\n */\n static addTemplate(name, template) {\n Template.templates[name] = (0, lodash_1.merge)(Template.current, template);\n if (Template.templates.hasOwnProperty(Template._framework)) {\n Template._current = Template.templates[Template._framework];\n }\n }\n /**\n * Extend an existing template.\n * @param name\n * @param template\n */\n static extendTemplate(name, template) {\n Template.templates[name] = (0, lodash_1.merge)(Template.templates[name], template);\n if (Template.templates.hasOwnProperty(Template._framework)) {\n Template._current = Template.templates[Template._framework];\n }\n }\n /**\n * Sets a template.\n * @param name\n * @param template\n */\n static setTemplate(name, template) {\n Template.addTemplate(name, template);\n }\n /**\n * Set the current template.\n */\n static set current(templates) {\n const defaultTemplates = Template.current;\n Template._current = (0, lodash_1.merge)(defaultTemplates, templates);\n }\n /**\n * Get the current template.\n */\n static get current() {\n return Template._current;\n }\n /**\n * Sets the current framework.\n */\n static set framework(framework) {\n Template._framework = framework;\n if (Template.templates.hasOwnProperty(framework)) {\n Template._current = Template.templates[framework];\n }\n }\n /**\n * Gets the current framework.\n */\n static get framework() {\n return Template._framework;\n }\n /**\n * Render a partial within the current template.\n * @param name\n * @param ctx\n * @param mode\n * @returns\n */\n static render(name, ctx, mode = 'html', defaultTemplate = null) {\n if (typeof name === 'function') {\n return name(ctx);\n }\n if (this.current[name] && this.current[name][mode]) {\n return this.current[name][mode](ctx);\n }\n if (defaultTemplate) {\n return defaultTemplate(ctx);\n }\n return 'Unknown template';\n }\n}\nexports.Template = Template;\nTemplate.templates =
|
336
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Template = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\n/**\n * Manages all the available templates which can be rendered.\n */\nclass Template {\n /**\n * Adds a collection of template frameworks to the renderer.\n * @param templates\n */\n static addTemplates(templates) {\n var framework = Template.framework;\n Template.templates = (0, lodash_1.merge)(Template.templates, templates);\n Template.framework = framework;\n }\n /**\n * Adds some templates to the existing template.\n * @param name\n * @param template\n */\n static addTemplate(name, template) {\n Template.templates[name] = (0, lodash_1.merge)(Template.current, template);\n if (Template.templates.hasOwnProperty(Template._framework)) {\n Template._current = Template.templates[Template._framework];\n }\n }\n /**\n * Extend an existing template.\n * @param name\n * @param template\n */\n static extendTemplate(name, template) {\n Template.templates[name] = (0, lodash_1.merge)(Template.templates[name], template);\n if (Template.templates.hasOwnProperty(Template._framework)) {\n Template._current = Template.templates[Template._framework];\n }\n }\n /**\n * Sets a template.\n * @param name\n * @param template\n */\n static setTemplate(name, template) {\n Template.addTemplate(name, template);\n }\n /**\n * Set the current template.\n */\n static set current(templates) {\n const defaultTemplates = Template.current;\n Template._current = (0, lodash_1.merge)(defaultTemplates, templates);\n }\n /**\n * Get the current template.\n */\n static get current() {\n return Template._current;\n }\n /**\n * Sets the current framework.\n */\n static set framework(framework) {\n Template._framework = framework;\n if (Template.templates.hasOwnProperty(framework)) {\n Template._current = Template.templates[framework];\n }\n }\n /**\n * Gets the current framework.\n */\n static get framework() {\n return Template._framework;\n }\n /**\n * Render a partial within the current template.\n * @param name\n * @param ctx\n * @param mode\n * @returns\n */\n static render(name, ctx, mode = 'html', defaultTemplate = null) {\n if (typeof name === 'function') {\n return name(ctx);\n }\n if (this.current[name] && this.current[name][mode]) {\n return this.current[name][mode](ctx);\n }\n if (defaultTemplate) {\n return defaultTemplate(ctx);\n }\n return 'Unknown template';\n }\n}\nexports.Template = Template;\nTemplate.templates = {};\nTemplate._current = {};\nTemplate._framework = 'bootstrap';\n\n\n//# sourceURL=webpack://Formio/../core/lib/experimental/template/Template.js?");
|
326
337
|
|
327
338
|
/***/ }),
|
328
339
|
|
@@ -388,7 +399,18 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
388
399
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
389
400
|
|
390
401
|
"use strict";
|
391
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.calculateProcessInfo = exports.calculateProcess = exports.calculateProcessSync = exports.shouldCalculate = void 0;\nconst jsonlogic_1 = __importDefault(__webpack_require__(/*! ../../modules/jsonlogic */ \"../core/lib/modules/jsonlogic/index.js\"));\nconst set_1 = __importDefault(__webpack_require__(/*! lodash/set */ \"../core/node_modules/lodash/set.js\"));\nconst Evaluator = jsonlogic_1.default.evaluator;\nconst shouldCalculate = (context) => {\n const { component, config } = context;\n if (!component.calculateValue ||\n ((config === null || config === void 0 ? void 0 : config.server) && !component.calculateServer)) {\n return false;\n }\n return true;\n};\nexports.shouldCalculate = shouldCalculate;\nconst calculateProcessSync = (context) => {\n const { component, data, evalContext, scope, path } = context;\n if (!(0, exports.shouldCalculate)(context)) {\n return;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = null;\n if (!scope.calculated)\n scope.calculated = [];\n let newValue = Evaluator.evaluate(component.calculateValue, evalContextValue, 'value');\n // Only set a new value if it is not \"null\" which would be the case if no calculation occurred.\n if (newValue !== null) {\n scope.calculated.push({\n path,\n value: newValue\n });\n (0, set_1.default)(data, path, newValue);\n }\n return;\n};\nexports.calculateProcessSync = calculateProcessSync;\nconst calculateProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.calculateProcessSync)(context);\n});\nexports.calculateProcess = calculateProcess;\nexports.calculateProcessInfo = {\n name: 'calculate',\n process: exports.calculateProcess,\n processSync: exports.calculateProcessSync,\n shouldProcess: exports.shouldCalculate,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/calculation/index.js?");
|
402
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.calculateProcessInfo = exports.calculateProcess = exports.calculateProcessSync = exports.shouldCalculate = void 0;\nconst jsonlogic_1 = __importDefault(__webpack_require__(/*! ../../modules/jsonlogic */ \"../core/lib/modules/jsonlogic/index.js\"));\nconst set_1 = __importDefault(__webpack_require__(/*! lodash/set */ \"../core/node_modules/lodash/set.js\"));\nconst Evaluator = jsonlogic_1.default.evaluator;\nconst shouldCalculate = (context) => {\n const { component, config } = context;\n if (!component.calculateValue ||\n ((config === null || config === void 0 ? void 0 : config.server) && !component.calculateServer)) {\n return false;\n }\n return true;\n};\nexports.shouldCalculate = shouldCalculate;\nconst calculateProcessSync = (context) => {\n const { component, data, evalContext, scope, path, value } = context;\n if (!(0, exports.shouldCalculate)(context)) {\n return;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = value || null;\n if (!scope.calculated)\n scope.calculated = [];\n let newValue = Evaluator.evaluate(component.calculateValue, evalContextValue, 'value');\n // Only set a new value if it is not \"null\" which would be the case if no calculation occurred.\n if (newValue !== null) {\n scope.calculated.push({\n path,\n value: newValue\n });\n (0, set_1.default)(data, path, newValue);\n }\n return;\n};\nexports.calculateProcessSync = calculateProcessSync;\nconst calculateProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.calculateProcessSync)(context);\n});\nexports.calculateProcess = calculateProcess;\nexports.calculateProcessInfo = {\n name: 'calculate',\n process: exports.calculateProcess,\n processSync: exports.calculateProcessSync,\n shouldProcess: exports.shouldCalculate,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/calculation/index.js?");
|
403
|
+
|
404
|
+
/***/ }),
|
405
|
+
|
406
|
+
/***/ "../core/lib/process/clearHidden.js":
|
407
|
+
/*!******************************************!*\
|
408
|
+
!*** ../core/lib/process/clearHidden.js ***!
|
409
|
+
\******************************************/
|
410
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
411
|
+
|
412
|
+
"use strict";
|
413
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.clearHiddenProcessInfo = exports.clearHiddenProcess = void 0;\nconst unset_1 = __importDefault(__webpack_require__(/*! lodash/unset */ \"../core/node_modules/lodash/unset.js\"));\n/**\n * This processor function checks components for the `hidden` property and unsets corresponding data\n */\nconst clearHiddenProcess = (context) => {\n const { component, data, path, value, scope } = context;\n if (!scope.clearHidden) {\n scope.clearHidden = {};\n }\n if (component.hidden && value !== undefined && (!component.hasOwnProperty('clearOnHide') || component.clearOnHide)) {\n (0, unset_1.default)(data, path);\n scope.clearHidden[path] = true;\n }\n};\nexports.clearHiddenProcess = clearHiddenProcess;\nexports.clearHiddenProcessInfo = {\n name: 'clearHidden',\n shouldProcess: () => true,\n processSync: exports.clearHiddenProcess,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/clearHidden.js?");
|
392
414
|
|
393
415
|
/***/ }),
|
394
416
|
|
@@ -399,7 +421,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
399
421
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
400
422
|
|
401
423
|
"use strict";
|
402
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.conditionProcessInfo = exports.simpleConditionProcessInfo = exports.customConditionProcessInfo = exports.conditionProcessSync = exports.conditionProcess = exports.simpleConditionProcessSync = exports.simpleConditionProcess = exports.customConditionProcessSync = exports.customConditionProcess = exports.conditionalProcess = exports.isConditionallyHidden = exports.isSimpleConditionallyHidden = exports.isCustomConditionallyHidden = exports.hasConditions = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"../core/lib/utils/index.js\");\nconst
|
424
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.conditionProcessInfo = exports.simpleConditionProcessInfo = exports.customConditionProcessInfo = exports.conditionProcessSync = exports.conditionProcess = exports.simpleConditionProcessSync = exports.simpleConditionProcess = exports.customConditionProcessSync = exports.customConditionProcess = exports.conditionalProcess = exports.isConditionallyHidden = exports.isSimpleConditionallyHidden = exports.isCustomConditionallyHidden = exports.hasConditions = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"../core/lib/utils/index.js\");\nconst set_1 = __importDefault(__webpack_require__(/*! lodash/set */ \"../core/node_modules/lodash/set.js\"));\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"../core/lib/utils/formUtil.js\");\nconst conditions_1 = __webpack_require__(/*! ../../utils/conditions */ \"../core/lib/utils/conditions.js\");\nconst skipOnServer = (context) => {\n const { component, config } = context;\n const clearOnHide = component.hasOwnProperty('clearOnHide') ? component.clearOnHide : true;\n if ((config === null || config === void 0 ? void 0 : config.server) && !clearOnHide) {\n // No need to run conditionals on server unless clearOnHide is set.\n return true;\n }\n return false;\n};\nconst hasCustomConditions = (context) => {\n const { component } = context;\n return !!component.customConditional;\n};\nconst hasSimpleConditions = (context) => {\n const { component } = context;\n const { conditional } = component;\n if ((0, conditions_1.isLegacyConditional)(conditional) ||\n (0, conditions_1.isSimpleConditional)(conditional) ||\n (0, conditions_1.isJSONConditional)(conditional)) {\n return true;\n }\n return false;\n};\nconst hasConditions = (context) => {\n return hasSimpleConditions(context) || hasCustomConditions(context);\n};\nexports.hasConditions = hasConditions;\nconst isCustomConditionallyHidden = (context) => {\n if (!hasCustomConditions(context)) {\n return false;\n }\n const { component } = context;\n const { customConditional } = component;\n let show = null;\n if (customConditional) {\n show = (0, conditions_1.checkCustomConditional)(customConditional, context, 'show');\n }\n if (show === null) {\n return false;\n }\n return !show;\n};\nexports.isCustomConditionallyHidden = isCustomConditionallyHidden;\nconst isSimpleConditionallyHidden = (context) => {\n if (!hasSimpleConditions(context)) {\n return false;\n }\n const { component } = context;\n const { conditional } = component;\n let show = null;\n if ((0, conditions_1.isJSONConditional)(conditional)) {\n show = (0, conditions_1.checkJsonConditional)(conditional, context);\n }\n if ((0, conditions_1.isLegacyConditional)(conditional)) {\n show = (0, conditions_1.checkLegacyConditional)(conditional, context);\n }\n if ((0, conditions_1.isSimpleConditional)(conditional)) {\n show = (0, conditions_1.checkSimpleConditional)(conditional, context);\n }\n if (show === null || show === undefined) {\n return false;\n }\n return !show;\n};\nexports.isSimpleConditionallyHidden = isSimpleConditionallyHidden;\nconst isConditionallyHidden = (context) => {\n return (0, exports.isCustomConditionallyHidden)(context) || (0, exports.isSimpleConditionallyHidden)(context);\n};\nexports.isConditionallyHidden = isConditionallyHidden;\nconst conditionalProcess = (context, isHidden) => {\n const { component, data, row, scope, path } = context;\n if (!(0, exports.hasConditions)(context)) {\n return;\n }\n if (!scope.conditionals) {\n scope.conditionals = [];\n }\n scope.conditionals.push({ path, conditionallyHidden: true });\n const conditionalComp = scope.conditionals[scope.conditionals.length - 1];\n if (skipOnServer(context)) {\n return false;\n }\n const conditionallyHidden = isHidden(context);\n if (conditionallyHidden) {\n conditionalComp.conditionallyHidden = conditionallyHidden;\n const info = (0, formUtil_1.componentInfo)(component);\n if (info.hasColumns || info.hasComps || info.hasRows) {\n // If this is a container component, we need to add all the child components as conditionally hidden as well.\n utils_1.Utils.eachComponentData([component], row, (comp, data, compRow, compPath) => {\n var _a;\n if (comp !== component) {\n (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.push({ path: (0, formUtil_1.getComponentPath)(comp, compPath), conditionallyHidden: true });\n }\n (0, set_1.default)(comp, 'hidden', true);\n });\n }\n else {\n (0, set_1.default)(component, 'hidden', true);\n }\n }\n else {\n conditionalComp.conditionallyHidden = false;\n }\n};\nexports.conditionalProcess = conditionalProcess;\nconst customConditionProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.customConditionProcessSync)(context);\n});\nexports.customConditionProcess = customConditionProcess;\nconst customConditionProcessSync = (context) => {\n return (0, exports.conditionalProcess)(context, exports.isCustomConditionallyHidden);\n};\nexports.customConditionProcessSync = customConditionProcessSync;\nconst simpleConditionProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.simpleConditionProcessSync)(context);\n});\nexports.simpleConditionProcess = simpleConditionProcess;\nconst simpleConditionProcessSync = (context) => {\n return (0, exports.conditionalProcess)(context, exports.isSimpleConditionallyHidden);\n};\nexports.simpleConditionProcessSync = simpleConditionProcessSync;\nconst conditionProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.conditionProcessSync)(context);\n});\nexports.conditionProcess = conditionProcess;\nconst conditionProcessSync = (context) => {\n return (0, exports.conditionalProcess)(context, exports.isConditionallyHidden);\n};\nexports.conditionProcessSync = conditionProcessSync;\nexports.customConditionProcessInfo = {\n name: 'customConditions',\n process: exports.customConditionProcess,\n processSync: exports.customConditionProcessSync,\n shouldProcess: hasCustomConditions,\n};\nexports.simpleConditionProcessInfo = {\n name: 'simpleConditions',\n process: exports.simpleConditionProcess,\n processSync: exports.simpleConditionProcessSync,\n shouldProcess: hasSimpleConditions,\n};\nexports.conditionProcessInfo = {\n name: 'conditions',\n process: exports.conditionProcess,\n processSync: exports.conditionProcessSync,\n shouldProcess: hasSimpleConditions,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/conditions/index.js?");
|
403
425
|
|
404
426
|
/***/ }),
|
405
427
|
|
@@ -414,6 +436,17 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
414
436
|
|
415
437
|
/***/ }),
|
416
438
|
|
439
|
+
/***/ "../core/lib/process/dereference/index.js":
|
440
|
+
/*!************************************************!*\
|
441
|
+
!*** ../core/lib/process/dereference/index.js ***!
|
442
|
+
\************************************************/
|
443
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
444
|
+
|
445
|
+
"use strict";
|
446
|
+
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.dereferenceProcessInfo = exports.dereferenceProcess = void 0;\nconst error_1 = __webpack_require__(/*! ../../error */ \"../core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"../core/lib/utils/index.js\");\nconst isDereferenceableDataTableComponent = (component) => {\n var _a, _b, _c;\n return component\n && component.type === 'datatable'\n && ((_a = component.fetch) === null || _a === void 0 ? void 0 : _a.enableFetch) === true\n && ((_b = component.fetch) === null || _b === void 0 ? void 0 : _b.dataSrc) === 'resource'\n && typeof ((_c = component.fetch) === null || _c === void 0 ? void 0 : _c.resource) === 'string';\n};\n/**\n * This function is used to dereference reference IDs contained in the form.\n * It is currently only compatible with Data Table components.\n * @todo Add support for other components (if applicable) and for submission data dereferencing (e.g. save-as-reference, currently a property action).\n */\nconst dereferenceProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { component, config, scope, path } = context;\n if (!scope.dereference) {\n scope.dereference = {};\n }\n if (!isDereferenceableDataTableComponent(component)) {\n return;\n }\n if (!(config === null || config === void 0 ? void 0 : config.database)) {\n throw new error_1.DereferenceError('Cannot dereference resource value without a database config object');\n }\n try {\n const components = yield ((_a = config.database) === null || _a === void 0 ? void 0 : _a.dereferenceDataTableComponent(component));\n const vmCompatibleComponents = (0, utils_1.fastCloneDeep)(components);\n scope.dereference[path] = vmCompatibleComponents;\n // Modify the components in place; we have to do this now as opposed to a \"post-processor\" step because\n // eachComponentDataAsync will immediately turn around and introspect these components in the case of Data Table\n component.components = vmCompatibleComponents;\n }\n catch (err) {\n throw new error_1.DereferenceError(err.message || err);\n }\n});\nexports.dereferenceProcess = dereferenceProcess;\nexports.dereferenceProcessInfo = {\n name: 'dereference',\n shouldProcess: () => true,\n process: exports.dereferenceProcess,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/dereference/index.js?");
|
447
|
+
|
448
|
+
/***/ }),
|
449
|
+
|
417
450
|
/***/ "../core/lib/process/fetch/index.js":
|
418
451
|
/*!******************************************!*\
|
419
452
|
!*** ../core/lib/process/fetch/index.js ***!
|
@@ -443,7 +476,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
443
476
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
444
477
|
|
445
478
|
"use strict";
|
446
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./validation */ \"../core/lib/process/validation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./calculation */ \"../core/lib/process/calculation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./conditions */ \"../core/lib/process/conditions/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./defaultValue */ \"../core/lib/process/defaultValue/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fetch */ \"../core/lib/process/fetch/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./filter */ \"../core/lib/process/filter/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./logic */ \"../core/lib/process/logic/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./populate */ \"../core/lib/process/populate/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./processOne */ \"../core/lib/process/processOne.js\"), exports);\n__exportStar(__webpack_require__(/*! ./process */ \"../core/lib/process/process.js\"), exports);\n__exportStar(__webpack_require__(/*! ./normalize */ \"../core/lib/process/normalize/index.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/index.js?");
|
479
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./validation */ \"../core/lib/process/validation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./calculation */ \"../core/lib/process/calculation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./conditions */ \"../core/lib/process/conditions/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./defaultValue */ \"../core/lib/process/defaultValue/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fetch */ \"../core/lib/process/fetch/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./filter */ \"../core/lib/process/filter/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./logic */ \"../core/lib/process/logic/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./populate */ \"../core/lib/process/populate/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./processOne */ \"../core/lib/process/processOne.js\"), exports);\n__exportStar(__webpack_require__(/*! ./process */ \"../core/lib/process/process.js\"), exports);\n__exportStar(__webpack_require__(/*! ./normalize */ \"../core/lib/process/normalize/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./dereference */ \"../core/lib/process/dereference/index.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/index.js?");
|
447
480
|
|
448
481
|
/***/ }),
|
449
482
|
|
@@ -465,7 +498,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
465
498
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
466
499
|
|
467
500
|
"use strict";
|
468
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.normalizeProcessInfo = exports.normalizeProcessSync = exports.normalizeProcess = void 0;\nconst get_1 = __importDefault(__webpack_require__(/*! lodash/get */ \"../core/node_modules/lodash/get.js\"));\nconst set_1 = __importDefault(__webpack_require__(/*! lodash/set */ \"../core/node_modules/lodash/set.js\"));\nconst isString_1 = __importDefault(__webpack_require__(/*! lodash/isString */ \"../core/node_modules/lodash/isString.js\"));\nconst toString_1 = __importDefault(__webpack_require__(/*! lodash/toString */ \"../core/node_modules/lodash/toString.js\"));\nconst isNil_1 = __importDefault(__webpack_require__(/*! lodash/isNil */ \"../core/node_modules/lodash/isNil.js\"));\nconst isObject_1 = __importDefault(__webpack_require__(/*! lodash/isObject */ \"../core/node_modules/lodash/isObject.js\"));\nconst isAddressComponent = (component) => component.type === \"address\";\nconst isDayComponent = (component) => component.type === \"day\";\nconst isEmailComponent = (component) => component.type === \"email\";\nconst isRadioComponent = (component) => component.type === \"radio\";\nconst isRecaptchaComponent = (component) => component.type === \"recaptcha\";\nconst isSelectComponent = (component) => component.type === \"select\";\nconst isSelectBoxesComponent = (component) => component.type === \"selectboxes\";\nconst isTagsComponent = (component) => component.type === \"tags\";\nconst isTextFieldComponent = (component) => component.type === \"textfield\";\nconst normalizeAddressComponentValue = (component, value) => {\n if (!component.multiple && Boolean(component.enableManualMode) && value && !value.mode) {\n return {\n mode: 'autocomplete',\n address: value,\n };\n }\n return value;\n};\nconst getLocaleDateFormatInfo = (locale = 'en') => {\n const formatInfo = {};\n const day = 21;\n const exampleDate = new Date(2017, 11, day);\n const localDateString = exampleDate.toLocaleDateString(locale);\n formatInfo.dayFirst = localDateString.slice(0, 2) === day.toString();\n return formatInfo;\n};\nconst getLocaleDayFirst = (component, form) => {\n var _a;\n if (component.useLocaleSettings) {\n return getLocaleDateFormatInfo((_a = form.options) === null || _a === void 0 ? void 0 : _a.language).dayFirst;\n }\n return component.dayFirst;\n};\nconst normalizeDayComponentValue = (component, form, value) => {\n // TODO: this is a quick and dirty port of the Day component's normalizeValue method, may need some updates\n const valueMask = /^\\d{2}\\/\\d{2}\\/\\d{4}$/;\n const isDayFirst = getLocaleDayFirst(component, form);\n const showDay = !(0, get_1.default)(component, 'fields.day.hide', false);\n const showMonth = !(0, get_1.default)(component, 'fields.month.hide', false);\n const showYear = !(0, get_1.default)(component, 'fields.year.hide', false);\n if (!value || valueMask.test(value)) {\n return value;\n }\n let dateParts = [];\n const valueParts = value.split('/');\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const defaultValue = component.defaultValue ? component.defaultValue.split('/') : '';\n const getNextPart = (shouldTake, defaultValue) => dateParts.push(shouldTake ? valueParts.shift() : defaultValue);\n if (isDayFirst) {\n getNextPart(showDay, defaultValue ? defaultValue[DAY] : '00');\n }\n getNextPart(showMonth, defaultValue ? defaultValue[MONTH] : '00');\n if (!isDayFirst) {\n getNextPart(showDay, defaultValue ? defaultValue[DAY] : '00');\n }\n getNextPart(showYear, defaultValue ? defaultValue[YEAR] : '0000');\n return dateParts.join('/');\n};\nconst normalizeRadioComponentValue = (value) => {\n const isEquivalent = (0, toString_1.default)(value) === Number(value).toString();\n if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {\n return +value;\n }\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n return value;\n};\nconst normalizeSingleSelectComponentValue = (component, value) => {\n if ((0, isNil_1.default)(value)) {\n return;\n }\n const valueIsObject = (0, isObject_1.default)(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n const dataType = component.dataType || 'auto';\n const normalize = {\n value,\n number() {\n const numberValue = Number(this.value);\n const isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean() {\n if ((0, isString_1.default)(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = (this.value.toLowerCase() === 'true');\n }\n return this;\n },\n string() {\n this.value = String(this.value);\n return this;\n },\n object() {\n return this;\n },\n auto() {\n if ((0, isObject_1.default)(this.value)) {\n this.value = this.object().value;\n }\n else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n }\n catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n};\nconst normalizeSelectComponentValue = (component, value) => {\n if (component.multiple && Array.isArray(value)) {\n return value.map((singleValue) => normalizeSingleSelectComponentValue(component, singleValue));\n }\n return normalizeSingleSelectComponentValue(component, value);\n};\nconst normalizeSelectBoxesComponentValue = (value) => {\n if (typeof value !== 'object') {\n if (typeof value === 'string') {\n return {\n [value]: true\n };\n }\n else {\n return {};\n }\n }\n if (Array.isArray(value)) {\n return value.reduce((acc, curr) => {\n return Object.assign(Object.assign({}, acc), { [curr]: true });\n }, {});\n }\n return value;\n};\nconst normalizeTagsComponentValue = (component, value) => {\n const delimiter = component.delimeter || ',';\n if (component.storeas === 'string' && Array.isArray(value)) {\n return value.join(delimiter);\n }\n else if (component.storeas === 'array' && typeof value === 'string') {\n return value.split(delimiter).filter(result => result);\n }\n return value;\n};\nconst normalizeMaskValue = (component, defaultValues, value, path) => {\n if (component.inputMasks && component.inputMasks.length > 0) {\n if (!value || typeof value !== 'object') {\n return {\n val: value,\n maskName: component.inputMasks[0].label\n };\n }\n if (!value.value) {\n const defaultValue = defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.find((defaultValue) => defaultValue.path === path);\n value.value = Array.isArray(defaultValue) && defaultValue.length > 0 ? defaultValue[0] : defaultValue;\n }\n }\n return value;\n};\nconst normalizeTextFieldComponentValue = (component, defaultValues, value, path) => {\n if (component.allowMultipleMasks && component.inputMasks && component.inputMasks.length > 0) {\n if (Array.isArray(value)) {\n return value.map((val) => normalizeMaskValue(component, defaultValues, val, path));\n }\n else {\n return normalizeMaskValue(component, defaultValues, value, path);\n }\n }\n return value;\n};\nconst normalizeProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.normalizeProcessSync)(context);\n});\nexports.normalizeProcess = normalizeProcess;\nconst normalizeProcessSync = (context) => {\n const { component, form, scope, path, data, value } = context;\n let { defaultValues } = scope;\n // First check for component-type-specific transformations\n if (isAddressComponent(component)) {\n (0, set_1.default)(data, path, normalizeAddressComponentValue(component, value));\n }\n else if (isDayComponent(component)) {\n (0, set_1.default)(data, path, normalizeDayComponentValue(component, form, value));\n }\n else if (isEmailComponent(component)) {\n if (value && typeof value === 'string') {\n (0, set_1.default)(data, path, value.toLowerCase());\n }\n }\n else if (isRadioComponent(component)) {\n (0, set_1.default)(data, path, normalizeRadioComponentValue(value));\n }\n else if (isSelectComponent(component)) {\n (0, set_1.default)(data, path, normalizeSelectComponentValue(component, value));\n }\n else if (isSelectBoxesComponent(component)) {\n (0, set_1.default)(data, path, normalizeSelectBoxesComponentValue(value));\n }\n else if (isTagsComponent(component)) {\n (0, set_1.default)(data, path, normalizeTagsComponentValue(component, value));\n }\n else if (isTextFieldComponent(component)) {\n (0, set_1.default)(data, path, normalizeTextFieldComponentValue(component, defaultValues, value, path));\n }\n // Next perform component-type-agnostic transformations (i.e. super())\n if (component.multiple && !Array.isArray(value)) {\n (0, set_1.default)(data, path, value ? [value] : []);\n }\n};\nexports.normalizeProcessSync = normalizeProcessSync;\nexports.normalizeProcessInfo = {\n name: 'normalize',\n shouldProcess: () => true,\n process: exports.normalizeProcess,\n processSync: exports.normalizeProcessSync\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/normalize/index.js?");
|
501
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.normalizeProcessInfo = exports.normalizeProcessSync = exports.normalizeProcess = void 0;\nconst get_1 = __importDefault(__webpack_require__(/*! lodash/get */ \"../core/node_modules/lodash/get.js\"));\nconst set_1 = __importDefault(__webpack_require__(/*! lodash/set */ \"../core/node_modules/lodash/set.js\"));\nconst isString_1 = __importDefault(__webpack_require__(/*! lodash/isString */ \"../core/node_modules/lodash/isString.js\"));\nconst toString_1 = __importDefault(__webpack_require__(/*! lodash/toString */ \"../core/node_modules/lodash/toString.js\"));\nconst isNil_1 = __importDefault(__webpack_require__(/*! lodash/isNil */ \"../core/node_modules/lodash/isNil.js\"));\nconst isObject_1 = __importDefault(__webpack_require__(/*! lodash/isObject */ \"../core/node_modules/lodash/isObject.js\"));\nconst dayjs_1 = __importDefault(__webpack_require__(/*! dayjs */ \"../core/node_modules/dayjs/dayjs.min.js\"));\nconst customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"../core/node_modules/dayjs/plugin/customParseFormat.js\"));\ndayjs_1.default.extend(customParseFormat_1.default);\nconst isAddressComponent = (component) => component.type === \"address\";\nconst isDayComponent = (component) => component.type === \"day\";\nconst isEmailComponent = (component) => component.type === \"email\";\nconst isRadioComponent = (component) => component.type === \"radio\";\nconst isRecaptchaComponent = (component) => component.type === \"recaptcha\";\nconst isSelectComponent = (component) => component.type === \"select\";\nconst isSelectBoxesComponent = (component) => component.type === \"selectboxes\";\nconst isTagsComponent = (component) => component.type === \"tags\";\nconst isTextFieldComponent = (component) => component.type === \"textfield\";\nconst isTimeComponent = (component) => component.type === \"time\";\nconst normalizeAddressComponentValue = (component, value) => {\n if (!component.multiple && Boolean(component.enableManualMode) && value && !value.mode) {\n return {\n mode: 'autocomplete',\n address: value,\n };\n }\n return value;\n};\nconst getLocaleDateFormatInfo = (locale = 'en') => {\n const formatInfo = {};\n const day = 21;\n const exampleDate = new Date(2017, 11, day);\n const localDateString = exampleDate.toLocaleDateString(locale);\n formatInfo.dayFirst = localDateString.slice(0, 2) === day.toString();\n return formatInfo;\n};\nconst getLocaleDayFirst = (component, form) => {\n var _a;\n if (component.useLocaleSettings) {\n return getLocaleDateFormatInfo((_a = form.options) === null || _a === void 0 ? void 0 : _a.language).dayFirst;\n }\n return component.dayFirst;\n};\nconst normalizeDayComponentValue = (component, form, value) => {\n // TODO: this is a quick and dirty port of the Day component's normalizeValue method, may need some updates\n const valueMask = /^\\d{2}\\/\\d{2}\\/\\d{4}$/;\n const isDayFirst = getLocaleDayFirst(component, form);\n const showDay = !(0, get_1.default)(component, 'fields.day.hide', false);\n const showMonth = !(0, get_1.default)(component, 'fields.month.hide', false);\n const showYear = !(0, get_1.default)(component, 'fields.year.hide', false);\n if (!value || valueMask.test(value)) {\n return value;\n }\n let dateParts = [];\n const valueParts = value.split('/');\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const defaultValue = component.defaultValue ? component.defaultValue.split('/') : '';\n const getNextPart = (shouldTake, defaultValue) => dateParts.push(shouldTake ? valueParts.shift() : defaultValue);\n if (isDayFirst) {\n getNextPart(showDay, defaultValue ? defaultValue[DAY] : '00');\n }\n getNextPart(showMonth, defaultValue ? defaultValue[MONTH] : '00');\n if (!isDayFirst) {\n getNextPart(showDay, defaultValue ? defaultValue[DAY] : '00');\n }\n getNextPart(showYear, defaultValue ? defaultValue[YEAR] : '0000');\n return dateParts.join('/');\n};\nconst normalizeRadioComponentValue = (value) => {\n const isEquivalent = (0, toString_1.default)(value) === Number(value).toString();\n if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {\n return +value;\n }\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n return value;\n};\nconst normalizeSingleSelectComponentValue = (component, value) => {\n if ((0, isNil_1.default)(value)) {\n return;\n }\n const valueIsObject = (0, isObject_1.default)(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n const dataType = component.dataType || 'auto';\n const normalize = {\n value,\n number() {\n const numberValue = Number(this.value);\n const isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean() {\n if ((0, isString_1.default)(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = (this.value.toLowerCase() === 'true');\n }\n return this;\n },\n string() {\n this.value = String(this.value);\n return this;\n },\n object() {\n return this;\n },\n auto() {\n if ((0, isObject_1.default)(this.value)) {\n this.value = this.object().value;\n }\n else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n }\n catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n};\nconst normalizeSelectComponentValue = (component, value) => {\n if (component.multiple && Array.isArray(value)) {\n return value.map((singleValue) => normalizeSingleSelectComponentValue(component, singleValue));\n }\n return normalizeSingleSelectComponentValue(component, value);\n};\nconst normalizeSelectBoxesComponentValue = (value) => {\n if (!value) {\n value = {};\n }\n if (typeof value !== 'object') {\n if (typeof value === 'string') {\n return {\n [value]: true\n };\n }\n else {\n return {};\n }\n }\n if (Array.isArray(value)) {\n return value.reduce((acc, curr) => {\n return Object.assign(Object.assign({}, acc), { [curr]: true });\n }, {});\n }\n return value;\n};\nconst normalizeTagsComponentValue = (component, value) => {\n const delimiter = component.delimeter || ',';\n if ((!component.hasOwnProperty('storeas') || component.storeas === 'string') && Array.isArray(value)) {\n return value.join(delimiter);\n }\n else if (component.storeas === 'array' && typeof value === 'string') {\n return value.split(delimiter).filter(result => result);\n }\n return value;\n};\nconst normalizeMaskValue = (component, defaultValues, value, path) => {\n if (component.inputMasks && component.inputMasks.length > 0) {\n if (!value || typeof value !== 'object') {\n return {\n value: value,\n maskName: component.inputMasks[0].label\n };\n }\n if (!value.value) {\n const defaultValue = defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.find((defaultValue) => defaultValue.path === path);\n value.value = Array.isArray(defaultValue) && defaultValue.length > 0 ? defaultValue[0] : defaultValue;\n }\n }\n return value;\n};\nconst normalizeTextFieldComponentValue = (component, defaultValues, value, path) => {\n if (component.allowMultipleMasks && component.inputMasks && component.inputMasks.length > 0) {\n if (Array.isArray(value)) {\n return value.map((val) => normalizeMaskValue(component, defaultValues, val, path));\n }\n else {\n return normalizeMaskValue(component, defaultValues, value, path);\n }\n }\n return value;\n};\n// Allow submissions of time components in their visual \"format\" property by coercing them to the \"dataFormat\" property\n// i.e. \"HH:mm\" -> \"HH:mm:ss\"\nconst normalizeTimeComponentValue = (component, value) => {\n const defaultDataFormat = 'HH:mm:ss';\n const defaultFormat = 'HH:mm';\n if ((0, dayjs_1.default)(value, component.format || defaultFormat, true).isValid()) {\n return (0, dayjs_1.default)(value, component.format || defaultFormat, true).format(component.dataFormat || defaultDataFormat);\n }\n return value;\n};\nconst normalizeProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.normalizeProcessSync)(context);\n});\nexports.normalizeProcess = normalizeProcess;\nconst normalizeProcessSync = (context) => {\n const { component, form, scope, path, data, value } = context;\n if (!scope.normalize) {\n scope.normalize = {};\n }\n let { defaultValues } = scope;\n scope.normalize[path] = {\n type: component.type,\n normalized: false\n };\n // First check for component-type-specific transformations\n if (isAddressComponent(component)) {\n (0, set_1.default)(data, path, normalizeAddressComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isDayComponent(component)) {\n (0, set_1.default)(data, path, normalizeDayComponentValue(component, form, value));\n scope.normalize[path].normalized = true;\n }\n else if (isEmailComponent(component)) {\n if (value && typeof value === 'string') {\n (0, set_1.default)(data, path, value.toLowerCase());\n scope.normalize[path].normalized = true;\n }\n }\n else if (isRadioComponent(component)) {\n (0, set_1.default)(data, path, normalizeRadioComponentValue(value));\n scope.normalize[path].normalized = true;\n }\n else if (isSelectComponent(component)) {\n (0, set_1.default)(data, path, normalizeSelectComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isSelectBoxesComponent(component)) {\n (0, set_1.default)(data, path, normalizeSelectBoxesComponentValue(value));\n scope.normalize[path].normalized = true;\n }\n else if (isTagsComponent(component)) {\n (0, set_1.default)(data, path, normalizeTagsComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isTextFieldComponent(component)) {\n (0, set_1.default)(data, path, normalizeTextFieldComponentValue(component, defaultValues, value, path));\n scope.normalize[path].normalized = true;\n }\n else if (isTimeComponent(component)) {\n (0, set_1.default)(data, path, normalizeTimeComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n // Next perform component-type-agnostic transformations (i.e. super())\n if (component.multiple && !Array.isArray(value)) {\n (0, set_1.default)(data, path, value ? [value] : []);\n scope.normalize[path].normalized = true;\n }\n};\nexports.normalizeProcessSync = normalizeProcessSync;\nexports.normalizeProcessInfo = {\n name: 'normalize',\n shouldProcess: () => true,\n process: exports.normalizeProcess,\n processSync: exports.normalizeProcessSync\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/normalize/index.js?");
|
469
502
|
|
470
503
|
/***/ }),
|
471
504
|
|
@@ -487,7 +520,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
487
520
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
488
521
|
|
489
522
|
"use strict";
|
490
|
-
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.ProcessTargets = exports.ProcessorMap = exports.processSync = exports.process = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"../core/lib/utils/formUtil.js\");\nconst processOne_1 = __webpack_require__(/*! ./processOne */ \"../core/lib/process/processOne.js\");\nconst defaultValue_1 = __webpack_require__(/*! ./defaultValue */ \"../core/lib/process/defaultValue/index.js\");\nconst fetch_1 = __webpack_require__(/*! ./fetch */ \"../core/lib/process/fetch/index.js\");\nconst calculation_1 = __webpack_require__(/*! ./calculation */ \"../core/lib/process/calculation/index.js\");\nconst logic_1 = __webpack_require__(/*! ./logic */ \"../core/lib/process/logic/index.js\");\nconst conditions_1 = __webpack_require__(/*! ./conditions */ \"../core/lib/process/conditions/index.js\");\nconst validation_1 = __webpack_require__(/*! ./validation */ \"../core/lib/process/validation/index.js\");\nconst filter_1 = __webpack_require__(/*! ./filter */ \"../core/lib/process/filter/index.js\");\nconst normalize_1 = __webpack_require__(/*! ./normalize */ \"../core/lib/process/normalize/index.js\");\nfunction process(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { instances, components, data, scope, flat, processors } = context;\n yield (0, formUtil_1.eachComponentDataAsync)(components, data, (component, compData, row, path, components, index) => __awaiter(this, void 0, void 0, function* () {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n yield (0, processOne_1.processOne)(Object.assign(Object.assign({}, context), {\n data: compData,\n component,\n components,\n path,\n row,\n index,\n instance: instances ? instances[path] : undefined\n }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n }));\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n });\n}\nexports.process = process;\nfunction processSync(context) {\n const { instances, components, data, scope, flat, processors } = context;\n (0, formUtil_1.eachComponentData)(components, data, (component, compData, row, path, components, index) => {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n (0, processOne_1.processOneSync)(Object.assign(Object.assign({}, context), { data: compData, component,\n components,\n path,\n row,\n index, instance: instances ? instances[path] : undefined }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n });\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n}\nexports.processSync = processSync;\n// Export a record of all the supported processors.\nexports.ProcessorMap = {\n filter: filter_1.filterProcessInfo,\n defaultValue: defaultValue_1.defaultValueProcessInfo,\n serverDefaultValue: defaultValue_1.serverDefaultValueProcessInfo,\n customDefaultValue: defaultValue_1.customDefaultValueProcessInfo,\n calculate: calculation_1.calculateProcessInfo,\n conditions: conditions_1.conditionProcessInfo,\n customConditions: conditions_1.customConditionProcessInfo,\n simpleConditions: conditions_1.simpleConditionProcessInfo,\n normalize: normalize_1.normalizeProcessInfo,\n fetch: fetch_1.fetchProcessInfo,\n logic: logic_1.logicProcessInfo,\n validate: validation_1.validateProcessInfo,\n validateCustom: validation_1.validateCustomProcessInfo,\n validateServer: validation_1.validateServerProcessInfo\n};\nexports.ProcessTargets = {\n submission: [\n filter_1.filterProcessInfo,\n defaultValue_1.serverDefaultValueProcessInfo,\n normalize_1.normalizeProcessInfo,\n fetch_1.fetchProcessInfo,\n conditions_1.simpleConditionProcessInfo,\n validation_1.validateServerProcessInfo\n ],\n evaluator: [\n defaultValue_1.customDefaultValueProcessInfo,\n calculation_1.calculateProcessInfo,\n logic_1.logicProcessInfo,\n conditions_1.conditionProcessInfo,\n validation_1.validateProcessInfo\n ]\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/process.js?");
|
523
|
+
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.ProcessTargets = exports.ProcessorMap = exports.processSync = exports.process = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"../core/lib/utils/formUtil.js\");\nconst processOne_1 = __webpack_require__(/*! ./processOne */ \"../core/lib/process/processOne.js\");\nconst defaultValue_1 = __webpack_require__(/*! ./defaultValue */ \"../core/lib/process/defaultValue/index.js\");\nconst fetch_1 = __webpack_require__(/*! ./fetch */ \"../core/lib/process/fetch/index.js\");\nconst calculation_1 = __webpack_require__(/*! ./calculation */ \"../core/lib/process/calculation/index.js\");\nconst logic_1 = __webpack_require__(/*! ./logic */ \"../core/lib/process/logic/index.js\");\nconst conditions_1 = __webpack_require__(/*! ./conditions */ \"../core/lib/process/conditions/index.js\");\nconst validation_1 = __webpack_require__(/*! ./validation */ \"../core/lib/process/validation/index.js\");\nconst filter_1 = __webpack_require__(/*! ./filter */ \"../core/lib/process/filter/index.js\");\nconst normalize_1 = __webpack_require__(/*! ./normalize */ \"../core/lib/process/normalize/index.js\");\nconst dereference_1 = __webpack_require__(/*! ./dereference */ \"../core/lib/process/dereference/index.js\");\nconst clearHidden_1 = __webpack_require__(/*! ./clearHidden */ \"../core/lib/process/clearHidden.js\");\nfunction process(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { instances, components, data, scope, flat, processors } = context;\n yield (0, formUtil_1.eachComponentDataAsync)(components, data, (component, compData, row, path, components, index) => __awaiter(this, void 0, void 0, function* () {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n yield (0, processOne_1.processOne)(Object.assign(Object.assign({}, context), {\n data: compData,\n component,\n components,\n path,\n row,\n index,\n instance: instances ? instances[path] : undefined\n }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n }));\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n });\n}\nexports.process = process;\nfunction processSync(context) {\n const { instances, components, data, scope, flat, processors } = context;\n (0, formUtil_1.eachComponentData)(components, data, (component, compData, row, path, components, index) => {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n (0, processOne_1.processOneSync)(Object.assign(Object.assign({}, context), { data: compData, component,\n components,\n path,\n row,\n index, instance: instances ? instances[path] : undefined }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n });\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n}\nexports.processSync = processSync;\n// Export a record of all the supported processors.\nexports.ProcessorMap = {\n filter: filter_1.filterProcessInfo,\n defaultValue: defaultValue_1.defaultValueProcessInfo,\n serverDefaultValue: defaultValue_1.serverDefaultValueProcessInfo,\n customDefaultValue: defaultValue_1.customDefaultValueProcessInfo,\n calculate: calculation_1.calculateProcessInfo,\n conditions: conditions_1.conditionProcessInfo,\n customConditions: conditions_1.customConditionProcessInfo,\n simpleConditions: conditions_1.simpleConditionProcessInfo,\n normalize: normalize_1.normalizeProcessInfo,\n dereference: dereference_1.dereferenceProcessInfo,\n clearHidden: clearHidden_1.clearHiddenProcessInfo,\n fetch: fetch_1.fetchProcessInfo,\n logic: logic_1.logicProcessInfo,\n validate: validation_1.validateProcessInfo,\n validateCustom: validation_1.validateCustomProcessInfo,\n validateServer: validation_1.validateServerProcessInfo\n};\nexports.ProcessTargets = {\n submission: [\n filter_1.filterProcessInfo,\n defaultValue_1.serverDefaultValueProcessInfo,\n normalize_1.normalizeProcessInfo,\n dereference_1.dereferenceProcessInfo,\n fetch_1.fetchProcessInfo,\n conditions_1.simpleConditionProcessInfo,\n validation_1.validateServerProcessInfo\n ],\n evaluator: [\n defaultValue_1.customDefaultValueProcessInfo,\n calculation_1.calculateProcessInfo,\n logic_1.logicProcessInfo,\n conditions_1.conditionProcessInfo,\n clearHidden_1.clearHiddenProcessInfo,\n validation_1.validateProcessInfo\n ]\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/process.js?");
|
491
524
|
|
492
525
|
/***/ }),
|
493
526
|
|
@@ -498,7 +531,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
498
531
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
499
532
|
|
500
533
|
"use strict";
|
501
|
-
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.processOneSync = exports.processOne = exports.dataValue = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"../core/lib/types/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"../core/lib/utils/formUtil.js\");\nfunction dataValue(component, row) {\n const key = (0, formUtil_1.getComponentKey)(component);\n return key ? (0, lodash_1.get)(row, key) : undefined;\n}\nexports.dataValue = dataValue;\nfunction processOne(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { processors } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n }\n });\n }\n if (!context.row) {\n return;\n }\n context.processor = types_1.ProcessorType.Custom;\n for (const processor of processors) {\n if (processor === null || processor === void 0 ? void 0 : processor.process) {\n yield processor.process(context);\n }\n }\n });\n}\nexports.processOne = processOne;\nfunction processOneSync(context) {\n const { processors, component } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n }\n });\n }\n if (!context.row) {\n return;\n }\n context.processor = types_1.ProcessorType.Custom;\n for (const processor of processors) {\n if (processor === null || processor === void 0 ? void 0 : processor.processSync) {\n processor.processSync(context);\n }\n }\n}\nexports.processOneSync = processOneSync;\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/processOne.js?");
|
534
|
+
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.processOneSync = exports.processOne = exports.dataValue = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"../core/lib/types/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"../core/lib/utils/formUtil.js\");\nfunction dataValue(component, row) {\n const key = (0, formUtil_1.getComponentKey)(component);\n return key ? (0, lodash_1.get)(row, key) : undefined;\n}\nexports.dataValue = dataValue;\nfunction processOne(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { processors } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n enumerable: true,\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n }\n });\n }\n if (!context.row) {\n return;\n }\n context.processor = types_1.ProcessorType.Custom;\n for (const processor of processors) {\n if (processor === null || processor === void 0 ? void 0 : processor.process) {\n yield processor.process(context);\n }\n }\n });\n}\nexports.processOne = processOne;\nfunction processOneSync(context) {\n const { processors, component } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n enumerable: true,\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n }\n });\n }\n if (!context.row) {\n return;\n }\n context.processor = types_1.ProcessorType.Custom;\n for (const processor of processors) {\n if (processor === null || processor === void 0 ? void 0 : processor.processSync) {\n processor.processSync(context);\n }\n }\n}\nexports.processOneSync = processOneSync;\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/processOne.js?");
|
502
535
|
|
503
536
|
/***/ }),
|
504
537
|
|
@@ -509,7 +542,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
509
542
|
/***/ (function(__unused_webpack_module, exports) {
|
510
543
|
|
511
544
|
"use strict";
|
512
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EN_ERRORS = void 0;\nexports.EN_ERRORS = {\n unsavedRowsError: 'Please save all rows before proceeding.',\n invalidRowsError: 'Please correct invalid rows before proceeding.',\n invalidRowError: 'Invalid row. Please correct it or delete.',\n invalidOption: '{{field}} is an invalid value.',\n invalidDay: '{{field}} is not a valid day.',\n required: '{{field}} is required',\n unique: '{{field}} must be unique',\n array: '{{field}} must be an array',\n array_nonempty: '{{field}} must be a non-empty array', // eslint-disable-line camelcase\n nonarray: '{{field}} must not be an array',\n select: '{{field}} contains an invalid selection',\n pattern: '{{field}} does not match the pattern {{pattern}}',\n minLength: '{{field}} must have at least {{length}} characters.',\n maxLength: '{{field}} must have no more than {{length}} characters.',\n minWords: '{{field}} must have at least {{length}} words.',\n maxWords: '{{field}} must have no more than {{length}} words.',\n min: '{{field}} cannot be less than {{min}}.',\n max: '{{field}} cannot be greater than {{max}}.',\n maxDate: '{{field}} should not contain date after {{- maxDate}}',\n minDate: '{{field}} should not contain date before {{- minDate}}',\n maxYear: '{{field}} should not contain year greater than {{maxYear}}',\n minSelectedCount: 'You must select at least {{minCount}} items',\n maxSelectedCount: 'You may only select up to {{maxCount}} items',\n minYear: '{{field}} should not contain year less than {{minYear}}',\n invalid_email: '{{field}} must be a valid email.', // eslint-disable-line camelcase\n invalid_url: '{{field}} must be a valid url.', // eslint-disable-line camelcase\n invalid_regex: '{{field}} does not match the pattern {{regex}}.', // eslint-disable-line camelcase\n invalid_date: '{{field}} is not a valid date.', // eslint-disable-line camelcase\n invalid_day: '{{field}} is not a valid day.', // eslint-disable-line camelcase\n invalidValueProperty: 'Invalid Value Property',\n mask: '{{field}} does not match the mask.',\n valueIsNotAvailable: '{{ field }} is an invalid value.',\n captchaTokenValidation: 'ReCAPTCHA: Token validation error',\n captchaTokenNotSpecified: 'ReCAPTCHA: Token is not specified in submission',\n captchaFailure: 'ReCaptcha: Response token not found'
|
545
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EN_ERRORS = void 0;\nexports.EN_ERRORS = {\n unsavedRowsError: 'Please save all rows before proceeding.',\n invalidRowsError: 'Please correct invalid rows before proceeding.',\n invalidRowError: 'Invalid row. Please correct it or delete.',\n invalidOption: '{{field}} is an invalid value.',\n invalidDay: '{{field}} is not a valid day.',\n required: '{{field}} is required',\n unique: '{{field}} must be unique',\n array: '{{field}} must be an array',\n array_nonempty: '{{field}} must be a non-empty array', // eslint-disable-line camelcase\n nonarray: '{{field}} must not be an array',\n select: '{{field}} contains an invalid selection',\n pattern: '{{field}} does not match the pattern {{pattern}}',\n minLength: '{{field}} must have at least {{length}} characters.',\n maxLength: '{{field}} must have no more than {{length}} characters.',\n minWords: '{{field}} must have at least {{length}} words.',\n maxWords: '{{field}} must have no more than {{length}} words.',\n min: '{{field}} cannot be less than {{min}}.',\n max: '{{field}} cannot be greater than {{max}}.',\n maxDate: '{{field}} should not contain date after {{- maxDate}}',\n minDate: '{{field}} should not contain date before {{- minDate}}',\n maxYear: '{{field}} should not contain year greater than {{maxYear}}',\n minSelectedCount: 'You must select at least {{minCount}} items',\n maxSelectedCount: 'You may only select up to {{maxCount}} items',\n minYear: '{{field}} should not contain year less than {{minYear}}',\n invalid_email: '{{field}} must be a valid email.', // eslint-disable-line camelcase\n invalid_url: '{{field}} must be a valid url.', // eslint-disable-line camelcase\n invalid_regex: '{{field}} does not match the pattern {{regex}}.', // eslint-disable-line camelcase\n invalid_date: '{{field}} is not a valid date.', // eslint-disable-line camelcase\n invalid_day: '{{field}} is not a valid day.', // eslint-disable-line camelcase\n invalidValueProperty: 'Invalid Value Property',\n mask: '{{field}} does not match the mask.',\n valueIsNotAvailable: '{{ field }} is an invalid value.',\n captchaTokenValidation: 'ReCAPTCHA: Token validation error',\n captchaTokenNotSpecified: 'ReCAPTCHA: Token is not specified in submission',\n captchaFailure: 'ReCaptcha: Response token not found',\n time: '{{field}} is not a valid time',\n invalidDate: '{{field}} is not a valid date',\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/validation/i18n/en.js?");
|
513
546
|
|
514
547
|
/***/ }),
|
515
548
|
|
@@ -619,7 +652,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
619
652
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
620
653
|
|
621
654
|
"use strict";
|
622
|
-
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.validateCustomInfo = exports.validateCustomSync = exports.shouldValidate = exports.validateCustom = void 0;\nconst
|
655
|
+
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.validateCustomInfo = exports.validateCustomSync = exports.shouldValidate = exports.validateCustom = void 0;\nconst FieldError_1 = __webpack_require__(/*! ../../../error/FieldError */ \"../core/lib/error/FieldError.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"../core/lib/utils/index.js\");\nconst validateCustom = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateCustomSync)(context);\n});\nexports.validateCustom = validateCustom;\nconst shouldValidate = (context) => {\n var _a;\n const { component, value } = context;\n const customValidation = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.custom;\n if (!customValidation) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateCustomSync = (context) => {\n var _a;\n const { component, data, row, value, index, instance, evalContext } = context;\n const customValidation = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.custom;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const evalContextValue = Object.assign(Object.assign({}, ((instance === null || instance === void 0 ? void 0 : instance.evalContext) ? instance.evalContext() : (evalContext ? evalContext(context) : context))), { component,\n data,\n row, rowIndex: index, instance, valid: true, input: value });\n const isValid = utils_1.Evaluator.evaluate(customValidation, evalContextValue, 'valid', true, {}, {});\n if (isValid === null || isValid === true) {\n return null;\n }\n return new FieldError_1.FieldError(typeof isValid === 'string' ? isValid : 'custom', Object.assign(Object.assign({}, context), { hasLabel: false }));\n};\nexports.validateCustomSync = validateCustomSync;\nexports.validateCustomInfo = {\n name: 'validateCustom',\n process: exports.validateCustom,\n processSync: exports.validateCustomSync,\n shouldProcess: exports.shouldValidate\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/validation/rules/validateCustom.js?");
|
623
656
|
|
624
657
|
/***/ }),
|
625
658
|
|
@@ -663,7 +696,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
663
696
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
664
697
|
|
665
698
|
"use strict";
|
666
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateJsonInfo = exports.validateJsonSync = exports.validateJson = exports.shouldValidate = void 0;\nconst jsonlogic_1 = __importDefault(__webpack_require__(/*! ../../../modules/jsonlogic */ \"../core/lib/modules/jsonlogic/index.js\"));\nconst error_1 = __webpack_require__(/*! ../../../error */ \"../core/lib/error/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst shouldValidate = (context) => {\n var _a;\n const { component
|
699
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateJsonInfo = exports.validateJsonSync = exports.validateJson = exports.shouldValidate = void 0;\nconst jsonlogic_1 = __importDefault(__webpack_require__(/*! ../../../modules/jsonlogic */ \"../core/lib/modules/jsonlogic/index.js\"));\nconst error_1 = __webpack_require__(/*! ../../../error */ \"../core/lib/error/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n if (!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.json) || !(0, lodash_1.isObject)(component.validate.json)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateJson = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateJsonSync)(context);\n});\nexports.validateJson = validateJson;\nconst validateJsonSync = (context) => {\n var _a;\n const { component, data, value, evalContext } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const func = (_a = component === null || component === void 0 ? void 0 : component.validate) === null || _a === void 0 ? void 0 : _a.json;\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = value || null;\n const valid = jsonlogic_1.default.evaluator.evaluate(func, Object.assign(Object.assign({}, evalContextValue), { input: value }), 'valid');\n if (valid === null) {\n return null;\n }\n return valid === true\n ? null\n : new error_1.FieldError(valid || 'jsonLogic', context);\n};\nexports.validateJsonSync = validateJsonSync;\nexports.validateJsonInfo = {\n name: 'validateJson',\n process: exports.validateJson,\n processSync: exports.validateJsonSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/validation/rules/validateJson.js?");
|
667
700
|
|
668
701
|
/***/ }),
|
669
702
|
|
@@ -817,7 +850,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
817
850
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
818
851
|
|
819
852
|
"use strict";
|
820
|
-
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 */ \"../core/node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"../core/lib/error/index.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 || component.as !== 'json') {\n return false;\n }\n return true;\n default:\n return true;\n }\n};\nexports.isEligible = isEligible;\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 return !!component.multiple;\n case 'tags':\n return component.storeas !== 'string';\n default:\n return false;\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 shouldBeArray = !!component.multiple;\n const isRequired = !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required);\n const isArray = Array.isArray(value);\n if (shouldBeArray) {\n if (isArray) {\n return isRequired ? value.length > 0 ? null : new error_1.FieldError('array_nonempty', 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);\n if (!canBeArray && isArray) {\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/../core/lib/process/validation/rules/validateMultiple.js?");
|
853
|
+
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 */ \"../core/node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"../core/lib/error/index.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 || component.as !== 'json') {\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 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 return !!component.multiple;\n case 'tags':\n return component.storeas !== 'string';\n default:\n return false;\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 shouldBeArray = !!component.multiple;\n const isRequired = !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required);\n const isArray = Array.isArray(value);\n if (shouldBeArray) {\n if (isArray) {\n return isRequired ? value.length > 0 ? null : new error_1.FieldError('array_nonempty', 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);\n if (!canBeArray && isArray) {\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/../core/lib/process/validation/rules/validateMultiple.js?");
|
821
854
|
|
822
855
|
/***/ }),
|
823
856
|
|
@@ -872,7 +905,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
872
905
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
873
906
|
|
874
907
|
"use strict";
|
875
|
-
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.validateTimeInfo = exports.validateTime = exports.validateTimeSync = exports.shouldValidate = void 0;\nconst
|
908
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateTimeInfo = exports.validateTime = exports.validateTimeSync = exports.shouldValidate = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"../core/lib/utils/formUtil.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"../core/lib/error/index.js\");\nconst date_1 = __webpack_require__(/*! ../../../utils/date */ \"../core/lib/utils/date.js\");\nconst customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"../core/node_modules/dayjs/plugin/customParseFormat.js\"));\ndate_1.dayjs.extend(customParseFormat_1.default);\nconst isValidatableTimeComponent = (comp) => {\n return comp && comp.type === 'time';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableTimeComponent(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateTimeSync = (context) => {\n const { component, data, path, value, config } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n try {\n if (!value || (0, formUtil_1.isComponentDataEmpty)(component, data, path))\n return null;\n // Server side evaluations of validity should use the \"dataFormat\" vs the \"format\" which is used on the client.\n const format = (config === null || config === void 0 ? void 0 : config.server) ?\n (component.dataFormat || 'HH:mm:ss') :\n (component.format || 'HH:mm');\n const isValid = (0, date_1.dayjs)(String(value), format, true).isValid();\n return isValid ? null : new error_1.FieldError('time', context);\n }\n catch (err) {\n throw new error_1.ValidatorError(`Could not validate time component ${component.key} with value ${value}`);\n }\n};\nexports.validateTimeSync = validateTimeSync;\nconst validateTime = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateTimeSync)(context);\n});\nexports.validateTime = validateTime;\nexports.validateTimeInfo = {\n name: 'validateTime',\n process: exports.validateTime,\n processSync: exports.validateTimeSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/../core/lib/process/validation/rules/validateTime.js?");
|
876
909
|
|
877
910
|
/***/ }),
|
878
911
|
|
@@ -916,7 +949,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
916
949
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
917
950
|
|
918
951
|
"use strict";
|
919
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.interpolateErrors = exports.
|
952
|
+
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 */ \"../core/lib/utils/index.js\");\nconst i18n_1 = __webpack_require__(/*! ./i18n */ \"../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;\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 = i18n[errorKeyOrMessage] ? 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: errorKeyOrMessage || context.processor,\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/../core/lib/process/validation/util.js?");
|
920
953
|
|
921
954
|
/***/ }),
|
922
955
|
|
@@ -1565,7 +1598,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1565
1598
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1566
1599
|
|
1567
1600
|
"use strict";
|
1568
|
-
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.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.isComponentModelType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst Evaluator_1 = __webpack_require__(/*! ./Evaluator */ \"../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) {\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;\nexports.MODEL_TYPES = {\n array: [\n 'datagrid',\n 'editgrid',\n 'datatable',\n 'dynamicWizard',\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 layout: [\n 'table',\n 'tabs',\n 'well',\n 'columns',\n 'fieldset',\n 'panel',\n 'tabs'\n ],\n};\nfunction getModelType(component) {\n if (isComponentNestedDataType(component)) {\n if (isComponentModelType(component, 'dataObject')) {\n return 'dataObject';\n }\n if (isComponentModelType(component, 'array')) {\n return 'array';\n }\n return 'object';\n }\n if ((component.input === false) || isComponentModelType(component, 'layout')) {\n return 'inherit';\n }\n if (getComponentKey(component)) {\n return 'value';\n }\n return 'inherit';\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 (isComponentModelType(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) === 'inherit') ? `${path}.${key}` : path;\n}\nexports.getComponentPath = getComponentPath;\nfunction isComponentModelType(component, modelType) {\n return component.modelType === modelType || exports.MODEL_TYPES[modelType].includes(component.type);\n}\nexports.isComponentModelType = isComponentModelType;\nfunction isComponentNestedDataType(component) {\n return component.tree || isComponentModelType(component, 'array') ||\n isComponentModelType(component, 'dataObject') ||\n isComponentModelType(component, 'object') ||\n isComponentModelType(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 componentChildPath = (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 (isComponentModelType(component, 'dataObject')) {\n return `${path}.data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath === undefined ? path : parentPath;\n }\n return path;\n};\nexports.componentChildPath = componentChildPath;\n// Async each component data.\nconst eachComponentDataAsync = (components, data, fn, path = \"\", index, parent) => __awaiter(void 0, void 0, void 0, function* () {\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);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row)) {\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 (isComponentModelType(component, 'dataObject')) {\n // No need to bother processing all the children data if there is no data for this form.\n if ((0, lodash_1.has)(data, component.path)) {\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.componentChildPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, null);\n yield (0, exports.eachComponentDataAsync)(component.components, childData, fn, '', index, component);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, (0, exports.componentChildPath)(component, path, compPath), index, component);\n }\n return true;\n }\n else {\n return false;\n }\n }), true, path, parent);\n});\nexports.eachComponentDataAsync = eachComponentDataAsync;\nconst eachComponentData = (components, data, fn, path = \"\", index, parent) => {\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);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row)) {\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 (isComponentModelType(component, 'dataObject')) {\n // No need to bother processing all the children data if there is no data for this form.\n if ((0, lodash_1.has)(data, component.path)) {\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.componentChildPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, {});\n (0, exports.eachComponentData)(component.components, childData, fn, '', index, component);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n (0, exports.eachComponentData)(component.components, data, fn, (0, exports.componentChildPath)(component, path, compPath), index, component);\n }\n return true;\n }\n else {\n return false;\n }\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 return {\n hasColumns,\n hasRows,\n hasComps,\n iterable: hasColumns || hasRows || hasComps || isComponentModelType(component, 'content'),\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 component.parent.path = parent.path;\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.iterable) {\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.componentChildPath)(component, path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponent = eachComponent;\n// Async each component.\nfunction eachComponentAsync(components, fn, includeAll = false, path = \"\", parent) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function* () {\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 component.parent.path = parent.path;\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.iterable) {\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.componentChildPath)(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(compPath, data, row) {\n let value = null;\n if (row) {\n value = (0, lodash_1.get)(row, compPath);\n }\n if (data && (0, lodash_1.isNil)(value)) {\n value = (0, lodash_1.get)(data, compPath);\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\n//# sourceURL=webpack://Formio/../core/lib/utils/formUtil.js?");
|
1601
|
+
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.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.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.isComponentModelType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"../core/node_modules/lodash/lodash.js\");\nconst fast_json_patch_1 = __webpack_require__(/*! fast-json-patch */ \"../core/node_modules/fast-json-patch/index.mjs\");\nconst Evaluator_1 = __webpack_require__(/*! ./Evaluator */ \"../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) {\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;\nexports.MODEL_TYPES = {\n array: [\n 'datagrid',\n 'editgrid',\n 'datatable',\n 'dynamicWizard',\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 layout: [\n 'table',\n 'tabs',\n 'well',\n 'columns',\n 'fieldset',\n 'panel',\n 'tabs'\n ],\n};\nfunction getModelType(component) {\n if (isComponentNestedDataType(component)) {\n if (isComponentModelType(component, 'dataObject')) {\n return 'dataObject';\n }\n if (isComponentModelType(component, 'array')) {\n return 'array';\n }\n return 'object';\n }\n if ((component.input === false) || isComponentModelType(component, 'layout')) {\n return 'inherit';\n }\n if (getComponentKey(component)) {\n return 'value';\n }\n return 'inherit';\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 (isComponentModelType(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) === 'inherit') ? `${path}.${key}` : path;\n}\nexports.getComponentPath = getComponentPath;\nfunction isComponentModelType(component, modelType) {\n return component.modelType === modelType || exports.MODEL_TYPES[modelType].includes(component.type);\n}\nexports.isComponentModelType = isComponentModelType;\nfunction isComponentNestedDataType(component) {\n return component.tree || isComponentModelType(component, 'array') ||\n isComponentModelType(component, 'dataObject') ||\n isComponentModelType(component, 'object') ||\n isComponentModelType(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 componentChildPath = (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 (isComponentModelType(component, 'dataObject')) {\n return `${path}.data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath === undefined ? path : parentPath;\n }\n return path;\n};\nexports.componentChildPath = componentChildPath;\n// Async each component data.\nconst eachComponentDataAsync = (components, data, fn, path = \"\", index, parent) => __awaiter(void 0, void 0, void 0, function* () {\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);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row)) {\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 (isComponentModelType(component, 'dataObject')) {\n // No need to bother processing all the children data if there is no data for this form.\n if ((0, lodash_1.has)(data, component.path)) {\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.componentChildPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, null);\n yield (0, exports.eachComponentDataAsync)(component.components, childData, fn, '', index, component);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, (0, exports.componentChildPath)(component, path, compPath), index, component);\n }\n return true;\n }\n else {\n return false;\n }\n }), true, path, parent);\n});\nexports.eachComponentDataAsync = eachComponentDataAsync;\nconst eachComponentData = (components, data, fn, path = \"\", index, parent) => {\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);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row)) {\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 (isComponentModelType(component, 'dataObject')) {\n // No need to bother processing all the children data if there is no data for this form.\n if ((0, lodash_1.has)(data, component.path)) {\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.componentChildPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, {});\n (0, exports.eachComponentData)(component.components, childData, fn, '', index, component);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n (0, exports.eachComponentData)(component.components, data, fn, (0, exports.componentChildPath)(component, path, compPath), index, component);\n }\n return true;\n }\n else {\n return false;\n }\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 return {\n hasColumns,\n hasRows,\n hasComps,\n iterable: hasColumns || hasRows || hasComps || isComponentModelType(component, 'content'),\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.iterable) {\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.componentChildPath)(component, path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponent = eachComponent;\n// Async each component.\nfunction eachComponentAsync(components, fn, includeAll = false, path = \"\", parent) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function* () {\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.iterable) {\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.componentChildPath)(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(compPath, data, row) {\n let value = null;\n if (row) {\n value = (0, lodash_1.get)(row, compPath);\n }\n if (data && (0, lodash_1.isNil)(value)) {\n value = (0, lodash_1.get)(data, compPath);\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\n * The components to iterate.\n * @param {String|Object} key\n * The key of the component to get, or a query of the component to search.\n *\n * @returns {Object}\n * The component that matches the given key, or undefined if not found.\n */\nfunction getComponent(components, key, includeAll) {\n let result;\n eachComponent(components, (component, path) => {\n if ((path === key) || (component.path === 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 * 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.condition)));\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.type === 'checkbox';\nconst isDataGridComponent = (component) => component.type === 'datagrid';\nconst isEditGridComponent = (component) => component.type === 'editgrid';\nconst isDataTableComponent = (component) => component.type === 'datatable';\nconst hasChildComponents = (component) => component.components != null;\nconst isDateTimeComponent = (component) => component.type === 'datetime';\nconst isSelectBoxesComponent = (component) => component.type === 'selectboxes';\nconst isTextAreaComponent = (component) => component.type === 'textarea';\nconst isTextFieldComponent = (component) => 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> </p>';\n const br = '<p><br></p>';\n const brNbsp = '<p><br> </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 // TODO: eachComponentData currently can't handle passing child components directly because it won't get the path right;\n // wrapping component in an array and skipping it's callback is a workaround to start with the correct path, but it is not ideal\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/../core/lib/utils/formUtil.js?");
|
1569
1602
|
|
1570
1603
|
/***/ }),
|
1571
1604
|
|
@@ -1631,7 +1664,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\ncons
|
|
1631
1664
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1632
1665
|
|
1633
1666
|
"use strict";
|
1634
|
-
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 */ \"../core/lib/utils/operators/ConditionOperator.js\"));\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"../core/node_modules/moment/moment.js\"));\nclass DateGeaterThan extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'dateGreaterThan';\n }\n static get displayedName() {\n return 'Greater Than';\n }\n getFormattedDates({ value, comparedValue, conditionTriggerComponent }) {\n const hasValidationFormat = conditionTriggerComponent ? conditionTriggerComponent.
|
1667
|
+
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 */ \"../core/lib/utils/operators/ConditionOperator.js\"));\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"../core/node_modules/moment/moment.js\"));\nconst date_1 = __webpack_require__(/*! ../../utils/date */ \"../core/lib/utils/date.js\");\nclass DateGeaterThan extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'dateGreaterThan';\n }\n static get displayedName() {\n return 'Greater Than';\n }\n getFormattedDates({ value, comparedValue, conditionTriggerComponent }) {\n const hasValidationFormat = conditionTriggerComponent && conditionTriggerComponent.component.type === 'day' ? (0, date_1.getDateValidationFormat)(conditionTriggerComponent.component) : null;\n const date = hasValidationFormat ? (0, moment_1.default)(value, conditionTriggerComponent.getValidationFormat()) : (0, moment_1.default)(value);\n const comparedDate = hasValidationFormat ? (0, moment_1.default)(comparedValue, conditionTriggerComponent.getValidationFormat()) : (0, moment_1.default)(comparedValue);\n return { date, comparedDate };\n }\n execute(options, functionName = 'isAfter') {\n const { value, instance, conditionComponentPath } = options;\n if (!value) {\n return false;\n }\n let conditionTriggerComponent = null;\n if (instance && instance.root) {\n conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);\n }\n if (conditionTriggerComponent && conditionTriggerComponent.component.type === 'day' && (0, date_1.isPartialDay)(conditionTriggerComponent.component, value)) {\n return false;\n }\n const { date, comparedDate } = this.getFormattedDates(Object.assign(Object.assign({}, options), { conditionTriggerComponent }));\n return date[functionName](comparedDate);\n }\n}\nexports[\"default\"] = DateGeaterThan;\n\n\n//# sourceURL=webpack://Formio/../core/lib/utils/operators/DateGreaterThan.js?");
|
1635
1668
|
|
1636
1669
|
/***/ }),
|
1637
1670
|
|
@@ -1933,7 +1966,7 @@ eval("!function(t,i){ true?module.exports=i():0}(this,(function(){\"use strict\"
|
|
1933
1966
|
\*****************************************************/
|
1934
1967
|
/***/ (function(module) {
|
1935
1968
|
|
1936
|
-
eval("/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */\n\n(function (global, factory) {\n true ? module.exports = factory() :\n 0;\n})(this, (function () { 'use strict';\n\n const {\n entries,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor\n } = Object;\n let {\n freeze,\n seal,\n create\n } = Object; // eslint-disable-line import/no-mutable-exports\n let {\n apply,\n construct\n } = typeof Reflect !== 'undefined' && Reflect;\n if (!freeze) {\n freeze = function freeze(x) {\n return x;\n };\n }\n if (!seal) {\n seal = function seal(x) {\n return x;\n };\n }\n if (!apply) {\n apply = function apply(fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n }\n if (!construct) {\n construct = function construct(Func, args) {\n return new Func(...args);\n };\n }\n const arrayForEach = unapply(Array.prototype.forEach);\n const arrayPop = unapply(Array.prototype.pop);\n const arrayPush = unapply(Array.prototype.push);\n const stringToLowerCase = unapply(String.prototype.toLowerCase);\n const stringToString = unapply(String.prototype.toString);\n const stringMatch = unapply(String.prototype.match);\n const stringReplace = unapply(String.prototype.replace);\n const stringIndexOf = unapply(String.prototype.indexOf);\n const stringTrim = unapply(String.prototype.trim);\n const regExpTest = unapply(RegExp.prototype.test);\n const typeErrorCreate = unconstruct(TypeError);\n\n /**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param {Function} func - The function to be wrapped and called.\n * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.\n */\n function unapply(func) {\n return function (thisArg) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n return apply(func, thisArg, args);\n };\n }\n\n /**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param {Function} func - The constructor function to be wrapped and called.\n * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.\n */\n function unconstruct(func) {\n return function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return construct(func, args);\n };\n }\n\n /**\n * Add properties to a lookup table\n *\n * @param {Object} set - The set to which elements will be added.\n * @param {Array} array - The array containing elements to be added to the set.\n * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns {Object} The modified set with added elements.\n */\n function addToSet(set, array) {\n let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n let l = array.length;\n while (l--) {\n let element = array[l];\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n element = lcElement;\n }\n }\n set[element] = true;\n }\n return set;\n }\n\n /**\n * Clean up an array to harden against CSPP\n *\n * @param {Array} array - The array to be cleaned.\n * @returns {Array} The cleaned version of the array\n */\n function cleanArray(array) {\n for (let index = 0; index < array.length; index++) {\n if (getOwnPropertyDescriptor(array, index) === undefined) {\n array[index] = null;\n }\n }\n return array;\n }\n\n /**\n * Shallow clone an object\n *\n * @param {Object} object - The object to be cloned.\n * @returns {Object} A new object that copies the original.\n */\n function clone(object) {\n const newObject = create(null);\n for (const [property, value] of entries(object)) {\n if (getOwnPropertyDescriptor(object, property) !== undefined) {\n if (Array.isArray(value)) {\n newObject[property] = cleanArray(value);\n } else if (value && typeof value === 'object' && value.constructor === Object) {\n newObject[property] = clone(value);\n } else {\n newObject[property] = value;\n }\n }\n }\n return newObject;\n }\n\n /**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param {Object} object - The object to look up the getter function in its prototype chain.\n * @param {String} prop - The property name for which to find the getter function.\n * @returns {Function} The getter function found in the prototype chain or a fallback function.\n */\n function lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n object = getPrototypeOf(object);\n }\n function fallbackValue(element) {\n console.warn('fallback value for', element);\n return null;\n }\n return fallbackValue;\n }\n\n const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);\n\n // SVG\n const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\n const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);\n\n // List of SVG elements that are disallowed by default.\n // We still need to know them so that we can do namespace\n // checks properly in case one wants to add them to\n // allow-list.\n const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\n const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);\n\n // Similarly to SVG, we want to know all MathML elements,\n // even those that we disallow by default.\n const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\n const text = freeze(['#text']);\n\n const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\n const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\n const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\n const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n // eslint-disable-next-line unicorn/better-regex\n const MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n const ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\n const TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\n const DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n const ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n );\n\n const IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\n const ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n );\n\n const DOCTYPE_NAME = seal(/^html$/i);\n\n var EXPRESSIONS = /*#__PURE__*/Object.freeze({\n __proto__: null,\n MUSTACHE_EXPR: MUSTACHE_EXPR,\n ERB_EXPR: ERB_EXPR,\n TMPLIT_EXPR: TMPLIT_EXPR,\n DATA_ATTR: DATA_ATTR,\n ARIA_ATTR: ARIA_ATTR,\n IS_ALLOWED_URI: IS_ALLOWED_URI,\n IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE: ATTR_WHITESPACE,\n DOCTYPE_NAME: DOCTYPE_NAME\n });\n\n const getGlobal = function getGlobal() {\n return typeof window === 'undefined' ? null : window;\n };\n\n /**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\n const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n return null;\n }\n\n // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n suffix = purifyHostElement.getAttribute(ATTR_NAME);\n }\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n createScriptURL(scriptUrl) {\n return scriptUrl;\n }\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n return null;\n }\n };\n function createDOMPurify() {\n let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n const DOMPurify = root => createDOMPurify(root);\n\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n DOMPurify.version = '3.0.8';\n\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n DOMPurify.removed = [];\n if (!window || !window.document || window.document.nodeType !== 9) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n return DOMPurify;\n }\n let {\n document\n } = window;\n const originalDocument = document;\n const currentScript = originalDocument.currentScript;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes\n } = window;\n const ElementPrototype = Element.prototype;\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n\n // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n let trustedTypesPolicy;\n let emptyHTML = '';\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName\n } = document;\n const {\n importNode\n } = originalDocument;\n let hooks = {};\n\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n TMPLIT_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE\n } = EXPRESSIONS;\n let {\n IS_ALLOWED_URI: IS_ALLOWED_URI$1\n } = EXPRESSIONS;\n\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n\n /* Allowed attribute names */\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false\n }\n }));\n\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n let FORBID_TAGS = null;\n\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n let FORBID_ATTR = null;\n\n /* Decide if ARIA attributes are okay */\n let ALLOW_ARIA_ATTR = true;\n\n /* Decide if custom data attributes are okay */\n let ALLOW_DATA_ATTR = true;\n\n /* Decide if unknown protocols are okay */\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n\n /* Decide if self-closing tags in attributes are allowed.\n * Usually removed due to a mXSS issue in jQuery 3.0 */\n let ALLOW_SELF_CLOSE_IN_ATTR = true;\n\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n let SAFE_FOR_TEMPLATES = false;\n\n /* Decide if document with <html>... should be returned */\n let WHOLE_DOCUMENT = false;\n\n /* Track whether config is already set on this instance of DOMPurify. */\n let SET_CONFIG = false;\n\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n let FORCE_BODY = false;\n\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n let RETURN_DOM = false;\n\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n let RETURN_DOM_FRAGMENT = false;\n\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n let RETURN_TRUSTED_TYPE = false;\n\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n let SANITIZE_DOM = true;\n\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n let SANITIZE_NAMED_PROPS = false;\n const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n\n /* Keep element content when removing element? */\n let KEEP_CONTENT = true;\n\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n let IN_PLACE = false;\n\n /* Allow usage of profiles like html, svg and mathMl */\n let USE_PROFILES = {};\n\n /* Tags to ignore content of when KEEP_CONTENT is true */\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n\n /* Tags that are safe for data: URIs */\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n\n /* Attributes safe for values like \"javascript:\" */\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n\n /* Allowed XHTML+XML namespaces */\n let ALLOWED_NAMESPACES = null;\n const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n\n /* Parsing of strict XHTML documents */\n let PARSER_MEDIA_TYPE = null;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc = null;\n\n /* Keep a reference to config to pass to hooks */\n let CONFIG = null;\n\n /* Ideally, do not touch anything below this line */\n /* ______________________________________________ */\n\n const formElement = document.createElement('form');\n const isRegexOrFunction = function isRegexOrFunction(testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n const _parseConfig = function _parseConfig() {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n\n /* Shield configuration object from tampering */\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n\n /* Shield configuration object from prototype pollution */\n cfg = clone(cfg);\n PARSER_MEDIA_TYPE =\n // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;\n\n // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n\n /* Set configuration parameters */\n ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),\n // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR,\n // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS),\n // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS,\n // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n\n /* Parse profile info */\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, text);\n ALLOWED_ATTR = [];\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, html$1);\n addToSet(ALLOWED_ATTR, html);\n }\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, svg$1);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, svgFilters);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, mathMl$1);\n addToSet(ALLOWED_ATTR, mathMl);\n addToSet(ALLOWED_ATTR, xml);\n }\n }\n\n /* Merge configuration parameters */\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n\n /* Add #text in case KEEP_CONTENT is set to true */\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n if (cfg.TRUSTED_TYPES_POLICY) {\n if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n }\n if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n }\n\n // Overwrite existing TrustedTypes policy.\n trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;\n\n // Sign local variables required by `sanitize`.\n emptyHTML = trustedTypesPolicy.createHTML('');\n } else {\n // Uninitialized policy, attempt to initialize the internal dompurify policy.\n if (trustedTypesPolicy === undefined) {\n trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n }\n\n // If creating the internal policy succeeded sign internal variables.\n if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n emptyHTML = trustedTypesPolicy.createHTML('');\n }\n }\n\n // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n if (freeze) {\n freeze(cfg);\n }\n CONFIG = cfg;\n };\n const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);\n\n // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);\n const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);\n\n /**\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n const _checkValidNamespace = function _checkValidNamespace(element) {\n let parent = getParentNode(element);\n\n // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template'\n };\n }\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via <svg>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n }\n\n // The only way to switch from MathML to SVG is via`\n // svg if parent is either <annotation-xml> or MathML\n // text integration points.\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n }\n\n // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via <math>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n }\n\n // The only way to switch from SVG to MathML is via\n // <math> and HTML integration points\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n }\n\n // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n\n // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n }\n\n // For XHTML and XML documents that support custom namespaces\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n return true;\n }\n\n // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n return false;\n };\n\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n const _forceRemove = function _forceRemove(node) {\n arrayPush(DOMPurify.removed, {\n element: node\n });\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n node.parentNode.removeChild(node);\n } catch (_) {\n node.remove();\n }\n };\n\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n const _removeAttribute = function _removeAttribute(name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node\n });\n }\n node.removeAttribute(name);\n\n // We void attribute values for unremovable \"is\"\" attributes\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n const _initDocument = function _initDocument(dirty) {\n /* Create a HTML document */\n let doc = null;\n let leadingWhitespace = null;\n if (FORCE_BODY) {\n dirty = '<remove></remove>' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n }\n const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n\n /* Use createHTMLDocument in case DOMParser is not available */\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n } catch (_) {\n // Syntax error if dirtyPayload is invalid xml\n }\n }\n const body = doc.body || doc.documentElement;\n if (dirty && leadingWhitespace) {\n body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n }\n\n /* Work on whole document or just its body */\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n }\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n *\n * @param {Node} root The root element or node to start traversing on.\n * @return {NodeIterator} The created NodeIterator\n */\n const _createNodeIterator = function _createNodeIterator(root) {\n return createNodeIterator.call(root.ownerDocument || root, root,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);\n };\n\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n const _isClobbered = function _isClobbered(elm) {\n return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n };\n\n /**\n * Checks whether the given object is a DOM node.\n *\n * @param {Node} object object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n const _isNode = function _isNode(object) {\n return typeof Node === 'function' && object instanceof Node;\n };\n\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n const _executeHook = function _executeHook(entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n arrayForEach(hooks[entryPoint], hook => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n const _sanitizeElements = function _sanitizeElements(currentNode) {\n let content = null;\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeElements', currentNode, null);\n\n /* Check if element is clobbered or can clobber */\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Now let's check the element's type and name */\n const tagName = transformCaseFunc(currentNode.nodeName);\n\n /* Execute a hook if present */\n _executeHook('uponSanitizeElement', currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS\n });\n\n /* Detect mXSS attempts abusing namespace confusion */\n if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove element if anything forbids its presence */\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n /* Check if we have a custom element to handle */\n if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {\n return false;\n }\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {\n return false;\n }\n }\n\n /* Keep content except for bad-listed elements */\n if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n if (childNodes && parentNode) {\n const childCount = childNodes.length;\n for (let i = childCount - 1; i >= 0; --i) {\n parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n }\n }\n }\n _forceRemove(currentNode);\n return true;\n }\n\n /* Check whether element has a valid namespace */\n if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Make sure that older browsers don't get fallback-tag mXSS */\n if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Sanitize element content to be template-safe */\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n /* Get the element's text content */\n content = currentNode.textContent;\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n content = stringReplace(content, expr, ' ');\n });\n if (currentNode.textContent !== content) {\n arrayPush(DOMPurify.removed, {\n element: currentNode.cloneNode()\n });\n currentNode.textContent = content;\n }\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeElements', currentNode, null);\n return false;\n };\n\n /**\n * _isValidAttribute\n *\n * @param {string} lcTag Lowercase tag name of containing element.\n * @param {string} lcName Lowercase attribute name.\n * @param {string} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid, otherwise false.\n */\n // eslint-disable-next-line complexity\n const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n /* Make sure attribute cannot clobber */\n if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n return false;\n }\n\n /* Allow valid data-* attributes: At least one character after \"-\"\n (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n We don't need to check the value; it's always URI safe. */\n if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n if (\n // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||\n // Alternative, second condition checks if it's an `is`-attribute, AND\n // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {\n return false;\n }\n /* Check value is safe. First, is attr inert? If so, is safe */\n } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {\n return false;\n } else ;\n return true;\n };\n\n /**\n * _isBasicCustomElement\n * checks if at least one dash is included in tagName, and it's not the first char\n * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n *\n * @param {string} tagName name of the tag of the node to sanitize\n * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n */\n const _isBasicCustomElement = function _isBasicCustomElement(tagName) {\n return tagName.indexOf('-') > 0;\n };\n\n /**\n * _sanitizeAttributes\n *\n * @protect attributes\n * @protect nodeName\n * @protect removeAttribute\n * @protect setAttribute\n *\n * @param {Node} currentNode to sanitize\n */\n const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n /* Execute a hook if present */\n _executeHook('beforeSanitizeAttributes', currentNode, null);\n const {\n attributes\n } = currentNode;\n\n /* Check if we have attributes; if not we might have a text node */\n if (!attributes) {\n return;\n }\n const hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR\n };\n let l = attributes.length;\n\n /* Go backwards over all attributes; safely remove bad ones */\n while (l--) {\n const attr = attributes[l];\n const {\n name,\n namespaceURI,\n value: attrValue\n } = attr;\n const lcName = transformCaseFunc(name);\n let value = name === 'value' ? attrValue : stringTrim(attrValue);\n\n /* Execute a hook if present */\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n value = hookEvent.attrValue;\n /* Did the hooks approve of the attribute? */\n if (hookEvent.forceKeepAttr) {\n continue;\n }\n\n /* Remove attribute */\n _removeAttribute(name, currentNode);\n\n /* Did the hooks approve of the attribute? */\n if (!hookEvent.keepAttr) {\n continue;\n }\n\n /* Work around a security issue in jQuery 3.0 */\n if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n\n /* Sanitize attribute content to be template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n value = stringReplace(value, expr, ' ');\n });\n }\n\n /* Is `value` valid for this attribute? */\n const lcTag = transformCaseFunc(currentNode.nodeName);\n if (!_isValidAttribute(lcTag, lcName, value)) {\n continue;\n }\n\n /* Full DOM Clobbering protection via namespace isolation,\n * Prefix id and name attributes with `user-content-`\n */\n if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n // Remove the attribute with this value\n _removeAttribute(name, currentNode);\n\n // Prefix the value and later re-create the attribute with the sanitized value\n value = SANITIZE_NAMED_PROPS_PREFIX + value;\n }\n\n /* Handle attributes that require Trusted Types */\n if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n if (namespaceURI) ; else {\n switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n case 'TrustedHTML':\n {\n value = trustedTypesPolicy.createHTML(value);\n break;\n }\n case 'TrustedScriptURL':\n {\n value = trustedTypesPolicy.createScriptURL(value);\n break;\n }\n }\n }\n }\n\n /* Handle invalid data-* attribute set by try-catching it */\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n arrayPop(DOMPurify.removed);\n } catch (_) {}\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeAttributes', currentNode, null);\n };\n\n /**\n * _sanitizeShadowDOM\n *\n * @param {DocumentFragment} fragment to iterate over recursively\n */\n const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n let shadowNode = null;\n const shadowIterator = _createNodeIterator(fragment);\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeShadowDOM', fragment, null);\n while (shadowNode = shadowIterator.nextNode()) {\n /* Execute a hook if present */\n _executeHook('uponSanitizeShadowNode', shadowNode, null);\n\n /* Sanitize tags and elements */\n if (_sanitizeElements(shadowNode)) {\n continue;\n }\n\n /* Deep shadow DOM detected */\n if (shadowNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(shadowNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(shadowNode);\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeShadowDOM', fragment, null);\n };\n\n /**\n * Sanitize\n * Public method providing core sanitation functionality\n *\n * @param {String|Node} dirty string or DOM node\n * @param {Object} cfg object\n */\n // eslint-disable-next-line complexity\n DOMPurify.sanitize = function (dirty) {\n let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n let body = null;\n let importedNode = null;\n let currentNode = null;\n let returnNode = null;\n /* Make sure we have a string to sanitize.\n DO NOT return early, as this will return the wrong type if\n the user has requested a DOM object rather than a string */\n IS_EMPTY_INPUT = !dirty;\n if (IS_EMPTY_INPUT) {\n dirty = '<!-->';\n }\n\n /* Stringify, in case dirty is an object */\n if (typeof dirty !== 'string' && !_isNode(dirty)) {\n if (typeof dirty.toString === 'function') {\n dirty = dirty.toString();\n if (typeof dirty !== 'string') {\n throw typeErrorCreate('dirty is not a string, aborting');\n }\n } else {\n throw typeErrorCreate('toString is not a function');\n }\n }\n\n /* Return dirty HTML if DOMPurify cannot run */\n if (!DOMPurify.isSupported) {\n return dirty;\n }\n\n /* Assign config vars */\n if (!SET_CONFIG) {\n _parseConfig(cfg);\n }\n\n /* Clean up removed elements */\n DOMPurify.removed = [];\n\n /* Check if dirty is correctly typed for IN_PLACE */\n if (typeof dirty === 'string') {\n IN_PLACE = false;\n }\n if (IN_PLACE) {\n /* Do some early pre-sanitization to avoid unsafe root nodes */\n if (dirty.nodeName) {\n const tagName = transformCaseFunc(dirty.nodeName);\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n }\n }\n } else if (dirty instanceof Node) {\n /* If dirty is a DOM element, append to an empty document to avoid\n elements being stripped by the parser */\n body = _initDocument('<!---->');\n importedNode = body.ownerDocument.importNode(dirty, true);\n if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n /* Node is already a body, use as is */\n body = importedNode;\n } else if (importedNode.nodeName === 'HTML') {\n body = importedNode;\n } else {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n body.appendChild(importedNode);\n }\n } else {\n /* Exit directly if we have nothing to do */\n if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&\n // eslint-disable-next-line unicorn/prefer-includes\n dirty.indexOf('<') === -1) {\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n }\n\n /* Initialize the document to work on */\n body = _initDocument(dirty);\n\n /* Check we have a DOM node from the data */\n if (!body) {\n return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n }\n }\n\n /* Remove first element node (ours) if FORCE_BODY is set */\n if (body && FORCE_BODY) {\n _forceRemove(body.firstChild);\n }\n\n /* Get node iterator */\n const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n\n /* Now start iterating over the created document */\n while (currentNode = nodeIterator.nextNode()) {\n /* Sanitize tags and elements */\n if (_sanitizeElements(currentNode)) {\n continue;\n }\n\n /* Shadow DOM detected, sanitize it */\n if (currentNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(currentNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(currentNode);\n }\n\n /* If we sanitized `dirty` in-place, return it. */\n if (IN_PLACE) {\n return dirty;\n }\n\n /* Return sanitized string or DOM */\n if (RETURN_DOM) {\n if (RETURN_DOM_FRAGMENT) {\n returnNode = createDocumentFragment.call(body.ownerDocument);\n while (body.firstChild) {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n returnNode.appendChild(body.firstChild);\n }\n } else {\n returnNode = body;\n }\n if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n /*\n AdoptNode() is not used because internal state is not reset\n (e.g. the past names map of a HTMLFormElement), this is safe\n in theory but we would rather not risk another attack vector.\n The state that is cloned by importNode() is explicitly defined\n by the specs.\n */\n returnNode = importNode.call(originalDocument, returnNode, true);\n }\n return returnNode;\n }\n let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n\n /* Serialize doctype if allowed */\n if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n }\n\n /* Sanitize final string template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n serializedHTML = stringReplace(serializedHTML, expr, ' ');\n });\n }\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n };\n\n /**\n * Public method to set the configuration once\n * setConfig\n *\n * @param {Object} cfg configuration object\n */\n DOMPurify.setConfig = function () {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _parseConfig(cfg);\n SET_CONFIG = true;\n };\n\n /**\n * Public method to remove the configuration\n * clearConfig\n *\n */\n DOMPurify.clearConfig = function () {\n CONFIG = null;\n SET_CONFIG = false;\n };\n\n /**\n * Public method to check if an attribute value is valid.\n * Uses last set config, if any. Otherwise, uses config defaults.\n * isValidAttribute\n *\n * @param {String} tag Tag name of containing element.\n * @param {String} attr Attribute name.\n * @param {String} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n */\n DOMPurify.isValidAttribute = function (tag, attr, value) {\n /* Initialize shared config vars if necessary. */\n if (!CONFIG) {\n _parseConfig({});\n }\n const lcTag = transformCaseFunc(tag);\n const lcName = transformCaseFunc(attr);\n return _isValidAttribute(lcTag, lcName, value);\n };\n\n /**\n * AddHook\n * Public method to add DOMPurify hooks\n *\n * @param {String} entryPoint entry point for the hook to add\n * @param {Function} hookFunction function to execute\n */\n DOMPurify.addHook = function (entryPoint, hookFunction) {\n if (typeof hookFunction !== 'function') {\n return;\n }\n hooks[entryPoint] = hooks[entryPoint] || [];\n arrayPush(hooks[entryPoint], hookFunction);\n };\n\n /**\n * RemoveHook\n * Public method to remove a DOMPurify hook at a given entryPoint\n * (pops it from the stack of hooks if more are present)\n *\n * @param {String} entryPoint entry point for the hook to remove\n * @return {Function} removed(popped) hook\n */\n DOMPurify.removeHook = function (entryPoint) {\n if (hooks[entryPoint]) {\n return arrayPop(hooks[entryPoint]);\n }\n };\n\n /**\n * RemoveHooks\n * Public method to remove all DOMPurify hooks at a given entryPoint\n *\n * @param {String} entryPoint entry point for the hooks to remove\n */\n DOMPurify.removeHooks = function (entryPoint) {\n if (hooks[entryPoint]) {\n hooks[entryPoint] = [];\n }\n };\n\n /**\n * RemoveAllHooks\n * Public method to remove all DOMPurify hooks\n */\n DOMPurify.removeAllHooks = function () {\n hooks = {};\n };\n return DOMPurify;\n }\n var purify = createDOMPurify();\n\n return purify;\n\n}));\n//# sourceMappingURL=purify.js.map\n\n\n//# sourceURL=webpack://Formio/../core/node_modules/dompurify/dist/purify.js?");
|
1969
|
+
eval("/*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */\n\n(function (global, factory) {\n true ? module.exports = factory() :\n 0;\n})(this, (function () { 'use strict';\n\n const {\n entries,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor\n } = Object;\n let {\n freeze,\n seal,\n create\n } = Object; // eslint-disable-line import/no-mutable-exports\n\n let {\n apply,\n construct\n } = typeof Reflect !== 'undefined' && Reflect;\n\n if (!freeze) {\n freeze = function freeze(x) {\n return x;\n };\n }\n\n if (!seal) {\n seal = function seal(x) {\n return x;\n };\n }\n\n if (!apply) {\n apply = function apply(fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n }\n\n if (!construct) {\n construct = function construct(Func, args) {\n return new Func(...args);\n };\n }\n\n const arrayForEach = unapply(Array.prototype.forEach);\n const arrayPop = unapply(Array.prototype.pop);\n const arrayPush = unapply(Array.prototype.push);\n const stringToLowerCase = unapply(String.prototype.toLowerCase);\n const stringToString = unapply(String.prototype.toString);\n const stringMatch = unapply(String.prototype.match);\n const stringReplace = unapply(String.prototype.replace);\n const stringIndexOf = unapply(String.prototype.indexOf);\n const stringTrim = unapply(String.prototype.trim);\n const regExpTest = unapply(RegExp.prototype.test);\n const typeErrorCreate = unconstruct(TypeError);\n /**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param {Function} func - The function to be wrapped and called.\n * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.\n */\n\n function unapply(func) {\n return function (thisArg) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return apply(func, thisArg, args);\n };\n }\n /**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param {Function} func - The constructor function to be wrapped and called.\n * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.\n */\n\n\n function unconstruct(func) {\n return function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return construct(func, args);\n };\n }\n /**\n * Add properties to a lookup table\n *\n * @param {Object} set - The set to which elements will be added.\n * @param {Array} array - The array containing elements to be added to the set.\n * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns {Object} The modified set with added elements.\n */\n\n\n function addToSet(set, array) {\n let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;\n\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n let l = array.length;\n\n while (l--) {\n let element = array[l];\n\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n }\n /**\n * Shallow clone an object\n *\n * @param {Object} object - The object to be cloned.\n * @returns {Object} A new object that copies the original.\n */\n\n\n function clone(object) {\n const newObject = create(null);\n\n for (const [property, value] of entries(object)) {\n if (getOwnPropertyDescriptor(object, property) !== undefined) {\n newObject[property] = value;\n }\n }\n\n return newObject;\n }\n /**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param {Object} object - The object to look up the getter function in its prototype chain.\n * @param {String} prop - The property name for which to find the getter function.\n * @returns {Function} The getter function found in the prototype chain or a fallback function.\n */\n\n function lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n\n object = getPrototypeOf(object);\n }\n\n function fallbackValue(element) {\n console.warn('fallback value for', element);\n return null;\n }\n\n return fallbackValue;\n }\n\n const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG\n\n const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\n const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.\n // We still need to know them so that we can do namespace\n // checks properly in case one wants to add them to\n // allow-list.\n\n const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\n const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements,\n // even those that we disallow by default.\n\n const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\n const text = freeze(['#text']);\n\n const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\n const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\n const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\n const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n const MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n\n const ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\n const TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\n const DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n\n const ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n\n const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n );\n const IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\n const ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n );\n const DOCTYPE_NAME = seal(/^html$/i);\n\n var EXPRESSIONS = /*#__PURE__*/Object.freeze({\n __proto__: null,\n MUSTACHE_EXPR: MUSTACHE_EXPR,\n ERB_EXPR: ERB_EXPR,\n TMPLIT_EXPR: TMPLIT_EXPR,\n DATA_ATTR: DATA_ATTR,\n ARIA_ATTR: ARIA_ATTR,\n IS_ALLOWED_URI: IS_ALLOWED_URI,\n IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE: ATTR_WHITESPACE,\n DOCTYPE_NAME: DOCTYPE_NAME\n });\n\n const getGlobal = function getGlobal() {\n return typeof window === 'undefined' ? null : window;\n };\n /**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\n\n\n const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n return null;\n } // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n\n\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n\n if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n suffix = purifyHostElement.getAttribute(ATTR_NAME);\n }\n\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n\n createScriptURL(scriptUrl) {\n return scriptUrl;\n }\n\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n return null;\n }\n };\n\n function createDOMPurify() {\n let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n\n const DOMPurify = root => createDOMPurify(root);\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n\n\n DOMPurify.version = '3.0.6';\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n\n DOMPurify.removed = [];\n\n if (!window || !window.document || window.document.nodeType !== 9) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n return DOMPurify;\n }\n\n let {\n document\n } = window;\n const originalDocument = document;\n const currentScript = originalDocument.currentScript;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes\n } = window;\n const ElementPrototype = Element.prototype;\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n\n let trustedTypesPolicy;\n let emptyHTML = '';\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName\n } = document;\n const {\n importNode\n } = originalDocument;\n let hooks = {};\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n\n DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n TMPLIT_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE\n } = EXPRESSIONS;\n let {\n IS_ALLOWED_URI: IS_ALLOWED_URI$1\n } = EXPRESSIONS;\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n /* Allowed attribute names */\n\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n\n let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false\n }\n }));\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n\n let FORBID_TAGS = null;\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n\n let FORBID_ATTR = null;\n /* Decide if ARIA attributes are okay */\n\n let ALLOW_ARIA_ATTR = true;\n /* Decide if custom data attributes are okay */\n\n let ALLOW_DATA_ATTR = true;\n /* Decide if unknown protocols are okay */\n\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n /* Decide if self-closing tags in attributes are allowed.\n * Usually removed due to a mXSS issue in jQuery 3.0 */\n\n let ALLOW_SELF_CLOSE_IN_ATTR = true;\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n\n let SAFE_FOR_TEMPLATES = false;\n /* Decide if document with <html>... should be returned */\n\n let WHOLE_DOCUMENT = false;\n /* Track whether config is already set on this instance of DOMPurify. */\n\n let SET_CONFIG = false;\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n\n let FORCE_BODY = false;\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n\n let RETURN_DOM = false;\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n\n let RETURN_DOM_FRAGMENT = false;\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n\n let RETURN_TRUSTED_TYPE = false;\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n\n let SANITIZE_DOM = true;\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n\n let SANITIZE_NAMED_PROPS = false;\n const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n /* Keep element content when removing element? */\n\n let KEEP_CONTENT = true;\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n\n let IN_PLACE = false;\n /* Allow usage of profiles like html, svg and mathMl */\n\n let USE_PROFILES = {};\n /* Tags to ignore content of when KEEP_CONTENT is true */\n\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n /* Tags that are safe for data: URIs */\n\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n /* Attributes safe for values like \"javascript:\" */\n\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n /* Allowed XHTML+XML namespaces */\n\n let ALLOWED_NAMESPACES = null;\n const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n /* Parsing of strict XHTML documents */\n\n let PARSER_MEDIA_TYPE = null;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc = null;\n /* Keep a reference to config to pass to hooks */\n\n let CONFIG = null;\n /* Ideally, do not touch anything below this line */\n\n /* ______________________________________________ */\n\n const formElement = document.createElement('form');\n\n const isRegexOrFunction = function isRegexOrFunction(testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n\n\n const _parseConfig = function _parseConfig() {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n /* Shield configuration object from tampering */\n\n\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n /* Shield configuration object from prototype pollution */\n\n\n cfg = clone(cfg);\n PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n\n transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n /* Set configuration parameters */\n\n ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n\n ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n\n IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n\n if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n /* Parse profile info */\n\n\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, [...text]);\n ALLOWED_ATTR = [];\n\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, html$1);\n addToSet(ALLOWED_ATTR, html);\n }\n\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, svg$1);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, svgFilters);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, mathMl$1);\n addToSet(ALLOWED_ATTR, mathMl);\n addToSet(ALLOWED_ATTR, xml);\n }\n }\n /* Merge configuration parameters */\n\n\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n /* Add #text in case KEEP_CONTENT is set to true */\n\n\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n\n\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n\n\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n\n if (cfg.TRUSTED_TYPES_POLICY) {\n if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n }\n\n if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n } // Overwrite existing TrustedTypes policy.\n\n\n trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.\n\n emptyHTML = trustedTypesPolicy.createHTML('');\n } else {\n // Uninitialized policy, attempt to initialize the internal dompurify policy.\n if (trustedTypesPolicy === undefined) {\n trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n } // If creating the internal policy succeeded sign internal variables.\n\n\n if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n emptyHTML = trustedTypesPolicy.createHTML('');\n }\n } // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n\n\n if (freeze) {\n freeze(cfg);\n }\n\n CONFIG = cfg;\n };\n\n const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n\n const ALL_SVG_TAGS = addToSet({}, svg$1);\n addToSet(ALL_SVG_TAGS, svgFilters);\n addToSet(ALL_SVG_TAGS, svgDisallowed);\n const ALL_MATHML_TAGS = addToSet({}, mathMl$1);\n addToSet(ALL_MATHML_TAGS, mathMlDisallowed);\n /**\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n\n const _checkValidNamespace = function _checkValidNamespace(element) {\n let parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template'\n };\n }\n\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via <svg>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n } // The only way to switch from MathML to SVG is via`\n // svg if parent is either <annotation-xml> or MathML\n // text integration points.\n\n\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n } // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n\n\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via <math>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n } // The only way to switch from SVG to MathML is via\n // <math> and HTML integration points\n\n\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n } // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n\n\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n\n if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n return false;\n } // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n\n\n return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n } // For XHTML and XML documents that support custom namespaces\n\n\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n return true;\n } // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n\n\n return false;\n };\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n\n\n const _forceRemove = function _forceRemove(node) {\n arrayPush(DOMPurify.removed, {\n element: node\n });\n\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n node.parentNode.removeChild(node);\n } catch (_) {\n node.remove();\n }\n };\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n\n\n const _removeAttribute = function _removeAttribute(name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node\n });\n }\n\n node.removeAttribute(name); // We void attribute values for unremovable \"is\"\" attributes\n\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n\n\n const _initDocument = function _initDocument(dirty) {\n /* Create a HTML document */\n let doc = null;\n let leadingWhitespace = null;\n\n if (FORCE_BODY) {\n dirty = '<remove></remove>' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n }\n\n const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n /* Use createHTMLDocument in case DOMParser is not available */\n\n\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n } catch (_) {// Syntax error if dirtyPayload is invalid xml\n }\n }\n\n const body = doc.body || doc.documentElement;\n\n if (dirty && leadingWhitespace) {\n body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n }\n /* Work on whole document or just its body */\n\n\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n }\n\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n *\n * @param {Node} root The root element or node to start traversing on.\n * @return {NodeIterator} The created NodeIterator\n */\n\n\n const _createNodeIterator = function _createNodeIterator(root) {\n return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);\n };\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n\n\n const _isClobbered = function _isClobbered(elm) {\n return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n };\n /**\n * Checks whether the given object is a DOM node.\n *\n * @param {Node} object object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n\n\n const _isNode = function _isNode(object) {\n return typeof Node === 'function' && object instanceof Node;\n };\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n\n\n const _executeHook = function _executeHook(entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n\n arrayForEach(hooks[entryPoint], hook => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n\n\n const _sanitizeElements = function _sanitizeElements(currentNode) {\n let content = null;\n /* Execute a hook if present */\n\n _executeHook('beforeSanitizeElements', currentNode, null);\n /* Check if element is clobbered or can clobber */\n\n\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Now let's check the element's type and name */\n\n\n const tagName = transformCaseFunc(currentNode.nodeName);\n /* Execute a hook if present */\n\n _executeHook('uponSanitizeElement', currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS\n });\n /* Detect mXSS attempts abusing namespace confusion */\n\n\n if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Remove element if anything forbids its presence */\n\n\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n /* Check if we have a custom element to handle */\n if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {\n return false;\n }\n\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {\n return false;\n }\n }\n /* Keep content except for bad-listed elements */\n\n\n if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n\n if (childNodes && parentNode) {\n const childCount = childNodes.length;\n\n for (let i = childCount - 1; i >= 0; --i) {\n parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n }\n }\n }\n\n _forceRemove(currentNode);\n\n return true;\n }\n /* Check whether element has a valid namespace */\n\n\n if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Make sure that older browsers don't get fallback-tag mXSS */\n\n\n if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Sanitize element content to be template-safe */\n\n\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n /* Get the element's text content */\n content = currentNode.textContent;\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n content = stringReplace(content, expr, ' ');\n });\n\n if (currentNode.textContent !== content) {\n arrayPush(DOMPurify.removed, {\n element: currentNode.cloneNode()\n });\n currentNode.textContent = content;\n }\n }\n /* Execute a hook if present */\n\n\n _executeHook('afterSanitizeElements', currentNode, null);\n\n return false;\n };\n /**\n * _isValidAttribute\n *\n * @param {string} lcTag Lowercase tag name of containing element.\n * @param {string} lcName Lowercase attribute name.\n * @param {string} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid, otherwise false.\n */\n // eslint-disable-next-line complexity\n\n\n const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n /* Make sure attribute cannot clobber */\n if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n return false;\n }\n /* Allow valid data-* attributes: At least one character after \"-\"\n (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n We don't need to check the value; it's always URI safe. */\n\n\n if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND\n // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {\n return false;\n }\n /* Check value is safe. First, is attr inert? If so, is safe */\n\n } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {\n return false;\n } else ;\n\n return true;\n };\n /**\n * _isBasicCustomElement\n * checks if at least one dash is included in tagName, and it's not the first char\n * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n *\n * @param {string} tagName name of the tag of the node to sanitize\n * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n */\n\n\n const _isBasicCustomElement = function _isBasicCustomElement(tagName) {\n return tagName.indexOf('-') > 0;\n };\n /**\n * _sanitizeAttributes\n *\n * @protect attributes\n * @protect nodeName\n * @protect removeAttribute\n * @protect setAttribute\n *\n * @param {Node} currentNode to sanitize\n */\n\n\n const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n /* Execute a hook if present */\n _executeHook('beforeSanitizeAttributes', currentNode, null);\n\n const {\n attributes\n } = currentNode;\n /* Check if we have attributes; if not we might have a text node */\n\n if (!attributes) {\n return;\n }\n\n const hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR\n };\n let l = attributes.length;\n /* Go backwards over all attributes; safely remove bad ones */\n\n while (l--) {\n const attr = attributes[l];\n const {\n name,\n namespaceURI,\n value: attrValue\n } = attr;\n const lcName = transformCaseFunc(name);\n let value = name === 'value' ? attrValue : stringTrim(attrValue);\n /* Execute a hook if present */\n\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n\n _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n\n value = hookEvent.attrValue;\n /* Did the hooks approve of the attribute? */\n\n if (hookEvent.forceKeepAttr) {\n continue;\n }\n /* Remove attribute */\n\n\n _removeAttribute(name, currentNode);\n /* Did the hooks approve of the attribute? */\n\n\n if (!hookEvent.keepAttr) {\n continue;\n }\n /* Work around a security issue in jQuery 3.0 */\n\n\n if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n _removeAttribute(name, currentNode);\n\n continue;\n }\n /* Sanitize attribute content to be template-safe */\n\n\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n value = stringReplace(value, expr, ' ');\n });\n }\n /* Is `value` valid for this attribute? */\n\n\n const lcTag = transformCaseFunc(currentNode.nodeName);\n\n if (!_isValidAttribute(lcTag, lcName, value)) {\n continue;\n }\n /* Full DOM Clobbering protection via namespace isolation,\n * Prefix id and name attributes with `user-content-`\n */\n\n\n if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n // Remove the attribute with this value\n _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value\n\n\n value = SANITIZE_NAMED_PROPS_PREFIX + value;\n }\n /* Handle attributes that require Trusted Types */\n\n\n if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n if (namespaceURI) ; else {\n switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n case 'TrustedHTML':\n {\n value = trustedTypesPolicy.createHTML(value);\n break;\n }\n\n case 'TrustedScriptURL':\n {\n value = trustedTypesPolicy.createScriptURL(value);\n break;\n }\n }\n }\n }\n /* Handle invalid data-* attribute set by try-catching it */\n\n\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n\n arrayPop(DOMPurify.removed);\n } catch (_) {}\n }\n /* Execute a hook if present */\n\n\n _executeHook('afterSanitizeAttributes', currentNode, null);\n };\n /**\n * _sanitizeShadowDOM\n *\n * @param {DocumentFragment} fragment to iterate over recursively\n */\n\n\n const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n let shadowNode = null;\n\n const shadowIterator = _createNodeIterator(fragment);\n /* Execute a hook if present */\n\n\n _executeHook('beforeSanitizeShadowDOM', fragment, null);\n\n while (shadowNode = shadowIterator.nextNode()) {\n /* Execute a hook if present */\n _executeHook('uponSanitizeShadowNode', shadowNode, null);\n /* Sanitize tags and elements */\n\n\n if (_sanitizeElements(shadowNode)) {\n continue;\n }\n /* Deep shadow DOM detected */\n\n\n if (shadowNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(shadowNode.content);\n }\n /* Check attributes, sanitize if necessary */\n\n\n _sanitizeAttributes(shadowNode);\n }\n /* Execute a hook if present */\n\n\n _executeHook('afterSanitizeShadowDOM', fragment, null);\n };\n /**\n * Sanitize\n * Public method providing core sanitation functionality\n *\n * @param {String|Node} dirty string or DOM node\n * @param {Object} cfg object\n */\n // eslint-disable-next-line complexity\n\n\n DOMPurify.sanitize = function (dirty) {\n let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n let body = null;\n let importedNode = null;\n let currentNode = null;\n let returnNode = null;\n /* Make sure we have a string to sanitize.\n DO NOT return early, as this will return the wrong type if\n the user has requested a DOM object rather than a string */\n\n IS_EMPTY_INPUT = !dirty;\n\n if (IS_EMPTY_INPUT) {\n dirty = '<!-->';\n }\n /* Stringify, in case dirty is an object */\n\n\n if (typeof dirty !== 'string' && !_isNode(dirty)) {\n if (typeof dirty.toString === 'function') {\n dirty = dirty.toString();\n\n if (typeof dirty !== 'string') {\n throw typeErrorCreate('dirty is not a string, aborting');\n }\n } else {\n throw typeErrorCreate('toString is not a function');\n }\n }\n /* Return dirty HTML if DOMPurify cannot run */\n\n\n if (!DOMPurify.isSupported) {\n return dirty;\n }\n /* Assign config vars */\n\n\n if (!SET_CONFIG) {\n _parseConfig(cfg);\n }\n /* Clean up removed elements */\n\n\n DOMPurify.removed = [];\n /* Check if dirty is correctly typed for IN_PLACE */\n\n if (typeof dirty === 'string') {\n IN_PLACE = false;\n }\n\n if (IN_PLACE) {\n /* Do some early pre-sanitization to avoid unsafe root nodes */\n if (dirty.nodeName) {\n const tagName = transformCaseFunc(dirty.nodeName);\n\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n }\n }\n } else if (dirty instanceof Node) {\n /* If dirty is a DOM element, append to an empty document to avoid\n elements being stripped by the parser */\n body = _initDocument('<!---->');\n importedNode = body.ownerDocument.importNode(dirty, true);\n\n if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n /* Node is already a body, use as is */\n body = importedNode;\n } else if (importedNode.nodeName === 'HTML') {\n body = importedNode;\n } else {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n body.appendChild(importedNode);\n }\n } else {\n /* Exit directly if we have nothing to do */\n if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes\n dirty.indexOf('<') === -1) {\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n }\n /* Initialize the document to work on */\n\n\n body = _initDocument(dirty);\n /* Check we have a DOM node from the data */\n\n if (!body) {\n return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n }\n }\n /* Remove first element node (ours) if FORCE_BODY is set */\n\n\n if (body && FORCE_BODY) {\n _forceRemove(body.firstChild);\n }\n /* Get node iterator */\n\n\n const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n /* Now start iterating over the created document */\n\n\n while (currentNode = nodeIterator.nextNode()) {\n /* Sanitize tags and elements */\n if (_sanitizeElements(currentNode)) {\n continue;\n }\n /* Shadow DOM detected, sanitize it */\n\n\n if (currentNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(currentNode.content);\n }\n /* Check attributes, sanitize if necessary */\n\n\n _sanitizeAttributes(currentNode);\n }\n /* If we sanitized `dirty` in-place, return it. */\n\n\n if (IN_PLACE) {\n return dirty;\n }\n /* Return sanitized string or DOM */\n\n\n if (RETURN_DOM) {\n if (RETURN_DOM_FRAGMENT) {\n returnNode = createDocumentFragment.call(body.ownerDocument);\n\n while (body.firstChild) {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n returnNode.appendChild(body.firstChild);\n }\n } else {\n returnNode = body;\n }\n\n if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n /*\n AdoptNode() is not used because internal state is not reset\n (e.g. the past names map of a HTMLFormElement), this is safe\n in theory but we would rather not risk another attack vector.\n The state that is cloned by importNode() is explicitly defined\n by the specs.\n */\n returnNode = importNode.call(originalDocument, returnNode, true);\n }\n\n return returnNode;\n }\n\n let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n /* Serialize doctype if allowed */\n\n if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n }\n /* Sanitize final string template-safe */\n\n\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n serializedHTML = stringReplace(serializedHTML, expr, ' ');\n });\n }\n\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n };\n /**\n * Public method to set the configuration once\n * setConfig\n *\n * @param {Object} cfg configuration object\n */\n\n\n DOMPurify.setConfig = function () {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _parseConfig(cfg);\n\n SET_CONFIG = true;\n };\n /**\n * Public method to remove the configuration\n * clearConfig\n *\n */\n\n\n DOMPurify.clearConfig = function () {\n CONFIG = null;\n SET_CONFIG = false;\n };\n /**\n * Public method to check if an attribute value is valid.\n * Uses last set config, if any. Otherwise, uses config defaults.\n * isValidAttribute\n *\n * @param {String} tag Tag name of containing element.\n * @param {String} attr Attribute name.\n * @param {String} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n */\n\n\n DOMPurify.isValidAttribute = function (tag, attr, value) {\n /* Initialize shared config vars if necessary. */\n if (!CONFIG) {\n _parseConfig({});\n }\n\n const lcTag = transformCaseFunc(tag);\n const lcName = transformCaseFunc(attr);\n return _isValidAttribute(lcTag, lcName, value);\n };\n /**\n * AddHook\n * Public method to add DOMPurify hooks\n *\n * @param {String} entryPoint entry point for the hook to add\n * @param {Function} hookFunction function to execute\n */\n\n\n DOMPurify.addHook = function (entryPoint, hookFunction) {\n if (typeof hookFunction !== 'function') {\n return;\n }\n\n hooks[entryPoint] = hooks[entryPoint] || [];\n arrayPush(hooks[entryPoint], hookFunction);\n };\n /**\n * RemoveHook\n * Public method to remove a DOMPurify hook at a given entryPoint\n * (pops it from the stack of hooks if more are present)\n *\n * @param {String} entryPoint entry point for the hook to remove\n * @return {Function} removed(popped) hook\n */\n\n\n DOMPurify.removeHook = function (entryPoint) {\n if (hooks[entryPoint]) {\n return arrayPop(hooks[entryPoint]);\n }\n };\n /**\n * RemoveHooks\n * Public method to remove all DOMPurify hooks at a given entryPoint\n *\n * @param {String} entryPoint entry point for the hooks to remove\n */\n\n\n DOMPurify.removeHooks = function (entryPoint) {\n if (hooks[entryPoint]) {\n hooks[entryPoint] = [];\n }\n };\n /**\n * RemoveAllHooks\n * Public method to remove all DOMPurify hooks\n */\n\n\n DOMPurify.removeAllHooks = function () {\n hooks = {};\n };\n\n return DOMPurify;\n }\n\n var purify = createDOMPurify();\n\n return purify;\n\n}));\n//# sourceMappingURL=purify.js.map\n\n\n//# sourceURL=webpack://Formio/../core/node_modules/dompurify/dist/purify.js?");
|
1937
1970
|
|
1938
1971
|
/***/ }),
|
1939
1972
|
|
@@ -1964,7 +1997,7 @@ eval("var __WEBPACK_AMD_DEFINE_RESULT__;(function (global) {\n 'use strict';\n\
|
|
1964
1997
|
\********************************************************/
|
1965
1998
|
/***/ (function(module) {
|
1966
1999
|
|
1967
|
-
eval("/*!\n * dist/inputmask\n * https://github.com/RobinHerbots/Inputmask\n * Copyright (c) 2010 - 2023 Robin Herbots\n * Licensed under the MIT license\n * Version: 5.0.9-beta.45\n */\n!function(e, t) {\n if (true) module.exports = t(); else { var i, n; }\n}(\"undefined\" != typeof self ? self : this, (function() {\n return function() {\n \"use strict\";\n var e = {\n 3976: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var i = n(2839);\n t.default = {\n _maxTestPos: 500,\n placeholder: \"_\",\n optionalmarker: [ \"[\", \"]\" ],\n quantifiermarker: [ \"{\", \"}\" ],\n groupmarker: [ \"(\", \")\" ],\n alternatormarker: \"|\",\n escapeChar: \"\\\\\",\n mask: null,\n regex: null,\n oncomplete: function() {},\n onincomplete: function() {},\n oncleared: function() {},\n repeat: 0,\n greedy: !1,\n autoUnmask: !1,\n removeMaskOnSubmit: !1,\n clearMaskOnLostFocus: !0,\n insertMode: !0,\n insertModeVisual: !0,\n clearIncomplete: !1,\n alias: null,\n onKeyDown: function() {},\n onBeforeMask: null,\n onBeforePaste: function(e, t) {\n return \"function\" == typeof t.onBeforeMask ? t.onBeforeMask.call(this, e, t) : e;\n },\n onBeforeWrite: null,\n onUnMask: null,\n showMaskOnFocus: !0,\n showMaskOnHover: !0,\n onKeyValidation: function() {},\n skipOptionalPartCharacter: \" \",\n numericInput: !1,\n rightAlign: !1,\n undoOnEscape: !0,\n radixPoint: \"\",\n _radixDance: !1,\n groupSeparator: \"\",\n keepStatic: null,\n positionCaretOnTab: !0,\n tabThrough: !1,\n supportsInputType: [ \"text\", \"tel\", \"url\", \"password\", \"search\" ],\n ignorables: Object.keys(i.ignorables),\n isComplete: null,\n preValidation: null,\n postValidation: null,\n staticDefinitionSymbol: void 0,\n jitMasking: !1,\n nullable: !0,\n inputEventOnly: !1,\n noValuePatching: !1,\n positionCaretOnClick: \"lvp\",\n casing: null,\n inputmode: \"text\",\n importDataAttributes: !0,\n shiftPositions: !0,\n usePrototypeDefinitions: !0,\n validationEventTimeOut: 3e3,\n substitutes: {}\n };\n },\n 7392: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n t.default = {\n 9: {\n validator: \"[0-9\\uff10-\\uff19]\",\n definitionSymbol: \"*\"\n },\n a: {\n validator: \"[A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\",\n definitionSymbol: \"*\"\n },\n \"*\": {\n validator: \"[0-9\\uff10-\\uff19A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\"\n }\n };\n },\n 253: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function(e, t, n) {\n if (void 0 === n) return e.__data ? e.__data[t] : null;\n e.__data = e.__data || {}, e.__data[t] = n;\n };\n },\n 3776: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.Event = void 0, t.off = function(e, t) {\n var n, i;\n u(this[0]) && e && (n = this[0].eventRegistry, i = this[0], e.split(\" \").forEach((function(e) {\n var a = o(e.split(\".\"), 2);\n (function(e, i) {\n var a, r, o = [];\n if (e.length > 0) if (void 0 === t) for (a = 0, r = n[e][i].length; a < r; a++) o.push({\n ev: e,\n namespace: i && i.length > 0 ? i : \"global\",\n handler: n[e][i][a]\n }); else o.push({\n ev: e,\n namespace: i && i.length > 0 ? i : \"global\",\n handler: t\n }); else if (i.length > 0) for (var l in n) for (var s in n[l]) if (s === i) if (void 0 === t) for (a = 0, \n r = n[l][s].length; a < r; a++) o.push({\n ev: l,\n namespace: s,\n handler: n[l][s][a]\n }); else o.push({\n ev: l,\n namespace: s,\n handler: t\n });\n return o;\n })(a[0], a[1]).forEach((function(e) {\n var t = e.ev, a = e.handler;\n !function(e, t, a) {\n if (e in n == 1) if (i.removeEventListener ? i.removeEventListener(e, a, !1) : i.detachEvent && i.detachEvent(\"on\".concat(e), a), \n \"global\" === t) for (var r in n[e]) n[e][r].splice(n[e][r].indexOf(a), 1); else n[e][t].splice(n[e][t].indexOf(a), 1);\n }(t, e.namespace, a);\n }));\n })));\n return this;\n }, t.on = function(e, t) {\n if (u(this[0])) {\n var n = this[0].eventRegistry, i = this[0];\n e.split(\" \").forEach((function(e) {\n var a = o(e.split(\".\"), 2), r = a[0], l = a[1];\n !function(e, a) {\n i.addEventListener ? i.addEventListener(e, t, !1) : i.attachEvent && i.attachEvent(\"on\".concat(e), t), \n n[e] = n[e] || {}, n[e][a] = n[e][a] || [], n[e][a].push(t);\n }(r, void 0 === l ? \"global\" : l);\n }));\n }\n return this;\n }, t.trigger = function(e) {\n var t = arguments;\n if (u(this[0])) for (var n = this[0].eventRegistry, a = this[0], o = \"string\" == typeof e ? e.split(\" \") : [ e.type ], l = 0; l < o.length; l++) {\n var s = o[l].split(\".\"), f = s[0], p = s[1] || \"global\";\n if (void 0 !== c && \"global\" === p) {\n var d, h = {\n bubbles: !0,\n cancelable: !0,\n composed: !0,\n detail: arguments[1]\n };\n if (c.createEvent) {\n try {\n if (\"input\" === f) h.inputType = \"insertText\", d = new InputEvent(f, h); else d = new CustomEvent(f, h);\n } catch (e) {\n (d = c.createEvent(\"CustomEvent\")).initCustomEvent(f, h.bubbles, h.cancelable, h.detail);\n }\n e.type && (0, i.default)(d, e), a.dispatchEvent(d);\n } else (d = c.createEventObject()).eventType = f, d.detail = arguments[1], e.type && (0, \n i.default)(d, e), a.fireEvent(\"on\" + d.eventType, d);\n } else if (void 0 !== n[f]) {\n arguments[0] = arguments[0].type ? arguments[0] : r.default.Event(arguments[0]), \n arguments[0].detail = arguments.slice(1);\n var v = n[f];\n (\"global\" === p ? Object.values(v).flat() : v[p]).forEach((function(e) {\n return e.apply(a, t);\n }));\n }\n }\n return this;\n };\n var i = s(n(600)), a = s(n(9380)), r = s(n(4963));\n function o(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return l(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return l(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function l(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function s(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var c = a.default.document;\n function u(e) {\n return e instanceof Element;\n }\n var f = t.Event = void 0;\n \"function\" == typeof a.default.CustomEvent ? t.Event = f = a.default.CustomEvent : a.default.Event && c && c.createEvent ? (t.Event = f = function(e, t) {\n t = t || {\n bubbles: !1,\n cancelable: !1,\n composed: !0,\n detail: void 0\n };\n var n = c.createEvent(\"CustomEvent\");\n return n.initCustomEvent(e, t.bubbles, t.cancelable, t.detail), n;\n }, f.prototype = a.default.Event.prototype) : \"undefined\" != typeof Event && (t.Event = f = Event);\n },\n 600: function(e, t) {\n function n(e) {\n return n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, n(e);\n }\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function e() {\n var t, i, a, r, o, l, s = arguments[0] || {}, c = 1, u = arguments.length, f = !1;\n \"boolean\" == typeof s && (f = s, s = arguments[c] || {}, c++);\n \"object\" !== n(s) && \"function\" != typeof s && (s = {});\n for (;c < u; c++) if (null != (t = arguments[c])) for (i in t) a = s[i], s !== (r = t[i]) && (f && r && (\"[object Object]\" === Object.prototype.toString.call(r) || (o = Array.isArray(r))) ? (o ? (o = !1, \n l = a && Array.isArray(a) ? a : []) : l = a && \"[object Object]\" === Object.prototype.toString.call(a) ? a : {}, \n s[i] = e(f, l, r)) : void 0 !== r && (s[i] = r));\n return s;\n };\n },\n 4963: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var i = l(n(600)), a = l(n(9380)), r = l(n(253)), o = n(3776);\n function l(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var s = a.default.document;\n function c(e) {\n return e instanceof c ? e : this instanceof c ? void (null != e && e !== a.default && (this[0] = e.nodeName ? e : void 0 !== e[0] && e[0].nodeName ? e[0] : s.querySelector(e), \n void 0 !== this[0] && null !== this[0] && (this[0].eventRegistry = this[0].eventRegistry || {}))) : new c(e);\n }\n c.prototype = {\n on: o.on,\n off: o.off,\n trigger: o.trigger\n }, c.extend = i.default, c.data = r.default, c.Event = o.Event;\n t.default = c;\n },\n 9845: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.mobile = t.iphone = t.ie = void 0;\n var i, a = (i = n(9380)) && i.__esModule ? i : {\n default: i\n };\n var r = a.default.navigator && a.default.navigator.userAgent || \"\";\n t.ie = r.indexOf(\"MSIE \") > 0 || r.indexOf(\"Trident/\") > 0, t.mobile = a.default.navigator && a.default.navigator.userAgentData && a.default.navigator.userAgentData.mobile || a.default.navigator && a.default.navigator.maxTouchPoints || \"ontouchstart\" in a.default, \n t.iphone = /iphone/i.test(r);\n },\n 7184: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function(e) {\n return e.replace(n, \"\\\\$1\");\n };\n var n = new RegExp(\"(\\\\\" + [ \"/\", \".\", \"*\", \"+\", \"?\", \"|\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", \"\\\\\", \"$\", \"^\" ].join(\"|\\\\\") + \")\", \"gim\");\n },\n 6030: function(e, t, n) {\n function i(e) {\n return i = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, i(e);\n }\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.EventHandlers = void 0;\n var a, r = n(8711), o = n(2839), l = n(9845), s = n(7215), c = n(7760), u = n(4713), f = (a = n(9380)) && a.__esModule ? a : {\n default: a\n };\n function p() {\n /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ p = function() {\n return t;\n };\n var e, t = {}, n = Object.prototype, a = n.hasOwnProperty, r = Object.defineProperty || function(e, t, n) {\n e[t] = n.value;\n }, o = \"function\" == typeof Symbol ? Symbol : {}, l = o.iterator || \"@@iterator\", s = o.asyncIterator || \"@@asyncIterator\", c = o.toStringTag || \"@@toStringTag\";\n function u(e, t, n) {\n return Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), e[t];\n }\n try {\n u({}, \"\");\n } catch (e) {\n u = function(e, t, n) {\n return e[t] = n;\n };\n }\n function f(e, t, n, i) {\n var a = t && t.prototype instanceof k ? t : k, o = Object.create(a.prototype), l = new D(i || []);\n return r(o, \"_invoke\", {\n value: E(e, n, l)\n }), o;\n }\n function d(e, t, n) {\n try {\n return {\n type: \"normal\",\n arg: e.call(t, n)\n };\n } catch (e) {\n return {\n type: \"throw\",\n arg: e\n };\n }\n }\n t.wrap = f;\n var h = \"suspendedStart\", v = \"suspendedYield\", m = \"executing\", g = \"completed\", y = {};\n function k() {}\n function b() {}\n function x() {}\n var P = {};\n u(P, l, (function() {\n return this;\n }));\n var w = Object.getPrototypeOf, S = w && w(w(L([])));\n S && S !== n && a.call(S, l) && (P = S);\n var O = x.prototype = k.prototype = Object.create(P);\n function _(e) {\n [ \"next\", \"throw\", \"return\" ].forEach((function(t) {\n u(e, t, (function(e) {\n return this._invoke(t, e);\n }));\n }));\n }\n function M(e, t) {\n function n(r, o, l, s) {\n var c = d(e[r], e, o);\n if (\"throw\" !== c.type) {\n var u = c.arg, f = u.value;\n return f && \"object\" == i(f) && a.call(f, \"__await\") ? t.resolve(f.__await).then((function(e) {\n n(\"next\", e, l, s);\n }), (function(e) {\n n(\"throw\", e, l, s);\n })) : t.resolve(f).then((function(e) {\n u.value = e, l(u);\n }), (function(e) {\n return n(\"throw\", e, l, s);\n }));\n }\n s(c.arg);\n }\n var o;\n r(this, \"_invoke\", {\n value: function(e, i) {\n function a() {\n return new t((function(t, a) {\n n(e, i, t, a);\n }));\n }\n return o = o ? o.then(a, a) : a();\n }\n });\n }\n function E(t, n, i) {\n var a = h;\n return function(r, o) {\n if (a === m) throw new Error(\"Generator is already running\");\n if (a === g) {\n if (\"throw\" === r) throw o;\n return {\n value: e,\n done: !0\n };\n }\n for (i.method = r, i.arg = o; ;) {\n var l = i.delegate;\n if (l) {\n var s = j(l, i);\n if (s) {\n if (s === y) continue;\n return s;\n }\n }\n if (\"next\" === i.method) i.sent = i._sent = i.arg; else if (\"throw\" === i.method) {\n if (a === h) throw a = g, i.arg;\n i.dispatchException(i.arg);\n } else \"return\" === i.method && i.abrupt(\"return\", i.arg);\n a = m;\n var c = d(t, n, i);\n if (\"normal\" === c.type) {\n if (a = i.done ? g : v, c.arg === y) continue;\n return {\n value: c.arg,\n done: i.done\n };\n }\n \"throw\" === c.type && (a = g, i.method = \"throw\", i.arg = c.arg);\n }\n };\n }\n function j(t, n) {\n var i = n.method, a = t.iterator[i];\n if (a === e) return n.delegate = null, \"throw\" === i && t.iterator.return && (n.method = \"return\", \n n.arg = e, j(t, n), \"throw\" === n.method) || \"return\" !== i && (n.method = \"throw\", \n n.arg = new TypeError(\"The iterator does not provide a '\" + i + \"' method\")), y;\n var r = d(a, t.iterator, n.arg);\n if (\"throw\" === r.type) return n.method = \"throw\", n.arg = r.arg, n.delegate = null, \n y;\n var o = r.arg;\n return o ? o.done ? (n[t.resultName] = o.value, n.next = t.nextLoc, \"return\" !== n.method && (n.method = \"next\", \n n.arg = e), n.delegate = null, y) : o : (n.method = \"throw\", n.arg = new TypeError(\"iterator result is not an object\"), \n n.delegate = null, y);\n }\n function T(e) {\n var t = {\n tryLoc: e[0]\n };\n 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), \n this.tryEntries.push(t);\n }\n function A(e) {\n var t = e.completion || {};\n t.type = \"normal\", delete t.arg, e.completion = t;\n }\n function D(e) {\n this.tryEntries = [ {\n tryLoc: \"root\"\n } ], e.forEach(T, this), this.reset(!0);\n }\n function L(t) {\n if (t || \"\" === t) {\n var n = t[l];\n if (n) return n.call(t);\n if (\"function\" == typeof t.next) return t;\n if (!isNaN(t.length)) {\n var r = -1, o = function n() {\n for (;++r < t.length; ) if (a.call(t, r)) return n.value = t[r], n.done = !1, n;\n return n.value = e, n.done = !0, n;\n };\n return o.next = o;\n }\n }\n throw new TypeError(i(t) + \" is not iterable\");\n }\n return b.prototype = x, r(O, \"constructor\", {\n value: x,\n configurable: !0\n }), r(x, \"constructor\", {\n value: b,\n configurable: !0\n }), b.displayName = u(x, c, \"GeneratorFunction\"), t.isGeneratorFunction = function(e) {\n var t = \"function\" == typeof e && e.constructor;\n return !!t && (t === b || \"GeneratorFunction\" === (t.displayName || t.name));\n }, t.mark = function(e) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(e, x) : (e.__proto__ = x, u(e, c, \"GeneratorFunction\")), \n e.prototype = Object.create(O), e;\n }, t.awrap = function(e) {\n return {\n __await: e\n };\n }, _(M.prototype), u(M.prototype, s, (function() {\n return this;\n })), t.AsyncIterator = M, t.async = function(e, n, i, a, r) {\n void 0 === r && (r = Promise);\n var o = new M(f(e, n, i, a), r);\n return t.isGeneratorFunction(n) ? o : o.next().then((function(e) {\n return e.done ? e.value : o.next();\n }));\n }, _(O), u(O, c, \"Generator\"), u(O, l, (function() {\n return this;\n })), u(O, \"toString\", (function() {\n return \"[object Generator]\";\n })), t.keys = function(e) {\n var t = Object(e), n = [];\n for (var i in t) n.push(i);\n return n.reverse(), function e() {\n for (;n.length; ) {\n var i = n.pop();\n if (i in t) return e.value = i, e.done = !1, e;\n }\n return e.done = !0, e;\n };\n }, t.values = L, D.prototype = {\n constructor: D,\n reset: function(t) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, \n this.method = \"next\", this.arg = e, this.tryEntries.forEach(A), !t) for (var n in this) \"t\" === n.charAt(0) && a.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = e);\n },\n stop: function() {\n this.done = !0;\n var e = this.tryEntries[0].completion;\n if (\"throw\" === e.type) throw e.arg;\n return this.rval;\n },\n dispatchException: function(t) {\n if (this.done) throw t;\n var n = this;\n function i(i, a) {\n return l.type = \"throw\", l.arg = t, n.next = i, a && (n.method = \"next\", n.arg = e), \n !!a;\n }\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r], l = o.completion;\n if (\"root\" === o.tryLoc) return i(\"end\");\n if (o.tryLoc <= this.prev) {\n var s = a.call(o, \"catchLoc\"), c = a.call(o, \"finallyLoc\");\n if (s && c) {\n if (this.prev < o.catchLoc) return i(o.catchLoc, !0);\n if (this.prev < o.finallyLoc) return i(o.finallyLoc);\n } else if (s) {\n if (this.prev < o.catchLoc) return i(o.catchLoc, !0);\n } else {\n if (!c) throw new Error(\"try statement without catch or finally\");\n if (this.prev < o.finallyLoc) return i(o.finallyLoc);\n }\n }\n }\n },\n abrupt: function(e, t) {\n for (var n = this.tryEntries.length - 1; n >= 0; --n) {\n var i = this.tryEntries[n];\n if (i.tryLoc <= this.prev && a.call(i, \"finallyLoc\") && this.prev < i.finallyLoc) {\n var r = i;\n break;\n }\n }\n r && (\"break\" === e || \"continue\" === e) && r.tryLoc <= t && t <= r.finallyLoc && (r = null);\n var o = r ? r.completion : {};\n return o.type = e, o.arg = t, r ? (this.method = \"next\", this.next = r.finallyLoc, \n y) : this.complete(o);\n },\n complete: function(e, t) {\n if (\"throw\" === e.type) throw e.arg;\n return \"break\" === e.type || \"continue\" === e.type ? this.next = e.arg : \"return\" === e.type ? (this.rval = this.arg = e.arg, \n this.method = \"return\", this.next = \"end\") : \"normal\" === e.type && t && (this.next = t), \n y;\n },\n finish: function(e) {\n for (var t = this.tryEntries.length - 1; t >= 0; --t) {\n var n = this.tryEntries[t];\n if (n.finallyLoc === e) return this.complete(n.completion, n.afterLoc), A(n), y;\n }\n },\n catch: function(e) {\n for (var t = this.tryEntries.length - 1; t >= 0; --t) {\n var n = this.tryEntries[t];\n if (n.tryLoc === e) {\n var i = n.completion;\n if (\"throw\" === i.type) {\n var a = i.arg;\n A(n);\n }\n return a;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function(t, n, i) {\n return this.delegate = {\n iterator: L(t),\n resultName: n,\n nextLoc: i\n }, \"next\" === this.method && (this.arg = e), y;\n }\n }, t;\n }\n function d(e, t) {\n var n = \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (!n) {\n if (Array.isArray(e) || (n = function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return h(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return h(e, t);\n }(e)) || t && e && \"number\" == typeof e.length) {\n n && (e = n);\n var i = 0, a = function() {};\n return {\n s: a,\n n: function() {\n return i >= e.length ? {\n done: !0\n } : {\n done: !1,\n value: e[i++]\n };\n },\n e: function(e) {\n throw e;\n },\n f: a\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var r, o = !0, l = !1;\n return {\n s: function() {\n n = n.call(e);\n },\n n: function() {\n var e = n.next();\n return o = e.done, e;\n },\n e: function(e) {\n l = !0, r = e;\n },\n f: function() {\n try {\n o || null == n.return || n.return();\n } finally {\n if (l) throw r;\n }\n }\n };\n }\n function h(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function v(e, t, n, i, a, r, o) {\n try {\n var l = e[r](o), s = l.value;\n } catch (e) {\n return void n(e);\n }\n l.done ? t(s) : Promise.resolve(s).then(i, a);\n }\n var m, g, y = t.EventHandlers = {\n keyEvent: function(e, t, n, i, a) {\n var f = this.inputmask, p = f.opts, d = f.dependencyLib, h = f.maskset, v = this, m = d(v), g = e.key, k = r.caret.call(f, v), b = p.onKeyDown.call(this, e, r.getBuffer.call(f), k, p);\n if (void 0 !== b) return b;\n if (g === o.keys.Backspace || g === o.keys.Delete || l.iphone && g === o.keys.BACKSPACE_SAFARI || e.ctrlKey && g === o.keys.x && !(\"oncut\" in v)) e.preventDefault(), \n s.handleRemove.call(f, v, g, k), (0, c.writeBuffer)(v, r.getBuffer.call(f, !0), h.p, e, v.inputmask._valueGet() !== r.getBuffer.call(f).join(\"\")); else if (g === o.keys.End || g === o.keys.PageDown) {\n e.preventDefault();\n var x = r.seekNext.call(f, r.getLastValidPosition.call(f));\n r.caret.call(f, v, e.shiftKey ? k.begin : x, x, !0);\n } else g === o.keys.Home && !e.shiftKey || g === o.keys.PageUp ? (e.preventDefault(), \n r.caret.call(f, v, 0, e.shiftKey ? k.begin : 0, !0)) : p.undoOnEscape && g === o.keys.Escape && !0 !== e.altKey ? ((0, \n c.checkVal)(v, !0, !1, f.undoValue.split(\"\")), m.trigger(\"click\")) : g !== o.keys.Insert || e.shiftKey || e.ctrlKey || void 0 !== f.userOptions.insertMode ? !0 === p.tabThrough && g === o.keys.Tab ? !0 === e.shiftKey ? (k.end = r.seekPrevious.call(f, k.end, !0), \n !0 === u.getTest.call(f, k.end - 1).match.static && k.end--, k.begin = r.seekPrevious.call(f, k.end, !0), \n k.begin >= 0 && k.end > 0 && (e.preventDefault(), r.caret.call(f, v, k.begin, k.end))) : (k.begin = r.seekNext.call(f, k.begin, !0), \n k.end = r.seekNext.call(f, k.begin, !0), k.end < h.maskLength && k.end--, k.begin <= h.maskLength && (e.preventDefault(), \n r.caret.call(f, v, k.begin, k.end))) : e.shiftKey || p.insertModeVisual && !1 === p.insertMode && (g === o.keys.ArrowRight ? setTimeout((function() {\n var e = r.caret.call(f, v);\n r.caret.call(f, v, e.begin);\n }), 0) : g === o.keys.ArrowLeft && setTimeout((function() {\n var e = r.translatePosition.call(f, v.inputmask.caretPos.begin);\n r.translatePosition.call(f, v.inputmask.caretPos.end);\n f.isRTL ? r.caret.call(f, v, e + (e === h.maskLength ? 0 : 1)) : r.caret.call(f, v, e - (0 === e ? 0 : 1));\n }), 0)) : s.isSelection.call(f, k) ? p.insertMode = !p.insertMode : (p.insertMode = !p.insertMode, \n r.caret.call(f, v, k.begin, k.begin));\n return f.isComposing = g == o.keys.Process || g == o.keys.Unidentified, f.ignorable = p.ignorables.includes(g), \n y.keypressEvent.call(this, e, t, n, i, a);\n },\n keypressEvent: function(e, t, n, i, a) {\n var l = this.inputmask || this, u = l.opts, f = l.dependencyLib, p = l.maskset, d = l.el, h = f(d), v = e.key;\n if (!0 === t || e.ctrlKey && e.altKey && !l.ignorable || !(e.ctrlKey || e.metaKey || l.ignorable)) {\n if (v) {\n var m, g = t ? {\n begin: a,\n end: a\n } : r.caret.call(l, d);\n v = u.substitutes[v] || v, p.writeOutBuffer = !0;\n var y = s.isValid.call(l, g, v, i, void 0, void 0, void 0, t);\n if (!1 !== y && (r.resetMaskSet.call(l, !0), m = void 0 !== y.caret ? y.caret : r.seekNext.call(l, y.pos.begin ? y.pos.begin : y.pos), \n p.p = m), m = u.numericInput && void 0 === y.caret ? r.seekPrevious.call(l, m) : m, \n !1 !== n && (setTimeout((function() {\n u.onKeyValidation.call(d, v, y);\n }), 0), p.writeOutBuffer && !1 !== y)) {\n var k = r.getBuffer.call(l);\n (0, c.writeBuffer)(d, k, m, e, !0 !== t);\n }\n if (e.preventDefault(), t) return !1 !== y && (y.forwardPosition = m), y;\n }\n } else v === o.keys.Enter && l.undoValue !== l._valueGet(!0) && (l.undoValue = l._valueGet(!0), \n setTimeout((function() {\n h.trigger(\"change\");\n }), 0));\n },\n pasteEvent: (m = p().mark((function e(t) {\n var n, i, a, o, l, s;\n return p().wrap((function(e) {\n for (;;) switch (e.prev = e.next) {\n case 0:\n n = function(e, n, i, a, l) {\n var s = r.caret.call(e, n, void 0, void 0, !0), u = i.substr(0, s.begin), f = i.substr(s.end, i.length);\n if (u == (e.isRTL ? r.getBufferTemplate.call(e).slice().reverse() : r.getBufferTemplate.call(e)).slice(0, s.begin).join(\"\") && (u = \"\"), \n f == (e.isRTL ? r.getBufferTemplate.call(e).slice().reverse() : r.getBufferTemplate.call(e)).slice(s.end).join(\"\") && (f = \"\"), \n a = u + a + f, e.isRTL && !0 !== o.numericInput) {\n a = a.split(\"\");\n var p, h = d(r.getBufferTemplate.call(e));\n try {\n for (h.s(); !(p = h.n()).done; ) {\n var v = p.value;\n a[0] === v && a.shift();\n }\n } catch (e) {\n h.e(e);\n } finally {\n h.f();\n }\n a = a.reverse().join(\"\");\n }\n var m = a;\n if (\"function\" == typeof l) {\n if (!1 === (m = l.call(e, m, o))) return !1;\n m || (m = i);\n }\n (0, c.checkVal)(n, !0, !1, m.toString().split(\"\"), t);\n }, i = this, a = this.inputmask, o = a.opts, l = a._valueGet(!0), a.skipInputEvent = !0, \n t.clipboardData && t.clipboardData.getData ? s = t.clipboardData.getData(\"text/plain\") : f.default.clipboardData && f.default.clipboardData.getData && (s = f.default.clipboardData.getData(\"Text\")), \n n(a, i, l, s, o.onBeforePaste), t.preventDefault();\n\n case 7:\n case \"end\":\n return e.stop();\n }\n }), e, this);\n })), g = function() {\n var e = this, t = arguments;\n return new Promise((function(n, i) {\n var a = m.apply(e, t);\n function r(e) {\n v(a, n, i, r, o, \"next\", e);\n }\n function o(e) {\n v(a, n, i, r, o, \"throw\", e);\n }\n r(void 0);\n }));\n }, function(e) {\n return g.apply(this, arguments);\n }),\n inputFallBackEvent: function(e) {\n var t = this.inputmask, n = t.opts, i = t.dependencyLib;\n var a, s = this, f = s.inputmask._valueGet(!0), p = (t.isRTL ? r.getBuffer.call(t).slice().reverse() : r.getBuffer.call(t)).join(\"\"), d = r.caret.call(t, s, void 0, void 0, !0);\n if (p !== f) {\n if (a = function(e, i, a) {\n for (var o, l, s, c = e.substr(0, a.begin).split(\"\"), f = e.substr(a.begin).split(\"\"), p = i.substr(0, a.begin).split(\"\"), d = i.substr(a.begin).split(\"\"), h = c.length >= p.length ? c.length : p.length, v = f.length >= d.length ? f.length : d.length, m = \"\", g = [], y = \"~\"; c.length < h; ) c.push(y);\n for (;p.length < h; ) p.push(y);\n for (;f.length < v; ) f.unshift(y);\n for (;d.length < v; ) d.unshift(y);\n var k = c.concat(f), b = p.concat(d);\n for (l = 0, o = k.length; l < o; l++) switch (s = u.getPlaceholder.call(t, r.translatePosition.call(t, l)), \n m) {\n case \"insertText\":\n b[l - 1] === k[l] && a.begin == k.length - 1 && g.push(k[l]), l = o;\n break;\n\n case \"insertReplacementText\":\n case \"deleteContentBackward\":\n k[l] === y ? a.end++ : l = o;\n break;\n\n default:\n k[l] !== b[l] && (k[l + 1] !== y && k[l + 1] !== s && void 0 !== k[l + 1] || (b[l] !== s || b[l + 1] !== y) && b[l] !== y ? b[l + 1] === y && b[l] === k[l + 1] ? (m = \"insertText\", \n g.push(k[l]), a.begin--, a.end--) : k[l] !== s && k[l] !== y && (k[l + 1] === y || b[l] !== k[l] && b[l + 1] === k[l + 1]) ? (m = \"insertReplacementText\", \n g.push(k[l]), a.begin--) : k[l] === y ? (m = \"deleteContentBackward\", (r.isMask.call(t, r.translatePosition.call(t, l), !0) || b[l] === n.radixPoint) && a.end++) : l = o : (m = \"insertText\", \n g.push(k[l]), a.begin--, a.end--));\n }\n return {\n action: m,\n data: g,\n caret: a\n };\n }(f, p, d), (s.inputmask.shadowRoot || s.ownerDocument).activeElement !== s && s.focus(), \n (0, c.writeBuffer)(s, r.getBuffer.call(t)), r.caret.call(t, s, d.begin, d.end, !0), \n !l.mobile && t.skipNextInsert && \"insertText\" === e.inputType && \"insertText\" === a.action && t.isComposing) return !1;\n switch (\"insertCompositionText\" === e.inputType && \"insertText\" === a.action && t.isComposing ? t.skipNextInsert = !0 : t.skipNextInsert = !1, \n a.action) {\n case \"insertText\":\n case \"insertReplacementText\":\n a.data.forEach((function(e, n) {\n var a = new i.Event(\"keypress\");\n a.key = e, t.ignorable = !1, y.keypressEvent.call(s, a);\n })), setTimeout((function() {\n t.$el.trigger(\"keyup\");\n }), 0);\n break;\n\n case \"deleteContentBackward\":\n var h = new i.Event(\"keydown\");\n h.key = o.keys.Backspace, y.keyEvent.call(s, h);\n break;\n\n default:\n (0, c.applyInputValue)(s, f), r.caret.call(t, s, d.begin, d.end, !0);\n }\n e.preventDefault();\n }\n },\n setValueEvent: function(e) {\n var t = this.inputmask, n = this, i = e && e.detail ? e.detail[0] : arguments[1];\n void 0 === i && (i = n.inputmask._valueGet(!0)), (0, c.applyInputValue)(n, i), (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && r.caret.call(t, n, e.detail ? e.detail[1] : arguments[2]);\n },\n focusEvent: function(e) {\n var t = this.inputmask, n = t.opts, i = t && t._valueGet();\n n.showMaskOnFocus && i !== r.getBuffer.call(t).join(\"\") && (0, c.writeBuffer)(this, r.getBuffer.call(t), r.seekNext.call(t, r.getLastValidPosition.call(t))), \n !0 !== n.positionCaretOnTab || !1 !== t.mouseEnter || s.isComplete.call(t, r.getBuffer.call(t)) && -1 !== r.getLastValidPosition.call(t) || y.clickEvent.apply(this, [ e, !0 ]), \n t.undoValue = t && t._valueGet(!0);\n },\n invalidEvent: function(e) {\n this.inputmask.validationEvent = !0;\n },\n mouseleaveEvent: function() {\n var e = this.inputmask, t = e.opts, n = this;\n e.mouseEnter = !1, t.clearMaskOnLostFocus && (n.inputmask.shadowRoot || n.ownerDocument).activeElement !== n && (0, \n c.HandleNativePlaceholder)(n, e.originalPlaceholder);\n },\n clickEvent: function(e, t) {\n var n = this.inputmask;\n n.clicked++;\n var i = this;\n if ((i.inputmask.shadowRoot || i.ownerDocument).activeElement === i) {\n var a = r.determineNewCaretPosition.call(n, r.caret.call(n, i), t);\n void 0 !== a && r.caret.call(n, i, a);\n }\n },\n cutEvent: function(e) {\n var t = this.inputmask, n = t.maskset, i = this, a = r.caret.call(t, i), l = t.isRTL ? r.getBuffer.call(t).slice(a.end, a.begin) : r.getBuffer.call(t).slice(a.begin, a.end), u = t.isRTL ? l.reverse().join(\"\") : l.join(\"\");\n f.default.navigator && f.default.navigator.clipboard ? f.default.navigator.clipboard.writeText(u) : f.default.clipboardData && f.default.clipboardData.getData && f.default.clipboardData.setData(\"Text\", u), \n s.handleRemove.call(t, i, o.keys.Delete, a), (0, c.writeBuffer)(i, r.getBuffer.call(t), n.p, e, t.undoValue !== t._valueGet(!0));\n },\n blurEvent: function(e) {\n var t = this.inputmask, n = t.opts, i = t.dependencyLib;\n t.clicked = 0;\n var a = i(this), o = this;\n if (o.inputmask) {\n (0, c.HandleNativePlaceholder)(o, t.originalPlaceholder);\n var l = o.inputmask._valueGet(), u = r.getBuffer.call(t).slice();\n \"\" !== l && (n.clearMaskOnLostFocus && (-1 === r.getLastValidPosition.call(t) && l === r.getBufferTemplate.call(t).join(\"\") ? u = [] : c.clearOptionalTail.call(t, u)), \n !1 === s.isComplete.call(t, u) && (setTimeout((function() {\n a.trigger(\"incomplete\");\n }), 0), n.clearIncomplete && (r.resetMaskSet.call(t, !1), u = n.clearMaskOnLostFocus ? [] : r.getBufferTemplate.call(t).slice())), \n (0, c.writeBuffer)(o, u, void 0, e)), l = t._valueGet(!0), t.undoValue !== l && (\"\" != l || t.undoValue != r.getBufferTemplate.call(t).join(\"\") || t.undoValue == r.getBufferTemplate.call(t).join(\"\") && t.maskset.validPositions.length > 0) && (t.undoValue = l, \n a.trigger(\"change\"));\n }\n },\n mouseenterEvent: function() {\n var e = this.inputmask, t = e.opts.showMaskOnHover, n = this;\n if (e.mouseEnter = !0, (n.inputmask.shadowRoot || n.ownerDocument).activeElement !== n) {\n var i = (e.isRTL ? r.getBufferTemplate.call(e).slice().reverse() : r.getBufferTemplate.call(e)).join(\"\");\n t && (0, c.HandleNativePlaceholder)(n, i);\n }\n },\n submitEvent: function() {\n var e = this.inputmask, t = e.opts;\n e.undoValue !== e._valueGet(!0) && e.$el.trigger(\"change\"), -1 === r.getLastValidPosition.call(e) && e._valueGet && e._valueGet() === r.getBufferTemplate.call(e).join(\"\") && e._valueSet(\"\"), \n t.clearIncomplete && !1 === s.isComplete.call(e, r.getBuffer.call(e)) && e._valueSet(\"\"), \n t.removeMaskOnSubmit && (e._valueSet(e.unmaskedvalue(), !0), setTimeout((function() {\n (0, c.writeBuffer)(e.el, r.getBuffer.call(e));\n }), 0));\n },\n resetEvent: function() {\n var e = this.inputmask;\n e.refreshValue = !0, setTimeout((function() {\n (0, c.applyInputValue)(e.el, e._valueGet(!0));\n }), 0);\n }\n };\n },\n 9716: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.EventRuler = void 0;\n var i, a = (i = n(2394)) && i.__esModule ? i : {\n default: i\n }, r = n(2839), o = n(8711), l = n(7760);\n t.EventRuler = {\n on: function(e, t, n) {\n var i = e.inputmask.dependencyLib, s = function(t) {\n t.originalEvent && (t = t.originalEvent || t, arguments[0] = t);\n var s, c = this, u = c.inputmask, f = u ? u.opts : void 0;\n if (void 0 === u && \"FORM\" !== this.nodeName) {\n var p = i.data(c, \"_inputmask_opts\");\n i(c).off(), p && new a.default(p).mask(c);\n } else {\n if ([ \"submit\", \"reset\", \"setvalue\" ].includes(t.type) || \"FORM\" === this.nodeName || !(c.disabled || c.readOnly && !(\"keydown\" === t.type && t.ctrlKey && t.key === r.keys.c || !1 === f.tabThrough && t.key === r.keys.Tab))) {\n switch (t.type) {\n case \"input\":\n if (!0 === u.skipInputEvent) return u.skipInputEvent = !1, t.preventDefault();\n break;\n\n case \"click\":\n case \"focus\":\n return u.validationEvent ? (u.validationEvent = !1, e.blur(), (0, l.HandleNativePlaceholder)(e, (u.isRTL ? o.getBufferTemplate.call(u).slice().reverse() : o.getBufferTemplate.call(u)).join(\"\")), \n setTimeout((function() {\n e.focus();\n }), f.validationEventTimeOut), !1) : (s = arguments, void setTimeout((function() {\n e.inputmask && n.apply(c, s);\n }), 0));\n }\n var d = n.apply(c, arguments);\n return !1 === d && (t.preventDefault(), t.stopPropagation()), d;\n }\n t.preventDefault();\n }\n };\n [ \"submit\", \"reset\" ].includes(t) ? (s = s.bind(e), null !== e.form && i(e.form).on(t, s)) : i(e).on(t, s), \n e.inputmask.events[t] = e.inputmask.events[t] || [], e.inputmask.events[t].push(s);\n },\n off: function(e, t) {\n if (e.inputmask && e.inputmask.events) {\n var n = e.inputmask.dependencyLib, i = e.inputmask.events;\n for (var a in t && ((i = [])[t] = e.inputmask.events[t]), i) {\n for (var r = i[a]; r.length > 0; ) {\n var o = r.pop();\n [ \"submit\", \"reset\" ].includes(a) ? null !== e.form && n(e.form).off(a, o) : n(e).off(a, o);\n }\n delete e.inputmask.events[a];\n }\n }\n }\n };\n },\n 219: function(e, t, n) {\n var i = p(n(2394)), a = n(2839), r = p(n(7184)), o = n(8711), l = n(4713);\n function s(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return c(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return c(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function c(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function u(e) {\n return u = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, u(e);\n }\n function f(e, t) {\n for (var n = 0; n < t.length; n++) {\n var i = t[n];\n i.enumerable = i.enumerable || !1, i.configurable = !0, \"value\" in i && (i.writable = !0), \n Object.defineProperty(e, (a = i.key, r = void 0, r = function(e, t) {\n if (\"object\" !== u(e) || null === e) return e;\n var n = e[Symbol.toPrimitive];\n if (void 0 !== n) {\n var i = n.call(e, t || \"default\");\n if (\"object\" !== u(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(a, \"string\"), \"symbol\" === u(r) ? r : String(r)), i);\n }\n var a, r;\n }\n function p(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n n(1313);\n var d = i.default.dependencyLib, h = function() {\n function e(t, n, i) {\n !function(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.mask = t, this.format = n, this.opts = i, this._date = new Date(1, 0, 1), \n this.initDateObject(t, this.opts);\n }\n var t, n, i;\n return t = e, (n = [ {\n key: \"date\",\n get: function() {\n return void 0 === this._date && (this._date = new Date(1, 0, 1), this.initDateObject(void 0, this.opts)), \n this._date;\n }\n }, {\n key: \"initDateObject\",\n value: function(e, t) {\n var n;\n for (w(t).lastIndex = 0; n = w(t).exec(this.format); ) {\n var i = new RegExp(\"\\\\d+$\").exec(n[0]), a = i ? n[0][0] + \"x\" : n[0], r = void 0;\n if (void 0 !== e) {\n if (i) {\n var o = w(t).lastIndex, l = j(n.index, t);\n w(t).lastIndex = o, r = e.slice(0, e.indexOf(l.nextMatch[0]));\n } else r = e.slice(0, y[a] && y[a][4] || a.length);\n e = e.slice(r.length);\n }\n Object.prototype.hasOwnProperty.call(y, a) && this.setValue(this, r, a, y[a][2], y[a][1]);\n }\n }\n }, {\n key: \"setValue\",\n value: function(e, t, n, i, a) {\n if (void 0 !== t && (e[i] = \"ampm\" === i || \"mmm\" === n || \"mmmm\" === n ? t : t.replace(/[^0-9]/g, \"0\"), \n e[\"raw\" + i] = t.replace(/\\s/g, \"_\")), void 0 !== a) {\n var r = e[i];\n (\"day\" === i && 29 === parseInt(r) || \"month\" === i && 2 === parseInt(r)) && (29 !== parseInt(e.day) || 2 !== parseInt(e.month) || \"\" !== e.year && void 0 !== e.year || e._date.setFullYear(2012, 1, 29)), \n \"day\" === i && (g = !0, 0 === parseInt(r) && (r = 1)), \"month\" === i && (g = !0), \n \"year\" === i && (g = !0, r.length < 4 && (r = _(r, 4, !0))), (\"\" !== r && !isNaN(r) || \"ampm\" === i || \"mmm\" === n || \"mmmm\" === n) && a.call(e._date, r);\n }\n }\n }, {\n key: \"reset\",\n value: function() {\n this._date = new Date(1, 0, 1);\n }\n }, {\n key: \"reInit\",\n value: function() {\n this._date = void 0, this.date;\n }\n } ]) && f(t.prototype, n), i && f(t, i), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e;\n }(), v = (new Date).getFullYear(), m = i.default.prototype.i18n, g = !1, y = {\n d: [ \"[1-9]|[12][0-9]|3[01]\", Date.prototype.setDate, \"day\", Date.prototype.getDate ],\n dd: [ \"0[1-9]|[12][0-9]|3[01]\", Date.prototype.setDate, \"day\", function() {\n return _(Date.prototype.getDate.call(this), 2);\n } ],\n ddd: [ \"\" ],\n dddd: [ \"\" ],\n m: [ \"[1-9]|1[012]\", function(e) {\n var t = e ? parseInt(e) : 0;\n return t > 0 && t--, Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return Date.prototype.getMonth.call(this) + 1;\n } ],\n mm: [ \"0[1-9]|1[012]\", function(e) {\n var t = e ? parseInt(e) : 0;\n return t > 0 && t--, Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return _(Date.prototype.getMonth.call(this) + 1, 2);\n } ],\n mmm: [ m.monthNames.slice(0, 12).join(\"|\"), function(e) {\n var t = m.monthNames.slice(0, 12).findIndex((function(t) {\n return e.toLowerCase() === t.toLowerCase();\n }));\n return Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return _(Date.prototype.getMonth.call(this) + 1, 2);\n } ],\n mmmm: [ m.monthNames.slice(12, 24).join(\"|\"), function(e) {\n var t = m.monthNames.slice(12, 24).findIndex((function(t) {\n return e.toLowerCase() === t.toLowerCase();\n }));\n return Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return _(Date.prototype.getMonth.call(this) + 1, 2);\n } ],\n yy: [ \"[0-9]{2}\", Date.prototype.setFullYear, \"year\", function() {\n return _(Date.prototype.getFullYear.call(this), 2);\n } ],\n yyyy: [ \"[0-9]{4}\", Date.prototype.setFullYear, \"year\", function() {\n return _(Date.prototype.getFullYear.call(this), 4);\n } ],\n h: [ \"[1-9]|1[0-2]\", Date.prototype.setHours, \"hours\", Date.prototype.getHours ],\n hh: [ \"0[1-9]|1[0-2]\", Date.prototype.setHours, \"hours\", function() {\n return _(Date.prototype.getHours.call(this), 2);\n } ],\n hx: [ function(e) {\n return \"[0-9]{\".concat(e, \"}\");\n }, Date.prototype.setHours, \"hours\", function(e) {\n return Date.prototype.getHours;\n } ],\n H: [ \"1?[0-9]|2[0-3]\", Date.prototype.setHours, \"hours\", Date.prototype.getHours ],\n HH: [ \"0[0-9]|1[0-9]|2[0-3]\", Date.prototype.setHours, \"hours\", function() {\n return _(Date.prototype.getHours.call(this), 2);\n } ],\n Hx: [ function(e) {\n return \"[0-9]{\".concat(e, \"}\");\n }, Date.prototype.setHours, \"hours\", function(e) {\n return function() {\n return _(Date.prototype.getHours.call(this), e);\n };\n } ],\n M: [ \"[1-5]?[0-9]\", Date.prototype.setMinutes, \"minutes\", Date.prototype.getMinutes ],\n MM: [ \"0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]\", Date.prototype.setMinutes, \"minutes\", function() {\n return _(Date.prototype.getMinutes.call(this), 2);\n } ],\n s: [ \"[1-5]?[0-9]\", Date.prototype.setSeconds, \"seconds\", Date.prototype.getSeconds ],\n ss: [ \"0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]\", Date.prototype.setSeconds, \"seconds\", function() {\n return _(Date.prototype.getSeconds.call(this), 2);\n } ],\n l: [ \"[0-9]{3}\", Date.prototype.setMilliseconds, \"milliseconds\", function() {\n return _(Date.prototype.getMilliseconds.call(this), 3);\n }, 3 ],\n L: [ \"[0-9]{2}\", Date.prototype.setMilliseconds, \"milliseconds\", function() {\n return _(Date.prototype.getMilliseconds.call(this), 2);\n }, 2 ],\n t: [ \"[ap]\", b, \"ampm\", x, 1 ],\n tt: [ \"[ap]m\", b, \"ampm\", x, 2 ],\n T: [ \"[AP]\", b, \"ampm\", x, 1 ],\n TT: [ \"[AP]M\", b, \"ampm\", x, 2 ],\n Z: [ \".*\", void 0, \"Z\", function() {\n var e = this.toString().match(/\\((.+)\\)/)[1];\n e.includes(\" \") && (e = (e = e.replace(\"-\", \" \").toUpperCase()).split(\" \").map((function(e) {\n return s(e, 1)[0];\n })).join(\"\"));\n return e;\n } ],\n o: [ \"\" ],\n S: [ \"\" ]\n }, k = {\n isoDate: \"yyyy-mm-dd\",\n isoTime: \"HH:MM:ss\",\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n };\n function b(e) {\n var t = this.getHours();\n e.toLowerCase().includes(\"p\") ? this.setHours(t + 12) : e.toLowerCase().includes(\"a\") && t >= 12 && this.setHours(t - 12);\n }\n function x() {\n var e = this.getHours();\n return (e = e || 12) >= 12 ? \"PM\" : \"AM\";\n }\n function P(e) {\n var t = new RegExp(\"\\\\d+$\").exec(e[0]);\n if (t && void 0 !== t[0]) {\n var n = y[e[0][0] + \"x\"].slice(\"\");\n return n[0] = n[0](t[0]), n[3] = n[3](t[0]), n;\n }\n if (y[e[0]]) return y[e[0]];\n }\n function w(e) {\n if (!e.tokenizer) {\n var t = [], n = [];\n for (var i in y) if (/\\.*x$/.test(i)) {\n var a = i[0] + \"\\\\d+\";\n -1 === n.indexOf(a) && n.push(a);\n } else -1 === t.indexOf(i[0]) && t.push(i[0]);\n e.tokenizer = \"(\" + (n.length > 0 ? n.join(\"|\") + \"|\" : \"\") + t.join(\"+|\") + \")+?|.\", \n e.tokenizer = new RegExp(e.tokenizer, \"g\");\n }\n return e.tokenizer;\n }\n function S(e, t, n) {\n if (!g) return !0;\n if (void 0 === e.rawday || !isFinite(e.rawday) && new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day || \"29\" == e.day && (!isFinite(e.rawyear) || void 0 === e.rawyear || \"\" === e.rawyear) || new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day) return t;\n if (\"29\" == e.day) {\n var i = j(t.pos, n);\n if (i.targetMatch && \"yyyy\" === i.targetMatch[0] && t.pos - i.targetMatchIndex == 2) return t.remove = t.pos + 1, \n t;\n } else if (2 == e.date.getMonth() && \"30\" == e.day && void 0 !== t.c) return e.day = \"03\", \n e.date.setDate(3), e.date.setMonth(1), t.insert = [ {\n pos: t.pos,\n c: \"0\"\n }, {\n pos: t.pos + 1,\n c: t.c\n } ], t.caret = o.seekNext.call(this, t.pos + 1), t;\n return !1;\n }\n function O(e, t, n, i) {\n var a, o, l = \"\", s = 0, c = {};\n for (w(n).lastIndex = 0; a = w(n).exec(e); ) {\n if (void 0 === t) if (o = P(a)) l += \"(\" + o[0] + \")\", c[s] = a[0].charAt(0); else switch (a[0]) {\n case \"[\":\n l += \"(\";\n break;\n\n case \"]\":\n l += \")?\";\n break;\n\n default:\n l += (0, r.default)(a[0]), c[s] = a[0].charAt(0);\n } else if (o = P(a)) if (!0 !== i && o[3]) l += o[3].call(t.date); else o[2] ? l += t[\"raw\" + o[2]] : l += a[0]; else l += a[0];\n s++;\n }\n return void 0 === t && \"\" === n.placeholder && (n.placeholder = c), l;\n }\n function _(e, t, n) {\n for (e = String(e), t = t || 2; e.length < t; ) e = n ? e + \"0\" : \"0\" + e;\n return e;\n }\n function M(e, t, n) {\n return \"string\" == typeof e ? new h(e, t, n) : e && \"object\" === u(e) && Object.prototype.hasOwnProperty.call(e, \"date\") ? e : void 0;\n }\n function E(e, t) {\n return O(t.inputFormat, {\n date: e\n }, t);\n }\n function j(e, t) {\n var n, i, a = 0, r = 0;\n for (w(t).lastIndex = 0; i = w(t).exec(t.inputFormat); ) {\n var o = new RegExp(\"\\\\d+$\").exec(i[0]);\n if ((a += r = o ? parseInt(o[0]) : i[0].length) >= e + 1) {\n n = i, i = w(t).exec(t.inputFormat);\n break;\n }\n }\n return {\n targetMatchIndex: a - r,\n nextMatch: i,\n targetMatch: n\n };\n }\n i.default.extendAliases({\n datetime: {\n mask: function(e) {\n return e.numericInput = !1, y.S = m.ordinalSuffix.join(\"|\"), e.inputFormat = k[e.inputFormat] || e.inputFormat, \n e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, \n e.regex = O(e.inputFormat, void 0, e), e.min = M(e.min, e.inputFormat, e), e.max = M(e.max, e.inputFormat, e), \n null;\n },\n placeholder: \"\",\n inputFormat: \"isoDateTime\",\n displayFormat: null,\n outputFormat: null,\n min: null,\n max: null,\n skipOptionalPartCharacter: \"\",\n preValidation: function(e, t, n, i, a, r, o, l) {\n if (l) return !0;\n if (isNaN(n) && e[t] !== n) {\n var s = j(t, a);\n if (s.nextMatch && s.nextMatch[0] === n && s.targetMatch[0].length > 1) {\n var c = y[s.targetMatch[0]][0];\n if (new RegExp(c).test(\"0\" + e[t - 1])) return e[t] = e[t - 1], e[t - 1] = \"0\", \n {\n fuzzy: !0,\n buffer: e,\n refreshFromBuffer: {\n start: t - 1,\n end: t + 1\n },\n pos: t + 1\n };\n }\n }\n return !0;\n },\n postValidation: function(e, t, n, i, a, r, o, s) {\n var c, u;\n if (o) return !0;\n if (!1 === i && (((c = j(t + 1, a)).targetMatch && c.targetMatchIndex === t && c.targetMatch[0].length > 1 && void 0 !== y[c.targetMatch[0]] || (c = j(t + 2, a)).targetMatch && c.targetMatchIndex === t + 1 && c.targetMatch[0].length > 1 && void 0 !== y[c.targetMatch[0]]) && (u = y[c.targetMatch[0]][0]), \n void 0 !== u && (void 0 !== r.validPositions[t + 1] && new RegExp(u).test(n + \"0\") ? (e[t] = n, \n e[t + 1] = \"0\", i = {\n pos: t + 2,\n caret: t\n }) : new RegExp(u).test(\"0\" + n) && (e[t] = \"0\", e[t + 1] = n, i = {\n pos: t + 2\n })), !1 === i)) return i;\n if (i.fuzzy && (e = i.buffer, t = i.pos), (c = j(t, a)).targetMatch && c.targetMatch[0] && void 0 !== y[c.targetMatch[0]]) {\n var f = y[c.targetMatch[0]];\n u = f[0];\n var p = e.slice(c.targetMatchIndex, c.targetMatchIndex + c.targetMatch[0].length);\n if (!1 === new RegExp(u).test(p.join(\"\")) && 2 === c.targetMatch[0].length && r.validPositions[c.targetMatchIndex] && r.validPositions[c.targetMatchIndex + 1] && (r.validPositions[c.targetMatchIndex + 1].input = \"0\"), \n \"year\" == f[2]) for (var d = l.getMaskTemplate.call(this, !1, 1, void 0, !0), h = t + 1; h < e.length; h++) e[h] = d[h], \n r.validPositions.splice(t + 1, 1);\n }\n var m = i, g = M(e.join(\"\"), a.inputFormat, a);\n return m && !isNaN(g.date.getTime()) && (a.prefillYear && (m = function(e, t, n) {\n if (e.year !== e.rawyear) {\n var i = v.toString(), a = e.rawyear.replace(/[^0-9]/g, \"\"), r = i.slice(0, a.length), o = i.slice(a.length);\n if (2 === a.length && a === r) {\n var l = new Date(v, e.month - 1, e.day);\n e.day == l.getDate() && (!n.max || n.max.date.getTime() >= l.getTime()) && (e.date.setFullYear(v), \n e.year = i, t.insert = [ {\n pos: t.pos + 1,\n c: o[0]\n }, {\n pos: t.pos + 2,\n c: o[1]\n } ]);\n }\n }\n return t;\n }(g, m, a)), m = function(e, t, n, i, a) {\n if (!t) return t;\n if (t && n.min && !isNaN(n.min.date.getTime())) {\n var r;\n for (e.reset(), w(n).lastIndex = 0; r = w(n).exec(n.inputFormat); ) {\n var o;\n if ((o = P(r)) && o[3]) {\n for (var l = o[1], s = e[o[2]], c = n.min[o[2]], u = n.max ? n.max[o[2]] : c, f = [], p = !1, d = 0; d < c.length; d++) void 0 !== i.validPositions[d + r.index] || p ? (f[d] = s[d], \n p = p || s[d] > c[d]) : (d + r.index == 0 && s[d] < c[d] ? (f[d] = s[d], p = !0) : f[d] = c[d], \n \"year\" === o[2] && s.length - 1 == d && c != u && (f = (parseInt(f.join(\"\")) + 1).toString().split(\"\")), \n \"ampm\" === o[2] && c != u && n.min.date.getTime() > e.date.getTime() && (f[d] = u[d]));\n l.call(e._date, f.join(\"\"));\n }\n }\n t = n.min.date.getTime() <= e.date.getTime(), e.reInit();\n }\n return t && n.max && (isNaN(n.max.date.getTime()) || (t = n.max.date.getTime() >= e.date.getTime())), \n t;\n }(g, m = S.call(this, g, m, a), a, r)), void 0 !== t && m && i.pos !== t ? {\n buffer: O(a.inputFormat, g, a).split(\"\"),\n refreshFromBuffer: {\n start: t,\n end: i.pos\n },\n pos: i.caret || i.pos\n } : m;\n },\n onKeyDown: function(e, t, n, i) {\n e.ctrlKey && e.key === a.keys.ArrowRight && (this.inputmask._valueSet(E(new Date, i)), \n d(this).trigger(\"setvalue\"));\n },\n onUnMask: function(e, t, n) {\n return t ? O(n.outputFormat, M(e, n.inputFormat, n), n, !0) : t;\n },\n casing: function(e, t, n, i) {\n return 0 == t.nativeDef.indexOf(\"[ap]\") ? e.toLowerCase() : 0 == t.nativeDef.indexOf(\"[AP]\") ? e.toUpperCase() : e;\n },\n onBeforeMask: function(e, t) {\n return \"[object Date]\" === Object.prototype.toString.call(e) && (e = E(e, t)), e;\n },\n insertMode: !1,\n insertModeVisual: !1,\n shiftPositions: !1,\n keepStatic: !1,\n inputmode: \"numeric\",\n prefillYear: !0\n }\n });\n },\n 1313: function(e, t, n) {\n var i, a = (i = n(2394)) && i.__esModule ? i : {\n default: i\n };\n a.default.dependencyLib.extend(!0, a.default.prototype.i18n, {\n dayNames: [ \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\" ],\n monthNames: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\", \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ],\n ordinalSuffix: [ \"st\", \"nd\", \"rd\", \"th\" ]\n });\n },\n 3851: function(e, t, n) {\n var i, a = (i = n(2394)) && i.__esModule ? i : {\n default: i\n }, r = n(8711), o = n(4713);\n function l(e) {\n return function(e) {\n if (Array.isArray(e)) return s(e);\n }(e) || function(e) {\n if (\"undefined\" != typeof Symbol && null != e[Symbol.iterator] || null != e[\"@@iterator\"]) return Array.from(e);\n }(e) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return s(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return s(e, t);\n }(e) || function() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function s(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n a.default.extendDefinitions({\n A: {\n validator: \"[A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\",\n casing: \"upper\"\n },\n \"&\": {\n validator: \"[0-9A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\",\n casing: \"upper\"\n },\n \"#\": {\n validator: \"[0-9A-Fa-f]\",\n casing: \"upper\"\n }\n });\n var c = new RegExp(\"25[0-5]|2[0-4][0-9]|[01][0-9][0-9]\");\n function u(e, t, n, i, a) {\n if (n - 1 > -1 && \".\" !== t.buffer[n - 1] ? (e = t.buffer[n - 1] + e, e = n - 2 > -1 && \".\" !== t.buffer[n - 2] ? t.buffer[n - 2] + e : \"0\" + e) : e = \"00\" + e, \n a.greedy && parseInt(e) > 255 && c.test(\"00\" + e.charAt(2))) {\n var r = [].concat(l(t.buffer.slice(0, n)), [ \".\", e.charAt(2) ]);\n if (r.join(\"\").match(/\\./g).length < 4) return {\n refreshFromBuffer: !0,\n buffer: r,\n caret: n + 2\n };\n }\n return c.test(e);\n }\n a.default.extendAliases({\n cssunit: {\n regex: \"[+-]?[0-9]+\\\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)\"\n },\n url: {\n regex: \"(https?|ftp)://.*\",\n autoUnmask: !1,\n keepStatic: !1,\n tabThrough: !0\n },\n ip: {\n mask: \"i{1,3}.j{1,3}.k{1,3}.l{1,3}\",\n definitions: {\n i: {\n validator: u\n },\n j: {\n validator: u\n },\n k: {\n validator: u\n },\n l: {\n validator: u\n }\n },\n onUnMask: function(e, t, n) {\n return e;\n },\n inputmode: \"decimal\",\n substitutes: {\n \",\": \".\"\n }\n },\n email: {\n mask: function(e) {\n var t = e.separator, n = e.quantifier, i = \"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]\", a = i;\n if (t) for (var r = 0; r < n; r++) a += \"[\".concat(t).concat(i, \"]\");\n return a;\n },\n greedy: !1,\n casing: \"lower\",\n separator: null,\n quantifier: 5,\n skipOptionalPartCharacter: \"\",\n onBeforePaste: function(e, t) {\n return (e = e.toLowerCase()).replace(\"mailto:\", \"\");\n },\n definitions: {\n \"*\": {\n validator: \"[0-9\\uff11-\\uff19A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5!#$%&'*+/=?^_`{|}~-]\"\n },\n \"-\": {\n validator: \"[0-9A-Za-z-]\"\n }\n },\n onUnMask: function(e, t, n) {\n return e;\n },\n inputmode: \"email\"\n },\n mac: {\n mask: \"##:##:##:##:##:##\"\n },\n vin: {\n mask: \"V{13}9{4}\",\n definitions: {\n V: {\n validator: \"[A-HJ-NPR-Za-hj-npr-z\\\\d]\",\n casing: \"upper\"\n }\n },\n clearIncomplete: !0,\n autoUnmask: !0\n },\n ssn: {\n mask: \"999-99-9999\",\n postValidation: function(e, t, n, i, a, l, s) {\n var c = o.getMaskTemplate.call(this, !0, r.getLastValidPosition.call(this), !0, !0);\n return /^(?!219-09-9999|078-05-1120)(?!666|000|9.{2}).{3}-(?!00).{2}-(?!0{4}).{4}$/.test(c.join(\"\"));\n }\n }\n });\n },\n 207: function(e, t, n) {\n var i = l(n(2394)), a = l(n(7184)), r = n(8711), o = n(2839);\n function l(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var s = i.default.dependencyLib;\n function c(e, t) {\n for (var n = \"\", a = 0; a < e.length; a++) i.default.prototype.definitions[e.charAt(a)] || t.definitions[e.charAt(a)] || t.optionalmarker[0] === e.charAt(a) || t.optionalmarker[1] === e.charAt(a) || t.quantifiermarker[0] === e.charAt(a) || t.quantifiermarker[1] === e.charAt(a) || t.groupmarker[0] === e.charAt(a) || t.groupmarker[1] === e.charAt(a) || t.alternatormarker === e.charAt(a) ? n += \"\\\\\" + e.charAt(a) : n += e.charAt(a);\n return n;\n }\n function u(e, t, n, i) {\n if (e.length > 0 && t > 0 && (!n.digitsOptional || i)) {\n var a = e.indexOf(n.radixPoint), r = !1;\n n.negationSymbol.back === e[e.length - 1] && (r = !0, e.length--), -1 === a && (e.push(n.radixPoint), \n a = e.length - 1);\n for (var o = 1; o <= t; o++) isFinite(e[a + o]) || (e[a + o] = \"0\");\n }\n return r && e.push(n.negationSymbol.back), e;\n }\n function f(e, t) {\n var n = 0;\n for (var i in \"+\" === e && (n = r.seekNext.call(this, t.validPositions.length - 1)), \n t.tests) if ((i = parseInt(i)) >= n) for (var a = 0, o = t.tests[i].length; a < o; a++) if ((void 0 === t.validPositions[i] || \"-\" === e) && t.tests[i][a].match.def === e) return i + (void 0 !== t.validPositions[i] && \"-\" !== e ? 1 : 0);\n return n;\n }\n function p(e, t) {\n for (var n = -1, i = 0, a = t.validPositions.length; i < a; i++) {\n var r = t.validPositions[i];\n if (r && r.match.def === e) {\n n = i;\n break;\n }\n }\n return n;\n }\n function d(e, t, n, i, a) {\n var r = t.buffer ? t.buffer.indexOf(a.radixPoint) : -1, o = (-1 !== r || i && a.jitMasking) && new RegExp(a.definitions[9].validator).test(e);\n return a._radixDance && -1 !== r && o && null == t.validPositions[r] ? {\n insert: {\n pos: r === n ? r + 1 : r,\n c: a.radixPoint\n },\n pos: n\n } : o;\n }\n i.default.extendAliases({\n numeric: {\n mask: function(e) {\n e.repeat = 0, e.groupSeparator === e.radixPoint && e.digits && \"0\" !== e.digits && (\".\" === e.radixPoint ? e.groupSeparator = \",\" : \",\" === e.radixPoint ? e.groupSeparator = \".\" : e.groupSeparator = \"\"), \n \" \" === e.groupSeparator && (e.skipOptionalPartCharacter = void 0), e.placeholder.length > 1 && (e.placeholder = e.placeholder.charAt(0)), \n \"radixFocus\" === e.positionCaretOnClick && \"\" === e.placeholder && (e.positionCaretOnClick = \"lvp\");\n var t = \"0\", n = e.radixPoint;\n !0 === e.numericInput && void 0 === e.__financeInput ? (t = \"1\", e.positionCaretOnClick = \"radixFocus\" === e.positionCaretOnClick ? \"lvp\" : e.positionCaretOnClick, \n e.digitsOptional = !1, isNaN(e.digits) && (e.digits = 2), e._radixDance = !1, n = \",\" === e.radixPoint ? \"?\" : \"!\", \n \"\" !== e.radixPoint && void 0 === e.definitions[n] && (e.definitions[n] = {}, e.definitions[n].validator = \"[\" + e.radixPoint + \"]\", \n e.definitions[n].placeholder = e.radixPoint, e.definitions[n].static = !0, e.definitions[n].generated = !0)) : (e.__financeInput = !1, \n e.numericInput = !0);\n var i, r = \"[+]\";\n if (r += c(e.prefix, e), \"\" !== e.groupSeparator ? (void 0 === e.definitions[e.groupSeparator] && (e.definitions[e.groupSeparator] = {}, \n e.definitions[e.groupSeparator].validator = \"[\" + e.groupSeparator + \"]\", e.definitions[e.groupSeparator].placeholder = e.groupSeparator, \n e.definitions[e.groupSeparator].static = !0, e.definitions[e.groupSeparator].generated = !0), \n r += e._mask(e)) : r += \"9{+}\", void 0 !== e.digits && 0 !== e.digits) {\n var o = e.digits.toString().split(\",\");\n isFinite(o[0]) && o[1] && isFinite(o[1]) ? r += n + t + \"{\" + e.digits + \"}\" : (isNaN(e.digits) || parseInt(e.digits) > 0) && (e.digitsOptional || e.jitMasking ? (i = r + n + t + \"{0,\" + e.digits + \"}\", \n e.keepStatic = !0) : r += n + t + \"{\" + e.digits + \"}\");\n } else e.inputmode = \"numeric\";\n return r += c(e.suffix, e), r += \"[-]\", i && (r = [ i + c(e.suffix, e) + \"[-]\", r ]), \n e.greedy = !1, function(e) {\n void 0 === e.parseMinMaxOptions && (null !== e.min && (e.min = e.min.toString().replace(new RegExp((0, \n a.default)(e.groupSeparator), \"g\"), \"\"), \",\" === e.radixPoint && (e.min = e.min.replace(e.radixPoint, \".\")), \n e.min = isFinite(e.min) ? parseFloat(e.min) : NaN, isNaN(e.min) && (e.min = Number.MIN_VALUE)), \n null !== e.max && (e.max = e.max.toString().replace(new RegExp((0, a.default)(e.groupSeparator), \"g\"), \"\"), \n \",\" === e.radixPoint && (e.max = e.max.replace(e.radixPoint, \".\")), e.max = isFinite(e.max) ? parseFloat(e.max) : NaN, \n isNaN(e.max) && (e.max = Number.MAX_VALUE)), e.parseMinMaxOptions = \"done\");\n }(e), \"\" !== e.radixPoint && e.substituteRadixPoint && (e.substitutes[\".\" == e.radixPoint ? \",\" : \".\"] = e.radixPoint), \n r;\n },\n _mask: function(e) {\n return \"(\" + e.groupSeparator + \"999){+|1}\";\n },\n digits: \"*\",\n digitsOptional: !0,\n enforceDigitsOnBlur: !1,\n radixPoint: \".\",\n positionCaretOnClick: \"radixFocus\",\n _radixDance: !0,\n groupSeparator: \"\",\n allowMinus: !0,\n negationSymbol: {\n front: \"-\",\n back: \"\"\n },\n prefix: \"\",\n suffix: \"\",\n min: null,\n max: null,\n SetMaxOnOverflow: !1,\n step: 1,\n inputType: \"text\",\n unmaskAsNumber: !1,\n roundingFN: Math.round,\n inputmode: \"decimal\",\n shortcuts: {\n k: \"1000\",\n m: \"1000000\"\n },\n placeholder: \"0\",\n greedy: !1,\n rightAlign: !0,\n insertMode: !0,\n autoUnmask: !1,\n skipOptionalPartCharacter: \"\",\n usePrototypeDefinitions: !1,\n stripLeadingZeroes: !0,\n substituteRadixPoint: !0,\n definitions: {\n 0: {\n validator: d\n },\n 1: {\n validator: d,\n definitionSymbol: \"9\"\n },\n 9: {\n validator: \"[0-9\\uff10-\\uff19\\u0660-\\u0669\\u06f0-\\u06f9]\",\n definitionSymbol: \"*\"\n },\n \"+\": {\n validator: function(e, t, n, i, a) {\n return a.allowMinus && (\"-\" === e || e === a.negationSymbol.front);\n }\n },\n \"-\": {\n validator: function(e, t, n, i, a) {\n return a.allowMinus && e === a.negationSymbol.back;\n }\n }\n },\n preValidation: function(e, t, n, i, a, r, o, l) {\n var s = this;\n if (!1 !== a.__financeInput && n === a.radixPoint) return !1;\n var c = e.indexOf(a.radixPoint), u = t;\n if (t = function(e, t, n, i, a) {\n return a._radixDance && a.numericInput && t !== a.negationSymbol.back && e <= n && (n > 0 || t == a.radixPoint) && (void 0 === i.validPositions[e - 1] || i.validPositions[e - 1].input !== a.negationSymbol.back) && (e -= 1), \n e;\n }(t, n, c, r, a), \"-\" === n || n === a.negationSymbol.front) {\n if (!0 !== a.allowMinus) return !1;\n var d = !1, h = p(\"+\", r), v = p(\"-\", r);\n return -1 !== h && (d = [ h, v ]), !1 !== d ? {\n remove: d,\n caret: u - a.negationSymbol.back.length\n } : {\n insert: [ {\n pos: f.call(s, \"+\", r),\n c: a.negationSymbol.front,\n fromIsValid: !0\n }, {\n pos: f.call(s, \"-\", r),\n c: a.negationSymbol.back,\n fromIsValid: void 0\n } ],\n caret: u + a.negationSymbol.back.length\n };\n }\n if (n === a.groupSeparator) return {\n caret: u\n };\n if (l) return !0;\n if (-1 !== c && !0 === a._radixDance && !1 === i && n === a.radixPoint && void 0 !== a.digits && (isNaN(a.digits) || parseInt(a.digits) > 0) && c !== t) {\n var m = f.call(s, a.radixPoint, r);\n return r.validPositions[m] && (r.validPositions[m].generatedInput = r.validPositions[m].generated || !1), \n {\n caret: a._radixDance && t === c - 1 ? c + 1 : c\n };\n }\n if (!1 === a.__financeInput) if (i) {\n if (a.digitsOptional) return {\n rewritePosition: o.end\n };\n if (!a.digitsOptional) {\n if (o.begin > c && o.end <= c) return n === a.radixPoint ? {\n insert: {\n pos: c + 1,\n c: \"0\",\n fromIsValid: !0\n },\n rewritePosition: c\n } : {\n rewritePosition: c + 1\n };\n if (o.begin < c) return {\n rewritePosition: o.begin - 1\n };\n }\n } else if (!a.showMaskOnHover && !a.showMaskOnFocus && !a.digitsOptional && a.digits > 0 && \"\" === this.__valueGet.call(this.el)) return {\n rewritePosition: c\n };\n return {\n rewritePosition: t\n };\n },\n postValidation: function(e, t, n, i, a, r, o) {\n if (!1 === i) return i;\n if (o) return !0;\n if (null !== a.min || null !== a.max) {\n var l = a.onUnMask(e.slice().reverse().join(\"\"), void 0, s.extend({}, a, {\n unmaskAsNumber: !0\n }));\n if (null !== a.min && l < a.min && (l.toString().length > a.min.toString().length || l < 0)) return !1;\n if (null !== a.max && l > a.max) return !!a.SetMaxOnOverflow && {\n refreshFromBuffer: !0,\n buffer: u(a.max.toString().replace(\".\", a.radixPoint).split(\"\"), a.digits, a).reverse()\n };\n }\n return i;\n },\n onUnMask: function(e, t, n) {\n if (\"\" === t && !0 === n.nullable) return t;\n var i = e.replace(n.prefix, \"\");\n return i = (i = i.replace(n.suffix, \"\")).replace(new RegExp((0, a.default)(n.groupSeparator), \"g\"), \"\"), \n \"\" !== n.placeholder.charAt(0) && (i = i.replace(new RegExp(n.placeholder.charAt(0), \"g\"), \"0\")), \n n.unmaskAsNumber ? (\"\" !== n.radixPoint && -1 !== i.indexOf(n.radixPoint) && (i = i.replace(a.default.call(this, n.radixPoint), \".\")), \n i = (i = i.replace(new RegExp(\"^\" + (0, a.default)(n.negationSymbol.front)), \"-\")).replace(new RegExp((0, \n a.default)(n.negationSymbol.back) + \"$\"), \"\"), Number(i)) : i;\n },\n isComplete: function(e, t) {\n var n = (t.numericInput ? e.slice().reverse() : e).join(\"\");\n return n = (n = (n = (n = (n = n.replace(new RegExp(\"^\" + (0, a.default)(t.negationSymbol.front)), \"-\")).replace(new RegExp((0, \n a.default)(t.negationSymbol.back) + \"$\"), \"\")).replace(t.prefix, \"\")).replace(t.suffix, \"\")).replace(new RegExp((0, \n a.default)(t.groupSeparator) + \"([0-9]{3})\", \"g\"), \"$1\"), \",\" === t.radixPoint && (n = n.replace((0, \n a.default)(t.radixPoint), \".\")), isFinite(n);\n },\n onBeforeMask: function(e, t) {\n var n = t.radixPoint || \",\";\n isFinite(t.digits) && (t.digits = parseInt(t.digits)), \"number\" != typeof e && \"number\" !== t.inputType || \"\" === n || (e = e.toString().replace(\".\", n));\n var i = \"-\" === e.charAt(0) || e.charAt(0) === t.negationSymbol.front, r = e.split(n), o = r[0].replace(/[^\\-0-9]/g, \"\"), l = r.length > 1 ? r[1].replace(/[^0-9]/g, \"\") : \"\", s = r.length > 1;\n e = o + (\"\" !== l ? n + l : l);\n var c = 0;\n if (\"\" !== n && (c = t.digitsOptional ? t.digits < l.length ? t.digits : l.length : t.digits, \n \"\" !== l || !t.digitsOptional)) {\n var f = Math.pow(10, c || 1);\n e = e.replace((0, a.default)(n), \".\"), isNaN(parseFloat(e)) || (e = (t.roundingFN(parseFloat(e) * f) / f).toFixed(c)), \n e = e.toString().replace(\".\", n);\n }\n if (0 === t.digits && -1 !== e.indexOf(n) && (e = e.substring(0, e.indexOf(n))), \n null !== t.min || null !== t.max) {\n var p = e.toString().replace(n, \".\");\n null !== t.min && p < t.min ? e = t.min.toString().replace(\".\", n) : null !== t.max && p > t.max && (e = t.max.toString().replace(\".\", n));\n }\n return i && \"-\" !== e.charAt(0) && (e = \"-\" + e), u(e.toString().split(\"\"), c, t, s).join(\"\");\n },\n onBeforeWrite: function(e, t, n, i) {\n function r(e, t) {\n if (!1 !== i.__financeInput || t) {\n var n = e.indexOf(i.radixPoint);\n -1 !== n && e.splice(n, 1);\n }\n if (\"\" !== i.groupSeparator) for (;-1 !== (n = e.indexOf(i.groupSeparator)); ) e.splice(n, 1);\n return e;\n }\n var o, l;\n if (i.stripLeadingZeroes && (l = function(e, t) {\n var n = new RegExp(\"(^\" + (\"\" !== t.negationSymbol.front ? (0, a.default)(t.negationSymbol.front) + \"?\" : \"\") + (0, \n a.default)(t.prefix) + \")(.*)(\" + (0, a.default)(t.suffix) + (\"\" != t.negationSymbol.back ? (0, \n a.default)(t.negationSymbol.back) + \"?\" : \"\") + \"$)\").exec(e.slice().reverse().join(\"\")), i = n ? n[2] : \"\", r = !1;\n return i && (i = i.split(t.radixPoint.charAt(0))[0], r = new RegExp(\"^[0\" + t.groupSeparator + \"]*\").exec(i)), \n !(!r || !(r[0].length > 1 || r[0].length > 0 && r[0].length < i.length)) && r;\n }(t, i))) for (var c = t.join(\"\").lastIndexOf(l[0].split(\"\").reverse().join(\"\")) - (l[0] == l.input ? 0 : 1), f = l[0] == l.input ? 1 : 0, p = l[0].length - f; p > 0; p--) this.maskset.validPositions.splice(c + p, 1), \n delete t[c + p];\n if (e) switch (e.type) {\n case \"blur\":\n case \"checkval\":\n if (null !== i.min) {\n var d = i.onUnMask(t.slice().reverse().join(\"\"), void 0, s.extend({}, i, {\n unmaskAsNumber: !0\n }));\n if (null !== i.min && d < i.min) return {\n refreshFromBuffer: !0,\n buffer: u(i.min.toString().replace(\".\", i.radixPoint).split(\"\"), i.digits, i).reverse()\n };\n }\n if (t[t.length - 1] === i.negationSymbol.front) {\n var h = new RegExp(\"(^\" + (\"\" != i.negationSymbol.front ? (0, a.default)(i.negationSymbol.front) + \"?\" : \"\") + (0, \n a.default)(i.prefix) + \")(.*)(\" + (0, a.default)(i.suffix) + (\"\" != i.negationSymbol.back ? (0, \n a.default)(i.negationSymbol.back) + \"?\" : \"\") + \"$)\").exec(r(t.slice(), !0).reverse().join(\"\"));\n 0 == (h ? h[2] : \"\") && (o = {\n refreshFromBuffer: !0,\n buffer: [ 0 ]\n });\n } else if (\"\" !== i.radixPoint) {\n t.indexOf(i.radixPoint) === i.suffix.length && (o && o.buffer ? o.buffer.splice(0, 1 + i.suffix.length) : (t.splice(0, 1 + i.suffix.length), \n o = {\n refreshFromBuffer: !0,\n buffer: r(t)\n }));\n }\n if (i.enforceDigitsOnBlur) {\n var v = (o = o || {}) && o.buffer || t.slice().reverse();\n o.refreshFromBuffer = !0, o.buffer = u(v, i.digits, i, !0).reverse();\n }\n }\n return o;\n },\n onKeyDown: function(e, t, n, i) {\n var a, r = s(this);\n if (3 != e.location) {\n var l, c = e.key;\n if ((l = i.shortcuts && i.shortcuts[c]) && l.length > 1) return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) * parseInt(l)), \n r.trigger(\"setvalue\"), !1;\n }\n if (e.ctrlKey) switch (e.key) {\n case o.keys.ArrowUp:\n return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) + parseInt(i.step)), \n r.trigger(\"setvalue\"), !1;\n\n case o.keys.ArrowDown:\n return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) - parseInt(i.step)), \n r.trigger(\"setvalue\"), !1;\n }\n if (!e.shiftKey && (e.key === o.keys.Delete || e.key === o.keys.Backspace || e.key === o.keys.BACKSPACE_SAFARI) && n.begin !== t.length) {\n if (t[e.key === o.keys.Delete ? n.begin - 1 : n.end] === i.negationSymbol.front) return a = t.slice().reverse(), \n \"\" !== i.negationSymbol.front && a.shift(), \"\" !== i.negationSymbol.back && a.pop(), \n r.trigger(\"setvalue\", [ a.join(\"\"), n.begin ]), !1;\n if (!0 === i._radixDance) {\n var f = t.indexOf(i.radixPoint);\n if (i.digitsOptional) {\n if (0 === f) return (a = t.slice().reverse()).pop(), r.trigger(\"setvalue\", [ a.join(\"\"), n.begin >= a.length ? a.length : n.begin ]), \n !1;\n } else if (-1 !== f && (n.begin < f || n.end < f || e.key === o.keys.Delete && (n.begin === f || n.begin - 1 === f))) {\n var p = void 0;\n return n.begin === n.end && (e.key === o.keys.Backspace || e.key === o.keys.BACKSPACE_SAFARI ? n.begin++ : e.key === o.keys.Delete && n.begin - 1 === f && (p = s.extend({}, n), \n n.begin--, n.end--)), (a = t.slice().reverse()).splice(a.length - n.begin, n.begin - n.end + 1), \n a = u(a, i.digits, i).join(\"\"), p && (n = p), r.trigger(\"setvalue\", [ a, n.begin >= a.length ? f + 1 : n.begin ]), \n !1;\n }\n }\n }\n }\n },\n currency: {\n prefix: \"\",\n groupSeparator: \",\",\n alias: \"numeric\",\n digits: 2,\n digitsOptional: !1\n },\n decimal: {\n alias: \"numeric\"\n },\n integer: {\n alias: \"numeric\",\n inputmode: \"numeric\",\n digits: 0\n },\n percentage: {\n alias: \"numeric\",\n min: 0,\n max: 100,\n suffix: \" %\",\n digits: 0,\n allowMinus: !1\n },\n indianns: {\n alias: \"numeric\",\n _mask: function(e) {\n return \"(\" + e.groupSeparator + \"99){*|1}(\" + e.groupSeparator + \"999){1|1}\";\n },\n groupSeparator: \",\",\n radixPoint: \".\",\n placeholder: \"0\",\n digits: 2,\n digitsOptional: !1\n }\n });\n },\n 9380: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var n = !(\"undefined\" == typeof window || !window.document || !window.document.createElement);\n t.default = n ? window : {};\n },\n 7760: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.HandleNativePlaceholder = function(e, t) {\n var n = e ? e.inputmask : this;\n if (l.ie) {\n if (e.inputmask._valueGet() !== t && (e.placeholder !== t || \"\" === e.placeholder)) {\n var i = r.getBuffer.call(n).slice(), a = e.inputmask._valueGet();\n if (a !== t) {\n var o = r.getLastValidPosition.call(n);\n -1 === o && a === r.getBufferTemplate.call(n).join(\"\") ? i = [] : -1 !== o && u.call(n, i), \n p(e, i);\n }\n }\n } else e.placeholder !== t && (e.placeholder = t, \"\" === e.placeholder && e.removeAttribute(\"placeholder\"));\n }, t.applyInputValue = c, t.checkVal = f, t.clearOptionalTail = u, t.unmaskedvalue = function(e) {\n var t = e ? e.inputmask : this, n = t.opts, i = t.maskset;\n if (e) {\n if (void 0 === e.inputmask) return e.value;\n e.inputmask && e.inputmask.refreshValue && c(e, e.inputmask._valueGet(!0));\n }\n for (var a = [], o = i.validPositions, l = 0, s = o.length; l < s; l++) o[l] && o[l].match && (1 != o[l].match.static || Array.isArray(i.metadata) && !0 !== o[l].generatedInput) && a.push(o[l].input);\n var u = 0 === a.length ? \"\" : (t.isRTL ? a.reverse() : a).join(\"\");\n if (\"function\" == typeof n.onUnMask) {\n var f = (t.isRTL ? r.getBuffer.call(t).slice().reverse() : r.getBuffer.call(t)).join(\"\");\n u = n.onUnMask.call(t, f, u, n);\n }\n return u;\n }, t.writeBuffer = p;\n var i = n(2839), a = n(4713), r = n(8711), o = n(7215), l = n(9845), s = n(6030);\n function c(e, t) {\n var n = e ? e.inputmask : this, i = n.opts;\n e.inputmask.refreshValue = !1, \"function\" == typeof i.onBeforeMask && (t = i.onBeforeMask.call(n, t, i) || t), \n f(e, !0, !1, t = (t || \"\").toString().split(\"\")), n.undoValue = n._valueGet(!0), \n (i.clearMaskOnLostFocus || i.clearIncomplete) && e.inputmask._valueGet() === r.getBufferTemplate.call(n).join(\"\") && -1 === r.getLastValidPosition.call(n) && e.inputmask._valueSet(\"\");\n }\n function u(e) {\n e.length = 0;\n for (var t, n = a.getMaskTemplate.call(this, !0, 0, !0, void 0, !0); void 0 !== (t = n.shift()); ) e.push(t);\n return e;\n }\n function f(e, t, n, i, l) {\n var c = e ? e.inputmask : this, u = c.maskset, f = c.opts, d = c.dependencyLib, h = i.slice(), v = \"\", m = -1, g = void 0, y = f.skipOptionalPartCharacter;\n f.skipOptionalPartCharacter = \"\", r.resetMaskSet.call(c, !1), c.clicked = 0, m = f.radixPoint ? r.determineNewCaretPosition.call(c, {\n begin: 0,\n end: 0\n }, !1, !1 === f.__financeInput ? \"radixFocus\" : void 0).begin : 0, u.p = m, c.caretPos = {\n begin: m\n };\n var k = [], b = c.caretPos;\n if (h.forEach((function(e, t) {\n if (void 0 !== e) {\n var i = new d.Event(\"_checkval\");\n i.key = e, v += e;\n var o = r.getLastValidPosition.call(c, void 0, !0);\n !function(e, t) {\n for (var n = a.getMaskTemplate.call(c, !0, 0).slice(e, r.seekNext.call(c, e, !1, !1)).join(\"\").replace(/'/g, \"\"), i = n.indexOf(t); i > 0 && \" \" === n[i - 1]; ) i--;\n var o = 0 === i && !r.isMask.call(c, e) && (a.getTest.call(c, e).match.nativeDef === t.charAt(0) || !0 === a.getTest.call(c, e).match.static && a.getTest.call(c, e).match.nativeDef === \"'\" + t.charAt(0) || \" \" === a.getTest.call(c, e).match.nativeDef && (a.getTest.call(c, e + 1).match.nativeDef === t.charAt(0) || !0 === a.getTest.call(c, e + 1).match.static && a.getTest.call(c, e + 1).match.nativeDef === \"'\" + t.charAt(0)));\n if (!o && i > 0 && !r.isMask.call(c, e, !1, !0)) {\n var l = r.seekNext.call(c, e);\n c.caretPos.begin < l && (c.caretPos = {\n begin: l\n });\n }\n return o;\n }(m, v) ? (g = s.EventHandlers.keypressEvent.call(c, i, !0, !1, n, c.caretPos.begin)) && (m = c.caretPos.begin + 1, \n v = \"\") : g = s.EventHandlers.keypressEvent.call(c, i, !0, !1, n, o + 1), g ? (void 0 !== g.pos && u.validPositions[g.pos] && !0 === u.validPositions[g.pos].match.static && void 0 === u.validPositions[g.pos].alternation && (k.push(g.pos), \n c.isRTL || (g.forwardPosition = g.pos + 1)), p.call(c, void 0, r.getBuffer.call(c), g.forwardPosition, i, !1), \n c.caretPos = {\n begin: g.forwardPosition,\n end: g.forwardPosition\n }, b = c.caretPos) : void 0 === u.validPositions[t] && h[t] === a.getPlaceholder.call(c, t) && r.isMask.call(c, t, !0) ? c.caretPos.begin++ : c.caretPos = b;\n }\n })), k.length > 0) {\n var x, P, w = r.seekNext.call(c, -1, void 0, !1);\n if (!o.isComplete.call(c, r.getBuffer.call(c)) && k.length <= w || o.isComplete.call(c, r.getBuffer.call(c)) && k.length > 0 && k.length !== w && 0 === k[0]) for (var S = w; void 0 !== (x = k.shift()); ) if (x < S) {\n var O = new d.Event(\"_checkval\");\n if ((P = u.validPositions[x]).generatedInput = !0, O.key = P.input, (g = s.EventHandlers.keypressEvent.call(c, O, !0, !1, n, S)) && void 0 !== g.pos && g.pos !== x && u.validPositions[g.pos] && !0 === u.validPositions[g.pos].match.static) k.push(g.pos); else if (!g) break;\n S++;\n }\n }\n t && p.call(c, e, r.getBuffer.call(c), g ? g.forwardPosition : c.caretPos.begin, l || new d.Event(\"checkval\"), l && (\"input\" === l.type && c.undoValue !== r.getBuffer.call(c).join(\"\") || \"paste\" === l.type)), \n f.skipOptionalPartCharacter = y;\n }\n function p(e, t, n, a, l) {\n var s = e ? e.inputmask : this, c = s.opts, u = s.dependencyLib;\n if (a && \"function\" == typeof c.onBeforeWrite) {\n var f = c.onBeforeWrite.call(s, a, t, n, c);\n if (f) {\n if (f.refreshFromBuffer) {\n var p = f.refreshFromBuffer;\n o.refreshFromBuffer.call(s, !0 === p ? p : p.start, p.end, f.buffer || t), t = r.getBuffer.call(s, !0);\n }\n void 0 !== n && (n = void 0 !== f.caret ? f.caret : n);\n }\n }\n if (void 0 !== e && (e.inputmask._valueSet(t.join(\"\")), void 0 === n || void 0 !== a && \"blur\" === a.type || r.caret.call(s, e, n, void 0, void 0, void 0 !== a && \"keydown\" === a.type && (a.key === i.keys.Delete || a.key === i.keys.Backspace)), \n !0 === l)) {\n var d = u(e), h = e.inputmask._valueGet();\n e.inputmask.skipInputEvent = !0, d.trigger(\"input\"), setTimeout((function() {\n h === r.getBufferTemplate.call(s).join(\"\") ? d.trigger(\"cleared\") : !0 === o.isComplete.call(s, t) && d.trigger(\"complete\");\n }), 0);\n }\n }\n },\n 2394: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var i = n(157), a = v(n(4963)), r = v(n(9380)), o = n(2391), l = n(4713), s = n(8711), c = n(7215), u = n(7760), f = n(9716), p = v(n(7392)), d = v(n(3976));\n function h(e) {\n return h = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, h(e);\n }\n function v(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var m = r.default.document, g = \"_inputmask_opts\";\n function y(e, t, n) {\n if (!(this instanceof y)) return new y(e, t, n);\n this.dependencyLib = a.default, this.el = void 0, this.events = {}, this.maskset = void 0, \n !0 !== n && (\"[object Object]\" === Object.prototype.toString.call(e) ? t = e : (t = t || {}, \n e && (t.alias = e)), this.opts = a.default.extend(!0, {}, this.defaults, t), this.noMasksCache = t && void 0 !== t.definitions, \n this.userOptions = t || {}, k(this.opts.alias, t, this.opts)), this.refreshValue = !1, \n this.undoValue = void 0, this.$el = void 0, this.skipInputEvent = !1, this.validationEvent = !1, \n this.ignorable = !1, this.maxLength, this.mouseEnter = !1, this.clicked = 0, this.originalPlaceholder = void 0, \n this.isComposing = !1, this.hasAlternator = !1;\n }\n function k(e, t, n) {\n var i = y.prototype.aliases[e];\n return i ? (i.alias && k(i.alias, void 0, n), a.default.extend(!0, n, i), a.default.extend(!0, n, t), \n !0) : (null === n.mask && (n.mask = e), !1);\n }\n y.prototype = {\n dataAttribute: \"data-inputmask\",\n defaults: d.default,\n definitions: p.default,\n aliases: {},\n masksCache: {},\n i18n: {},\n get isRTL() {\n return this.opts.isRTL || this.opts.numericInput;\n },\n mask: function(e) {\n var t = this;\n return \"string\" == typeof e && (e = m.getElementById(e) || m.querySelectorAll(e)), \n (e = e.nodeName ? [ e ] : Array.isArray(e) ? e : [].slice.call(e)).forEach((function(e, n) {\n var l = a.default.extend(!0, {}, t.opts);\n if (function(e, t, n, i) {\n function o(t, a) {\n var o = \"\" === i ? t : i + \"-\" + t;\n null !== (a = void 0 !== a ? a : e.getAttribute(o)) && (\"string\" == typeof a && (0 === t.indexOf(\"on\") ? a = r.default[a] : \"false\" === a ? a = !1 : \"true\" === a && (a = !0)), \n n[t] = a);\n }\n if (!0 === t.importDataAttributes) {\n var l, s, c, u, f = e.getAttribute(i);\n if (f && \"\" !== f && (f = f.replace(/'/g, '\"'), s = JSON.parse(\"{\" + f + \"}\")), \n s) for (u in c = void 0, s) if (\"alias\" === u.toLowerCase()) {\n c = s[u];\n break;\n }\n for (l in o(\"alias\", c), n.alias && k(n.alias, n, t), t) {\n if (s) for (u in c = void 0, s) if (u.toLowerCase() === l.toLowerCase()) {\n c = s[u];\n break;\n }\n o(l, c);\n }\n }\n a.default.extend(!0, t, n), (\"rtl\" === e.dir || t.rightAlign) && (e.style.textAlign = \"right\");\n (\"rtl\" === e.dir || t.numericInput) && (e.dir = \"ltr\", e.removeAttribute(\"dir\"), \n t.isRTL = !0);\n return Object.keys(n).length;\n }(e, l, a.default.extend(!0, {}, t.userOptions), t.dataAttribute)) {\n var s = (0, o.generateMaskSet)(l, t.noMasksCache);\n void 0 !== s && (void 0 !== e.inputmask && (e.inputmask.opts.autoUnmask = !0, e.inputmask.remove()), \n e.inputmask = new y(void 0, void 0, !0), e.inputmask.opts = l, e.inputmask.noMasksCache = t.noMasksCache, \n e.inputmask.userOptions = a.default.extend(!0, {}, t.userOptions), e.inputmask.el = e, \n e.inputmask.$el = (0, a.default)(e), e.inputmask.maskset = s, a.default.data(e, g, t.userOptions), \n i.mask.call(e.inputmask));\n }\n })), e && e[0] && e[0].inputmask || this;\n },\n option: function(e, t) {\n return \"string\" == typeof e ? this.opts[e] : \"object\" === h(e) ? (a.default.extend(this.userOptions, e), \n this.el && !0 !== t && this.mask(this.el), this) : void 0;\n },\n unmaskedvalue: function(e) {\n if (this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n void 0 === this.el || void 0 !== e) {\n var t = (\"function\" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, e, this.opts) || e).split(\"\");\n u.checkVal.call(this, void 0, !1, !1, t), \"function\" == typeof this.opts.onBeforeWrite && this.opts.onBeforeWrite.call(this, void 0, s.getBuffer.call(this), 0, this.opts);\n }\n return u.unmaskedvalue.call(this, this.el);\n },\n remove: function() {\n if (this.el) {\n a.default.data(this.el, g, null);\n var e = this.opts.autoUnmask ? (0, u.unmaskedvalue)(this.el) : this._valueGet(this.opts.autoUnmask);\n e !== s.getBufferTemplate.call(this).join(\"\") ? this._valueSet(e, this.opts.autoUnmask) : this._valueSet(\"\"), \n f.EventRuler.off(this.el), Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.el), \"value\") && this.__valueGet && Object.defineProperty(this.el, \"value\", {\n get: this.__valueGet,\n set: this.__valueSet,\n configurable: !0\n }) : m.__lookupGetter__ && this.el.__lookupGetter__(\"value\") && this.__valueGet && (this.el.__defineGetter__(\"value\", this.__valueGet), \n this.el.__defineSetter__(\"value\", this.__valueSet)), this.el.inputmask = void 0;\n }\n return this.el;\n },\n getemptymask: function() {\n return this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n (this.isRTL ? s.getBufferTemplate.call(this).reverse() : s.getBufferTemplate.call(this)).join(\"\");\n },\n hasMaskedValue: function() {\n return !this.opts.autoUnmask;\n },\n isComplete: function() {\n return this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n c.isComplete.call(this, s.getBuffer.call(this));\n },\n getmetadata: function() {\n if (this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n Array.isArray(this.maskset.metadata)) {\n var e = l.getMaskTemplate.call(this, !0, 0, !1).join(\"\");\n return this.maskset.metadata.forEach((function(t) {\n return t.mask !== e || (e = t, !1);\n })), e;\n }\n return this.maskset.metadata;\n },\n isValid: function(e) {\n if (this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n e) {\n var t = (\"function\" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, e, this.opts) || e).split(\"\");\n u.checkVal.call(this, void 0, !0, !1, t);\n } else e = this.isRTL ? s.getBuffer.call(this).slice().reverse().join(\"\") : s.getBuffer.call(this).join(\"\");\n for (var n = s.getBuffer.call(this), i = s.determineLastRequiredPosition.call(this), a = n.length - 1; a > i && !s.isMask.call(this, a); a--) ;\n return n.splice(i, a + 1 - i), c.isComplete.call(this, n) && e === (this.isRTL ? s.getBuffer.call(this).slice().reverse().join(\"\") : s.getBuffer.call(this).join(\"\"));\n },\n format: function(e, t) {\n this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache);\n var n = (\"function\" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, e, this.opts) || e).split(\"\");\n u.checkVal.call(this, void 0, !0, !1, n);\n var i = this.isRTL ? s.getBuffer.call(this).slice().reverse().join(\"\") : s.getBuffer.call(this).join(\"\");\n return t ? {\n value: i,\n metadata: this.getmetadata()\n } : i;\n },\n setValue: function(e) {\n this.el && (0, a.default)(this.el).trigger(\"setvalue\", [ e ]);\n },\n analyseMask: o.analyseMask\n }, y.extendDefaults = function(e) {\n a.default.extend(!0, y.prototype.defaults, e);\n }, y.extendDefinitions = function(e) {\n a.default.extend(!0, y.prototype.definitions, e);\n }, y.extendAliases = function(e) {\n a.default.extend(!0, y.prototype.aliases, e);\n }, y.format = function(e, t, n) {\n return y(t).format(e, n);\n }, y.unmask = function(e, t) {\n return y(t).unmaskedvalue(e);\n }, y.isValid = function(e, t) {\n return y(t).isValid(e);\n }, y.remove = function(e) {\n \"string\" == typeof e && (e = m.getElementById(e) || m.querySelectorAll(e)), (e = e.nodeName ? [ e ] : e).forEach((function(e) {\n e.inputmask && e.inputmask.remove();\n }));\n }, y.setValue = function(e, t) {\n \"string\" == typeof e && (e = m.getElementById(e) || m.querySelectorAll(e)), (e = e.nodeName ? [ e ] : e).forEach((function(e) {\n e.inputmask ? e.inputmask.setValue(t) : (0, a.default)(e).trigger(\"setvalue\", [ t ]);\n }));\n }, y.dependencyLib = a.default, r.default.Inputmask = y;\n t.default = y;\n },\n 5296: function(e, t, n) {\n function i(e) {\n return i = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, i(e);\n }\n var a = d(n(9380)), r = d(n(2394));\n function o(e, t) {\n for (var n = 0; n < t.length; n++) {\n var a = t[n];\n a.enumerable = a.enumerable || !1, a.configurable = !0, \"value\" in a && (a.writable = !0), \n Object.defineProperty(e, (r = a.key, o = void 0, o = function(e, t) {\n if (\"object\" !== i(e) || null === e) return e;\n var n = e[Symbol.toPrimitive];\n if (void 0 !== n) {\n var a = n.call(e, t || \"default\");\n if (\"object\" !== i(a)) return a;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(r, \"string\"), \"symbol\" === i(o) ? o : String(o)), a);\n }\n var r, o;\n }\n function l(e) {\n var t = u();\n return function() {\n var n, a = p(e);\n if (t) {\n var r = p(this).constructor;\n n = Reflect.construct(a, arguments, r);\n } else n = a.apply(this, arguments);\n return function(e, t) {\n if (t && (\"object\" === i(t) || \"function\" == typeof t)) return t;\n if (void 0 !== t) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return function(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n }(e);\n }(this, n);\n };\n }\n function s(e) {\n var t = \"function\" == typeof Map ? new Map : void 0;\n return s = function(e) {\n if (null === e || !function(e) {\n try {\n return -1 !== Function.toString.call(e).indexOf(\"[native code]\");\n } catch (t) {\n return \"function\" == typeof e;\n }\n }(e)) return e;\n if (\"function\" != typeof e) throw new TypeError(\"Super expression must either be null or a function\");\n if (void 0 !== t) {\n if (t.has(e)) return t.get(e);\n t.set(e, n);\n }\n function n() {\n return c(e, arguments, p(this).constructor);\n }\n return n.prototype = Object.create(e.prototype, {\n constructor: {\n value: n,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), f(n, e);\n }, s(e);\n }\n function c(e, t, n) {\n return c = u() ? Reflect.construct.bind() : function(e, t, n) {\n var i = [ null ];\n i.push.apply(i, t);\n var a = new (Function.bind.apply(e, i));\n return n && f(a, n.prototype), a;\n }, c.apply(null, arguments);\n }\n function u() {\n if (\"undefined\" == typeof Reflect || !Reflect.construct) return !1;\n if (Reflect.construct.sham) return !1;\n if (\"function\" == typeof Proxy) return !0;\n try {\n return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), \n !0;\n } catch (e) {\n return !1;\n }\n }\n function f(e, t) {\n return f = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {\n return e.__proto__ = t, e;\n }, f(e, t);\n }\n function p(e) {\n return p = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {\n return e.__proto__ || Object.getPrototypeOf(e);\n }, p(e);\n }\n function d(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var h = a.default.document;\n if (h && h.head && h.head.attachShadow && a.default.customElements && void 0 === a.default.customElements.get(\"input-mask\")) {\n var v = function(e) {\n !function(e, t) {\n if (\"function\" != typeof t && null !== t) throw new TypeError(\"Super expression must either be null or a function\");\n e.prototype = Object.create(t && t.prototype, {\n constructor: {\n value: e,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), t && f(e, t);\n }(s, e);\n var t, n, i, a = l(s);\n function s() {\n var e;\n !function(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, s);\n var t = (e = a.call(this)).getAttributeNames(), n = e.attachShadow({\n mode: \"closed\"\n });\n for (var i in e.input = h.createElement(\"input\"), e.input.type = \"text\", n.appendChild(e.input), \n t) Object.prototype.hasOwnProperty.call(t, i) && e.input.setAttribute(t[i], e.getAttribute(t[i]));\n var o = new r.default;\n return o.dataAttribute = \"\", o.mask(e.input), e.input.inputmask.shadowRoot = n, \n e;\n }\n return t = s, (n = [ {\n key: \"attributeChangedCallback\",\n value: function(e, t, n) {\n this.input.setAttribute(e, n);\n }\n }, {\n key: \"value\",\n get: function() {\n return this.input.value;\n },\n set: function(e) {\n this.input.value = e;\n }\n } ]) && o(t.prototype, n), i && o(t, i), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), s;\n }(s(HTMLElement));\n a.default.customElements.define(\"input-mask\", v);\n }\n },\n 2839: function(e, t) {\n function n(e) {\n return n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, n(e);\n }\n function i(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return a(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return a(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function a(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function r(e, t) {\n var n = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var i = Object.getOwnPropertySymbols(e);\n t && (i = i.filter((function(t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n }))), n.push.apply(n, i);\n }\n return n;\n }\n function o(e, t, i) {\n return (t = function(e) {\n var t = function(e, t) {\n if (\"object\" !== n(e) || null === e) return e;\n var i = e[Symbol.toPrimitive];\n if (void 0 !== i) {\n var a = i.call(e, t || \"default\");\n if (\"object\" !== n(a)) return a;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(e, \"string\");\n return \"symbol\" === n(t) ? t : String(t);\n }(t)) in e ? Object.defineProperty(e, t, {\n value: i,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = i, e;\n }\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.keys = t.keyCode = t.ignorables = void 0, t.toKey = function(e, t) {\n return c[e] || (t ? String.fromCharCode(e) : String.fromCharCode(e).toLowerCase());\n }, t.toKeyCode = function(e) {\n return s[e];\n };\n var l = t.ignorables = {\n Alt: 18,\n AltGraph: 18,\n ArrowDown: 40,\n ArrowLeft: 37,\n ArrowRight: 39,\n ArrowUp: 38,\n Backspace: 8,\n CapsLock: 20,\n Control: 17,\n ContextMenu: 93,\n Dead: 221,\n Delete: 46,\n End: 35,\n Escape: 27,\n F1: 112,\n F2: 113,\n F3: 114,\n F4: 115,\n F5: 116,\n F6: 117,\n F7: 118,\n F8: 119,\n F9: 120,\n F10: 121,\n F11: 122,\n F12: 123,\n Home: 36,\n Insert: 45,\n NumLock: 144,\n PageDown: 34,\n PageUp: 33,\n Pause: 19,\n PrintScreen: 44,\n Process: 229,\n Shift: 16,\n ScrollLock: 145,\n Tab: 9,\n Unidentified: 229\n }, s = t.keyCode = function(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? r(Object(n), !0).forEach((function(t) {\n o(e, t, n[t]);\n })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : r(Object(n)).forEach((function(t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n }));\n }\n return e;\n }({\n c: 67,\n x: 88,\n z: 90,\n BACKSPACE_SAFARI: 127,\n Enter: 13,\n Meta_LEFT: 91,\n Meta_RIGHT: 92,\n Space: 32\n }, l), c = Object.entries(s).reduce((function(e, t) {\n var n = i(t, 2), a = n[0], r = n[1];\n return e[r] = void 0 === e[r] ? a : e[r], e;\n }), {});\n t.keys = Object.entries(s).reduce((function(e, t) {\n var n = i(t, 2), a = n[0];\n n[1];\n return e[a] = \"Space\" === a ? \" \" : a, e;\n }), {});\n },\n 2391: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.analyseMask = function(e, t, n) {\n var i, o, s, c, u, f, p = /(?:[?*+]|\\{[0-9+*]+(?:,[0-9+*]*)?(?:\\|[0-9+*]*)?\\})|[^.?*+^${[]()|\\\\]+|./g, d = /\\[\\^?]?(?:[^\\\\\\]]+|\\\\[\\S\\s]?)*]?|\\\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\\S\\s]?)|\\((?:\\?[:=!]?)?|(?:[?*+]|\\{[0-9]+(?:,[0-9]*)?\\})\\??|[^.?*+^${[()|\\\\]+|./g, h = !1, v = new a.default, m = [], g = [], y = !1;\n function k(e, i, a) {\n a = void 0 !== a ? a : e.matches.length;\n var o = e.matches[a - 1];\n if (t) {\n if (0 === i.indexOf(\"[\") || h && /\\\\d|\\\\s|\\\\w|\\\\p/i.test(i) || \".\" === i) {\n var s = n.casing ? \"i\" : \"\";\n /\\\\p\\{.*}/i.test(i) && (s += \"u\"), e.matches.splice(a++, 0, {\n fn: new RegExp(i, s),\n static: !1,\n optionality: !1,\n newBlockMarker: void 0 === o ? \"master\" : o.def !== i,\n casing: null,\n def: i,\n placeholder: \"object\" === l(n.placeholder) ? n.placeholder[v.matches.length] : void 0,\n nativeDef: i\n });\n } else h && (i = i[i.length - 1]), i.split(\"\").forEach((function(t, i) {\n o = e.matches[a - 1], e.matches.splice(a++, 0, {\n fn: /[a-z]/i.test(n.staticDefinitionSymbol || t) ? new RegExp(\"[\" + (n.staticDefinitionSymbol || t) + \"]\", n.casing ? \"i\" : \"\") : null,\n static: !0,\n optionality: !1,\n newBlockMarker: void 0 === o ? \"master\" : o.def !== t && !0 !== o.static,\n casing: null,\n def: n.staticDefinitionSymbol || t,\n placeholder: void 0 !== n.staticDefinitionSymbol ? t : \"object\" === l(n.placeholder) ? n.placeholder[v.matches.length] : void 0,\n nativeDef: (h ? \"'\" : \"\") + t\n });\n }));\n h = !1;\n } else {\n var c = n.definitions && n.definitions[i] || n.usePrototypeDefinitions && r.default.prototype.definitions[i];\n c && !h ? e.matches.splice(a++, 0, {\n fn: c.validator ? \"string\" == typeof c.validator ? new RegExp(c.validator, n.casing ? \"i\" : \"\") : new function() {\n this.test = c.validator;\n } : new RegExp(\".\"),\n static: c.static || !1,\n optionality: c.optional || !1,\n defOptionality: c.optional || !1,\n newBlockMarker: void 0 === o || c.optional ? \"master\" : o.def !== (c.definitionSymbol || i),\n casing: c.casing,\n def: c.definitionSymbol || i,\n placeholder: c.placeholder,\n nativeDef: i,\n generated: c.generated\n }) : (e.matches.splice(a++, 0, {\n fn: /[a-z]/i.test(n.staticDefinitionSymbol || i) ? new RegExp(\"[\" + (n.staticDefinitionSymbol || i) + \"]\", n.casing ? \"i\" : \"\") : null,\n static: !0,\n optionality: !1,\n newBlockMarker: void 0 === o ? \"master\" : o.def !== i && !0 !== o.static,\n casing: null,\n def: n.staticDefinitionSymbol || i,\n placeholder: void 0 !== n.staticDefinitionSymbol ? i : void 0,\n nativeDef: (h ? \"'\" : \"\") + i\n }), h = !1);\n }\n }\n function b() {\n if (m.length > 0) {\n if (k(c = m[m.length - 1], o), c.isAlternator) {\n u = m.pop();\n for (var e = 0; e < u.matches.length; e++) u.matches[e].isGroup && (u.matches[e].isGroup = !1);\n m.length > 0 ? (c = m[m.length - 1]).matches.push(u) : v.matches.push(u);\n }\n } else k(v, o);\n }\n function x(e) {\n var t = new a.default(!0);\n return t.openGroup = !1, t.matches = e, t;\n }\n function P() {\n if ((s = m.pop()).openGroup = !1, void 0 !== s) if (m.length > 0) {\n if ((c = m[m.length - 1]).matches.push(s), c.isAlternator) {\n u = m.pop();\n for (var e = 0; e < u.matches.length; e++) u.matches[e].isGroup = !1, u.matches[e].alternatorGroup = !1;\n m.length > 0 ? (c = m[m.length - 1]).matches.push(u) : v.matches.push(u);\n }\n } else v.matches.push(s); else b();\n }\n function w(e) {\n var t = e.pop();\n return t.isQuantifier && (t = x([ e.pop(), t ])), t;\n }\n t && (n.optionalmarker[0] = void 0, n.optionalmarker[1] = void 0);\n for (;i = t ? d.exec(e) : p.exec(e); ) {\n if (o = i[0], t) {\n switch (o.charAt(0)) {\n case \"?\":\n o = \"{0,1}\";\n break;\n\n case \"+\":\n case \"*\":\n o = \"{\" + o + \"}\";\n break;\n\n case \"|\":\n if (0 === m.length) {\n var S = x(v.matches);\n S.openGroup = !0, m.push(S), v.matches = [], y = !0;\n }\n }\n switch (o) {\n case \"\\\\d\":\n o = \"[0-9]\";\n break;\n\n case \"\\\\p\":\n o += d.exec(e)[0], o += d.exec(e)[0];\n }\n }\n if (h) b(); else switch (o.charAt(0)) {\n case \"$\":\n case \"^\":\n t || b();\n break;\n\n case n.escapeChar:\n h = !0, t && b();\n break;\n\n case n.optionalmarker[1]:\n case n.groupmarker[1]:\n P();\n break;\n\n case n.optionalmarker[0]:\n m.push(new a.default(!1, !0));\n break;\n\n case n.groupmarker[0]:\n m.push(new a.default(!0));\n break;\n\n case n.quantifiermarker[0]:\n var O = new a.default(!1, !1, !0), _ = (o = o.replace(/[{}?]/g, \"\")).split(\"|\"), M = _[0].split(\",\"), E = isNaN(M[0]) ? M[0] : parseInt(M[0]), j = 1 === M.length ? E : isNaN(M[1]) ? M[1] : parseInt(M[1]), T = isNaN(_[1]) ? _[1] : parseInt(_[1]);\n \"*\" !== E && \"+\" !== E || (E = \"*\" === j ? 0 : 1), O.quantifier = {\n min: E,\n max: j,\n jit: T\n };\n var A = m.length > 0 ? m[m.length - 1].matches : v.matches;\n (i = A.pop()).isGroup || (i = x([ i ])), A.push(i), A.push(O);\n break;\n\n case n.alternatormarker:\n if (m.length > 0) {\n var D = (c = m[m.length - 1]).matches[c.matches.length - 1];\n f = c.openGroup && (void 0 === D.matches || !1 === D.isGroup && !1 === D.isAlternator) ? m.pop() : w(c.matches);\n } else f = w(v.matches);\n if (f.isAlternator) m.push(f); else if (f.alternatorGroup ? (u = m.pop(), f.alternatorGroup = !1) : u = new a.default(!1, !1, !1, !0), \n u.matches.push(f), m.push(u), f.openGroup) {\n f.openGroup = !1;\n var L = new a.default(!0);\n L.alternatorGroup = !0, m.push(L);\n }\n break;\n\n default:\n b();\n }\n }\n y && P();\n for (;m.length > 0; ) s = m.pop(), v.matches.push(s);\n v.matches.length > 0 && (!function e(i) {\n i && i.matches && i.matches.forEach((function(a, r) {\n var o = i.matches[r + 1];\n (void 0 === o || void 0 === o.matches || !1 === o.isQuantifier) && a && a.isGroup && (a.isGroup = !1, \n t || (k(a, n.groupmarker[0], 0), !0 !== a.openGroup && k(a, n.groupmarker[1]))), \n e(a);\n }));\n }(v), g.push(v));\n (n.numericInput || n.isRTL) && function e(t) {\n for (var i in t.matches = t.matches.reverse(), t.matches) if (Object.prototype.hasOwnProperty.call(t.matches, i)) {\n var a = parseInt(i);\n if (t.matches[i].isQuantifier && t.matches[a + 1] && t.matches[a + 1].isGroup) {\n var r = t.matches[i];\n t.matches.splice(i, 1), t.matches.splice(a + 1, 0, r);\n }\n void 0 !== t.matches[i].matches ? t.matches[i] = e(t.matches[i]) : t.matches[i] = ((o = t.matches[i]) === n.optionalmarker[0] ? o = n.optionalmarker[1] : o === n.optionalmarker[1] ? o = n.optionalmarker[0] : o === n.groupmarker[0] ? o = n.groupmarker[1] : o === n.groupmarker[1] && (o = n.groupmarker[0]), \n o);\n }\n var o;\n return t;\n }(g[0]);\n return g;\n }, t.generateMaskSet = function(e, t) {\n var n;\n function a(e, t) {\n var n = t.repeat, i = t.groupmarker, a = t.quantifiermarker, r = t.keepStatic;\n if (n > 0 || \"*\" === n || \"+\" === n) {\n var l = \"*\" === n ? 0 : \"+\" === n ? 1 : n;\n if (l != n) e = i[0] + e + i[1] + a[0] + l + \",\" + n + a[1]; else for (var c = e, u = 1; u < l; u++) e += c;\n }\n if (!0 === r) {\n var f = e.match(new RegExp(\"(.)\\\\[([^\\\\]]*)\\\\]\", \"g\"));\n f && f.forEach((function(t, n) {\n var i = function(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return s(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return s(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }(t.split(\"[\"), 2), a = i[0], r = i[1];\n r = r.replace(\"]\", \"\"), e = e.replace(new RegExp(\"\".concat((0, o.default)(a), \"\\\\[\").concat((0, \n o.default)(r), \"\\\\]\")), a.charAt(0) === r.charAt(0) ? \"(\".concat(a, \"|\").concat(a).concat(r, \")\") : \"\".concat(a, \"[\").concat(r, \"]\"));\n }));\n }\n return e;\n }\n function c(e, n, o) {\n var s, c, u = !1;\n return null !== e && \"\" !== e || ((u = null !== o.regex) ? e = (e = o.regex).replace(/^(\\^)(.*)(\\$)$/, \"$2\") : (u = !0, \n e = \".*\")), 1 === e.length && !1 === o.greedy && 0 !== o.repeat && (o.placeholder = \"\"), \n e = a(e, o), c = u ? \"regex_\" + o.regex : o.numericInput ? e.split(\"\").reverse().join(\"\") : e, \n null !== o.keepStatic && (c = \"ks_\" + o.keepStatic + c), \"object\" === l(o.placeholder) && (c = \"ph_\" + JSON.stringify(o.placeholder) + c), \n void 0 === r.default.prototype.masksCache[c] || !0 === t ? (s = {\n mask: e,\n maskToken: r.default.prototype.analyseMask(e, u, o),\n validPositions: [],\n _buffer: void 0,\n buffer: void 0,\n tests: {},\n excludes: {},\n metadata: n,\n maskLength: void 0,\n jitOffset: {}\n }, !0 !== t && (r.default.prototype.masksCache[c] = s, s = i.default.extend(!0, {}, r.default.prototype.masksCache[c]))) : s = i.default.extend(!0, {}, r.default.prototype.masksCache[c]), \n s;\n }\n \"function\" == typeof e.mask && (e.mask = e.mask(e));\n if (Array.isArray(e.mask)) {\n if (e.mask.length > 1) {\n null === e.keepStatic && (e.keepStatic = !0);\n var u = e.groupmarker[0];\n return (e.isRTL ? e.mask.reverse() : e.mask).forEach((function(t) {\n u.length > 1 && (u += e.alternatormarker), void 0 !== t.mask && \"function\" != typeof t.mask ? u += t.mask : u += t;\n })), c(u += e.groupmarker[1], e.mask, e);\n }\n e.mask = e.mask.pop();\n }\n n = e.mask && void 0 !== e.mask.mask && \"function\" != typeof e.mask.mask ? c(e.mask.mask, e.mask, e) : c(e.mask, e.mask, e);\n null === e.keepStatic && (e.keepStatic = !1);\n return n;\n };\n var i = c(n(4963)), a = c(n(9695)), r = c(n(2394)), o = c(n(7184));\n function l(e) {\n return l = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, l(e);\n }\n function s(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function c(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n },\n 157: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.mask = function() {\n var e = this, t = this.opts, n = this.el, u = this.dependencyLib;\n o.EventRuler.off(n);\n var f = function(t, n) {\n \"textarea\" !== t.tagName.toLowerCase() && n.ignorables.push(i.keys.Enter);\n var l = t.getAttribute(\"type\"), s = \"input\" === t.tagName.toLowerCase() && n.supportsInputType.includes(l) || t.isContentEditable || \"textarea\" === t.tagName.toLowerCase();\n if (!s) if (\"input\" === t.tagName.toLowerCase()) {\n var c = document.createElement(\"input\");\n c.setAttribute(\"type\", l), s = \"text\" === c.type, c = null;\n } else s = \"partial\";\n return !1 !== s ? function(t) {\n var i, l;\n function s() {\n return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : -1 !== a.getLastValidPosition.call(e) || !0 !== n.nullable ? (this.inputmask.shadowRoot || this.ownerDocument).activeElement === this && n.clearMaskOnLostFocus ? (e.isRTL ? r.clearOptionalTail.call(e, a.getBuffer.call(e).slice()).reverse() : r.clearOptionalTail.call(e, a.getBuffer.call(e).slice())).join(\"\") : i.call(this) : \"\" : i.call(this);\n }\n function c(e) {\n l.call(this, e), this.inputmask && (0, r.applyInputValue)(this, e);\n }\n if (!t.inputmask.__valueGet) {\n if (!0 !== n.noValuePatching) {\n if (Object.getOwnPropertyDescriptor) {\n var f = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t), \"value\") : void 0;\n f && f.get && f.set ? (i = f.get, l = f.set, Object.defineProperty(t, \"value\", {\n get: s,\n set: c,\n configurable: !0\n })) : \"input\" !== t.tagName.toLowerCase() && (i = function() {\n return this.textContent;\n }, l = function(e) {\n this.textContent = e;\n }, Object.defineProperty(t, \"value\", {\n get: s,\n set: c,\n configurable: !0\n }));\n } else document.__lookupGetter__ && t.__lookupGetter__(\"value\") && (i = t.__lookupGetter__(\"value\"), \n l = t.__lookupSetter__(\"value\"), t.__defineGetter__(\"value\", s), t.__defineSetter__(\"value\", c));\n t.inputmask.__valueGet = i, t.inputmask.__valueSet = l;\n }\n t.inputmask._valueGet = function(t) {\n return e.isRTL && !0 !== t ? i.call(this.el).split(\"\").reverse().join(\"\") : i.call(this.el);\n }, t.inputmask._valueSet = function(t, n) {\n l.call(this.el, null == t ? \"\" : !0 !== n && e.isRTL ? t.split(\"\").reverse().join(\"\") : t);\n }, void 0 === i && (i = function() {\n return this.value;\n }, l = function(e) {\n this.value = e;\n }, function(t) {\n if (u.valHooks && (void 0 === u.valHooks[t] || !0 !== u.valHooks[t].inputmaskpatch)) {\n var i = u.valHooks[t] && u.valHooks[t].get ? u.valHooks[t].get : function(e) {\n return e.value;\n }, o = u.valHooks[t] && u.valHooks[t].set ? u.valHooks[t].set : function(e, t) {\n return e.value = t, e;\n };\n u.valHooks[t] = {\n get: function(t) {\n if (t.inputmask) {\n if (t.inputmask.opts.autoUnmask) return t.inputmask.unmaskedvalue();\n var r = i(t);\n return -1 !== a.getLastValidPosition.call(e, void 0, void 0, t.inputmask.maskset.validPositions) || !0 !== n.nullable ? r : \"\";\n }\n return i(t);\n },\n set: function(e, t) {\n var n = o(e, t);\n return e.inputmask && (0, r.applyInputValue)(e, t), n;\n },\n inputmaskpatch: !0\n };\n }\n }(t.type), function(e) {\n o.EventRuler.on(e, \"mouseenter\", (function() {\n var e = this, t = e.inputmask._valueGet(!0);\n t != (e.inputmask.isRTL ? a.getBuffer.call(e.inputmask).slice().reverse() : a.getBuffer.call(e.inputmask)).join(\"\") && (0, \n r.applyInputValue)(e, t);\n }));\n }(t));\n }\n }(t) : t.inputmask = void 0, s;\n }(n, t);\n if (!1 !== f) {\n e.originalPlaceholder = n.placeholder, e.maxLength = void 0 !== n ? n.maxLength : void 0, \n -1 === e.maxLength && (e.maxLength = void 0), \"inputMode\" in n && null === n.getAttribute(\"inputmode\") && (n.inputMode = t.inputmode, \n n.setAttribute(\"inputmode\", t.inputmode)), !0 === f && (t.showMaskOnFocus = t.showMaskOnFocus && -1 === [ \"cc-number\", \"cc-exp\" ].indexOf(n.autocomplete), \n l.iphone && (t.insertModeVisual = !1, n.setAttribute(\"autocorrect\", \"off\")), o.EventRuler.on(n, \"submit\", c.EventHandlers.submitEvent), \n o.EventRuler.on(n, \"reset\", c.EventHandlers.resetEvent), o.EventRuler.on(n, \"blur\", c.EventHandlers.blurEvent), \n o.EventRuler.on(n, \"focus\", c.EventHandlers.focusEvent), o.EventRuler.on(n, \"invalid\", c.EventHandlers.invalidEvent), \n o.EventRuler.on(n, \"click\", c.EventHandlers.clickEvent), o.EventRuler.on(n, \"mouseleave\", c.EventHandlers.mouseleaveEvent), \n o.EventRuler.on(n, \"mouseenter\", c.EventHandlers.mouseenterEvent), o.EventRuler.on(n, \"paste\", c.EventHandlers.pasteEvent), \n o.EventRuler.on(n, \"cut\", c.EventHandlers.cutEvent), o.EventRuler.on(n, \"complete\", t.oncomplete), \n o.EventRuler.on(n, \"incomplete\", t.onincomplete), o.EventRuler.on(n, \"cleared\", t.oncleared), \n !0 !== t.inputEventOnly && o.EventRuler.on(n, \"keydown\", c.EventHandlers.keyEvent), \n (l.mobile || t.inputEventOnly) && n.removeAttribute(\"maxLength\"), o.EventRuler.on(n, \"input\", c.EventHandlers.inputFallBackEvent)), \n o.EventRuler.on(n, \"setvalue\", c.EventHandlers.setValueEvent), a.getBufferTemplate.call(e).join(\"\"), \n e.undoValue = e._valueGet(!0);\n var p = (n.inputmask.shadowRoot || n.ownerDocument).activeElement;\n if (\"\" !== n.inputmask._valueGet(!0) || !1 === t.clearMaskOnLostFocus || p === n) {\n (0, r.applyInputValue)(n, n.inputmask._valueGet(!0), t);\n var d = a.getBuffer.call(e).slice();\n !1 === s.isComplete.call(e, d) && t.clearIncomplete && a.resetMaskSet.call(e, !1), \n t.clearMaskOnLostFocus && p !== n && (-1 === a.getLastValidPosition.call(e) ? d = [] : r.clearOptionalTail.call(e, d)), \n (!1 === t.clearMaskOnLostFocus || t.showMaskOnFocus && p === n || \"\" !== n.inputmask._valueGet(!0)) && (0, \n r.writeBuffer)(n, d), p === n && a.caret.call(e, n, a.seekNext.call(e, a.getLastValidPosition.call(e)));\n }\n }\n };\n var i = n(2839), a = n(8711), r = n(7760), o = n(9716), l = n(9845), s = n(7215), c = n(6030);\n },\n 9695: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function(e, t, n, i) {\n this.matches = [], this.openGroup = e || !1, this.alternatorGroup = !1, this.isGroup = e || !1, \n this.isOptional = t || !1, this.isQuantifier = n || !1, this.isAlternator = i || !1, \n this.quantifier = {\n min: 1,\n max: 1\n };\n };\n },\n 3194: function() {\n Array.prototype.includes || Object.defineProperty(Array.prototype, \"includes\", {\n value: function(e, t) {\n if (null == this) throw new TypeError('\"this\" is null or not defined');\n var n = Object(this), i = n.length >>> 0;\n if (0 === i) return !1;\n for (var a = 0 | t, r = Math.max(a >= 0 ? a : i - Math.abs(a), 0); r < i; ) {\n if (n[r] === e) return !0;\n r++;\n }\n return !1;\n }\n });\n },\n 9302: function() {\n var e = Function.bind.call(Function.call, Array.prototype.reduce), t = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable), n = Function.bind.call(Function.call, Array.prototype.concat), i = Object.keys;\n Object.entries || (Object.entries = function(a) {\n return e(i(a), (function(e, i) {\n return n(e, \"string\" == typeof i && t(a, i) ? [ [ i, a[i] ] ] : []);\n }), []);\n });\n },\n 7149: function() {\n function e(t) {\n return e = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, e(t);\n }\n \"function\" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = \"object\" === e(\"test\".__proto__) ? function(e) {\n return e.__proto__;\n } : function(e) {\n return e.constructor.prototype;\n });\n },\n 4013: function() {\n String.prototype.includes || (String.prototype.includes = function(e, t) {\n return \"number\" != typeof t && (t = 0), !(t + e.length > this.length) && -1 !== this.indexOf(e, t);\n });\n },\n 8711: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.caret = function(e, t, n, i, r) {\n var o, l = this, s = this.opts;\n if (void 0 === t) return \"selectionStart\" in e && \"selectionEnd\" in e ? (t = e.selectionStart, \n n = e.selectionEnd) : a.default.getSelection ? (o = a.default.getSelection().getRangeAt(0)).commonAncestorContainer.parentNode !== e && o.commonAncestorContainer !== e || (t = o.startOffset, \n n = o.endOffset) : document.selection && document.selection.createRange && (n = (t = 0 - (o = document.selection.createRange()).duplicate().moveStart(\"character\", -e.inputmask._valueGet().length)) + o.text.length), \n {\n begin: i ? t : f.call(l, t),\n end: i ? n : f.call(l, n)\n };\n if (Array.isArray(t) && (n = l.isRTL ? t[0] : t[1], t = l.isRTL ? t[1] : t[0]), \n void 0 !== t.begin && (n = l.isRTL ? t.begin : t.end, t = l.isRTL ? t.end : t.begin), \n \"number\" == typeof t) {\n t = i ? t : f.call(l, t), n = \"number\" == typeof (n = i ? n : f.call(l, n)) ? n : t;\n var c = parseInt(((e.ownerDocument.defaultView || a.default).getComputedStyle ? (e.ownerDocument.defaultView || a.default).getComputedStyle(e, null) : e.currentStyle).fontSize) * n;\n if (e.scrollLeft = c > e.scrollWidth ? c : 0, e.inputmask.caretPos = {\n begin: t,\n end: n\n }, s.insertModeVisual && !1 === s.insertMode && t === n && (r || n++), e === (e.inputmask.shadowRoot || e.ownerDocument).activeElement) if (\"setSelectionRange\" in e) e.setSelectionRange(t, n); else if (a.default.getSelection) {\n if (o = document.createRange(), void 0 === e.firstChild || null === e.firstChild) {\n var u = document.createTextNode(\"\");\n e.appendChild(u);\n }\n o.setStart(e.firstChild, t < e.inputmask._valueGet().length ? t : e.inputmask._valueGet().length), \n o.setEnd(e.firstChild, n < e.inputmask._valueGet().length ? n : e.inputmask._valueGet().length), \n o.collapse(!0);\n var p = a.default.getSelection();\n p.removeAllRanges(), p.addRange(o);\n } else e.createTextRange && ((o = e.createTextRange()).collapse(!0), o.moveEnd(\"character\", n), \n o.moveStart(\"character\", t), o.select());\n }\n }, t.determineLastRequiredPosition = function(e) {\n var t, n, i = this, a = i.maskset, l = i.dependencyLib, c = r.getMaskTemplate.call(i, !0, s.call(i), !0, !0), u = c.length, f = s.call(i), p = {}, d = a.validPositions[f], h = void 0 !== d ? d.locator.slice() : void 0;\n for (t = f + 1; t < c.length; t++) h = (n = r.getTestTemplate.call(i, t, h, t - 1)).locator.slice(), \n p[t] = l.extend(!0, {}, n);\n var v = d && void 0 !== d.alternation ? d.locator[d.alternation] : void 0;\n for (t = u - 1; t > f && (((n = p[t]).match.optionality || n.match.optionalQuantifier && n.match.newBlockMarker || v && (v !== p[t].locator[d.alternation] && 1 != n.match.static || !0 === n.match.static && n.locator[d.alternation] && o.checkAlternationMatch.call(i, n.locator[d.alternation].toString().split(\",\"), v.toString().split(\",\")) && \"\" !== r.getTests.call(i, t)[0].def)) && c[t] === r.getPlaceholder.call(i, t, n.match)); t--) u--;\n return e ? {\n l: u,\n def: p[u] ? p[u].match : void 0\n } : u;\n }, t.determineNewCaretPosition = function(e, t, n) {\n var i = this, a = i.maskset, o = i.opts;\n t && (i.isRTL ? e.end = e.begin : e.begin = e.end);\n if (e.begin === e.end) {\n switch (n = n || o.positionCaretOnClick) {\n case \"none\":\n break;\n\n case \"select\":\n e = {\n begin: 0,\n end: l.call(i).length\n };\n break;\n\n case \"ignore\":\n e.end = e.begin = u.call(i, s.call(i));\n break;\n\n case \"radixFocus\":\n if (i.clicked > 1 && 0 == a.validPositions.length) break;\n if (function(e) {\n if (\"\" !== o.radixPoint && 0 !== o.digits) {\n var t = a.validPositions;\n if (void 0 === t[e] || t[e].input === r.getPlaceholder.call(i, e)) {\n if (e < u.call(i, -1)) return !0;\n var n = l.call(i).indexOf(o.radixPoint);\n if (-1 !== n) {\n for (var s = 0, c = t.length; s < c; s++) if (t[s] && n < s && t[s].input !== r.getPlaceholder.call(i, s)) return !1;\n return !0;\n }\n }\n }\n return !1;\n }(e.begin)) {\n var f = l.call(i).join(\"\").indexOf(o.radixPoint);\n e.end = e.begin = o.numericInput ? u.call(i, f) : f;\n break;\n }\n\n default:\n var p = e.begin, d = s.call(i, p, !0), h = u.call(i, -1 !== d || c.call(i, 0) ? d : -1);\n if (p <= h) e.end = e.begin = c.call(i, p, !1, !0) ? p : u.call(i, p); else {\n var v = a.validPositions[d], m = r.getTestTemplate.call(i, h, v ? v.match.locator : void 0, v), g = r.getPlaceholder.call(i, h, m.match);\n if (\"\" !== g && l.call(i)[h] !== g && !0 !== m.match.optionalQuantifier && !0 !== m.match.newBlockMarker || !c.call(i, h, o.keepStatic, !0) && m.match.def === g) {\n var y = u.call(i, h);\n (p >= y || p === h) && (h = y);\n }\n e.end = e.begin = h;\n }\n }\n return e;\n }\n }, t.getBuffer = l, t.getBufferTemplate = function() {\n var e = this.maskset;\n void 0 === e._buffer && (e._buffer = r.getMaskTemplate.call(this, !1, 1), void 0 === e.buffer && (e.buffer = e._buffer.slice()));\n return e._buffer;\n }, t.getLastValidPosition = s, t.isMask = c, t.resetMaskSet = function(e) {\n var t = this.maskset;\n t.buffer = void 0, !0 !== e && (t.validPositions = [], t.p = 0);\n !1 === e && (t.tests = {});\n }, t.seekNext = u, t.seekPrevious = function(e, t) {\n var n = this, i = e - 1;\n if (e <= 0) return 0;\n for (;i > 0 && (!0 === t && (!0 !== r.getTest.call(n, i).match.newBlockMarker || !c.call(n, i, void 0, !0)) || !0 !== t && !c.call(n, i, void 0, !0)); ) i--;\n return i;\n }, t.translatePosition = f;\n var i, a = (i = n(9380)) && i.__esModule ? i : {\n default: i\n }, r = n(4713), o = n(7215);\n function l(e) {\n var t = this, n = t.maskset;\n return void 0 !== n.buffer && !0 !== e || (n.buffer = r.getMaskTemplate.call(t, !0, s.call(t), !0), \n void 0 === n._buffer && (n._buffer = n.buffer.slice())), n.buffer;\n }\n function s(e, t, n) {\n var i = this.maskset, a = -1, r = -1, o = n || i.validPositions;\n void 0 === e && (e = -1);\n for (var l = 0, s = o.length; l < s; l++) o[l] && (t || !0 !== o[l].generatedInput) && (l <= e && (a = l), \n l >= e && (r = l));\n return -1 === a || a == e ? r : -1 == r || e - a < r - e ? a : r;\n }\n function c(e, t, n) {\n var i = this, a = this.maskset, o = r.getTestTemplate.call(i, e).match;\n if (\"\" === o.def && (o = r.getTest.call(i, e).match), !0 !== o.static) return o.fn;\n if (!0 === n && void 0 !== a.validPositions[e] && !0 !== a.validPositions[e].generatedInput) return !0;\n if (!0 !== t && e > -1) {\n if (n) {\n var l = r.getTests.call(i, e);\n return l.length > 1 + (\"\" === l[l.length - 1].match.def ? 1 : 0);\n }\n var s = r.determineTestTemplate.call(i, e, r.getTests.call(i, e)), c = r.getPlaceholder.call(i, e, s.match);\n return s.match.def !== c;\n }\n return !1;\n }\n function u(e, t, n) {\n var i = this;\n void 0 === n && (n = !0);\n for (var a = e + 1; \"\" !== r.getTest.call(i, a).match.def && (!0 === t && (!0 !== r.getTest.call(i, a).match.newBlockMarker || !c.call(i, a, void 0, !0)) || !0 !== t && !c.call(i, a, void 0, n)); ) a++;\n return a;\n }\n function f(e) {\n var t = this.opts, n = this.el;\n return !this.isRTL || \"number\" != typeof e || t.greedy && \"\" === t.placeholder || !n || (e = this._valueGet().length - e) < 0 && (e = 0), \n e;\n }\n },\n 4713: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.determineTestTemplate = f, t.getDecisionTaker = s, t.getMaskTemplate = function(e, t, n, i, a) {\n var r = this, o = this.opts, l = this.maskset, s = o.greedy;\n a && o.greedy && (o.greedy = !1, r.maskset.tests = {});\n t = t || 0;\n var p, d, v, m, g = [], y = 0;\n do {\n if (!0 === e && l.validPositions[y]) d = (v = a && l.validPositions[y].match.optionality && void 0 === l.validPositions[y + 1] && (!0 === l.validPositions[y].generatedInput || l.validPositions[y].input == o.skipOptionalPartCharacter && y > 0) ? f.call(r, y, h.call(r, y, p, y - 1)) : l.validPositions[y]).match, \n p = v.locator.slice(), g.push(!0 === n ? v.input : !1 === n ? d.nativeDef : c.call(r, y, d)); else {\n d = (v = u.call(r, y, p, y - 1)).match, p = v.locator.slice();\n var k = !0 !== i && (!1 !== o.jitMasking ? o.jitMasking : d.jit);\n (m = (m || l.validPositions[y - 1]) && d.static && d.def !== o.groupSeparator && null === d.fn) || !1 === k || void 0 === k || \"number\" == typeof k && isFinite(k) && k > y ? g.push(!1 === n ? d.nativeDef : c.call(r, g.length, d)) : m = !1;\n }\n y++;\n } while (!0 !== d.static || \"\" !== d.def || t > y);\n \"\" === g[g.length - 1] && g.pop();\n !1 === n && void 0 !== l.maskLength || (l.maskLength = y - 1);\n return o.greedy = s, g;\n }, t.getPlaceholder = c, t.getTest = p, t.getTestTemplate = u, t.getTests = h, t.isSubsetOf = d;\n var i, a = n(8711), r = (i = n(2394)) && i.__esModule ? i : {\n default: i\n };\n function o(e) {\n return o = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, o(e);\n }\n function l(e, t) {\n var n = (null != e.alternation ? e.mloc[s(e)] : e.locator).join(\"\");\n if (\"\" !== n) for (n = n.split(\":\")[0]; n.length < t; ) n += \"0\";\n return n;\n }\n function s(e) {\n var t = e.locator[e.alternation];\n return \"string\" == typeof t && t.length > 0 && (t = t.split(\",\")[0]), void 0 !== t ? t.toString() : \"\";\n }\n function c(e, t, n) {\n var i = this, r = this.opts, l = this.maskset;\n if (void 0 !== (t = t || p.call(i, e).match).placeholder || !0 === n) {\n if (\"\" !== t.placeholder && !0 === t.static && !0 !== t.generated) {\n var s = a.getLastValidPosition.call(i, e), c = a.seekNext.call(i, s);\n return (n ? e <= c : e < c) ? r.staticDefinitionSymbol && t.static ? t.nativeDef : t.def : \"function\" == typeof t.placeholder ? t.placeholder(r) : t.placeholder;\n }\n return \"function\" == typeof t.placeholder ? t.placeholder(r) : t.placeholder;\n }\n if (!0 === t.static) {\n if (e > -1 && void 0 === l.validPositions[e]) {\n var u, f = h.call(i, e), d = [];\n if (\"string\" == typeof r.placeholder && f.length > 1 + (\"\" === f[f.length - 1].match.def ? 1 : 0)) for (var v = 0; v < f.length; v++) if (\"\" !== f[v].match.def && !0 !== f[v].match.optionality && !0 !== f[v].match.optionalQuantifier && (!0 === f[v].match.static || void 0 === u || !1 !== f[v].match.fn.test(u.match.def, l, e, !0, r)) && (d.push(f[v]), \n !0 === f[v].match.static && (u = f[v]), d.length > 1 && /[0-9a-bA-Z]/.test(d[0].match.def))) return r.placeholder.charAt(e % r.placeholder.length);\n }\n return t.def;\n }\n return \"object\" === o(r.placeholder) ? t.def : r.placeholder.charAt(e % r.placeholder.length);\n }\n function u(e, t, n) {\n return this.maskset.validPositions[e] || f.call(this, e, h.call(this, e, t ? t.slice() : t, n));\n }\n function f(e, t) {\n var n = this.opts, i = 0, a = function(e, t) {\n var n = 0, i = !1;\n t.forEach((function(e) {\n e.match.optionality && (0 !== n && n !== e.match.optionality && (i = !0), (0 === n || n > e.match.optionality) && (n = e.match.optionality));\n })), n && (0 == e || 1 == t.length ? n = 0 : i || (n = 0));\n return n;\n }(e, t);\n e = e > 0 ? e - 1 : 0;\n var r, o, s, c = l(p.call(this, e));\n n.greedy && t.length > 1 && \"\" === t[t.length - 1].match.def && (i = 1);\n for (var u = 0; u < t.length - i; u++) {\n var f = t[u];\n r = l(f, c.length);\n var d = Math.abs(r - c);\n (void 0 === o || \"\" !== r && d < o || s && !n.greedy && s.match.optionality && s.match.optionality - a > 0 && \"master\" === s.match.newBlockMarker && (!f.match.optionality || f.match.optionality - a < 1 || !f.match.newBlockMarker) || s && !n.greedy && s.match.optionalQuantifier && !f.match.optionalQuantifier) && (o = d, \n s = f);\n }\n return s;\n }\n function p(e, t) {\n var n = this.maskset;\n return n.validPositions[e] ? n.validPositions[e] : (t || h.call(this, e))[0];\n }\n function d(e, t, n) {\n function i(e) {\n for (var t, n = [], i = -1, a = 0, r = e.length; a < r; a++) if (\"-\" === e.charAt(a)) for (t = e.charCodeAt(a + 1); ++i < t; ) n.push(String.fromCharCode(i)); else i = e.charCodeAt(a), \n n.push(e.charAt(a));\n return n.join(\"\");\n }\n return e.match.def === t.match.nativeDef || !(!(n.regex || e.match.fn instanceof RegExp && t.match.fn instanceof RegExp) || !0 === e.match.static || !0 === t.match.static) && (\".\" === t.match.fn.source || -1 !== i(t.match.fn.source.replace(/[[\\]/]/g, \"\")).indexOf(i(e.match.fn.source.replace(/[[\\]/]/g, \"\"))));\n }\n function h(e, t, n) {\n var i, a, o = this, l = this.dependencyLib, s = this.maskset, c = this.opts, u = this.el, p = s.maskToken, h = t ? n : 0, v = t ? t.slice() : [ 0 ], m = [], g = !1, y = t ? t.join(\"\") : \"\", k = !1;\n function b(t, n, a, l) {\n function f(a, l, p) {\n function v(e, t) {\n var n = 0 === t.matches.indexOf(e);\n return n || t.matches.every((function(i, a) {\n return !0 === i.isQuantifier ? n = v(e, t.matches[a - 1]) : Object.prototype.hasOwnProperty.call(i, \"matches\") && (n = v(e, i)), \n !n;\n })), n;\n }\n function P(e, t, n) {\n var i, a;\n if ((s.tests[e] || s.validPositions[e]) && (s.validPositions[e] ? [ s.validPositions[e] ] : s.tests[e]).every((function(e, r) {\n if (e.mloc[t]) return i = e, !1;\n var o = void 0 !== n ? n : e.alternation, l = void 0 !== e.locator[o] ? e.locator[o].toString().indexOf(t) : -1;\n return (void 0 === a || l < a) && -1 !== l && (i = e, a = l), !0;\n })), i) {\n var r = i.locator[i.alternation], o = i.mloc[t] || i.mloc[r] || i.locator;\n if (-1 !== o[o.length - 1].toString().indexOf(\":\")) o.pop();\n return o.slice((void 0 !== n ? n : i.alternation) + 1);\n }\n return void 0 !== n ? P(e, t) : void 0;\n }\n function w(t, n) {\n return !0 === t.match.static && !0 !== n.match.static && n.match.fn.test(t.match.def, s, e, !1, c, !1);\n }\n function S(e, t) {\n var n = e.alternation, i = void 0 === t || n <= t.alternation && -1 === e.locator[n].toString().indexOf(t.locator[n]);\n if (!i && n > t.alternation) for (var a = 0; a < n; a++) if (e.locator[a] !== t.locator[a]) {\n n = a, i = !0;\n break;\n }\n return !!i && function(n) {\n e.mloc = e.mloc || {};\n var i = e.locator[n];\n if (void 0 !== i) {\n if (\"string\" == typeof i && (i = i.split(\",\")[0]), void 0 === e.mloc[i] && (e.mloc[i] = e.locator.slice(), \n e.mloc[i].push(\":\".concat(e.alternation))), void 0 !== t) {\n for (var a in t.mloc) \"string\" == typeof a && (a = parseInt(a.split(\",\")[0])), e.mloc[a + 0] = t.mloc[a];\n e.locator[n] = Object.keys(e.mloc).join(\",\");\n }\n return e.alternation > n && (e.alternation = n), !0;\n }\n return e.alternation = void 0, !1;\n }(n);\n }\n function O(e, t) {\n if (e.locator.length !== t.locator.length) return !1;\n for (var n = e.alternation + 1; n < e.locator.length; n++) if (e.locator[n] !== t.locator[n]) return !1;\n return !0;\n }\n if (h > e + c._maxTestPos) throw \"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. \" + s.mask;\n if (h === e && void 0 === a.matches) {\n if (m.push({\n match: a,\n locator: l.reverse(),\n cd: y,\n mloc: {}\n }), !a.optionality || void 0 !== p || !(c.definitions && c.definitions[a.nativeDef] && c.definitions[a.nativeDef].optional || r.default.prototype.definitions[a.nativeDef] && r.default.prototype.definitions[a.nativeDef].optional)) return !0;\n g = !0, h = e;\n } else if (void 0 !== a.matches) {\n if (a.isGroup && p !== a) return function() {\n if (a = f(t.matches[t.matches.indexOf(a) + 1], l, p)) return !0;\n }();\n if (a.isOptional) return function() {\n var t = a, r = m.length;\n if (a = b(a, n, l, p), m.length > 0) {\n if (m.forEach((function(e, t) {\n t >= r && (e.match.optionality = e.match.optionality ? e.match.optionality + 1 : 1);\n })), i = m[m.length - 1].match, void 0 !== p || !v(i, t)) return a;\n g = !0, h = e;\n }\n }();\n if (a.isAlternator) return function() {\n function i(e) {\n for (var t, n = e.matches[0].matches ? e.matches[0].matches.length : 1, i = 0; i < e.matches.length && n === (t = e.matches[i].matches ? e.matches[i].matches.length : 1); i++) ;\n return n !== t;\n }\n o.hasAlternator = !0;\n var r, v = a, y = [], b = m.slice(), x = l.length, _ = n.length > 0 ? n.shift() : -1;\n if (-1 === _ || \"string\" == typeof _) {\n var M, E = h, j = n.slice(), T = [];\n if (\"string\" == typeof _) T = _.split(\",\"); else for (M = 0; M < v.matches.length; M++) T.push(M.toString());\n if (void 0 !== s.excludes[e]) {\n for (var A = T.slice(), D = 0, L = s.excludes[e].length; D < L; D++) {\n var C = s.excludes[e][D].toString().split(\":\");\n l.length == C[1] && T.splice(T.indexOf(C[0]), 1);\n }\n 0 === T.length && (delete s.excludes[e], T = A);\n }\n (!0 === c.keepStatic || isFinite(parseInt(c.keepStatic)) && E >= c.keepStatic) && (T = T.slice(0, 1));\n for (var B = 0; B < T.length; B++) {\n M = parseInt(T[B]), m = [], n = \"string\" == typeof _ && P(h, M, x) || j.slice();\n var R = v.matches[M];\n if (R && f(R, [ M ].concat(l), p)) a = !0; else if (0 === B && (k = i(v)), R && R.matches && R.matches.length > v.matches[0].matches.length) break;\n r = m.slice(), h = E, m = [];\n for (var I = 0; I < r.length; I++) {\n var F = r[I], N = !1;\n F.alternation = F.alternation || x, S(F);\n for (var V = 0; V < y.length; V++) {\n var G = y[V];\n if (\"string\" != typeof _ || void 0 !== F.alternation && T.includes(F.locator[F.alternation].toString())) {\n if (F.match.nativeDef === G.match.nativeDef) {\n N = !0, S(G, F);\n break;\n }\n if (d(F, G, c)) {\n S(F, G) && (N = !0, y.splice(y.indexOf(G), 0, F));\n break;\n }\n if (d(G, F, c)) {\n S(G, F);\n break;\n }\n if (w(F, G)) {\n O(F, G) || void 0 !== u.inputmask.userOptions.keepStatic ? S(F, G) && (N = !0, y.splice(y.indexOf(G), 0, F)) : c.keepStatic = !0;\n break;\n }\n if (w(G, F)) {\n S(G, F);\n break;\n }\n }\n }\n N || y.push(F);\n }\n }\n m = b.concat(y), h = e, g = m.length > 0 && k, a = y.length > 0 && !k, n = j.slice();\n } else a = f(v.matches[_] || t.matches[_], [ _ ].concat(l), p);\n if (a) return !0;\n }();\n if (a.isQuantifier && p !== t.matches[t.matches.indexOf(a) - 1]) return function() {\n for (var r = a, o = !1, u = n.length > 0 ? n.shift() : 0; u < (isNaN(r.quantifier.max) ? u + 1 : r.quantifier.max) && h <= e; u++) {\n var p = t.matches[t.matches.indexOf(r) - 1];\n if (a = f(p, [ u ].concat(l), p)) {\n if (m.forEach((function(t, n) {\n (i = x(p, t.match) ? t.match : m[m.length - 1].match).optionalQuantifier = u >= r.quantifier.min, \n i.jit = (u + 1) * (p.matches.indexOf(i) + 1) > r.quantifier.jit, i.optionalQuantifier && v(i, p) && (g = !0, \n h = e, c.greedy && null == s.validPositions[e - 1] && u > r.quantifier.min && -1 != [ \"*\", \"+\" ].indexOf(r.quantifier.max) && (m.pop(), \n y = void 0), o = !0, a = !1), !o && i.jit && (s.jitOffset[e] = p.matches.length - p.matches.indexOf(i));\n })), o) break;\n return !0;\n }\n }\n }();\n if (a = b(a, n, l, p)) return !0;\n } else h++;\n }\n for (var p = n.length > 0 ? n.shift() : 0; p < t.matches.length; p++) if (!0 !== t.matches[p].isQuantifier) {\n var v = f(t.matches[p], [ p ].concat(a), l);\n if (v && h === e) return v;\n if (h > e) break;\n }\n }\n function x(e, t) {\n var n = -1 != e.matches.indexOf(t);\n return n || e.matches.forEach((function(e, i) {\n void 0 === e.matches || n || (n = x(e, t));\n })), n;\n }\n if (e > -1) {\n if (void 0 === t) {\n for (var P, w = e - 1; void 0 === (P = s.validPositions[w] || s.tests[w]) && w > -1; ) w--;\n void 0 !== P && w > -1 && (v = function(e, t) {\n var n, i = [];\n return Array.isArray(t) || (t = [ t ]), t.length > 0 && (void 0 === t[0].alternation || !0 === c.keepStatic ? 0 === (i = f.call(o, e, t.slice()).locator.slice()).length && (i = t[0].locator.slice()) : t.forEach((function(e) {\n \"\" !== e.def && (0 === i.length ? (n = e.alternation, i = e.locator.slice()) : e.locator[n] && -1 === i[n].toString().indexOf(e.locator[n]) && (i[n] += \",\" + e.locator[n]));\n }))), i;\n }(w, P), y = v.join(\"\"), h = w);\n }\n if (s.tests[e] && s.tests[e][0].cd === y) return s.tests[e];\n for (var S = v.shift(); S < p.length; S++) {\n if (b(p[S], v, [ S ]) && h === e || h > e) break;\n }\n }\n return (0 === m.length || g) && m.push({\n match: {\n fn: null,\n static: !0,\n optionality: !1,\n casing: null,\n def: \"\",\n placeholder: \"\"\n },\n locator: k ? [ 0 ] : [],\n mloc: {},\n cd: y\n }), void 0 !== t && s.tests[e] ? a = l.extend(!0, [], m) : (s.tests[e] = l.extend(!0, [], m), \n a = s.tests[e]), m.forEach((function(e) {\n e.match.optionality = e.match.defOptionality || !1;\n })), a;\n }\n },\n 7215: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.alternate = l, t.checkAlternationMatch = function(e, t, n) {\n for (var i, a = this.opts.greedy ? t : t.slice(0, 1), r = !1, o = void 0 !== n ? n.split(\",\") : [], l = 0; l < o.length; l++) -1 !== (i = e.indexOf(o[l])) && e.splice(i, 1);\n for (var s = 0; s < e.length; s++) if (a.includes(e[s])) {\n r = !0;\n break;\n }\n return r;\n }, t.handleRemove = function(e, t, n, o, s) {\n var c = this, u = this.maskset, f = this.opts;\n if ((f.numericInput || c.isRTL) && (t === a.keys.Backspace ? t = a.keys.Delete : t === a.keys.Delete && (t = a.keys.Backspace), \n c.isRTL)) {\n var p = n.end;\n n.end = n.begin, n.begin = p;\n }\n var d, h = r.getLastValidPosition.call(c, void 0, !0);\n n.end >= r.getBuffer.call(c).length && h >= n.end && (n.end = h + 1);\n t === a.keys.Backspace ? n.end - n.begin < 1 && (n.begin = r.seekPrevious.call(c, n.begin)) : t === a.keys.Delete && n.begin === n.end && (n.end = r.isMask.call(c, n.end, !0, !0) ? n.end + 1 : r.seekNext.call(c, n.end) + 1);\n if (!1 !== (d = v.call(c, n))) {\n if (!0 !== o && !1 !== f.keepStatic || null !== f.regex && -1 !== i.getTest.call(c, n.begin).match.def.indexOf(\"|\")) {\n var m = l.call(c, !0);\n if (m) {\n var g = void 0 !== m.caret ? m.caret : m.pos ? r.seekNext.call(c, m.pos.begin ? m.pos.begin : m.pos) : r.getLastValidPosition.call(c, -1, !0);\n (t !== a.keys.Delete || n.begin > g) && n.begin;\n }\n }\n !0 !== o && (u.p = t === a.keys.Delete ? n.begin + d : n.begin, u.p = r.determineNewCaretPosition.call(c, {\n begin: u.p,\n end: u.p\n }, !1, !1 === f.insertMode && t === a.keys.Backspace ? \"none\" : void 0).begin);\n }\n }, t.isComplete = c, t.isSelection = u, t.isValid = f, t.refreshFromBuffer = d, \n t.revalidateMask = v;\n var i = n(4713), a = n(2839), r = n(8711), o = n(6030);\n function l(e, t, n, a, o, s) {\n var c, u, p, d, h, v, m, g, y, k, b, x = this, P = this.dependencyLib, w = this.opts, S = x.maskset, O = P.extend(!0, [], S.validPositions), _ = P.extend(!0, {}, S.tests), M = !1, E = !1, j = void 0 !== o ? o : r.getLastValidPosition.call(x);\n if (s && (k = s.begin, b = s.end, s.begin > s.end && (k = s.end, b = s.begin)), \n -1 === j && void 0 === o) c = 0, u = (d = i.getTest.call(x, c)).alternation; else for (;j >= 0; j--) if ((p = S.validPositions[j]) && void 0 !== p.alternation) {\n if (j <= (e || 0) && d && d.locator[p.alternation] !== p.locator[p.alternation]) break;\n c = j, u = S.validPositions[c].alternation, d = p;\n }\n if (void 0 !== u) {\n m = parseInt(c), S.excludes[m] = S.excludes[m] || [], !0 !== e && S.excludes[m].push((0, \n i.getDecisionTaker)(d) + \":\" + d.alternation);\n var T = [], A = -1;\n for (h = m; m < r.getLastValidPosition.call(x, void 0, !0) + 1; h++) -1 === A && e <= h && void 0 !== t && (T.push(t), \n A = T.length - 1), (v = S.validPositions[m]) && !0 !== v.generatedInput && (void 0 === s || h < k || h >= b) && T.push(v.input), \n S.validPositions.splice(m, 1);\n for (-1 === A && void 0 !== t && (T.push(t), A = T.length - 1); void 0 !== S.excludes[m] && S.excludes[m].length < 10; ) {\n for (S.tests = {}, r.resetMaskSet.call(x, !0), M = !0, h = 0; h < T.length && (g = M.caret || 0 == w.insertMode && null != g ? r.seekNext.call(x, g) : r.getLastValidPosition.call(x, void 0, !0) + 1, \n y = T[h], M = f.call(x, g, y, !1, a, !0)); h++) h === A && (E = M), 1 == e && M && (E = {\n caretPos: h\n });\n if (M) break;\n if (r.resetMaskSet.call(x), d = i.getTest.call(x, m), S.validPositions = P.extend(!0, [], O), \n S.tests = P.extend(!0, {}, _), !S.excludes[m]) {\n E = l.call(x, e, t, n, a, m - 1, s);\n break;\n }\n if (null != d.alternation) {\n var D = (0, i.getDecisionTaker)(d);\n if (-1 !== S.excludes[m].indexOf(D + \":\" + d.alternation)) {\n E = l.call(x, e, t, n, a, m - 1, s);\n break;\n }\n for (S.excludes[m].push(D + \":\" + d.alternation), h = m; h < r.getLastValidPosition.call(x, void 0, !0) + 1; h++) S.validPositions.splice(m);\n } else delete S.excludes[m];\n }\n }\n return E && !1 === w.keepStatic || delete S.excludes[m], E;\n }\n function s(e, t, n) {\n var i = this.opts, r = this.maskset;\n switch (i.casing || t.casing) {\n case \"upper\":\n e = e.toUpperCase();\n break;\n\n case \"lower\":\n e = e.toLowerCase();\n break;\n\n case \"title\":\n var o = r.validPositions[n - 1];\n e = 0 === n || o && o.input === String.fromCharCode(a.keyCode.Space) ? e.toUpperCase() : e.toLowerCase();\n break;\n\n default:\n if (\"function\" == typeof i.casing) {\n var l = Array.prototype.slice.call(arguments);\n l.push(r.validPositions), e = i.casing.apply(this, l);\n }\n }\n return e;\n }\n function c(e) {\n var t = this, n = this.opts, a = this.maskset;\n if (\"function\" == typeof n.isComplete) return n.isComplete(e, n);\n if (\"*\" !== n.repeat) {\n var o = !1, l = r.determineLastRequiredPosition.call(t, !0), s = l.l;\n if (void 0 === l.def || l.def.newBlockMarker || l.def.optionality || l.def.optionalQuantifier) {\n o = !0;\n for (var c = 0; c <= s; c++) {\n var u = i.getTestTemplate.call(t, c).match;\n if (!0 !== u.static && void 0 === a.validPositions[c] && (!1 === u.optionality || void 0 === u.optionality || u.optionality && 0 == u.newBlockMarker) && (!1 === u.optionalQuantifier || void 0 === u.optionalQuantifier) || !0 === u.static && \"\" != u.def && e[c] !== i.getPlaceholder.call(t, c, u)) {\n o = !1;\n break;\n }\n }\n }\n return o;\n }\n }\n function u(e) {\n var t = this.opts.insertMode ? 0 : 1;\n return this.isRTL ? e.begin - e.end > t : e.end - e.begin > t;\n }\n function f(e, t, n, a, o, p, m) {\n var g = this, y = this.dependencyLib, k = this.opts, b = g.maskset;\n n = !0 === n;\n var x = e;\n function P(e) {\n if (void 0 !== e) {\n if (void 0 !== e.remove && (Array.isArray(e.remove) || (e.remove = [ e.remove ]), \n e.remove.sort((function(e, t) {\n return g.isRTL ? e.pos - t.pos : t.pos - e.pos;\n })).forEach((function(e) {\n v.call(g, {\n begin: e,\n end: e + 1\n });\n })), e.remove = void 0), void 0 !== e.insert && (Array.isArray(e.insert) || (e.insert = [ e.insert ]), \n e.insert.sort((function(e, t) {\n return g.isRTL ? t.pos - e.pos : e.pos - t.pos;\n })).forEach((function(e) {\n \"\" !== e.c && f.call(g, e.pos, e.c, void 0 === e.strict || e.strict, void 0 !== e.fromIsValid ? e.fromIsValid : a);\n })), e.insert = void 0), e.refreshFromBuffer && e.buffer) {\n var t = e.refreshFromBuffer;\n d.call(g, !0 === t ? t : t.start, t.end, e.buffer), e.refreshFromBuffer = void 0;\n }\n void 0 !== e.rewritePosition && (x = e.rewritePosition, e = !0);\n }\n return e;\n }\n function w(t, n, o) {\n var l = !1;\n return i.getTests.call(g, t).every((function(c, f) {\n var p = c.match;\n if (r.getBuffer.call(g, !0), !1 !== (l = (!p.jit || void 0 !== b.validPositions[r.seekPrevious.call(g, t)]) && (null != p.fn ? p.fn.test(n, b, t, o, k, u.call(g, e)) : (n === p.def || n === k.skipOptionalPartCharacter) && \"\" !== p.def && {\n c: i.getPlaceholder.call(g, t, p, !0) || p.def,\n pos: t\n }))) {\n var d = void 0 !== l.c ? l.c : n, h = t;\n return d = d === k.skipOptionalPartCharacter && !0 === p.static ? i.getPlaceholder.call(g, t, p, !0) || p.def : d, \n !0 !== (l = P(l)) && void 0 !== l.pos && l.pos !== t && (h = l.pos), !0 !== l && void 0 === l.pos && void 0 === l.c ? !1 : (!1 === v.call(g, e, y.extend({}, c, {\n input: s.call(g, d, p, h)\n }), a, h) && (l = !1), !1);\n }\n return !0;\n })), l;\n }\n void 0 !== e.begin && (x = g.isRTL ? e.end : e.begin);\n var S = !0, O = y.extend(!0, [], b.validPositions);\n if (!1 === k.keepStatic && void 0 !== b.excludes[x] && !0 !== o && !0 !== a) for (var _ = x; _ < (g.isRTL ? e.begin : e.end); _++) void 0 !== b.excludes[_] && (b.excludes[_] = void 0, \n delete b.tests[_]);\n if (\"function\" == typeof k.preValidation && !0 !== a && !0 !== p && (S = P(S = k.preValidation.call(g, r.getBuffer.call(g), x, t, u.call(g, e), k, b, e, n || o))), \n !0 === S) {\n if (S = w(x, t, n), (!n || !0 === a) && !1 === S && !0 !== p) {\n var M = b.validPositions[x];\n if (!M || !0 !== M.match.static || M.match.def !== t && t !== k.skipOptionalPartCharacter) {\n if (k.insertMode || void 0 === b.validPositions[r.seekNext.call(g, x)] || e.end > x) {\n var E = !1;\n if (b.jitOffset[x] && void 0 === b.validPositions[r.seekNext.call(g, x)] && !1 !== (S = f.call(g, x + b.jitOffset[x], t, !0, !0)) && (!0 !== o && (S.caret = x), \n E = !0), e.end > x && (b.validPositions[x] = void 0), !E && !r.isMask.call(g, x, k.keepStatic && 0 === x)) for (var j = x + 1, T = r.seekNext.call(g, x, !1, 0 !== x); j <= T; j++) if (!1 !== (S = w(j, t, n))) {\n S = h.call(g, x, void 0 !== S.pos ? S.pos : j) || S, x = j;\n break;\n }\n }\n } else S = {\n caret: r.seekNext.call(g, x)\n };\n }\n g.hasAlternator && !0 !== o && !n && (o = !0, !1 === S && k.keepStatic && (c.call(g, r.getBuffer.call(g)) || 0 === x) ? S = l.call(g, x, t, n, a, void 0, e) : (u.call(g, e) && b.tests[x] && b.tests[x].length > 1 && k.keepStatic || 1 == S && !0 !== k.numericInput && b.tests[x] && b.tests[x].length > 1 && r.getLastValidPosition.call(g, void 0, !0) > x) && (S = l.call(g, !0))), \n !0 === S && (S = {\n pos: x\n });\n }\n if (\"function\" == typeof k.postValidation && !0 !== a && !0 !== p) {\n var A = k.postValidation.call(g, r.getBuffer.call(g, !0), void 0 !== e.begin ? g.isRTL ? e.end : e.begin : e, t, S, k, b, n, m);\n void 0 !== A && (S = !0 === A ? S : A);\n }\n S && void 0 === S.pos && (S.pos = x), !1 === S || !0 === p ? (r.resetMaskSet.call(g, !0), \n b.validPositions = y.extend(!0, [], O)) : h.call(g, void 0, x, !0);\n var D = P(S);\n void 0 !== g.maxLength && (r.getBuffer.call(g).length > g.maxLength && !a && (r.resetMaskSet.call(g, !0), \n b.validPositions = y.extend(!0, [], O), D = !1));\n return D;\n }\n function p(e, t, n) {\n for (var a = this.maskset, r = !1, o = i.getTests.call(this, e), l = 0; l < o.length; l++) {\n if (o[l].match && (o[l].match.nativeDef === t.match[n.shiftPositions ? \"def\" : \"nativeDef\"] && (!n.shiftPositions || !t.match.static) || o[l].match.nativeDef === t.match.nativeDef || n.regex && !o[l].match.static && o[l].match.fn.test(t.input, a, e, !1, n))) {\n r = !0;\n break;\n }\n if (o[l].match && o[l].match.def === t.match.nativeDef) {\n r = void 0;\n break;\n }\n }\n return !1 === r && void 0 !== a.jitOffset[e] && (r = p.call(this, e + a.jitOffset[e], t, n)), \n r;\n }\n function d(e, t, n) {\n var i, a, l = this, s = this.maskset, c = this.opts, u = this.dependencyLib, f = c.skipOptionalPartCharacter, p = l.isRTL ? n.slice().reverse() : n;\n if (c.skipOptionalPartCharacter = \"\", !0 === e) r.resetMaskSet.call(l, !1), e = 0, \n t = n.length, a = r.determineNewCaretPosition.call(l, {\n begin: 0,\n end: 0\n }, !1).begin; else {\n for (i = e; i < t; i++) s.validPositions.splice(e, 0);\n a = e;\n }\n var d = new u.Event(\"keypress\");\n for (i = e; i < t; i++) {\n d.key = p[i].toString(), l.ignorable = !1;\n var h = o.EventHandlers.keypressEvent.call(l, d, !0, !1, !1, a);\n !1 !== h && void 0 !== h && (a = h.forwardPosition);\n }\n c.skipOptionalPartCharacter = f;\n }\n function h(e, t, n) {\n var a = this, o = this.maskset, l = this.dependencyLib;\n if (void 0 === e) for (e = t - 1; e > 0 && !o.validPositions[e]; e--) ;\n for (var s = e; s < t; s++) {\n if (void 0 === o.validPositions[s] && !r.isMask.call(a, s, !1)) if (0 == s ? i.getTest.call(a, s) : o.validPositions[s - 1]) {\n var c = i.getTests.call(a, s).slice();\n \"\" === c[c.length - 1].match.def && c.pop();\n var u, p = i.determineTestTemplate.call(a, s, c);\n if (p && (!0 !== p.match.jit || \"master\" === p.match.newBlockMarker && (u = o.validPositions[s + 1]) && !0 === u.match.optionalQuantifier) && ((p = l.extend({}, p, {\n input: i.getPlaceholder.call(a, s, p.match, !0) || p.match.def\n })).generatedInput = !0, v.call(a, s, p, !0), !0 !== n)) {\n var d = o.validPositions[t].input;\n return o.validPositions[t] = void 0, f.call(a, t, d, !0, !0);\n }\n }\n }\n }\n function v(e, t, n, a) {\n var o = this, l = this.maskset, s = this.opts, c = this.dependencyLib;\n function d(e, t, n) {\n var i = t[e];\n if (void 0 !== i && !0 === i.match.static && !0 !== i.match.optionality && (void 0 === t[0] || void 0 === t[0].alternation)) {\n var a = n.begin <= e - 1 ? t[e - 1] && !0 === t[e - 1].match.static && t[e - 1] : t[e - 1], r = n.end > e + 1 ? t[e + 1] && !0 === t[e + 1].match.static && t[e + 1] : t[e + 1];\n return a && r;\n }\n return !1;\n }\n var h = 0, v = void 0 !== e.begin ? e.begin : e, m = void 0 !== e.end ? e.end : e, g = !0;\n if (e.begin > e.end && (v = e.end, m = e.begin), a = void 0 !== a ? a : v, void 0 === n && (v !== m || s.insertMode && void 0 !== l.validPositions[a] || void 0 === t || t.match.optionalQuantifier || t.match.optionality)) {\n var y, k = c.extend(!0, [], l.validPositions), b = r.getLastValidPosition.call(o, void 0, !0);\n l.p = v;\n var x = u.call(o, e) ? v : a;\n for (y = b; y >= x; y--) l.validPositions.splice(y, 1), void 0 === t && delete l.tests[y + 1];\n var P, w, S = a, O = S;\n for (t && (l.validPositions[a] = c.extend(!0, {}, t), O++, S++), null == k[m] && l.jitOffset[m] && (m += l.jitOffset[m] + 1), \n y = t ? m : m - 1; y <= b; y++) {\n if (void 0 !== (P = k[y]) && !0 !== P.generatedInput && (y >= m || y >= v && d(y, k, {\n begin: v,\n end: m\n }))) {\n for (;\"\" !== i.getTest.call(o, O).match.def; ) {\n if (!1 !== (w = p.call(o, O, P, s)) || \"+\" === P.match.def) {\n \"+\" === P.match.def && r.getBuffer.call(o, !0);\n var _ = f.call(o, O, P.input, \"+\" !== P.match.def, !0);\n if (g = !1 !== _, S = (_.pos || O) + 1, !g && w) break;\n } else g = !1;\n if (g) {\n void 0 === t && P.match.static && y === e.begin && h++;\n break;\n }\n if (!g && r.getBuffer.call(o), O > l.maskLength) break;\n O++;\n }\n \"\" == i.getTest.call(o, O).match.def && (g = !1), O = S;\n }\n if (!g) break;\n }\n if (!g) return l.validPositions = c.extend(!0, [], k), r.resetMaskSet.call(o, !0), \n !1;\n } else t && i.getTest.call(o, a).match.cd === t.match.cd && (l.validPositions[a] = c.extend(!0, {}, t));\n return r.resetMaskSet.call(o, !0), h;\n }\n }\n }, t = {};\n function n(i) {\n var a = t[i];\n if (void 0 !== a) return a.exports;\n var r = t[i] = {\n exports: {}\n };\n return e[i](r, r.exports, n), r.exports;\n }\n var i = {};\n return function() {\n var e = i;\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.default = void 0, n(7149), n(3194), n(9302), n(4013), n(3851), n(219), n(207), \n n(5296);\n var t, a = (t = n(2394)) && t.__esModule ? t : {\n default: t\n };\n e.default = a.default;\n }(), i;\n }();\n}));\n\n//# sourceURL=webpack://Formio/../core/node_modules/inputmask/dist/inputmask.js?");
|
2000
|
+
eval("/*!\n * dist/inputmask\n * https://github.com/RobinHerbots/Inputmask\n * Copyright (c) 2010 - 2024 Robin Herbots\n * Licensed under the MIT license\n * Version: 5.0.9-beta.62\n */\n!function(e, t) {\n if (true) module.exports = t(); else { var i, n; }\n}(\"undefined\" != typeof self ? self : this, (function() {\n return function() {\n \"use strict\";\n var e = {\n 3976: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n n(2839), t.default = {\n _maxTestPos: 500,\n placeholder: \"_\",\n optionalmarker: [ \"[\", \"]\" ],\n quantifiermarker: [ \"{\", \"}\" ],\n groupmarker: [ \"(\", \")\" ],\n alternatormarker: \"|\",\n escapeChar: \"\\\\\",\n mask: null,\n regex: null,\n oncomplete: function() {},\n onincomplete: function() {},\n oncleared: function() {},\n repeat: 0,\n greedy: !1,\n autoUnmask: !1,\n removeMaskOnSubmit: !1,\n clearMaskOnLostFocus: !0,\n insertMode: !0,\n insertModeVisual: !0,\n clearIncomplete: !1,\n alias: null,\n onKeyDown: function() {},\n onBeforeMask: null,\n onBeforePaste: function(e, t) {\n return \"function\" == typeof t.onBeforeMask ? t.onBeforeMask.call(this, e, t) : e;\n },\n onBeforeWrite: null,\n onUnMask: null,\n showMaskOnFocus: !0,\n showMaskOnHover: !0,\n onKeyValidation: function() {},\n skipOptionalPartCharacter: \" \",\n numericInput: !1,\n rightAlign: !1,\n undoOnEscape: !0,\n radixPoint: \"\",\n _radixDance: !1,\n groupSeparator: \"\",\n keepStatic: null,\n positionCaretOnTab: !0,\n tabThrough: !1,\n supportsInputType: [ \"text\", \"tel\", \"url\", \"password\", \"search\" ],\n isComplete: null,\n preValidation: null,\n postValidation: null,\n staticDefinitionSymbol: void 0,\n jitMasking: !1,\n nullable: !0,\n inputEventOnly: !1,\n noValuePatching: !1,\n positionCaretOnClick: \"lvp\",\n casing: null,\n inputmode: \"text\",\n importDataAttributes: !0,\n shiftPositions: !0,\n usePrototypeDefinitions: !0,\n validationEventTimeOut: 3e3,\n substitutes: {}\n };\n },\n 7392: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n t.default = {\n 9: {\n validator: \"[0-9\\uff10-\\uff19]\",\n definitionSymbol: \"*\"\n },\n a: {\n validator: \"[A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\",\n definitionSymbol: \"*\"\n },\n \"*\": {\n validator: \"[0-9\\uff10-\\uff19A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\"\n }\n };\n },\n 253: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function(e, t, n) {\n if (void 0 === n) return e.__data ? e.__data[t] : null;\n e.__data = e.__data || {}, e.__data[t] = n;\n };\n },\n 3776: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.Event = void 0, t.off = function(e, t) {\n var n, i;\n u(this[0]) && e && (n = this[0].eventRegistry, i = this[0], e.split(\" \").forEach((function(e) {\n var a = o(e.split(\".\"), 2);\n (function(e, i) {\n var a, r, o = [];\n if (e.length > 0) if (void 0 === t) for (a = 0, r = n[e][i].length; a < r; a++) o.push({\n ev: e,\n namespace: i && i.length > 0 ? i : \"global\",\n handler: n[e][i][a]\n }); else o.push({\n ev: e,\n namespace: i && i.length > 0 ? i : \"global\",\n handler: t\n }); else if (i.length > 0) for (var l in n) for (var s in n[l]) if (s === i) if (void 0 === t) for (a = 0, \n r = n[l][s].length; a < r; a++) o.push({\n ev: l,\n namespace: s,\n handler: n[l][s][a]\n }); else o.push({\n ev: l,\n namespace: s,\n handler: t\n });\n return o;\n })(a[0], a[1]).forEach((function(e) {\n var t = e.ev, a = e.handler;\n !function(e, t, a) {\n if (e in n == 1) if (i.removeEventListener ? i.removeEventListener(e, a, !1) : i.detachEvent && i.detachEvent(\"on\".concat(e), a), \n \"global\" === t) for (var r in n[e]) n[e][r].splice(n[e][r].indexOf(a), 1); else n[e][t].splice(n[e][t].indexOf(a), 1);\n }(t, e.namespace, a);\n }));\n })));\n return this;\n }, t.on = function(e, t) {\n if (u(this[0])) {\n var n = this[0].eventRegistry, i = this[0];\n e.split(\" \").forEach((function(e) {\n var a = o(e.split(\".\"), 2), r = a[0], l = a[1];\n !function(e, a) {\n i.addEventListener ? i.addEventListener(e, t, !1) : i.attachEvent && i.attachEvent(\"on\".concat(e), t), \n n[e] = n[e] || {}, n[e][a] = n[e][a] || [], n[e][a].push(t);\n }(r, void 0 === l ? \"global\" : l);\n }));\n }\n return this;\n }, t.trigger = function(e) {\n var t = arguments;\n if (u(this[0])) for (var n = this[0].eventRegistry, a = this[0], o = \"string\" == typeof e ? e.split(\" \") : [ e.type ], l = 0; l < o.length; l++) {\n var s = o[l].split(\".\"), f = s[0], p = s[1] || \"global\";\n if (void 0 !== c && \"global\" === p) {\n var d, h = {\n bubbles: !0,\n cancelable: !0,\n composed: !0,\n detail: arguments[1]\n };\n if (c.createEvent) {\n try {\n if (\"input\" === f) h.inputType = \"insertText\", d = new InputEvent(f, h); else d = new CustomEvent(f, h);\n } catch (e) {\n (d = c.createEvent(\"CustomEvent\")).initCustomEvent(f, h.bubbles, h.cancelable, h.detail);\n }\n e.type && (0, i.default)(d, e), a.dispatchEvent(d);\n } else (d = c.createEventObject()).eventType = f, d.detail = arguments[1], e.type && (0, \n i.default)(d, e), a.fireEvent(\"on\" + d.eventType, d);\n } else if (void 0 !== n[f]) {\n arguments[0] = arguments[0].type ? arguments[0] : r.default.Event(arguments[0]), \n arguments[0].detail = arguments.slice(1);\n var v = n[f];\n (\"global\" === p ? Object.values(v).flat() : v[p]).forEach((function(e) {\n return e.apply(a, t);\n }));\n }\n }\n return this;\n };\n var i = s(n(600)), a = s(n(9380)), r = s(n(4963));\n function o(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return l(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return l(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function l(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function s(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var c = a.default.document;\n function u(e) {\n return e instanceof Element;\n }\n var f = t.Event = void 0;\n \"function\" == typeof a.default.CustomEvent ? t.Event = f = a.default.CustomEvent : a.default.Event && c && c.createEvent ? (t.Event = f = function(e, t) {\n t = t || {\n bubbles: !1,\n cancelable: !1,\n composed: !0,\n detail: void 0\n };\n var n = c.createEvent(\"CustomEvent\");\n return n.initCustomEvent(e, t.bubbles, t.cancelable, t.detail), n;\n }, f.prototype = a.default.Event.prototype) : \"undefined\" != typeof Event && (t.Event = f = Event);\n },\n 600: function(e, t) {\n function n(e) {\n return n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, n(e);\n }\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function e() {\n var t, i, a, r, o, l, s = arguments[0] || {}, c = 1, u = arguments.length, f = !1;\n \"boolean\" == typeof s && (f = s, s = arguments[c] || {}, c++);\n \"object\" !== n(s) && \"function\" != typeof s && (s = {});\n for (;c < u; c++) if (null != (t = arguments[c])) for (i in t) a = s[i], s !== (r = t[i]) && (f && r && (\"[object Object]\" === Object.prototype.toString.call(r) || (o = Array.isArray(r))) ? (o ? (o = !1, \n l = a && Array.isArray(a) ? a : []) : l = a && \"[object Object]\" === Object.prototype.toString.call(a) ? a : {}, \n s[i] = e(f, l, r)) : void 0 !== r && (s[i] = r));\n return s;\n };\n },\n 4963: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var i = l(n(600)), a = l(n(9380)), r = l(n(253)), o = n(3776);\n function l(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var s = a.default.document;\n function c(e) {\n return e instanceof c ? e : this instanceof c ? void (null != e && e !== a.default && (this[0] = e.nodeName ? e : void 0 !== e[0] && e[0].nodeName ? e[0] : s.querySelector(e), \n void 0 !== this[0] && null !== this[0] && (this[0].eventRegistry = this[0].eventRegistry || {}))) : new c(e);\n }\n c.prototype = {\n on: o.on,\n off: o.off,\n trigger: o.trigger\n }, c.extend = i.default, c.data = r.default, c.Event = o.Event;\n t.default = c;\n },\n 9845: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.mobile = t.iphone = t.ie = void 0;\n var i, a = (i = n(9380)) && i.__esModule ? i : {\n default: i\n };\n var r = a.default.navigator && a.default.navigator.userAgent || \"\";\n t.ie = r.indexOf(\"MSIE \") > 0 || r.indexOf(\"Trident/\") > 0, t.mobile = a.default.navigator && a.default.navigator.userAgentData && a.default.navigator.userAgentData.mobile || a.default.navigator && a.default.navigator.maxTouchPoints || \"ontouchstart\" in a.default, \n t.iphone = /iphone/i.test(r);\n },\n 7184: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function(e) {\n return e.replace(n, \"\\\\$1\");\n };\n var n = new RegExp(\"(\\\\\" + [ \"/\", \".\", \"*\", \"+\", \"?\", \"|\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", \"\\\\\", \"$\", \"^\" ].join(\"|\\\\\") + \")\", \"gim\");\n },\n 6030: function(e, t, n) {\n function i(e) {\n return i = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, i(e);\n }\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.EventHandlers = void 0;\n var a, r = n(8711), o = n(2839), l = n(9845), s = n(7215), c = n(7760), u = n(4713), f = (a = n(9380)) && a.__esModule ? a : {\n default: a\n };\n function p() {\n /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ p = function() {\n return t;\n };\n var e, t = {}, n = Object.prototype, a = n.hasOwnProperty, r = Object.defineProperty || function(e, t, n) {\n e[t] = n.value;\n }, o = \"function\" == typeof Symbol ? Symbol : {}, l = o.iterator || \"@@iterator\", s = o.asyncIterator || \"@@asyncIterator\", c = o.toStringTag || \"@@toStringTag\";\n function u(e, t, n) {\n return Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), e[t];\n }\n try {\n u({}, \"\");\n } catch (e) {\n u = function(e, t, n) {\n return e[t] = n;\n };\n }\n function f(e, t, n, i) {\n var a = t && t.prototype instanceof k ? t : k, o = Object.create(a.prototype), l = new D(i || []);\n return r(o, \"_invoke\", {\n value: E(e, n, l)\n }), o;\n }\n function d(e, t, n) {\n try {\n return {\n type: \"normal\",\n arg: e.call(t, n)\n };\n } catch (e) {\n return {\n type: \"throw\",\n arg: e\n };\n }\n }\n t.wrap = f;\n var h = \"suspendedStart\", v = \"suspendedYield\", m = \"executing\", g = \"completed\", y = {};\n function k() {}\n function b() {}\n function x() {}\n var w = {};\n u(w, l, (function() {\n return this;\n }));\n var P = Object.getPrototypeOf, S = P && P(P(L([])));\n S && S !== n && a.call(S, l) && (w = S);\n var O = x.prototype = k.prototype = Object.create(w);\n function _(e) {\n [ \"next\", \"throw\", \"return\" ].forEach((function(t) {\n u(e, t, (function(e) {\n return this._invoke(t, e);\n }));\n }));\n }\n function M(e, t) {\n function n(r, o, l, s) {\n var c = d(e[r], e, o);\n if (\"throw\" !== c.type) {\n var u = c.arg, f = u.value;\n return f && \"object\" == i(f) && a.call(f, \"__await\") ? t.resolve(f.__await).then((function(e) {\n n(\"next\", e, l, s);\n }), (function(e) {\n n(\"throw\", e, l, s);\n })) : t.resolve(f).then((function(e) {\n u.value = e, l(u);\n }), (function(e) {\n return n(\"throw\", e, l, s);\n }));\n }\n s(c.arg);\n }\n var o;\n r(this, \"_invoke\", {\n value: function(e, i) {\n function a() {\n return new t((function(t, a) {\n n(e, i, t, a);\n }));\n }\n return o = o ? o.then(a, a) : a();\n }\n });\n }\n function E(t, n, i) {\n var a = h;\n return function(r, o) {\n if (a === m) throw new Error(\"Generator is already running\");\n if (a === g) {\n if (\"throw\" === r) throw o;\n return {\n value: e,\n done: !0\n };\n }\n for (i.method = r, i.arg = o; ;) {\n var l = i.delegate;\n if (l) {\n var s = j(l, i);\n if (s) {\n if (s === y) continue;\n return s;\n }\n }\n if (\"next\" === i.method) i.sent = i._sent = i.arg; else if (\"throw\" === i.method) {\n if (a === h) throw a = g, i.arg;\n i.dispatchException(i.arg);\n } else \"return\" === i.method && i.abrupt(\"return\", i.arg);\n a = m;\n var c = d(t, n, i);\n if (\"normal\" === c.type) {\n if (a = i.done ? g : v, c.arg === y) continue;\n return {\n value: c.arg,\n done: i.done\n };\n }\n \"throw\" === c.type && (a = g, i.method = \"throw\", i.arg = c.arg);\n }\n };\n }\n function j(t, n) {\n var i = n.method, a = t.iterator[i];\n if (a === e) return n.delegate = null, \"throw\" === i && t.iterator.return && (n.method = \"return\", \n n.arg = e, j(t, n), \"throw\" === n.method) || \"return\" !== i && (n.method = \"throw\", \n n.arg = new TypeError(\"The iterator does not provide a '\" + i + \"' method\")), y;\n var r = d(a, t.iterator, n.arg);\n if (\"throw\" === r.type) return n.method = \"throw\", n.arg = r.arg, n.delegate = null, \n y;\n var o = r.arg;\n return o ? o.done ? (n[t.resultName] = o.value, n.next = t.nextLoc, \"return\" !== n.method && (n.method = \"next\", \n n.arg = e), n.delegate = null, y) : o : (n.method = \"throw\", n.arg = new TypeError(\"iterator result is not an object\"), \n n.delegate = null, y);\n }\n function T(e) {\n var t = {\n tryLoc: e[0]\n };\n 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), \n this.tryEntries.push(t);\n }\n function A(e) {\n var t = e.completion || {};\n t.type = \"normal\", delete t.arg, e.completion = t;\n }\n function D(e) {\n this.tryEntries = [ {\n tryLoc: \"root\"\n } ], e.forEach(T, this), this.reset(!0);\n }\n function L(t) {\n if (t || \"\" === t) {\n var n = t[l];\n if (n) return n.call(t);\n if (\"function\" == typeof t.next) return t;\n if (!isNaN(t.length)) {\n var r = -1, o = function n() {\n for (;++r < t.length; ) if (a.call(t, r)) return n.value = t[r], n.done = !1, n;\n return n.value = e, n.done = !0, n;\n };\n return o.next = o;\n }\n }\n throw new TypeError(i(t) + \" is not iterable\");\n }\n return b.prototype = x, r(O, \"constructor\", {\n value: x,\n configurable: !0\n }), r(x, \"constructor\", {\n value: b,\n configurable: !0\n }), b.displayName = u(x, c, \"GeneratorFunction\"), t.isGeneratorFunction = function(e) {\n var t = \"function\" == typeof e && e.constructor;\n return !!t && (t === b || \"GeneratorFunction\" === (t.displayName || t.name));\n }, t.mark = function(e) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(e, x) : (e.__proto__ = x, u(e, c, \"GeneratorFunction\")), \n e.prototype = Object.create(O), e;\n }, t.awrap = function(e) {\n return {\n __await: e\n };\n }, _(M.prototype), u(M.prototype, s, (function() {\n return this;\n })), t.AsyncIterator = M, t.async = function(e, n, i, a, r) {\n void 0 === r && (r = Promise);\n var o = new M(f(e, n, i, a), r);\n return t.isGeneratorFunction(n) ? o : o.next().then((function(e) {\n return e.done ? e.value : o.next();\n }));\n }, _(O), u(O, c, \"Generator\"), u(O, l, (function() {\n return this;\n })), u(O, \"toString\", (function() {\n return \"[object Generator]\";\n })), t.keys = function(e) {\n var t = Object(e), n = [];\n for (var i in t) n.push(i);\n return n.reverse(), function e() {\n for (;n.length; ) {\n var i = n.pop();\n if (i in t) return e.value = i, e.done = !1, e;\n }\n return e.done = !0, e;\n };\n }, t.values = L, D.prototype = {\n constructor: D,\n reset: function(t) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, \n this.method = \"next\", this.arg = e, this.tryEntries.forEach(A), !t) for (var n in this) \"t\" === n.charAt(0) && a.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = e);\n },\n stop: function() {\n this.done = !0;\n var e = this.tryEntries[0].completion;\n if (\"throw\" === e.type) throw e.arg;\n return this.rval;\n },\n dispatchException: function(t) {\n if (this.done) throw t;\n var n = this;\n function i(i, a) {\n return l.type = \"throw\", l.arg = t, n.next = i, a && (n.method = \"next\", n.arg = e), \n !!a;\n }\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r], l = o.completion;\n if (\"root\" === o.tryLoc) return i(\"end\");\n if (o.tryLoc <= this.prev) {\n var s = a.call(o, \"catchLoc\"), c = a.call(o, \"finallyLoc\");\n if (s && c) {\n if (this.prev < o.catchLoc) return i(o.catchLoc, !0);\n if (this.prev < o.finallyLoc) return i(o.finallyLoc);\n } else if (s) {\n if (this.prev < o.catchLoc) return i(o.catchLoc, !0);\n } else {\n if (!c) throw new Error(\"try statement without catch or finally\");\n if (this.prev < o.finallyLoc) return i(o.finallyLoc);\n }\n }\n }\n },\n abrupt: function(e, t) {\n for (var n = this.tryEntries.length - 1; n >= 0; --n) {\n var i = this.tryEntries[n];\n if (i.tryLoc <= this.prev && a.call(i, \"finallyLoc\") && this.prev < i.finallyLoc) {\n var r = i;\n break;\n }\n }\n r && (\"break\" === e || \"continue\" === e) && r.tryLoc <= t && t <= r.finallyLoc && (r = null);\n var o = r ? r.completion : {};\n return o.type = e, o.arg = t, r ? (this.method = \"next\", this.next = r.finallyLoc, \n y) : this.complete(o);\n },\n complete: function(e, t) {\n if (\"throw\" === e.type) throw e.arg;\n return \"break\" === e.type || \"continue\" === e.type ? this.next = e.arg : \"return\" === e.type ? (this.rval = this.arg = e.arg, \n this.method = \"return\", this.next = \"end\") : \"normal\" === e.type && t && (this.next = t), \n y;\n },\n finish: function(e) {\n for (var t = this.tryEntries.length - 1; t >= 0; --t) {\n var n = this.tryEntries[t];\n if (n.finallyLoc === e) return this.complete(n.completion, n.afterLoc), A(n), y;\n }\n },\n catch: function(e) {\n for (var t = this.tryEntries.length - 1; t >= 0; --t) {\n var n = this.tryEntries[t];\n if (n.tryLoc === e) {\n var i = n.completion;\n if (\"throw\" === i.type) {\n var a = i.arg;\n A(n);\n }\n return a;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function(t, n, i) {\n return this.delegate = {\n iterator: L(t),\n resultName: n,\n nextLoc: i\n }, \"next\" === this.method && (this.arg = e), y;\n }\n }, t;\n }\n function d(e, t) {\n var n = \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (!n) {\n if (Array.isArray(e) || (n = function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return h(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return h(e, t);\n }(e)) || t && e && \"number\" == typeof e.length) {\n n && (e = n);\n var i = 0, a = function() {};\n return {\n s: a,\n n: function() {\n return i >= e.length ? {\n done: !0\n } : {\n done: !1,\n value: e[i++]\n };\n },\n e: function(e) {\n throw e;\n },\n f: a\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var r, o = !0, l = !1;\n return {\n s: function() {\n n = n.call(e);\n },\n n: function() {\n var e = n.next();\n return o = e.done, e;\n },\n e: function(e) {\n l = !0, r = e;\n },\n f: function() {\n try {\n o || null == n.return || n.return();\n } finally {\n if (l) throw r;\n }\n }\n };\n }\n function h(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function v(e, t, n, i, a, r, o) {\n try {\n var l = e[r](o), s = l.value;\n } catch (e) {\n return void n(e);\n }\n l.done ? t(s) : Promise.resolve(s).then(i, a);\n }\n var m, g, y = t.EventHandlers = {\n keyEvent: function(e, t, n, i, a) {\n var f = this.inputmask, p = f.opts, d = f.dependencyLib, h = f.maskset, v = this, m = d(v), g = e.key, b = r.caret.call(f, v), x = p.onKeyDown.call(this, e, r.getBuffer.call(f), b, p);\n if (void 0 !== x) return x;\n if (g === o.keys.Backspace || g === o.keys.Delete || l.iphone && g === o.keys.BACKSPACE_SAFARI || e.ctrlKey && g === o.keys.x && !(\"oncut\" in v)) e.preventDefault(), \n s.handleRemove.call(f, v, g, b), (0, c.writeBuffer)(v, r.getBuffer.call(f, !0), h.p, e, v.inputmask._valueGet() !== r.getBuffer.call(f).join(\"\")); else if (g === o.keys.End || g === o.keys.PageDown) {\n e.preventDefault();\n var w = r.seekNext.call(f, r.getLastValidPosition.call(f));\n r.caret.call(f, v, e.shiftKey ? b.begin : w, w, !0);\n } else g === o.keys.Home && !e.shiftKey || g === o.keys.PageUp ? (e.preventDefault(), \n r.caret.call(f, v, 0, e.shiftKey ? b.begin : 0, !0)) : p.undoOnEscape && g === o.keys.Escape && !0 !== e.altKey ? ((0, \n c.checkVal)(v, !0, !1, f.undoValue.split(\"\")), m.trigger(\"click\")) : g !== o.keys.Insert || e.shiftKey || e.ctrlKey || void 0 !== f.userOptions.insertMode ? !0 === p.tabThrough && g === o.keys.Tab ? !0 === e.shiftKey ? (b.end = r.seekPrevious.call(f, b.end, !0), \n !0 === u.getTest.call(f, b.end - 1).match.static && b.end--, b.begin = r.seekPrevious.call(f, b.end, !0), \n b.begin >= 0 && b.end > 0 && (e.preventDefault(), r.caret.call(f, v, b.begin, b.end))) : (b.begin = r.seekNext.call(f, b.begin, !0), \n b.end = r.seekNext.call(f, b.begin, !0), b.end < h.maskLength && b.end--, b.begin <= h.maskLength && (e.preventDefault(), \n r.caret.call(f, v, b.begin, b.end))) : e.shiftKey || (p.insertModeVisual && !1 === p.insertMode ? g === o.keys.ArrowRight ? setTimeout((function() {\n var e = r.caret.call(f, v);\n r.caret.call(f, v, e.begin);\n }), 0) : g === o.keys.ArrowLeft && setTimeout((function() {\n var e = r.translatePosition.call(f, v.inputmask.caretPos.begin);\n r.translatePosition.call(f, v.inputmask.caretPos.end);\n f.isRTL ? r.caret.call(f, v, e + (e === h.maskLength ? 0 : 1)) : r.caret.call(f, v, e - (0 === e ? 0 : 1));\n }), 0) : void 0 === f.keyEventHook || f.keyEventHook.call(f, e)) : s.isSelection.call(f, b) ? p.insertMode = !p.insertMode : (p.insertMode = !p.insertMode, \n r.caret.call(f, v, b.begin, b.begin));\n return f.isComposing = g == o.keys.Process || g == o.keys.Unidentified, f.ignorable = g.length > 1 && !(\"textarea\" === v.tagName.toLowerCase() && k == o.keys.Enter), \n y.keypressEvent.call(this, e, t, n, i, a);\n },\n keypressEvent: function(e, t, n, i, a) {\n var l = this.inputmask || this, u = l.opts, f = l.dependencyLib, p = l.maskset, d = l.el, h = f(d), v = e.key;\n if (!0 === t || e.ctrlKey && e.altKey && !l.ignorable || !(e.ctrlKey || e.metaKey || l.ignorable)) {\n if (v) {\n var m, g = t ? {\n begin: a,\n end: a\n } : r.caret.call(l, d);\n t || (v = u.substitutes[v] || v), p.writeOutBuffer = !0;\n var y = s.isValid.call(l, g, v, i, void 0, void 0, void 0, t);\n if (!1 !== y && (r.resetMaskSet.call(l, !0), m = void 0 !== y.caret ? y.caret : r.seekNext.call(l, y.pos.begin ? y.pos.begin : y.pos), \n p.p = m), m = u.numericInput && void 0 === y.caret ? r.seekPrevious.call(l, m) : m, \n !1 !== n && (setTimeout((function() {\n u.onKeyValidation.call(d, v, y);\n }), 0), p.writeOutBuffer && !1 !== y)) {\n var k = r.getBuffer.call(l);\n (0, c.writeBuffer)(d, k, m, e, !0 !== t);\n }\n if (e.preventDefault(), t) return !1 !== y && (y.forwardPosition = m), y;\n }\n } else v === o.keys.Enter && l.undoValue !== l._valueGet(!0) && (l.undoValue = l._valueGet(!0), \n setTimeout((function() {\n h.trigger(\"change\");\n }), 0));\n },\n pasteEvent: (m = p().mark((function e(t) {\n var n, i, a, o, l, s;\n return p().wrap((function(e) {\n for (;;) switch (e.prev = e.next) {\n case 0:\n n = function(e, n, i, a, l) {\n var s = r.caret.call(e, n, void 0, void 0, !0), u = i.substr(0, s.begin), f = i.substr(s.end, i.length);\n if (u == (e.isRTL ? r.getBufferTemplate.call(e).slice().reverse() : r.getBufferTemplate.call(e)).slice(0, s.begin).join(\"\") && (u = \"\"), \n f == (e.isRTL ? r.getBufferTemplate.call(e).slice().reverse() : r.getBufferTemplate.call(e)).slice(s.end).join(\"\") && (f = \"\"), \n a = u + a + f, e.isRTL && !0 !== o.numericInput) {\n a = a.split(\"\");\n var p, h = d(r.getBufferTemplate.call(e));\n try {\n for (h.s(); !(p = h.n()).done; ) {\n var v = p.value;\n a[0] === v && a.shift();\n }\n } catch (e) {\n h.e(e);\n } finally {\n h.f();\n }\n a = a.reverse().join(\"\");\n }\n var m = a;\n if (\"function\" == typeof l) {\n if (!1 === (m = l.call(e, m, o))) return !1;\n m || (m = i);\n }\n (0, c.checkVal)(n, !0, !1, m.toString().split(\"\"), t);\n }, i = this, a = this.inputmask, o = a.opts, l = a._valueGet(!0), a.skipInputEvent = !0, \n t.clipboardData && t.clipboardData.getData ? s = t.clipboardData.getData(\"text/plain\") : f.default.clipboardData && f.default.clipboardData.getData && (s = f.default.clipboardData.getData(\"Text\")), \n n(a, i, l, s, o.onBeforePaste), t.preventDefault();\n\n case 7:\n case \"end\":\n return e.stop();\n }\n }), e, this);\n })), g = function() {\n var e = this, t = arguments;\n return new Promise((function(n, i) {\n var a = m.apply(e, t);\n function r(e) {\n v(a, n, i, r, o, \"next\", e);\n }\n function o(e) {\n v(a, n, i, r, o, \"throw\", e);\n }\n r(void 0);\n }));\n }, function(e) {\n return g.apply(this, arguments);\n }),\n inputFallBackEvent: function(e) {\n var t = this.inputmask, n = t.opts, i = t.dependencyLib;\n var a, s = this, f = s.inputmask._valueGet(!0), p = (t.isRTL ? r.getBuffer.call(t).slice().reverse() : r.getBuffer.call(t)).join(\"\"), d = r.caret.call(t, s, void 0, void 0, !0);\n if (p !== f) {\n if (a = function(e, i, a) {\n for (var o, l, s, c = e.substr(0, a.begin).split(\"\"), f = e.substr(a.begin).split(\"\"), p = i.substr(0, a.begin).split(\"\"), d = i.substr(a.begin).split(\"\"), h = c.length >= p.length ? c.length : p.length, v = f.length >= d.length ? f.length : d.length, m = \"\", g = [], y = \"~\"; c.length < h; ) c.push(y);\n for (;p.length < h; ) p.push(y);\n for (;f.length < v; ) f.unshift(y);\n for (;d.length < v; ) d.unshift(y);\n var k = c.concat(f), b = p.concat(d);\n for (l = 0, o = k.length; l < o; l++) switch (s = u.getPlaceholder.call(t, r.translatePosition.call(t, l)), \n m) {\n case \"insertText\":\n b[l - 1] === k[l] && a.begin == k.length - 1 && g.push(k[l]), l = o;\n break;\n\n case \"insertReplacementText\":\n case \"deleteContentBackward\":\n k[l] === y ? a.end++ : l = o;\n break;\n\n default:\n k[l] !== b[l] && (k[l + 1] !== y && k[l + 1] !== s && void 0 !== k[l + 1] || (b[l] !== s || b[l + 1] !== y) && b[l] !== y ? b[l + 1] === y && b[l] === k[l + 1] ? (m = \"insertText\", \n g.push(k[l]), a.begin--, a.end--) : k[l] !== s && k[l] !== y && (k[l + 1] === y || b[l] !== k[l] && b[l + 1] === k[l + 1]) ? (m = \"insertReplacementText\", \n g.push(k[l]), a.begin--) : k[l] === y ? (m = \"deleteContentBackward\", (r.isMask.call(t, r.translatePosition.call(t, l), !0) || b[l] === n.radixPoint) && a.end++) : l = o : (m = \"insertText\", \n g.push(k[l]), a.begin--, a.end--));\n }\n return {\n action: m,\n data: g,\n caret: a\n };\n }(f, p, d), (s.inputmask.shadowRoot || s.ownerDocument).activeElement !== s && s.focus(), \n (0, c.writeBuffer)(s, r.getBuffer.call(t)), r.caret.call(t, s, d.begin, d.end, !0), \n !l.mobile && t.skipNextInsert && \"insertText\" === e.inputType && \"insertText\" === a.action && t.isComposing) return !1;\n switch (\"insertCompositionText\" === e.inputType && \"insertText\" === a.action && t.isComposing ? t.skipNextInsert = !0 : t.skipNextInsert = !1, \n a.action) {\n case \"insertText\":\n case \"insertReplacementText\":\n a.data.forEach((function(e, n) {\n var a = new i.Event(\"keypress\");\n a.key = e, t.ignorable = !1, y.keypressEvent.call(s, a);\n })), setTimeout((function() {\n t.$el.trigger(\"keyup\");\n }), 0);\n break;\n\n case \"deleteContentBackward\":\n var h = new i.Event(\"keydown\");\n h.key = o.keys.Backspace, y.keyEvent.call(s, h);\n break;\n\n default:\n (0, c.applyInputValue)(s, f), r.caret.call(t, s, d.begin, d.end, !0);\n }\n e.preventDefault();\n }\n },\n setValueEvent: function(e) {\n var t = this.inputmask, n = t.dependencyLib, i = this, a = e && e.detail ? e.detail[0] : arguments[1];\n void 0 === a && (a = i.inputmask._valueGet(!0)), (0, c.applyInputValue)(i, a, new n.Event(\"input\")), \n (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && r.caret.call(t, i, e.detail ? e.detail[1] : arguments[2]);\n },\n focusEvent: function(e) {\n var t = this.inputmask, n = t.opts, i = t && t._valueGet();\n n.showMaskOnFocus && i !== r.getBuffer.call(t).join(\"\") && (0, c.writeBuffer)(this, r.getBuffer.call(t), r.seekNext.call(t, r.getLastValidPosition.call(t))), \n !0 !== n.positionCaretOnTab || !1 !== t.mouseEnter || s.isComplete.call(t, r.getBuffer.call(t)) && -1 !== r.getLastValidPosition.call(t) || y.clickEvent.apply(this, [ e, !0 ]), \n t.undoValue = t && t._valueGet(!0);\n },\n invalidEvent: function(e) {\n this.inputmask.validationEvent = !0;\n },\n mouseleaveEvent: function() {\n var e = this.inputmask, t = e.opts, n = this;\n e.mouseEnter = !1, t.clearMaskOnLostFocus && (n.inputmask.shadowRoot || n.ownerDocument).activeElement !== n && (0, \n c.HandleNativePlaceholder)(n, e.originalPlaceholder);\n },\n clickEvent: function(e, t) {\n var n = this.inputmask;\n n.clicked++;\n var i = this;\n if ((i.inputmask.shadowRoot || i.ownerDocument).activeElement === i) {\n var a = r.determineNewCaretPosition.call(n, r.caret.call(n, i), t);\n void 0 !== a && r.caret.call(n, i, a);\n }\n },\n cutEvent: function(e) {\n var t = this.inputmask, n = t.maskset, i = this, a = r.caret.call(t, i), l = t.isRTL ? r.getBuffer.call(t).slice(a.end, a.begin) : r.getBuffer.call(t).slice(a.begin, a.end), u = t.isRTL ? l.reverse().join(\"\") : l.join(\"\");\n f.default.navigator && f.default.navigator.clipboard ? f.default.navigator.clipboard.writeText(u) : f.default.clipboardData && f.default.clipboardData.getData && f.default.clipboardData.setData(\"Text\", u), \n s.handleRemove.call(t, i, o.keys.Delete, a), (0, c.writeBuffer)(i, r.getBuffer.call(t), n.p, e, t.undoValue !== t._valueGet(!0));\n },\n blurEvent: function(e) {\n var t = this.inputmask, n = t.opts, i = t.dependencyLib;\n t.clicked = 0;\n var a = i(this), o = this;\n if (o.inputmask) {\n (0, c.HandleNativePlaceholder)(o, t.originalPlaceholder);\n var l = o.inputmask._valueGet(), u = r.getBuffer.call(t).slice();\n \"\" !== l && (n.clearMaskOnLostFocus && (-1 === r.getLastValidPosition.call(t) && l === r.getBufferTemplate.call(t).join(\"\") ? u = [] : c.clearOptionalTail.call(t, u)), \n !1 === s.isComplete.call(t, u) && (setTimeout((function() {\n a.trigger(\"incomplete\");\n }), 0), n.clearIncomplete && (r.resetMaskSet.call(t, !1), u = n.clearMaskOnLostFocus ? [] : r.getBufferTemplate.call(t).slice())), \n (0, c.writeBuffer)(o, u, void 0, e)), l = t._valueGet(!0), t.undoValue !== l && (\"\" != l || t.undoValue != r.getBufferTemplate.call(t).join(\"\") || t.undoValue == r.getBufferTemplate.call(t).join(\"\") && t.maskset.validPositions.length > 0) && (t.undoValue = l, \n a.trigger(\"change\"));\n }\n },\n mouseenterEvent: function() {\n var e = this.inputmask, t = e.opts.showMaskOnHover, n = this;\n if (e.mouseEnter = !0, (n.inputmask.shadowRoot || n.ownerDocument).activeElement !== n) {\n var i = (e.isRTL ? r.getBufferTemplate.call(e).slice().reverse() : r.getBufferTemplate.call(e)).join(\"\");\n t && (0, c.HandleNativePlaceholder)(n, i);\n }\n },\n submitEvent: function() {\n var e = this.inputmask, t = e.opts;\n e.undoValue !== e._valueGet(!0) && e.$el.trigger(\"change\"), -1 === r.getLastValidPosition.call(e) && e._valueGet && e._valueGet() === r.getBufferTemplate.call(e).join(\"\") && e._valueSet(\"\"), \n t.clearIncomplete && !1 === s.isComplete.call(e, r.getBuffer.call(e)) && e._valueSet(\"\"), \n t.removeMaskOnSubmit && (e._valueSet(e.unmaskedvalue(), !0), setTimeout((function() {\n (0, c.writeBuffer)(e.el, r.getBuffer.call(e));\n }), 0));\n },\n resetEvent: function() {\n var e = this.inputmask;\n e.refreshValue = !0, setTimeout((function() {\n (0, c.applyInputValue)(e.el, e._valueGet(!0));\n }), 0);\n }\n };\n },\n 9716: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.EventRuler = void 0;\n var i, a = (i = n(2394)) && i.__esModule ? i : {\n default: i\n }, r = n(2839), o = n(8711), l = n(7760);\n t.EventRuler = {\n on: function(e, t, n) {\n var i = e.inputmask.dependencyLib, s = function(t) {\n t.originalEvent && (t = t.originalEvent || t, arguments[0] = t);\n var s, c = this, u = c.inputmask, f = u ? u.opts : void 0;\n if (void 0 === u && \"FORM\" !== this.nodeName) {\n var p = i.data(c, \"_inputmask_opts\");\n i(c).off(), p && new a.default(p).mask(c);\n } else {\n if ([ \"submit\", \"reset\", \"setvalue\" ].includes(t.type) || \"FORM\" === this.nodeName || !(c.disabled || c.readOnly && !(\"keydown\" === t.type && t.ctrlKey && t.key === r.keys.c || !1 === f.tabThrough && t.key === r.keys.Tab))) {\n switch (t.type) {\n case \"input\":\n if (!0 === u.skipInputEvent) return u.skipInputEvent = !1, t.preventDefault();\n break;\n\n case \"click\":\n case \"focus\":\n return u.validationEvent ? (u.validationEvent = !1, e.blur(), (0, l.HandleNativePlaceholder)(e, (u.isRTL ? o.getBufferTemplate.call(u).slice().reverse() : o.getBufferTemplate.call(u)).join(\"\")), \n setTimeout((function() {\n e.focus();\n }), f.validationEventTimeOut), !1) : (s = arguments, void setTimeout((function() {\n e.inputmask && n.apply(c, s);\n }), 0));\n }\n var d = n.apply(c, arguments);\n return !1 === d && (t.preventDefault(), t.stopPropagation()), d;\n }\n t.preventDefault();\n }\n };\n [ \"submit\", \"reset\" ].includes(t) ? (s = s.bind(e), null !== e.form && i(e.form).on(t, s)) : i(e).on(t, s), \n e.inputmask.events[t] = e.inputmask.events[t] || [], e.inputmask.events[t].push(s);\n },\n off: function(e, t) {\n if (e.inputmask && e.inputmask.events) {\n var n = e.inputmask.dependencyLib, i = e.inputmask.events;\n for (var a in t && ((i = [])[t] = e.inputmask.events[t]), i) {\n for (var r = i[a]; r.length > 0; ) {\n var o = r.pop();\n [ \"submit\", \"reset\" ].includes(a) ? null !== e.form && n(e.form).off(a, o) : n(e).off(a, o);\n }\n delete e.inputmask.events[a];\n }\n }\n }\n };\n },\n 219: function(e, t, n) {\n var i = p(n(2394)), a = n(2839), r = p(n(7184)), o = n(8711), l = n(4713);\n function s(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return c(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return c(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function c(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function u(e) {\n return u = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, u(e);\n }\n function f(e, t) {\n for (var n = 0; n < t.length; n++) {\n var i = t[n];\n i.enumerable = i.enumerable || !1, i.configurable = !0, \"value\" in i && (i.writable = !0), \n Object.defineProperty(e, (a = i.key, r = void 0, r = function(e, t) {\n if (\"object\" !== u(e) || null === e) return e;\n var n = e[Symbol.toPrimitive];\n if (void 0 !== n) {\n var i = n.call(e, t || \"default\");\n if (\"object\" !== u(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(a, \"string\"), \"symbol\" === u(r) ? r : String(r)), i);\n }\n var a, r;\n }\n function p(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n n(1313);\n var d = i.default.dependencyLib, h = function() {\n function e(t, n, i, a) {\n !function(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.mask = t, this.format = n, this.opts = i, this.inputmask = a, this._date = new Date(1, 0, 1), \n this.initDateObject(t, this.opts, this.inputmask);\n }\n var t, n, i;\n return t = e, (n = [ {\n key: \"date\",\n get: function() {\n return void 0 === this._date && (this._date = new Date(1, 0, 1), this.initDateObject(void 0, this.opts, this.inputmask)), \n this._date;\n }\n }, {\n key: \"initDateObject\",\n value: function(e, t, n) {\n var i;\n for (P(t).lastIndex = 0; i = P(t).exec(this.format); ) {\n var a = new RegExp(\"\\\\d+$\").exec(i[0]), r = a ? i[0][0] + \"x\" : i[0], o = void 0;\n if (void 0 !== e) {\n if (a) {\n var s = P(t).lastIndex, c = j.call(n, i.index, t, n && n.maskset);\n P(t).lastIndex = s, o = e.slice(0, e.indexOf(c.nextMatch[0]));\n } else {\n for (var u = i[0][0], f = i.index; n && l.getTest.call(n, f).match.placeholder === u; ) f++;\n var p = f - i.index;\n o = e.slice(0, p || y[r] && y[r][4] || r.length);\n }\n e = e.slice(o.length);\n }\n Object.prototype.hasOwnProperty.call(y, r) && this.setValue(this, o, r, y[r][2], y[r][1]);\n }\n }\n }, {\n key: \"setValue\",\n value: function(e, t, n, i, a) {\n if (void 0 !== t) switch (i) {\n case \"ampm\":\n e[i] = t, e[\"raw\" + i] = t.replace(/\\s/g, \"_\");\n break;\n\n case \"month\":\n if (\"mmm\" === n || \"mmmm\" === n) {\n e[i] = _(\"mmm\" === n ? m.monthNames.slice(0, 12).findIndex((function(e) {\n return t.toLowerCase() === e.toLowerCase();\n })) + 1 : m.monthNames.slice(12, 24).findIndex((function(e) {\n return t.toLowerCase() === e.toLowerCase();\n })) + 1, 2), e[i] = \"00\" === e[i] ? \"\" : e[i].toString(), e[\"raw\" + i] = e[i];\n break;\n }\n\n default:\n e[i] = t.replace(/[^0-9]/g, \"0\"), e[\"raw\" + i] = t.replace(/\\s/g, \"_\");\n }\n if (void 0 !== a) {\n var r = e[i];\n (\"day\" === i && 29 === parseInt(r) || \"month\" === i && 2 === parseInt(r)) && (29 !== parseInt(e.day) || 2 !== parseInt(e.month) || \"\" !== e.year && void 0 !== e.year || e._date.setFullYear(2012, 1, 29)), \n \"day\" === i && (g = !0, 0 === parseInt(r) && (r = 1)), \"month\" === i && (g = !0), \n \"year\" === i && (g = !0, r.length < y[n][4] && (r = _(r, y[n][4], !0))), (\"\" !== r && !isNaN(r) || \"ampm\" === i) && a.call(e._date, r);\n }\n }\n }, {\n key: \"reset\",\n value: function() {\n this._date = new Date(1, 0, 1);\n }\n }, {\n key: \"reInit\",\n value: function() {\n this._date = void 0, this.date;\n }\n } ]) && f(t.prototype, n), i && f(t, i), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e;\n }(), v = (new Date).getFullYear(), m = i.default.prototype.i18n, g = !1, y = {\n d: [ \"[1-9]|[12][0-9]|3[01]\", Date.prototype.setDate, \"day\", Date.prototype.getDate ],\n dd: [ \"0[1-9]|[12][0-9]|3[01]\", Date.prototype.setDate, \"day\", function() {\n return _(Date.prototype.getDate.call(this), 2);\n } ],\n ddd: [ \"\" ],\n dddd: [ \"\" ],\n m: [ \"[1-9]|1[012]\", function(e) {\n var t = e ? parseInt(e) : 0;\n return t > 0 && t--, Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return Date.prototype.getMonth.call(this) + 1;\n } ],\n mm: [ \"0[1-9]|1[012]\", function(e) {\n var t = e ? parseInt(e) : 0;\n return t > 0 && t--, Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return _(Date.prototype.getMonth.call(this) + 1, 2);\n } ],\n mmm: [ m.monthNames.slice(0, 12).join(\"|\"), function(e) {\n var t = m.monthNames.slice(0, 12).findIndex((function(t) {\n return e.toLowerCase() === t.toLowerCase();\n }));\n return -1 !== t && Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return m.monthNames.slice(0, 12)[Date.prototype.getMonth.call(this)];\n } ],\n mmmm: [ m.monthNames.slice(12, 24).join(\"|\"), function(e) {\n var t = m.monthNames.slice(12, 24).findIndex((function(t) {\n return e.toLowerCase() === t.toLowerCase();\n }));\n return -1 !== t && Date.prototype.setMonth.call(this, t);\n }, \"month\", function() {\n return m.monthNames.slice(12, 24)[Date.prototype.getMonth.call(this)];\n } ],\n yy: [ \"[0-9]{2}\", function(e) {\n var t = (new Date).getFullYear().toString().slice(0, 2);\n Date.prototype.setFullYear.call(this, \"\".concat(t).concat(e));\n }, \"year\", function() {\n return _(Date.prototype.getFullYear.call(this), 2);\n }, 2 ],\n yyyy: [ \"[0-9]{4}\", Date.prototype.setFullYear, \"year\", function() {\n return _(Date.prototype.getFullYear.call(this), 4);\n }, 4 ],\n h: [ \"[1-9]|1[0-2]\", Date.prototype.setHours, \"hours\", Date.prototype.getHours ],\n hh: [ \"0[1-9]|1[0-2]\", Date.prototype.setHours, \"hours\", function() {\n return _(Date.prototype.getHours.call(this), 2);\n } ],\n hx: [ function(e) {\n return \"[0-9]{\".concat(e, \"}\");\n }, Date.prototype.setHours, \"hours\", function(e) {\n return Date.prototype.getHours;\n } ],\n H: [ \"1?[0-9]|2[0-3]\", Date.prototype.setHours, \"hours\", Date.prototype.getHours ],\n HH: [ \"0[0-9]|1[0-9]|2[0-3]\", Date.prototype.setHours, \"hours\", function() {\n return _(Date.prototype.getHours.call(this), 2);\n } ],\n Hx: [ function(e) {\n return \"[0-9]{\".concat(e, \"}\");\n }, Date.prototype.setHours, \"hours\", function(e) {\n return function() {\n return _(Date.prototype.getHours.call(this), e);\n };\n } ],\n M: [ \"[1-5]?[0-9]\", Date.prototype.setMinutes, \"minutes\", Date.prototype.getMinutes ],\n MM: [ \"0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]\", Date.prototype.setMinutes, \"minutes\", function() {\n return _(Date.prototype.getMinutes.call(this), 2);\n } ],\n s: [ \"[1-5]?[0-9]\", Date.prototype.setSeconds, \"seconds\", Date.prototype.getSeconds ],\n ss: [ \"0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]\", Date.prototype.setSeconds, \"seconds\", function() {\n return _(Date.prototype.getSeconds.call(this), 2);\n } ],\n l: [ \"[0-9]{3}\", Date.prototype.setMilliseconds, \"milliseconds\", function() {\n return _(Date.prototype.getMilliseconds.call(this), 3);\n }, 3 ],\n L: [ \"[0-9]{2}\", Date.prototype.setMilliseconds, \"milliseconds\", function() {\n return _(Date.prototype.getMilliseconds.call(this), 2);\n }, 2 ],\n t: [ \"[ap]\", b, \"ampm\", x, 1 ],\n tt: [ \"[ap]m\", b, \"ampm\", x, 2 ],\n T: [ \"[AP]\", b, \"ampm\", x, 1 ],\n TT: [ \"[AP]M\", b, \"ampm\", x, 2 ],\n Z: [ \".*\", void 0, \"Z\", function() {\n var e = this.toString().match(/\\((.+)\\)/)[1];\n e.includes(\" \") && (e = (e = e.replace(\"-\", \" \").toUpperCase()).split(\" \").map((function(e) {\n return s(e, 1)[0];\n })).join(\"\"));\n return e;\n } ],\n o: [ \"\" ],\n S: [ \"\" ]\n }, k = {\n isoDate: \"yyyy-mm-dd\",\n isoTime: \"HH:MM:ss\",\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n };\n function b(e) {\n var t = this.getHours();\n e.toLowerCase().includes(\"p\") ? this.setHours(t + 12) : e.toLowerCase().includes(\"a\") && t >= 12 && this.setHours(t - 12);\n }\n function x() {\n var e = this.getHours();\n return (e = e || 12) >= 12 ? \"PM\" : \"AM\";\n }\n function w(e) {\n var t = new RegExp(\"\\\\d+$\").exec(e[0]);\n if (t && void 0 !== t[0]) {\n var n = y[e[0][0] + \"x\"].slice(\"\");\n return n[0] = n[0](t[0]), n[3] = n[3](t[0]), n;\n }\n if (y[e[0]]) return y[e[0]];\n }\n function P(e) {\n if (!e.tokenizer) {\n var t = [], n = [];\n for (var i in y) if (/\\.*x$/.test(i)) {\n var a = i[0] + \"\\\\d+\";\n -1 === n.indexOf(a) && n.push(a);\n } else -1 === t.indexOf(i[0]) && t.push(i[0]);\n e.tokenizer = \"(\" + (n.length > 0 ? n.join(\"|\") + \"|\" : \"\") + t.join(\"+|\") + \")+?|.\", \n e.tokenizer = new RegExp(e.tokenizer, \"g\");\n }\n return e.tokenizer;\n }\n function S(e, t, n) {\n if (!g) return !0;\n if (void 0 === e.rawday || !isFinite(e.rawday) && new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day || \"29\" == e.day && (!isFinite(e.rawyear) || void 0 === e.rawyear || \"\" === e.rawyear) || new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day) return t;\n if (\"29\" == e.day) {\n var i = j.call(this, t.pos, n, this.maskset);\n if (i.targetMatch && \"yyyy\" === i.targetMatch[0] && t.pos - i.targetMatchIndex == 2) return t.remove = t.pos + 1, \n t;\n } else if (2 == e.date.getMonth() && \"30\" == e.day && void 0 !== t.c) return e.day = \"03\", \n e.date.setDate(3), e.date.setMonth(1), t.insert = [ {\n pos: t.pos,\n c: \"0\"\n }, {\n pos: t.pos + 1,\n c: t.c\n } ], t.caret = o.seekNext.call(this, t.pos + 1), t;\n return !1;\n }\n function O(e, t, n, i) {\n var a, o, l = \"\", s = 0, c = {};\n for (P(n).lastIndex = 0; a = P(n).exec(e); ) {\n if (void 0 === t) if (o = w(a)) l += \"(\" + o[0] + \")\", c[s] = a[0].charAt(0); else switch (a[0]) {\n case \"[\":\n l += \"(\";\n break;\n\n case \"]\":\n l += \")?\";\n break;\n\n default:\n l += (0, r.default)(a[0]), c[s] = a[0].charAt(0);\n } else if (o = w(a)) if (!0 !== i && o[3]) l += o[3].call(t.date); else o[2] ? l += t[\"raw\" + o[2]] : l += a[0]; else l += a[0];\n s++;\n }\n return void 0 !== t || \"\" !== n.placeholder && -1 === n.inputFormat.indexOf(\"mmmm\") || (n.placeholder = c), \n l;\n }\n function _(e, t, n) {\n for (e = String(e), t = t || 2; e.length < t; ) e = n ? e + \"0\" : \"0\" + e;\n return e;\n }\n function M(e, t, n) {\n return \"string\" == typeof e ? new h(e, t, n, this) : e && \"object\" === u(e) && Object.prototype.hasOwnProperty.call(e, \"date\") ? e : void 0;\n }\n function E(e, t) {\n return O(t.inputFormat, {\n date: e\n }, t);\n }\n function j(e, t, n) {\n var i, a, r = n && n.tests[e] ? n.tests[e][0].match.placeholder : \"\", o = 0, s = 0;\n for (P(t).lastIndex = 0; a = P(t).exec(t.inputFormat); ) {\n var c = new RegExp(\"\\\\d+$\").exec(a[0]);\n if (c) s = parseInt(c[0]); else {\n for (var u = a[0][0], f = o; this && l.getTest.call(this, f).match.placeholder === u; ) f++;\n 0 === (s = f - o) && (s = a[0].length);\n }\n if (o += s, -1 != a[0].indexOf(r) || o >= e + 1) {\n i = a, a = P(t).exec(t.inputFormat);\n break;\n }\n }\n return {\n targetMatchIndex: o - s,\n nextMatch: a,\n targetMatch: i\n };\n }\n i.default.extendAliases({\n datetime: {\n mask: function(e) {\n return e.numericInput = !1, y.S = m.ordinalSuffix.join(\"|\"), e.inputFormat = k[e.inputFormat] || e.inputFormat, \n e.displayFormat = k[e.displayFormat] || e.displayFormat || e.inputFormat, e.outputFormat = k[e.outputFormat] || e.outputFormat || e.inputFormat, \n e.regex = O(e.inputFormat, void 0, e), e.min = M(e.min, e.inputFormat, e), e.max = M(e.max, e.inputFormat, e), \n null;\n },\n placeholder: \"\",\n inputFormat: \"isoDateTime\",\n displayFormat: null,\n outputFormat: null,\n min: null,\n max: null,\n skipOptionalPartCharacter: \"\",\n preValidation: function(e, t, n, i, a, r, o, l) {\n if (l) return !0;\n if (isNaN(n) && e[t] !== n) {\n var s = j.call(this, t, a, r);\n if (s.nextMatch && s.nextMatch[0] === n && s.targetMatch[0].length > 1) {\n var c = w(s.targetMatch)[0];\n if (new RegExp(c).test(\"0\" + e[t - 1])) return e[t] = e[t - 1], e[t - 1] = \"0\", \n {\n fuzzy: !0,\n buffer: e,\n refreshFromBuffer: {\n start: t - 1,\n end: t + 1\n },\n pos: t + 1\n };\n }\n }\n return !0;\n },\n postValidation: function(e, t, n, i, a, r, o, s) {\n var c, u, f = this;\n if (o) return !0;\n if (!1 === i && (((c = j.call(f, t + 1, a, r)).targetMatch && c.targetMatchIndex === t && c.targetMatch[0].length > 1 && void 0 !== y[c.targetMatch[0]] || (c = j.call(f, t + 2, a, r)).targetMatch && c.targetMatchIndex === t + 1 && c.targetMatch[0].length > 1 && void 0 !== y[c.targetMatch[0]]) && (u = w(c.targetMatch)[0]), \n void 0 !== u && (void 0 !== r.validPositions[t + 1] && new RegExp(u).test(n + \"0\") ? (e[t] = n, \n e[t + 1] = \"0\", i = {\n pos: t + 2,\n caret: t\n }) : new RegExp(u).test(\"0\" + n) && (e[t] = \"0\", e[t + 1] = n, i = {\n pos: t + 2\n })), !1 === i)) return i;\n if (i.fuzzy && (e = i.buffer, t = i.pos), (c = j.call(f, t, a, r)).targetMatch && c.targetMatch[0] && void 0 !== y[c.targetMatch[0]]) {\n var p = w(c.targetMatch);\n u = p[0];\n var d = e.slice(c.targetMatchIndex, c.targetMatchIndex + c.targetMatch[0].length);\n if (!1 === new RegExp(u).test(d.join(\"\")) && 2 === c.targetMatch[0].length && r.validPositions[c.targetMatchIndex] && r.validPositions[c.targetMatchIndex + 1] && (r.validPositions[c.targetMatchIndex + 1].input = \"0\"), \n \"year\" == p[2]) for (var h = l.getMaskTemplate.call(f, !1, 1, void 0, !0), m = t + 1; m < e.length; m++) e[m] = h[m], \n r.validPositions.splice(t + 1, 1);\n }\n var g = i, k = M.call(f, e.join(\"\"), a.inputFormat, a);\n return g && !isNaN(k.date.getTime()) && (a.prefillYear && (g = function(e, t, n) {\n if (e.year !== e.rawyear) {\n var i = v.toString(), a = e.rawyear.replace(/[^0-9]/g, \"\"), r = i.slice(0, a.length), o = i.slice(a.length);\n if (2 === a.length && a === r) {\n var l = new Date(v, e.month - 1, e.day);\n e.day == l.getDate() && (!n.max || n.max.date.getTime() >= l.getTime()) && (e.date.setFullYear(v), \n e.year = i, t.insert = [ {\n pos: t.pos + 1,\n c: o[0]\n }, {\n pos: t.pos + 2,\n c: o[1]\n } ]);\n }\n }\n return t;\n }(k, g, a)), g = function(e, t, n, i, a) {\n if (!t) return t;\n if (t && n.min && !isNaN(n.min.date.getTime())) {\n var r;\n for (e.reset(), P(n).lastIndex = 0; r = P(n).exec(n.inputFormat); ) {\n var o;\n if ((o = w(r)) && o[3]) {\n for (var l = o[1], s = e[o[2]], c = n.min[o[2]], u = n.max ? n.max[o[2]] : c + 1, f = [], p = !1, d = 0; d < c.length; d++) void 0 !== i.validPositions[d + r.index] || p ? (f[d] = s[d], \n p = p || s[d] > c[d]) : (d + r.index == 0 && s[d] < c[d] ? (f[d] = s[d], p = !0) : f[d] = c[d], \n \"year\" === o[2] && s.length - 1 == d && c != u && (f = (parseInt(f.join(\"\")) + 1).toString().split(\"\")), \n \"ampm\" === o[2] && c != u && n.min.date.getTime() > e.date.getTime() && (f[d] = u[d]));\n l.call(e._date, f.join(\"\"));\n }\n }\n t = n.min.date.getTime() <= e.date.getTime(), e.reInit();\n }\n return t && n.max && (isNaN(n.max.date.getTime()) || (t = n.max.date.getTime() >= e.date.getTime())), \n t;\n }(k, g = S.call(f, k, g, a), a, r)), void 0 !== t && g && i.pos !== t ? {\n buffer: O(a.inputFormat, k, a).split(\"\"),\n refreshFromBuffer: {\n start: t,\n end: i.pos\n },\n pos: i.caret || i.pos\n } : g;\n },\n onKeyDown: function(e, t, n, i) {\n e.ctrlKey && e.key === a.keys.ArrowRight && (this.inputmask._valueSet(E(new Date, i)), \n d(this).trigger(\"setvalue\"));\n },\n onUnMask: function(e, t, n) {\n return t ? O(n.outputFormat, M.call(this, e, n.inputFormat, n), n, !0) : t;\n },\n casing: function(e, t, n, i) {\n if (0 == t.nativeDef.indexOf(\"[ap]\")) return e.toLowerCase();\n if (0 == t.nativeDef.indexOf(\"[AP]\")) return e.toUpperCase();\n var r = l.getTest.call(this, [ n - 1 ]);\n return 0 === n || r && r.input === String.fromCharCode(a.keyCode.Space) || r && r.match.def === String.fromCharCode(a.keyCode.Space) ? e.toUpperCase() : e.toLowerCase();\n },\n onBeforeMask: function(e, t) {\n return \"[object Date]\" === Object.prototype.toString.call(e) && (e = E(e, t)), e;\n },\n insertMode: !1,\n insertModeVisual: !1,\n shiftPositions: !1,\n keepStatic: !1,\n inputmode: \"numeric\",\n prefillYear: !0\n }\n });\n },\n 1313: function(e, t, n) {\n var i, a = (i = n(2394)) && i.__esModule ? i : {\n default: i\n };\n a.default.dependencyLib.extend(!0, a.default.prototype.i18n, {\n dayNames: [ \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\" ],\n monthNames: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\", \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ],\n ordinalSuffix: [ \"st\", \"nd\", \"rd\", \"th\" ]\n });\n },\n 3851: function(e, t, n) {\n var i, a = (i = n(2394)) && i.__esModule ? i : {\n default: i\n }, r = n(8711), o = n(4713);\n function l(e) {\n return function(e) {\n if (Array.isArray(e)) return s(e);\n }(e) || function(e) {\n if (\"undefined\" != typeof Symbol && null != e[Symbol.iterator] || null != e[\"@@iterator\"]) return Array.from(e);\n }(e) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return s(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return s(e, t);\n }(e) || function() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function s(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n a.default.extendDefinitions({\n A: {\n validator: \"[A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\",\n casing: \"upper\"\n },\n \"&\": {\n validator: \"[0-9A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5]\",\n casing: \"upper\"\n },\n \"#\": {\n validator: \"[0-9A-Fa-f]\",\n casing: \"upper\"\n }\n });\n var c = new RegExp(\"25[0-5]|2[0-4][0-9]|[01][0-9][0-9]\");\n function u(e, t, n, i, a) {\n if (n - 1 > -1 && \".\" !== t.buffer[n - 1] ? (e = t.buffer[n - 1] + e, e = n - 2 > -1 && \".\" !== t.buffer[n - 2] ? t.buffer[n - 2] + e : \"0\" + e) : e = \"00\" + e, \n a.greedy && parseInt(e) > 255 && c.test(\"00\" + e.charAt(2))) {\n var r = [].concat(l(t.buffer.slice(0, n)), [ \".\", e.charAt(2) ]);\n if (r.join(\"\").match(/\\./g).length < 4) return {\n refreshFromBuffer: !0,\n buffer: r,\n caret: n + 2\n };\n }\n return c.test(e);\n }\n a.default.extendAliases({\n cssunit: {\n regex: \"[+-]?[0-9]+\\\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)\"\n },\n url: {\n regex: \"(https?|ftp)://.*\",\n autoUnmask: !1,\n keepStatic: !1,\n tabThrough: !0\n },\n ip: {\n mask: \"i{1,3}.j{1,3}.k{1,3}.l{1,3}\",\n definitions: {\n i: {\n validator: u\n },\n j: {\n validator: u\n },\n k: {\n validator: u\n },\n l: {\n validator: u\n }\n },\n onUnMask: function(e, t, n) {\n return e;\n },\n inputmode: \"decimal\",\n substitutes: {\n \",\": \".\"\n }\n },\n email: {\n mask: function(e) {\n var t = e.separator, n = e.quantifier, i = \"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]\", a = i;\n if (t) for (var r = 0; r < n; r++) a += \"[\".concat(t).concat(i, \"]\");\n return a;\n },\n greedy: !1,\n casing: \"lower\",\n separator: null,\n quantifier: 5,\n skipOptionalPartCharacter: \"\",\n onBeforePaste: function(e, t) {\n return (e = e.toLowerCase()).replace(\"mailto:\", \"\");\n },\n definitions: {\n \"*\": {\n validator: \"[0-9\\uff11-\\uff19A-Za-z\\u0410-\\u044f\\u0401\\u0451\\xc0-\\xff\\xb5!#$%&'*+/=?^_`{|}~-]\"\n },\n \"-\": {\n validator: \"[0-9A-Za-z-]\"\n }\n },\n onUnMask: function(e, t, n) {\n return e;\n },\n inputmode: \"email\"\n },\n mac: {\n mask: \"##:##:##:##:##:##\"\n },\n vin: {\n mask: \"V{13}9{4}\",\n definitions: {\n V: {\n validator: \"[A-HJ-NPR-Za-hj-npr-z\\\\d]\",\n casing: \"upper\"\n }\n },\n clearIncomplete: !0,\n autoUnmask: !0\n },\n ssn: {\n mask: \"999-99-9999\",\n postValidation: function(e, t, n, i, a, l, s) {\n var c = o.getMaskTemplate.call(this, !0, r.getLastValidPosition.call(this), !0, !0);\n return /^(?!219-09-9999|078-05-1120)(?!666|000|9.{2}).{3}-(?!00).{2}-(?!0{4}).{4}$/.test(c.join(\"\"));\n }\n }\n });\n },\n 207: function(e, t, n) {\n var i = l(n(2394)), a = l(n(7184)), r = n(8711), o = n(2839);\n function l(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var s = i.default.dependencyLib;\n function c(e, t) {\n for (var n = \"\", a = 0; a < e.length; a++) i.default.prototype.definitions[e.charAt(a)] || t.definitions[e.charAt(a)] || t.optionalmarker[0] === e.charAt(a) || t.optionalmarker[1] === e.charAt(a) || t.quantifiermarker[0] === e.charAt(a) || t.quantifiermarker[1] === e.charAt(a) || t.groupmarker[0] === e.charAt(a) || t.groupmarker[1] === e.charAt(a) || t.alternatormarker === e.charAt(a) ? n += \"\\\\\" + e.charAt(a) : n += e.charAt(a);\n return n;\n }\n function u(e, t, n, i) {\n if (e.length > 0 && t > 0 && (!n.digitsOptional || i)) {\n var a = e.indexOf(n.radixPoint), r = !1;\n n.negationSymbol.back === e[e.length - 1] && (r = !0, e.length--), -1 === a && (e.push(n.radixPoint), \n a = e.length - 1);\n for (var o = 1; o <= t; o++) isFinite(e[a + o]) || (e[a + o] = \"0\");\n }\n return r && e.push(n.negationSymbol.back), e;\n }\n function f(e, t) {\n var n = 0;\n for (var i in \"+\" === e && (n = r.seekNext.call(this, t.validPositions.length - 1)), \n t.tests) if ((i = parseInt(i)) >= n) for (var a = 0, o = t.tests[i].length; a < o; a++) if ((void 0 === t.validPositions[i] || \"-\" === e) && t.tests[i][a].match.def === e) return i + (void 0 !== t.validPositions[i] && \"-\" !== e ? 1 : 0);\n return n;\n }\n function p(e, t) {\n for (var n = -1, i = 0, a = t.validPositions.length; i < a; i++) {\n var r = t.validPositions[i];\n if (r && r.match.def === e) {\n n = i;\n break;\n }\n }\n return n;\n }\n function d(e, t, n, i, a) {\n var r = t.buffer ? t.buffer.indexOf(a.radixPoint) : -1, o = (-1 !== r || i && a.jitMasking) && new RegExp(a.definitions[9].validator).test(e);\n return a._radixDance && -1 !== r && o && null == t.validPositions[r] ? {\n insert: {\n pos: r === n ? r + 1 : r,\n c: a.radixPoint\n },\n pos: n\n } : o;\n }\n i.default.extendAliases({\n numeric: {\n mask: function(e) {\n e.repeat = 0, e.groupSeparator === e.radixPoint && e.digits && \"0\" !== e.digits && (\".\" === e.radixPoint ? e.groupSeparator = \",\" : \",\" === e.radixPoint ? e.groupSeparator = \".\" : e.groupSeparator = \"\"), \n \" \" === e.groupSeparator && (e.skipOptionalPartCharacter = void 0), e.placeholder.length > 1 && (e.placeholder = e.placeholder.charAt(0)), \n \"radixFocus\" === e.positionCaretOnClick && \"\" === e.placeholder && (e.positionCaretOnClick = \"lvp\");\n var t = \"0\", n = e.radixPoint;\n !0 === e.numericInput && void 0 === e.__financeInput ? (t = \"1\", e.positionCaretOnClick = \"radixFocus\" === e.positionCaretOnClick ? \"lvp\" : e.positionCaretOnClick, \n e.digitsOptional = !1, isNaN(e.digits) && (e.digits = 2), e._radixDance = !1, n = \",\" === e.radixPoint ? \"?\" : \"!\", \n \"\" !== e.radixPoint && void 0 === e.definitions[n] && (e.definitions[n] = {}, e.definitions[n].validator = \"[\" + e.radixPoint + \"]\", \n e.definitions[n].placeholder = e.radixPoint, e.definitions[n].static = !0, e.definitions[n].generated = !0)) : (e.__financeInput = !1, \n e.numericInput = !0);\n var i, r = \"[+]\";\n if (r += c(e.prefix, e), \"\" !== e.groupSeparator ? (void 0 === e.definitions[e.groupSeparator] && (e.definitions[e.groupSeparator] = {}, \n e.definitions[e.groupSeparator].validator = \"[\" + e.groupSeparator + \"]\", e.definitions[e.groupSeparator].placeholder = e.groupSeparator, \n e.definitions[e.groupSeparator].static = !0, e.definitions[e.groupSeparator].generated = !0), \n r += e._mask(e)) : r += \"9{+}\", void 0 !== e.digits && 0 !== e.digits) {\n var o = e.digits.toString().split(\",\");\n isFinite(o[0]) && o[1] && isFinite(o[1]) ? r += n + t + \"{\" + e.digits + \"}\" : (isNaN(e.digits) || parseInt(e.digits) > 0) && (e.digitsOptional || e.jitMasking ? (i = r + n + t + \"{0,\" + e.digits + \"}\", \n e.keepStatic = !0) : r += n + t + \"{\" + e.digits + \"}\");\n } else e.inputmode = \"numeric\";\n return r += c(e.suffix, e), r += \"[-]\", i && (r = [ i + c(e.suffix, e) + \"[-]\", r ]), \n e.greedy = !1, function(e) {\n void 0 === e.parseMinMaxOptions && (null !== e.min && (e.min = e.min.toString().replace(new RegExp((0, \n a.default)(e.groupSeparator), \"g\"), \"\"), \",\" === e.radixPoint && (e.min = e.min.replace(e.radixPoint, \".\")), \n e.min = isFinite(e.min) ? parseFloat(e.min) : NaN, isNaN(e.min) && (e.min = Number.MIN_VALUE)), \n null !== e.max && (e.max = e.max.toString().replace(new RegExp((0, a.default)(e.groupSeparator), \"g\"), \"\"), \n \",\" === e.radixPoint && (e.max = e.max.replace(e.radixPoint, \".\")), e.max = isFinite(e.max) ? parseFloat(e.max) : NaN, \n isNaN(e.max) && (e.max = Number.MAX_VALUE)), e.parseMinMaxOptions = \"done\");\n }(e), \"\" !== e.radixPoint && e.substituteRadixPoint && (e.substitutes[\".\" == e.radixPoint ? \",\" : \".\"] = e.radixPoint), \n r;\n },\n _mask: function(e) {\n return \"(\" + e.groupSeparator + \"999){+|1}\";\n },\n digits: \"*\",\n digitsOptional: !0,\n enforceDigitsOnBlur: !1,\n radixPoint: \".\",\n positionCaretOnClick: \"radixFocus\",\n _radixDance: !0,\n groupSeparator: \"\",\n allowMinus: !0,\n negationSymbol: {\n front: \"-\",\n back: \"\"\n },\n prefix: \"\",\n suffix: \"\",\n min: null,\n max: null,\n SetMaxOnOverflow: !1,\n step: 1,\n inputType: \"text\",\n unmaskAsNumber: !1,\n roundingFN: Math.round,\n inputmode: \"decimal\",\n shortcuts: {\n k: \"1000\",\n m: \"1000000\"\n },\n placeholder: \"0\",\n greedy: !1,\n rightAlign: !0,\n insertMode: !0,\n autoUnmask: !1,\n skipOptionalPartCharacter: \"\",\n usePrototypeDefinitions: !1,\n stripLeadingZeroes: !0,\n substituteRadixPoint: !0,\n definitions: {\n 0: {\n validator: d\n },\n 1: {\n validator: d,\n definitionSymbol: \"9\"\n },\n 9: {\n validator: \"[0-9\\uff10-\\uff19\\u0660-\\u0669\\u06f0-\\u06f9]\",\n definitionSymbol: \"*\"\n },\n \"+\": {\n validator: function(e, t, n, i, a) {\n return a.allowMinus && (\"-\" === e || e === a.negationSymbol.front);\n }\n },\n \"-\": {\n validator: function(e, t, n, i, a) {\n return a.allowMinus && e === a.negationSymbol.back;\n }\n }\n },\n preValidation: function(e, t, n, i, a, r, o, l) {\n var s = this;\n if (!1 !== a.__financeInput && n === a.radixPoint) return !1;\n var c = e.indexOf(a.radixPoint), u = t;\n if (t = function(e, t, n, i, a) {\n return a._radixDance && a.numericInput && t !== a.negationSymbol.back && e <= n && (n > 0 || t == a.radixPoint) && (void 0 === i.validPositions[e - 1] || i.validPositions[e - 1].input !== a.negationSymbol.back) && (e -= 1), \n e;\n }(t, n, c, r, a), \"-\" === n || n === a.negationSymbol.front) {\n if (!0 !== a.allowMinus) return !1;\n var d = !1, h = p(\"+\", r), v = p(\"-\", r);\n return -1 !== h && (d = [ h, v ]), !1 !== d ? {\n remove: d,\n caret: u - a.negationSymbol.back.length\n } : {\n insert: [ {\n pos: f.call(s, \"+\", r),\n c: a.negationSymbol.front,\n fromIsValid: !0\n }, {\n pos: f.call(s, \"-\", r),\n c: a.negationSymbol.back,\n fromIsValid: void 0\n } ],\n caret: u + a.negationSymbol.back.length\n };\n }\n if (n === a.groupSeparator) return {\n caret: u\n };\n if (l) return !0;\n if (-1 !== c && !0 === a._radixDance && !1 === i && n === a.radixPoint && void 0 !== a.digits && (isNaN(a.digits) || parseInt(a.digits) > 0) && c !== t) {\n var m = f.call(s, a.radixPoint, r);\n return r.validPositions[m] && (r.validPositions[m].generatedInput = r.validPositions[m].generated || !1), \n {\n caret: a._radixDance && t === c - 1 ? c + 1 : c\n };\n }\n if (!1 === a.__financeInput) if (i) {\n if (a.digitsOptional) return {\n rewritePosition: o.end\n };\n if (!a.digitsOptional) {\n if (o.begin > c && o.end <= c) return n === a.radixPoint ? {\n insert: {\n pos: c + 1,\n c: \"0\",\n fromIsValid: !0\n },\n rewritePosition: c\n } : {\n rewritePosition: c + 1\n };\n if (o.begin < c) return {\n rewritePosition: o.begin - 1\n };\n }\n } else if (!a.showMaskOnHover && !a.showMaskOnFocus && !a.digitsOptional && a.digits > 0 && \"\" === this.__valueGet.call(this.el)) return {\n rewritePosition: c\n };\n return {\n rewritePosition: t\n };\n },\n postValidation: function(e, t, n, i, a, r, o) {\n if (!1 === i) return i;\n if (o) return !0;\n if (null !== a.min || null !== a.max) {\n var l = a.onUnMask(e.slice().reverse().join(\"\"), void 0, s.extend({}, a, {\n unmaskAsNumber: !0\n }));\n if (null !== a.min && l < a.min && (l.toString().length > a.min.toString().length || l < 0)) return !1;\n if (null !== a.max && l > a.max) return !!a.SetMaxOnOverflow && {\n refreshFromBuffer: !0,\n buffer: u(a.max.toString().replace(\".\", a.radixPoint).split(\"\"), a.digits, a).reverse()\n };\n }\n return i;\n },\n onUnMask: function(e, t, n) {\n if (\"\" === t && !0 === n.nullable) return t;\n var i = e.replace(n.prefix, \"\");\n return i = (i = i.replace(n.suffix, \"\")).replace(new RegExp((0, a.default)(n.groupSeparator), \"g\"), \"\"), \n \"\" !== n.placeholder.charAt(0) && (i = i.replace(new RegExp(n.placeholder.charAt(0), \"g\"), \"0\")), \n n.unmaskAsNumber ? (\"\" !== n.radixPoint && -1 !== i.indexOf(n.radixPoint) && (i = i.replace(a.default.call(this, n.radixPoint), \".\")), \n i = (i = i.replace(new RegExp(\"^\" + (0, a.default)(n.negationSymbol.front)), \"-\")).replace(new RegExp((0, \n a.default)(n.negationSymbol.back) + \"$\"), \"\"), Number(i)) : i;\n },\n isComplete: function(e, t) {\n var n = (t.numericInput ? e.slice().reverse() : e).join(\"\");\n return n = (n = (n = (n = (n = n.replace(new RegExp(\"^\" + (0, a.default)(t.negationSymbol.front)), \"-\")).replace(new RegExp((0, \n a.default)(t.negationSymbol.back) + \"$\"), \"\")).replace(t.prefix, \"\")).replace(t.suffix, \"\")).replace(new RegExp((0, \n a.default)(t.groupSeparator) + \"([0-9]{3})\", \"g\"), \"$1\"), \",\" === t.radixPoint && (n = n.replace((0, \n a.default)(t.radixPoint), \".\")), isFinite(n);\n },\n onBeforeMask: function(e, t) {\n var n = t.radixPoint || \",\";\n isFinite(t.digits) && (t.digits = parseInt(t.digits)), \"number\" != typeof e && \"number\" !== t.inputType || \"\" === n || (e = e.toString().replace(\".\", n));\n var i = \"-\" === e.charAt(0) || e.charAt(0) === t.negationSymbol.front, r = e.split(n), o = r[0].replace(/[^\\-0-9]/g, \"\"), l = r.length > 1 ? r[1].replace(/[^0-9]/g, \"\") : \"\", s = r.length > 1;\n e = o + (\"\" !== l ? n + l : l);\n var c = 0;\n if (\"\" !== n && (c = t.digitsOptional ? t.digits < l.length ? t.digits : l.length : t.digits, \n \"\" !== l || !t.digitsOptional)) {\n var f = Math.pow(10, c || 1);\n e = e.replace((0, a.default)(n), \".\"), isNaN(parseFloat(e)) || (e = (t.roundingFN(parseFloat(e) * f) / f).toFixed(c)), \n e = e.toString().replace(\".\", n);\n }\n if (0 === t.digits && -1 !== e.indexOf(n) && (e = e.substring(0, e.indexOf(n))), \n null !== t.min || null !== t.max) {\n var p = e.toString().replace(n, \".\");\n null !== t.min && p < t.min ? e = t.min.toString().replace(\".\", n) : null !== t.max && p > t.max && (e = t.max.toString().replace(\".\", n));\n }\n return i && \"-\" !== e.charAt(0) && (e = \"-\" + e), u(e.toString().split(\"\"), c, t, s).join(\"\");\n },\n onBeforeWrite: function(e, t, n, i) {\n function r(e, t) {\n if (!1 !== i.__financeInput || t) {\n var n = e.indexOf(i.radixPoint);\n -1 !== n && e.splice(n, 1);\n }\n if (\"\" !== i.groupSeparator) for (;-1 !== (n = e.indexOf(i.groupSeparator)); ) e.splice(n, 1);\n return e;\n }\n var o, l;\n if (i.stripLeadingZeroes && (l = function(e, t) {\n var n = new RegExp(\"(^\" + (\"\" !== t.negationSymbol.front ? (0, a.default)(t.negationSymbol.front) + \"?\" : \"\") + (0, \n a.default)(t.prefix) + \")(.*)(\" + (0, a.default)(t.suffix) + (\"\" != t.negationSymbol.back ? (0, \n a.default)(t.negationSymbol.back) + \"?\" : \"\") + \"$)\").exec(e.slice().reverse().join(\"\")), i = n ? n[2] : \"\", r = !1;\n return i && (i = i.split(t.radixPoint.charAt(0))[0], r = new RegExp(\"^[0\" + t.groupSeparator + \"]*\").exec(i)), \n !(!r || !(r[0].length > 1 || r[0].length > 0 && r[0].length < i.length)) && r;\n }(t, i))) for (var c = t.join(\"\").lastIndexOf(l[0].split(\"\").reverse().join(\"\")) - (l[0] == l.input ? 0 : 1), f = l[0] == l.input ? 1 : 0, p = l[0].length - f; p > 0; p--) this.maskset.validPositions.splice(c + p, 1), \n delete t[c + p];\n if (e) switch (e.type) {\n case \"blur\":\n case \"checkval\":\n if (null !== i.min) {\n var d = i.onUnMask(t.slice().reverse().join(\"\"), void 0, s.extend({}, i, {\n unmaskAsNumber: !0\n }));\n if (null !== i.min && d < i.min) return {\n refreshFromBuffer: !0,\n buffer: u(i.min.toString().replace(\".\", i.radixPoint).split(\"\"), i.digits, i).reverse()\n };\n }\n if (t[t.length - 1] === i.negationSymbol.front) {\n var h = new RegExp(\"(^\" + (\"\" != i.negationSymbol.front ? (0, a.default)(i.negationSymbol.front) + \"?\" : \"\") + (0, \n a.default)(i.prefix) + \")(.*)(\" + (0, a.default)(i.suffix) + (\"\" != i.negationSymbol.back ? (0, \n a.default)(i.negationSymbol.back) + \"?\" : \"\") + \"$)\").exec(r(t.slice(), !0).reverse().join(\"\"));\n 0 == (h ? h[2] : \"\") && (o = {\n refreshFromBuffer: !0,\n buffer: [ 0 ]\n });\n } else if (\"\" !== i.radixPoint) {\n t.indexOf(i.radixPoint) === i.suffix.length && (o && o.buffer ? o.buffer.splice(0, 1 + i.suffix.length) : (t.splice(0, 1 + i.suffix.length), \n o = {\n refreshFromBuffer: !0,\n buffer: r(t)\n }));\n }\n if (i.enforceDigitsOnBlur) {\n var v = (o = o || {}) && o.buffer || t.slice().reverse();\n o.refreshFromBuffer = !0, o.buffer = u(v, i.digits, i, !0).reverse();\n }\n }\n return o;\n },\n onKeyDown: function(e, t, n, i) {\n var a, r = s(this);\n if (3 != e.location) {\n var l, c = e.key;\n if ((l = i.shortcuts && i.shortcuts[c]) && l.length > 1) return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) * parseInt(l)), \n r.trigger(\"setvalue\"), !1;\n }\n if (e.ctrlKey) switch (e.key) {\n case o.keys.ArrowUp:\n return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) + parseInt(i.step)), \n r.trigger(\"setvalue\"), !1;\n\n case o.keys.ArrowDown:\n return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) - parseInt(i.step)), \n r.trigger(\"setvalue\"), !1;\n }\n if (!e.shiftKey && (e.key === o.keys.Delete || e.key === o.keys.Backspace || e.key === o.keys.BACKSPACE_SAFARI) && n.begin !== t.length) {\n if (t[e.key === o.keys.Delete ? n.begin - 1 : n.end] === i.negationSymbol.front) return a = t.slice().reverse(), \n \"\" !== i.negationSymbol.front && a.shift(), \"\" !== i.negationSymbol.back && a.pop(), \n r.trigger(\"setvalue\", [ a.join(\"\"), n.begin ]), !1;\n if (!0 === i._radixDance) {\n var f = t.indexOf(i.radixPoint);\n if (i.digitsOptional) {\n if (0 === f) return (a = t.slice().reverse()).pop(), r.trigger(\"setvalue\", [ a.join(\"\"), n.begin >= a.length ? a.length : n.begin ]), \n !1;\n } else if (-1 !== f && (n.begin < f || n.end < f || e.key === o.keys.Delete && (n.begin === f || n.begin - 1 === f))) {\n var p = void 0;\n return n.begin === n.end && (e.key === o.keys.Backspace || e.key === o.keys.BACKSPACE_SAFARI ? n.begin++ : e.key === o.keys.Delete && n.begin - 1 === f && (p = s.extend({}, n), \n n.begin--, n.end--)), (a = t.slice().reverse()).splice(a.length - n.begin, n.begin - n.end + 1), \n a = u(a, i.digits, i).join(\"\"), p && (n = p), r.trigger(\"setvalue\", [ a, n.begin >= a.length ? f + 1 : n.begin ]), \n !1;\n }\n }\n }\n }\n },\n currency: {\n prefix: \"\",\n groupSeparator: \",\",\n alias: \"numeric\",\n digits: 2,\n digitsOptional: !1\n },\n decimal: {\n alias: \"numeric\"\n },\n integer: {\n alias: \"numeric\",\n inputmode: \"numeric\",\n digits: 0\n },\n percentage: {\n alias: \"numeric\",\n min: 0,\n max: 100,\n suffix: \" %\",\n digits: 0,\n allowMinus: !1\n },\n indianns: {\n alias: \"numeric\",\n _mask: function(e) {\n return \"(\" + e.groupSeparator + \"99){*|1}(\" + e.groupSeparator + \"999){1|1}\";\n },\n groupSeparator: \",\",\n radixPoint: \".\",\n placeholder: \"0\",\n digits: 2,\n digitsOptional: !1\n }\n });\n },\n 9380: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var n = !(\"undefined\" == typeof window || !window.document || !window.document.createElement);\n t.default = n ? window : {};\n },\n 7760: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.HandleNativePlaceholder = function(e, t) {\n var n = e ? e.inputmask : this;\n if (l.ie) {\n if (e.inputmask._valueGet() !== t && (e.placeholder !== t || \"\" === e.placeholder)) {\n var i = r.getBuffer.call(n).slice(), a = e.inputmask._valueGet();\n if (a !== t) {\n var o = r.getLastValidPosition.call(n);\n -1 === o && a === r.getBufferTemplate.call(n).join(\"\") ? i = [] : -1 !== o && u.call(n, i), \n p(e, i);\n }\n }\n } else e.placeholder !== t && (e.placeholder = t, \"\" === e.placeholder && e.removeAttribute(\"placeholder\"));\n }, t.applyInputValue = c, t.checkVal = f, t.clearOptionalTail = u, t.unmaskedvalue = function(e) {\n var t = e ? e.inputmask : this, n = t.opts, i = t.maskset;\n if (e) {\n if (void 0 === e.inputmask) return e.value;\n e.inputmask && e.inputmask.refreshValue && c(e, e.inputmask._valueGet(!0));\n }\n for (var a = [], o = i.validPositions, l = 0, s = o.length; l < s; l++) o[l] && o[l].match && (1 != o[l].match.static || Array.isArray(i.metadata) && !0 !== o[l].generatedInput) && a.push(o[l].input);\n var u = 0 === a.length ? \"\" : (t.isRTL ? a.reverse() : a).join(\"\");\n if (\"function\" == typeof n.onUnMask) {\n var f = (t.isRTL ? r.getBuffer.call(t).slice().reverse() : r.getBuffer.call(t)).join(\"\");\n u = n.onUnMask.call(t, f, u, n);\n }\n return u;\n }, t.writeBuffer = p;\n var i = n(2839), a = n(4713), r = n(8711), o = n(7215), l = n(9845), s = n(6030);\n function c(e, t, n) {\n var i = e ? e.inputmask : this, a = i.opts;\n e.inputmask.refreshValue = !1, \"function\" == typeof a.onBeforeMask && (t = a.onBeforeMask.call(i, t, a) || t), \n f(e, !0, !1, t = (t || \"\").toString().split(\"\"), n), i.undoValue = i._valueGet(!0), \n (a.clearMaskOnLostFocus || a.clearIncomplete) && e.inputmask._valueGet() === r.getBufferTemplate.call(i).join(\"\") && -1 === r.getLastValidPosition.call(i) && e.inputmask._valueSet(\"\");\n }\n function u(e) {\n e.length = 0;\n for (var t, n = a.getMaskTemplate.call(this, !0, 0, !0, void 0, !0); void 0 !== (t = n.shift()); ) e.push(t);\n return e;\n }\n function f(e, t, n, i, l) {\n var c = e ? e.inputmask : this, u = c.maskset, f = c.opts, d = c.dependencyLib, h = i.slice(), v = \"\", m = -1, g = void 0, y = f.skipOptionalPartCharacter;\n f.skipOptionalPartCharacter = \"\", r.resetMaskSet.call(c, !1), c.clicked = 0, m = f.radixPoint ? r.determineNewCaretPosition.call(c, {\n begin: 0,\n end: 0\n }, !1, !1 === f.__financeInput ? \"radixFocus\" : void 0).begin : 0, u.p = m, c.caretPos = {\n begin: m\n };\n var k = [], b = c.caretPos;\n if (h.forEach((function(e, t) {\n if (void 0 !== e) {\n var i = new d.Event(\"_checkval\");\n i.key = e, v += e;\n var o = r.getLastValidPosition.call(c, void 0, !0);\n !function(e, t) {\n for (var n = a.getMaskTemplate.call(c, !0, 0).slice(e, r.seekNext.call(c, e, !1, !1)).join(\"\").replace(/'/g, \"\"), i = n.indexOf(t); i > 0 && \" \" === n[i - 1]; ) i--;\n var o = 0 === i && !r.isMask.call(c, e) && (a.getTest.call(c, e).match.nativeDef === t.charAt(0) || !0 === a.getTest.call(c, e).match.static && a.getTest.call(c, e).match.nativeDef === \"'\" + t.charAt(0) || \" \" === a.getTest.call(c, e).match.nativeDef && (a.getTest.call(c, e + 1).match.nativeDef === t.charAt(0) || !0 === a.getTest.call(c, e + 1).match.static && a.getTest.call(c, e + 1).match.nativeDef === \"'\" + t.charAt(0)));\n if (!o && i > 0 && !r.isMask.call(c, e, !1, !0)) {\n var l = r.seekNext.call(c, e);\n c.caretPos.begin < l && (c.caretPos = {\n begin: l\n });\n }\n return o;\n }(m, v) ? (g = s.EventHandlers.keypressEvent.call(c, i, !0, !1, n, c.caretPos.begin)) && (m = c.caretPos.begin + 1, \n v = \"\") : g = s.EventHandlers.keypressEvent.call(c, i, !0, !1, n, o + 1), g ? (void 0 !== g.pos && u.validPositions[g.pos] && !0 === u.validPositions[g.pos].match.static && void 0 === u.validPositions[g.pos].alternation && (k.push(g.pos), \n c.isRTL || (g.forwardPosition = g.pos + 1)), p.call(c, void 0, r.getBuffer.call(c), g.forwardPosition, i, !1), \n c.caretPos = {\n begin: g.forwardPosition,\n end: g.forwardPosition\n }, b = c.caretPos) : void 0 === u.validPositions[t] && h[t] === a.getPlaceholder.call(c, t) && r.isMask.call(c, t, !0) ? c.caretPos.begin++ : c.caretPos = b;\n }\n })), k.length > 0) {\n var x, w, P = r.seekNext.call(c, -1, void 0, !1);\n if (!o.isComplete.call(c, r.getBuffer.call(c)) && k.length <= P || o.isComplete.call(c, r.getBuffer.call(c)) && k.length > 0 && k.length !== P && 0 === k[0]) for (var S = P; void 0 !== (x = k.shift()); ) if (x < S) {\n var O = new d.Event(\"_checkval\");\n if ((w = u.validPositions[x]).generatedInput = !0, O.key = w.input, (g = s.EventHandlers.keypressEvent.call(c, O, !0, !1, n, S)) && void 0 !== g.pos && g.pos !== x && u.validPositions[g.pos] && !0 === u.validPositions[g.pos].match.static) k.push(g.pos); else if (!g) break;\n S++;\n }\n }\n t && p.call(c, e, r.getBuffer.call(c), g ? g.forwardPosition : c.caretPos.begin, l || new d.Event(\"checkval\"), l && (\"input\" === l.type && c.undoValue !== r.getBuffer.call(c).join(\"\") || \"paste\" === l.type)), \n f.skipOptionalPartCharacter = y;\n }\n function p(e, t, n, a, l) {\n var s = e ? e.inputmask : this, c = s.opts, u = s.dependencyLib;\n if (a && \"function\" == typeof c.onBeforeWrite) {\n var f = c.onBeforeWrite.call(s, a, t, n, c);\n if (f) {\n if (f.refreshFromBuffer) {\n var p = f.refreshFromBuffer;\n o.refreshFromBuffer.call(s, !0 === p ? p : p.start, p.end, f.buffer || t), t = r.getBuffer.call(s, !0);\n }\n void 0 !== n && (n = void 0 !== f.caret ? f.caret : n);\n }\n }\n if (void 0 !== e && (e.inputmask._valueSet(t.join(\"\")), void 0 === n || void 0 !== a && \"blur\" === a.type || r.caret.call(s, e, n, void 0, void 0, void 0 !== a && \"keydown\" === a.type && (a.key === i.keys.Delete || a.key === i.keys.Backspace)), \n void 0 === e.inputmask.writeBufferHook || e.inputmask.writeBufferHook(n), !0 === l)) {\n var d = u(e), h = e.inputmask._valueGet();\n e.inputmask.skipInputEvent = !0, d.trigger(\"input\"), setTimeout((function() {\n h === r.getBufferTemplate.call(s).join(\"\") ? d.trigger(\"cleared\") : !0 === o.isComplete.call(s, t) && d.trigger(\"complete\");\n }), 0);\n }\n }\n },\n 2394: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = void 0;\n var i = n(157), a = v(n(4963)), r = v(n(9380)), o = n(2391), l = n(4713), s = n(8711), c = n(7215), u = n(7760), f = n(9716), p = v(n(7392)), d = v(n(3976));\n function h(e) {\n return h = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, h(e);\n }\n function v(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var m = r.default.document, g = \"_inputmask_opts\";\n function y(e, t, n) {\n if (!(this instanceof y)) return new y(e, t, n);\n this.dependencyLib = a.default, this.el = void 0, this.events = {}, this.maskset = void 0, \n !0 !== n && (\"[object Object]\" === Object.prototype.toString.call(e) ? t = e : (t = t || {}, \n e && (t.alias = e)), this.opts = a.default.extend(!0, {}, this.defaults, t), this.noMasksCache = t && void 0 !== t.definitions, \n this.userOptions = t || {}, k(this.opts.alias, t, this.opts)), this.refreshValue = !1, \n this.undoValue = void 0, this.$el = void 0, this.skipInputEvent = !1, this.validationEvent = !1, \n this.ignorable = !1, this.maxLength, this.mouseEnter = !1, this.clicked = 0, this.originalPlaceholder = void 0, \n this.isComposing = !1, this.hasAlternator = !1;\n }\n function k(e, t, n) {\n var i = y.prototype.aliases[e];\n return i ? (i.alias && k(i.alias, void 0, n), a.default.extend(!0, n, i), a.default.extend(!0, n, t), \n !0) : (null === n.mask && (n.mask = e), !1);\n }\n y.prototype = {\n dataAttribute: \"data-inputmask\",\n defaults: d.default,\n definitions: p.default,\n aliases: {},\n masksCache: {},\n i18n: {},\n get isRTL() {\n return this.opts.isRTL || this.opts.numericInput;\n },\n mask: function(e) {\n var t = this;\n return \"string\" == typeof e && (e = m.getElementById(e) || m.querySelectorAll(e)), \n (e = e.nodeName ? [ e ] : Array.isArray(e) ? e : [].slice.call(e)).forEach((function(e, n) {\n var l = a.default.extend(!0, {}, t.opts);\n if (function(e, t, n, i) {\n function o(t, a) {\n var o = \"\" === i ? t : i + \"-\" + t;\n null !== (a = void 0 !== a ? a : e.getAttribute(o)) && (\"string\" == typeof a && (0 === t.indexOf(\"on\") ? a = r.default[a] : \"false\" === a ? a = !1 : \"true\" === a && (a = !0)), \n n[t] = a);\n }\n if (!0 === t.importDataAttributes) {\n var l, s, c, u, f = e.getAttribute(i);\n if (f && \"\" !== f && (f = f.replace(/'/g, '\"'), s = JSON.parse(\"{\" + f + \"}\")), \n s) for (u in c = void 0, s) if (\"alias\" === u.toLowerCase()) {\n c = s[u];\n break;\n }\n for (l in o(\"alias\", c), n.alias && k(n.alias, n, t), t) {\n if (s) for (u in c = void 0, s) if (u.toLowerCase() === l.toLowerCase()) {\n c = s[u];\n break;\n }\n o(l, c);\n }\n }\n a.default.extend(!0, t, n), (\"rtl\" === e.dir || t.rightAlign) && (e.style.textAlign = \"right\");\n (\"rtl\" === e.dir || t.numericInput) && (e.dir = \"ltr\", e.removeAttribute(\"dir\"), \n t.isRTL = !0);\n return Object.keys(n).length;\n }(e, l, a.default.extend(!0, {}, t.userOptions), t.dataAttribute)) {\n var s = (0, o.generateMaskSet)(l, t.noMasksCache);\n void 0 !== s && (void 0 !== e.inputmask && (e.inputmask.opts.autoUnmask = !0, e.inputmask.remove()), \n e.inputmask = new y(void 0, void 0, !0), e.inputmask.opts = l, e.inputmask.noMasksCache = t.noMasksCache, \n e.inputmask.userOptions = a.default.extend(!0, {}, t.userOptions), e.inputmask.el = e, \n e.inputmask.$el = (0, a.default)(e), e.inputmask.maskset = s, a.default.data(e, g, t.userOptions), \n i.mask.call(e.inputmask));\n }\n })), e && e[0] && e[0].inputmask || this;\n },\n option: function(e, t) {\n return \"string\" == typeof e ? this.opts[e] : \"object\" === h(e) ? (a.default.extend(this.userOptions, e), \n this.el && !0 !== t && this.mask(this.el), this) : void 0;\n },\n unmaskedvalue: function(e) {\n if (this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n void 0 === this.el || void 0 !== e) {\n var t = (\"function\" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, e, this.opts) || e).split(\"\");\n u.checkVal.call(this, void 0, !1, !1, t), \"function\" == typeof this.opts.onBeforeWrite && this.opts.onBeforeWrite.call(this, void 0, s.getBuffer.call(this), 0, this.opts);\n }\n return u.unmaskedvalue.call(this, this.el);\n },\n remove: function() {\n if (this.el) {\n a.default.data(this.el, g, null);\n var e = this.opts.autoUnmask ? (0, u.unmaskedvalue)(this.el) : this._valueGet(this.opts.autoUnmask);\n e !== s.getBufferTemplate.call(this).join(\"\") ? this._valueSet(e, this.opts.autoUnmask) : this._valueSet(\"\"), \n f.EventRuler.off(this.el), Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.el), \"value\") && this.__valueGet && Object.defineProperty(this.el, \"value\", {\n get: this.__valueGet,\n set: this.__valueSet,\n configurable: !0\n }) : m.__lookupGetter__ && this.el.__lookupGetter__(\"value\") && this.__valueGet && (this.el.__defineGetter__(\"value\", this.__valueGet), \n this.el.__defineSetter__(\"value\", this.__valueSet)), this.el.inputmask = void 0;\n }\n return this.el;\n },\n getemptymask: function() {\n return this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n (this.isRTL ? s.getBufferTemplate.call(this).reverse() : s.getBufferTemplate.call(this)).join(\"\");\n },\n hasMaskedValue: function() {\n return !this.opts.autoUnmask;\n },\n isComplete: function() {\n return this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n c.isComplete.call(this, s.getBuffer.call(this));\n },\n getmetadata: function() {\n if (this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n Array.isArray(this.maskset.metadata)) {\n var e = l.getMaskTemplate.call(this, !0, 0, !1).join(\"\");\n return this.maskset.metadata.forEach((function(t) {\n return t.mask !== e || (e = t, !1);\n })), e;\n }\n return this.maskset.metadata;\n },\n isValid: function(e) {\n if (this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache), \n e) {\n var t = (\"function\" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, e, this.opts) || e).split(\"\");\n u.checkVal.call(this, void 0, !0, !1, t);\n } else e = this.isRTL ? s.getBuffer.call(this).slice().reverse().join(\"\") : s.getBuffer.call(this).join(\"\");\n for (var n = s.getBuffer.call(this), i = s.determineLastRequiredPosition.call(this), a = n.length - 1; a > i && !s.isMask.call(this, a); a--) ;\n return n.splice(i, a + 1 - i), c.isComplete.call(this, n) && e === (this.isRTL ? s.getBuffer.call(this).slice().reverse().join(\"\") : s.getBuffer.call(this).join(\"\"));\n },\n format: function(e, t) {\n this.maskset = this.maskset || (0, o.generateMaskSet)(this.opts, this.noMasksCache);\n var n = (\"function\" == typeof this.opts.onBeforeMask && this.opts.onBeforeMask.call(this, e, this.opts) || e).split(\"\");\n u.checkVal.call(this, void 0, !0, !1, n);\n var i = this.isRTL ? s.getBuffer.call(this).slice().reverse().join(\"\") : s.getBuffer.call(this).join(\"\");\n return t ? {\n value: i,\n metadata: this.getmetadata()\n } : i;\n },\n setValue: function(e) {\n this.el && (0, a.default)(this.el).trigger(\"setvalue\", [ e ]);\n },\n analyseMask: o.analyseMask\n }, y.extendDefaults = function(e) {\n a.default.extend(!0, y.prototype.defaults, e);\n }, y.extendDefinitions = function(e) {\n a.default.extend(!0, y.prototype.definitions, e);\n }, y.extendAliases = function(e) {\n a.default.extend(!0, y.prototype.aliases, e);\n }, y.format = function(e, t, n) {\n return y(t).format(e, n);\n }, y.unmask = function(e, t) {\n return y(t).unmaskedvalue(e);\n }, y.isValid = function(e, t) {\n return y(t).isValid(e);\n }, y.remove = function(e) {\n \"string\" == typeof e && (e = m.getElementById(e) || m.querySelectorAll(e)), (e = e.nodeName ? [ e ] : e).forEach((function(e) {\n e.inputmask && e.inputmask.remove();\n }));\n }, y.setValue = function(e, t) {\n \"string\" == typeof e && (e = m.getElementById(e) || m.querySelectorAll(e)), (e = e.nodeName ? [ e ] : e).forEach((function(e) {\n e.inputmask ? e.inputmask.setValue(t) : (0, a.default)(e).trigger(\"setvalue\", [ t ]);\n }));\n }, y.dependencyLib = a.default, r.default.Inputmask = y;\n t.default = y;\n },\n 5296: function(e, t, n) {\n function i(e) {\n return i = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, i(e);\n }\n var a = d(n(9380)), r = d(n(2394));\n function o(e, t) {\n for (var n = 0; n < t.length; n++) {\n var a = t[n];\n a.enumerable = a.enumerable || !1, a.configurable = !0, \"value\" in a && (a.writable = !0), \n Object.defineProperty(e, (r = a.key, o = void 0, o = function(e, t) {\n if (\"object\" !== i(e) || null === e) return e;\n var n = e[Symbol.toPrimitive];\n if (void 0 !== n) {\n var a = n.call(e, t || \"default\");\n if (\"object\" !== i(a)) return a;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(r, \"string\"), \"symbol\" === i(o) ? o : String(o)), a);\n }\n var r, o;\n }\n function l(e) {\n var t = u();\n return function() {\n var n, a = p(e);\n if (t) {\n var r = p(this).constructor;\n n = Reflect.construct(a, arguments, r);\n } else n = a.apply(this, arguments);\n return function(e, t) {\n if (t && (\"object\" === i(t) || \"function\" == typeof t)) return t;\n if (void 0 !== t) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return function(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n }(e);\n }(this, n);\n };\n }\n function s(e) {\n var t = \"function\" == typeof Map ? new Map : void 0;\n return s = function(e) {\n if (null === e || !function(e) {\n try {\n return -1 !== Function.toString.call(e).indexOf(\"[native code]\");\n } catch (t) {\n return \"function\" == typeof e;\n }\n }(e)) return e;\n if (\"function\" != typeof e) throw new TypeError(\"Super expression must either be null or a function\");\n if (void 0 !== t) {\n if (t.has(e)) return t.get(e);\n t.set(e, n);\n }\n function n() {\n return c(e, arguments, p(this).constructor);\n }\n return n.prototype = Object.create(e.prototype, {\n constructor: {\n value: n,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), f(n, e);\n }, s(e);\n }\n function c(e, t, n) {\n return c = u() ? Reflect.construct.bind() : function(e, t, n) {\n var i = [ null ];\n i.push.apply(i, t);\n var a = new (Function.bind.apply(e, i));\n return n && f(a, n.prototype), a;\n }, c.apply(null, arguments);\n }\n function u() {\n if (\"undefined\" == typeof Reflect || !Reflect.construct) return !1;\n if (Reflect.construct.sham) return !1;\n if (\"function\" == typeof Proxy) return !0;\n try {\n return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), \n !0;\n } catch (e) {\n return !1;\n }\n }\n function f(e, t) {\n return f = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {\n return e.__proto__ = t, e;\n }, f(e, t);\n }\n function p(e) {\n return p = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {\n return e.__proto__ || Object.getPrototypeOf(e);\n }, p(e);\n }\n function d(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n var h = a.default.document;\n if (h && h.head && h.head.attachShadow && a.default.customElements && void 0 === a.default.customElements.get(\"input-mask\")) {\n var v = function(e) {\n !function(e, t) {\n if (\"function\" != typeof t && null !== t) throw new TypeError(\"Super expression must either be null or a function\");\n e.prototype = Object.create(t && t.prototype, {\n constructor: {\n value: e,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), t && f(e, t);\n }(s, e);\n var t, n, i, a = l(s);\n function s() {\n var e;\n !function(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, s);\n var t = (e = a.call(this)).getAttributeNames(), n = e.attachShadow({\n mode: \"closed\"\n });\n for (var i in e.input = h.createElement(\"input\"), e.input.type = \"text\", n.appendChild(e.input), \n t) Object.prototype.hasOwnProperty.call(t, i) && e.input.setAttribute(t[i], e.getAttribute(t[i]));\n var o = new r.default;\n return o.dataAttribute = \"\", o.mask(e.input), e.input.inputmask.shadowRoot = n, \n e;\n }\n return t = s, (n = [ {\n key: \"attributeChangedCallback\",\n value: function(e, t, n) {\n this.input.setAttribute(e, n);\n }\n }, {\n key: \"value\",\n get: function() {\n return this.input.value;\n },\n set: function(e) {\n this.input.value = e;\n }\n } ]) && o(t.prototype, n), i && o(t, i), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), s;\n }(s(HTMLElement));\n a.default.customElements.define(\"input-mask\", v);\n }\n },\n 2839: function(e, t) {\n function n(e) {\n return n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, n(e);\n }\n function i(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return a(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return a(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n function a(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function r(e, t) {\n var n = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var i = Object.getOwnPropertySymbols(e);\n t && (i = i.filter((function(t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n }))), n.push.apply(n, i);\n }\n return n;\n }\n function o(e, t, i) {\n return (t = function(e) {\n var t = function(e, t) {\n if (\"object\" !== n(e) || null === e) return e;\n var i = e[Symbol.toPrimitive];\n if (void 0 !== i) {\n var a = i.call(e, t || \"default\");\n if (\"object\" !== n(a)) return a;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(e, \"string\");\n return \"symbol\" === n(t) ? t : String(t);\n }(t)) in e ? Object.defineProperty(e, t, {\n value: i,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = i, e;\n }\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.keys = t.keyCode = void 0, t.toKey = function(e, t) {\n return s[e] || (t ? String.fromCharCode(e) : String.fromCharCode(e).toLowerCase());\n }, t.toKeyCode = function(e) {\n return l[e];\n };\n var l = t.keyCode = function(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? r(Object(n), !0).forEach((function(t) {\n o(e, t, n[t]);\n })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : r(Object(n)).forEach((function(t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n }));\n }\n return e;\n }({\n c: 67,\n x: 88,\n z: 90,\n BACKSPACE_SAFARI: 127,\n Enter: 13,\n Meta_LEFT: 91,\n Meta_RIGHT: 92,\n Space: 32\n }, {\n Alt: 18,\n AltGraph: 18,\n ArrowDown: 40,\n ArrowLeft: 37,\n ArrowRight: 39,\n ArrowUp: 38,\n Backspace: 8,\n CapsLock: 20,\n Control: 17,\n ContextMenu: 93,\n Dead: 221,\n Delete: 46,\n End: 35,\n Escape: 27,\n F1: 112,\n F2: 113,\n F3: 114,\n F4: 115,\n F5: 116,\n F6: 117,\n F7: 118,\n F8: 119,\n F9: 120,\n F10: 121,\n F11: 122,\n F12: 123,\n Home: 36,\n Insert: 45,\n NumLock: 144,\n PageDown: 34,\n PageUp: 33,\n Pause: 19,\n PrintScreen: 44,\n Process: 229,\n Shift: 16,\n ScrollLock: 145,\n Tab: 9,\n Unidentified: 229\n }), s = Object.entries(l).reduce((function(e, t) {\n var n = i(t, 2), a = n[0], r = n[1];\n return e[r] = void 0 === e[r] ? a : e[r], e;\n }), {});\n t.keys = Object.entries(l).reduce((function(e, t) {\n var n = i(t, 2), a = n[0];\n n[1];\n return e[a] = \"Space\" === a ? \" \" : a, e;\n }), {});\n },\n 2391: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.analyseMask = function(e, t, n) {\n var i, o, s, c, u, f, p = /(?:[?*+]|\\{[0-9+*]+(?:,[0-9+*]*)?(?:\\|[0-9+*]*)?\\})|[^.?*+^${[]()|\\\\]+|./g, d = /\\[\\^?]?(?:[^\\\\\\]]+|\\\\[\\S\\s]?)*]?|\\\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\\S\\s]?)|\\((?:\\?[:=!]?)?|(?:[?*+]|\\{[0-9]+(?:,[0-9]*)?\\})\\??|[^.?*+^${[()|\\\\]+|./g, h = !1, v = new a.default, m = [], g = [], y = !1;\n function k(e, i, a) {\n a = void 0 !== a ? a : e.matches.length;\n var o = e.matches[a - 1];\n if (t) {\n if (0 === i.indexOf(\"[\") || h && /\\\\d|\\\\s|\\\\w|\\\\p/i.test(i) || \".\" === i) {\n var s = n.casing ? \"i\" : \"\";\n /\\\\p\\{.*}/i.test(i) && (s += \"u\"), e.matches.splice(a++, 0, {\n fn: new RegExp(i, s),\n static: !1,\n optionality: !1,\n newBlockMarker: void 0 === o ? \"master\" : o.def !== i,\n casing: null,\n def: i,\n placeholder: \"object\" === l(n.placeholder) ? n.placeholder[v.matches.length] : void 0,\n nativeDef: i\n });\n } else h && (i = i[i.length - 1]), i.split(\"\").forEach((function(t, i) {\n o = e.matches[a - 1], e.matches.splice(a++, 0, {\n fn: /[a-z]/i.test(n.staticDefinitionSymbol || t) ? new RegExp(\"[\" + (n.staticDefinitionSymbol || t) + \"]\", n.casing ? \"i\" : \"\") : null,\n static: !0,\n optionality: !1,\n newBlockMarker: void 0 === o ? \"master\" : o.def !== t && !0 !== o.static,\n casing: null,\n def: n.staticDefinitionSymbol || t,\n placeholder: void 0 !== n.staticDefinitionSymbol ? t : \"object\" === l(n.placeholder) ? n.placeholder[v.matches.length] : void 0,\n nativeDef: (h ? \"'\" : \"\") + t\n });\n }));\n h = !1;\n } else {\n var c = n.definitions && n.definitions[i] || n.usePrototypeDefinitions && r.default.prototype.definitions[i];\n c && !h ? e.matches.splice(a++, 0, {\n fn: c.validator ? \"string\" == typeof c.validator ? new RegExp(c.validator, n.casing ? \"i\" : \"\") : new function() {\n this.test = c.validator;\n } : new RegExp(\".\"),\n static: c.static || !1,\n optionality: c.optional || !1,\n defOptionality: c.optional || !1,\n newBlockMarker: void 0 === o || c.optional ? \"master\" : o.def !== (c.definitionSymbol || i),\n casing: c.casing,\n def: c.definitionSymbol || i,\n placeholder: c.placeholder,\n nativeDef: i,\n generated: c.generated\n }) : (e.matches.splice(a++, 0, {\n fn: /[a-z]/i.test(n.staticDefinitionSymbol || i) ? new RegExp(\"[\" + (n.staticDefinitionSymbol || i) + \"]\", n.casing ? \"i\" : \"\") : null,\n static: !0,\n optionality: !1,\n newBlockMarker: void 0 === o ? \"master\" : o.def !== i && !0 !== o.static,\n casing: null,\n def: n.staticDefinitionSymbol || i,\n placeholder: void 0 !== n.staticDefinitionSymbol ? i : void 0,\n nativeDef: (h ? \"'\" : \"\") + i\n }), h = !1);\n }\n }\n function b() {\n if (m.length > 0) {\n if (k(c = m[m.length - 1], o), c.isAlternator) {\n u = m.pop();\n for (var e = 0; e < u.matches.length; e++) u.matches[e].isGroup && (u.matches[e].isGroup = !1);\n m.length > 0 ? (c = m[m.length - 1]).matches.push(u) : v.matches.push(u);\n }\n } else k(v, o);\n }\n function x(e) {\n var t = new a.default(!0);\n return t.openGroup = !1, t.matches = e, t;\n }\n function w() {\n if ((s = m.pop()).openGroup = !1, void 0 !== s) if (m.length > 0) {\n if ((c = m[m.length - 1]).matches.push(s), c.isAlternator) {\n u = m.pop();\n for (var e = 0; e < u.matches.length; e++) u.matches[e].isGroup = !1, u.matches[e].alternatorGroup = !1;\n m.length > 0 ? (c = m[m.length - 1]).matches.push(u) : v.matches.push(u);\n }\n } else v.matches.push(s); else b();\n }\n function P(e) {\n var t = e.pop();\n return t.isQuantifier && (t = x([ e.pop(), t ])), t;\n }\n t && (n.optionalmarker[0] = void 0, n.optionalmarker[1] = void 0);\n for (;i = t ? d.exec(e) : p.exec(e); ) {\n if (o = i[0], t) {\n switch (o.charAt(0)) {\n case \"?\":\n o = \"{0,1}\";\n break;\n\n case \"+\":\n case \"*\":\n o = \"{\" + o + \"}\";\n break;\n\n case \"|\":\n if (0 === m.length) {\n var S = x(v.matches);\n S.openGroup = !0, m.push(S), v.matches = [], y = !0;\n }\n }\n switch (o) {\n case \"\\\\d\":\n o = \"[0-9]\";\n break;\n\n case \"\\\\p\":\n o += d.exec(e)[0], o += d.exec(e)[0];\n }\n }\n if (h) b(); else switch (o.charAt(0)) {\n case \"$\":\n case \"^\":\n t || b();\n break;\n\n case n.escapeChar:\n h = !0, t && b();\n break;\n\n case n.optionalmarker[1]:\n case n.groupmarker[1]:\n w();\n break;\n\n case n.optionalmarker[0]:\n m.push(new a.default(!1, !0));\n break;\n\n case n.groupmarker[0]:\n m.push(new a.default(!0));\n break;\n\n case n.quantifiermarker[0]:\n var O = new a.default(!1, !1, !0), _ = (o = o.replace(/[{}?]/g, \"\")).split(\"|\"), M = _[0].split(\",\"), E = isNaN(M[0]) ? M[0] : parseInt(M[0]), j = 1 === M.length ? E : isNaN(M[1]) ? M[1] : parseInt(M[1]), T = isNaN(_[1]) ? _[1] : parseInt(_[1]);\n \"*\" !== E && \"+\" !== E || (E = \"*\" === j ? 0 : 1), O.quantifier = {\n min: E,\n max: j,\n jit: T\n };\n var A = m.length > 0 ? m[m.length - 1].matches : v.matches;\n (i = A.pop()).isGroup || (i = x([ i ])), A.push(i), A.push(O);\n break;\n\n case n.alternatormarker:\n if (m.length > 0) {\n var D = (c = m[m.length - 1]).matches[c.matches.length - 1];\n f = c.openGroup && (void 0 === D.matches || !1 === D.isGroup && !1 === D.isAlternator) ? m.pop() : P(c.matches);\n } else f = P(v.matches);\n if (f.isAlternator) m.push(f); else if (f.alternatorGroup ? (u = m.pop(), f.alternatorGroup = !1) : u = new a.default(!1, !1, !1, !0), \n u.matches.push(f), m.push(u), f.openGroup) {\n f.openGroup = !1;\n var L = new a.default(!0);\n L.alternatorGroup = !0, m.push(L);\n }\n break;\n\n default:\n b();\n }\n }\n y && w();\n for (;m.length > 0; ) s = m.pop(), v.matches.push(s);\n v.matches.length > 0 && (!function e(i) {\n i && i.matches && i.matches.forEach((function(a, r) {\n var o = i.matches[r + 1];\n (void 0 === o || void 0 === o.matches || !1 === o.isQuantifier) && a && a.isGroup && (a.isGroup = !1, \n t || (k(a, n.groupmarker[0], 0), !0 !== a.openGroup && k(a, n.groupmarker[1]))), \n e(a);\n }));\n }(v), g.push(v));\n (n.numericInput || n.isRTL) && function e(t) {\n for (var i in t.matches = t.matches.reverse(), t.matches) if (Object.prototype.hasOwnProperty.call(t.matches, i)) {\n var a = parseInt(i);\n if (t.matches[i].isQuantifier && t.matches[a + 1] && t.matches[a + 1].isGroup) {\n var r = t.matches[i];\n t.matches.splice(i, 1), t.matches.splice(a + 1, 0, r);\n }\n void 0 !== t.matches[i].matches ? t.matches[i] = e(t.matches[i]) : t.matches[i] = ((o = t.matches[i]) === n.optionalmarker[0] ? o = n.optionalmarker[1] : o === n.optionalmarker[1] ? o = n.optionalmarker[0] : o === n.groupmarker[0] ? o = n.groupmarker[1] : o === n.groupmarker[1] && (o = n.groupmarker[0]), \n o);\n }\n var o;\n return t;\n }(g[0]);\n return g;\n }, t.generateMaskSet = function(e, t) {\n var n;\n function a(e, t) {\n var n = t.repeat, i = t.groupmarker, a = t.quantifiermarker, r = t.keepStatic;\n if (n > 0 || \"*\" === n || \"+\" === n) {\n var l = \"*\" === n ? 0 : \"+\" === n ? 1 : n;\n if (l != n) e = i[0] + e + i[1] + a[0] + l + \",\" + n + a[1]; else for (var c = e, u = 1; u < l; u++) e += c;\n }\n if (!0 === r) {\n var f = e.match(new RegExp(\"(.)\\\\[([^\\\\]]*)\\\\]\", \"g\"));\n f && f.forEach((function(t, n) {\n var i = function(e, t) {\n return function(e) {\n if (Array.isArray(e)) return e;\n }(e) || function(e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null != n) {\n var i, a, r, o, l = [], s = !0, c = !1;\n try {\n if (r = (n = n.call(e)).next, 0 === t) {\n if (Object(n) !== n) return;\n s = !1;\n } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ;\n } catch (e) {\n c = !0, a = e;\n } finally {\n try {\n if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return;\n } finally {\n if (c) throw a;\n }\n }\n return l;\n }\n }(e, t) || function(e, t) {\n if (!e) return;\n if (\"string\" == typeof e) return s(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n \"Object\" === n && e.constructor && (n = e.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(e);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return s(e, t);\n }(e, t) || function() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }(t.split(\"[\"), 2), a = i[0], r = i[1];\n r = r.replace(\"]\", \"\"), e = e.replace(new RegExp(\"\".concat((0, o.default)(a), \"\\\\[\").concat((0, \n o.default)(r), \"\\\\]\")), a.charAt(0) === r.charAt(0) ? \"(\".concat(a, \"|\").concat(a).concat(r, \")\") : \"\".concat(a, \"[\").concat(r, \"]\"));\n }));\n }\n return e;\n }\n function c(e, n, o) {\n var s, c, u = !1;\n return null !== e && \"\" !== e || ((u = null !== o.regex) ? e = (e = o.regex).replace(/^(\\^)(.*)(\\$)$/, \"$2\") : (u = !0, \n e = \".*\")), 1 === e.length && !1 === o.greedy && 0 !== o.repeat && (o.placeholder = \"\"), \n e = a(e, o), c = u ? \"regex_\" + o.regex : o.numericInput ? e.split(\"\").reverse().join(\"\") : e, \n null !== o.keepStatic && (c = \"ks_\" + o.keepStatic + c), \"object\" === l(o.placeholder) && (c = \"ph_\" + JSON.stringify(o.placeholder) + c), \n void 0 === r.default.prototype.masksCache[c] || !0 === t ? (s = {\n mask: e,\n maskToken: r.default.prototype.analyseMask(e, u, o),\n validPositions: [],\n _buffer: void 0,\n buffer: void 0,\n tests: {},\n excludes: {},\n metadata: n,\n maskLength: void 0,\n jitOffset: {}\n }, !0 !== t && (r.default.prototype.masksCache[c] = s, s = i.default.extend(!0, {}, r.default.prototype.masksCache[c]))) : s = i.default.extend(!0, {}, r.default.prototype.masksCache[c]), \n s;\n }\n \"function\" == typeof e.mask && (e.mask = e.mask(e));\n if (Array.isArray(e.mask)) {\n if (e.mask.length > 1) {\n null === e.keepStatic && (e.keepStatic = !0);\n var u = e.groupmarker[0];\n return (e.isRTL ? e.mask.reverse() : e.mask).forEach((function(t) {\n u.length > 1 && (u += e.alternatormarker), void 0 !== t.mask && \"function\" != typeof t.mask ? u += t.mask : u += t;\n })), c(u += e.groupmarker[1], e.mask, e);\n }\n e.mask = e.mask.pop();\n }\n n = e.mask && void 0 !== e.mask.mask && \"function\" != typeof e.mask.mask ? c(e.mask.mask, e.mask, e) : c(e.mask, e.mask, e);\n null === e.keepStatic && (e.keepStatic = !1);\n return n;\n };\n var i = c(n(4963)), a = c(n(9695)), r = c(n(2394)), o = c(n(7184));\n function l(e) {\n return l = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, l(e);\n }\n function s(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n }\n function c(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n },\n 157: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.mask = function() {\n var e = this, t = this.opts, n = this.el, c = this.dependencyLib;\n r.EventRuler.off(n);\n var u = function(t, n) {\n var o = t.getAttribute(\"type\"), l = \"input\" === t.tagName.toLowerCase() && n.supportsInputType.includes(o) || t.isContentEditable || \"textarea\" === t.tagName.toLowerCase();\n if (!l) if (\"input\" === t.tagName.toLowerCase()) {\n var s = document.createElement(\"input\");\n s.setAttribute(\"type\", o), l = \"text\" === s.type, s = null;\n } else l = \"partial\";\n return !1 !== l ? function(t) {\n var o, l;\n function s() {\n return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : -1 !== i.getLastValidPosition.call(e) || !0 !== n.nullable ? (this.inputmask.shadowRoot || this.ownerDocument).activeElement === this && n.clearMaskOnLostFocus ? (e.isRTL ? a.clearOptionalTail.call(e, i.getBuffer.call(e).slice()).reverse() : a.clearOptionalTail.call(e, i.getBuffer.call(e).slice())).join(\"\") : o.call(this) : \"\" : o.call(this);\n }\n function u(e) {\n l.call(this, e), this.inputmask && (0, a.applyInputValue)(this, e);\n }\n if (!t.inputmask.__valueGet) {\n if (!0 !== n.noValuePatching) {\n if (Object.getOwnPropertyDescriptor) {\n var f = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t), \"value\") : void 0;\n f && f.get && f.set ? (o = f.get, l = f.set, Object.defineProperty(t, \"value\", {\n get: s,\n set: u,\n configurable: !0\n })) : \"input\" !== t.tagName.toLowerCase() && (o = function() {\n return this.textContent;\n }, l = function(e) {\n this.textContent = e;\n }, Object.defineProperty(t, \"value\", {\n get: s,\n set: u,\n configurable: !0\n }));\n } else document.__lookupGetter__ && t.__lookupGetter__(\"value\") && (o = t.__lookupGetter__(\"value\"), \n l = t.__lookupSetter__(\"value\"), t.__defineGetter__(\"value\", s), t.__defineSetter__(\"value\", u));\n t.inputmask.__valueGet = o, t.inputmask.__valueSet = l;\n }\n t.inputmask._valueGet = function(t) {\n return e.isRTL && !0 !== t ? o.call(this.el).split(\"\").reverse().join(\"\") : o.call(this.el);\n }, t.inputmask._valueSet = function(t, n) {\n l.call(this.el, null == t ? \"\" : !0 !== n && e.isRTL ? t.split(\"\").reverse().join(\"\") : t);\n }, void 0 === o && (o = function() {\n return this.value;\n }, l = function(e) {\n this.value = e;\n }, function(t) {\n if (c.valHooks && (void 0 === c.valHooks[t] || !0 !== c.valHooks[t].inputmaskpatch)) {\n var r = c.valHooks[t] && c.valHooks[t].get ? c.valHooks[t].get : function(e) {\n return e.value;\n }, o = c.valHooks[t] && c.valHooks[t].set ? c.valHooks[t].set : function(e, t) {\n return e.value = t, e;\n };\n c.valHooks[t] = {\n get: function(t) {\n if (t.inputmask) {\n if (t.inputmask.opts.autoUnmask) return t.inputmask.unmaskedvalue();\n var a = r(t);\n return -1 !== i.getLastValidPosition.call(e, void 0, void 0, t.inputmask.maskset.validPositions) || !0 !== n.nullable ? a : \"\";\n }\n return r(t);\n },\n set: function(e, t) {\n var n = o(e, t);\n return e.inputmask && (0, a.applyInputValue)(e, t), n;\n },\n inputmaskpatch: !0\n };\n }\n }(t.type), function(e) {\n r.EventRuler.on(e, \"mouseenter\", (function() {\n var e = this, t = e.inputmask._valueGet(!0);\n t != (e.inputmask.isRTL ? i.getBuffer.call(e.inputmask).slice().reverse() : i.getBuffer.call(e.inputmask)).join(\"\") && (0, \n a.applyInputValue)(e, t);\n }));\n }(t));\n }\n }(t) : t.inputmask = void 0, l;\n }(n, t);\n if (!1 !== u) {\n e.originalPlaceholder = n.placeholder, e.maxLength = void 0 !== n ? n.maxLength : void 0, \n -1 === e.maxLength && (e.maxLength = void 0), \"inputMode\" in n && null === n.getAttribute(\"inputmode\") && (n.inputMode = t.inputmode, \n n.setAttribute(\"inputmode\", t.inputmode)), !0 === u && (t.showMaskOnFocus = t.showMaskOnFocus && -1 === [ \"cc-number\", \"cc-exp\" ].indexOf(n.autocomplete), \n o.iphone && (t.insertModeVisual = !1, n.setAttribute(\"autocorrect\", \"off\")), r.EventRuler.on(n, \"submit\", s.EventHandlers.submitEvent), \n r.EventRuler.on(n, \"reset\", s.EventHandlers.resetEvent), r.EventRuler.on(n, \"blur\", s.EventHandlers.blurEvent), \n r.EventRuler.on(n, \"focus\", s.EventHandlers.focusEvent), r.EventRuler.on(n, \"invalid\", s.EventHandlers.invalidEvent), \n r.EventRuler.on(n, \"click\", s.EventHandlers.clickEvent), r.EventRuler.on(n, \"mouseleave\", s.EventHandlers.mouseleaveEvent), \n r.EventRuler.on(n, \"mouseenter\", s.EventHandlers.mouseenterEvent), r.EventRuler.on(n, \"paste\", s.EventHandlers.pasteEvent), \n r.EventRuler.on(n, \"cut\", s.EventHandlers.cutEvent), r.EventRuler.on(n, \"complete\", t.oncomplete), \n r.EventRuler.on(n, \"incomplete\", t.onincomplete), r.EventRuler.on(n, \"cleared\", t.oncleared), \n !0 !== t.inputEventOnly && r.EventRuler.on(n, \"keydown\", s.EventHandlers.keyEvent), \n (o.mobile || t.inputEventOnly) && n.removeAttribute(\"maxLength\"), r.EventRuler.on(n, \"input\", s.EventHandlers.inputFallBackEvent)), \n r.EventRuler.on(n, \"setvalue\", s.EventHandlers.setValueEvent), void 0 === e.applyMaskHook || e.applyMaskHook.call(e), \n i.getBufferTemplate.call(e).join(\"\"), e.undoValue = e._valueGet(!0);\n var f = (n.inputmask.shadowRoot || n.ownerDocument).activeElement;\n if (\"\" !== n.inputmask._valueGet(!0) || !1 === t.clearMaskOnLostFocus || f === n) {\n (0, a.applyInputValue)(n, n.inputmask._valueGet(!0), t);\n var p = i.getBuffer.call(e).slice();\n !1 === l.isComplete.call(e, p) && t.clearIncomplete && i.resetMaskSet.call(e, !1), \n t.clearMaskOnLostFocus && f !== n && (-1 === i.getLastValidPosition.call(e) ? p = [] : a.clearOptionalTail.call(e, p)), \n (!1 === t.clearMaskOnLostFocus || t.showMaskOnFocus && f === n || \"\" !== n.inputmask._valueGet(!0)) && (0, \n a.writeBuffer)(n, p), f === n && i.caret.call(e, n, i.seekNext.call(e, i.getLastValidPosition.call(e)));\n }\n }\n };\n n(2839);\n var i = n(8711), a = n(7760), r = n(9716), o = n(9845), l = n(7215), s = n(6030);\n },\n 9695: function(e, t) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.default = function(e, t, n, i) {\n this.matches = [], this.openGroup = e || !1, this.alternatorGroup = !1, this.isGroup = e || !1, \n this.isOptional = t || !1, this.isQuantifier = n || !1, this.isAlternator = i || !1, \n this.quantifier = {\n min: 1,\n max: 1\n };\n };\n },\n 3194: function() {\n Array.prototype.includes || Object.defineProperty(Array.prototype, \"includes\", {\n value: function(e, t) {\n if (null == this) throw new TypeError('\"this\" is null or not defined');\n var n = Object(this), i = n.length >>> 0;\n if (0 === i) return !1;\n for (var a = 0 | t, r = Math.max(a >= 0 ? a : i - Math.abs(a), 0); r < i; ) {\n if (n[r] === e) return !0;\n r++;\n }\n return !1;\n }\n });\n },\n 9302: function() {\n var e = Function.bind.call(Function.call, Array.prototype.reduce), t = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable), n = Function.bind.call(Function.call, Array.prototype.concat), i = Object.keys;\n Object.entries || (Object.entries = function(a) {\n return e(i(a), (function(e, i) {\n return n(e, \"string\" == typeof i && t(a, i) ? [ [ i, a[i] ] ] : []);\n }), []);\n });\n },\n 7149: function() {\n function e(t) {\n return e = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, e(t);\n }\n \"function\" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = \"object\" === e(\"test\".__proto__) ? function(e) {\n return e.__proto__;\n } : function(e) {\n return e.constructor.prototype;\n });\n },\n 4013: function() {\n String.prototype.includes || (String.prototype.includes = function(e, t) {\n return \"number\" != typeof t && (t = 0), !(t + e.length > this.length) && -1 !== this.indexOf(e, t);\n });\n },\n 8711: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.caret = function(e, t, n, i, r) {\n var o, l = this, s = this.opts;\n if (void 0 === t) return \"selectionStart\" in e && \"selectionEnd\" in e ? (t = e.selectionStart, \n n = e.selectionEnd) : a.default.getSelection ? (o = a.default.getSelection().getRangeAt(0)).commonAncestorContainer.parentNode !== e && o.commonAncestorContainer !== e || (t = o.startOffset, \n n = o.endOffset) : document.selection && document.selection.createRange && (n = (t = 0 - (o = document.selection.createRange()).duplicate().moveStart(\"character\", -e.inputmask._valueGet().length)) + o.text.length), \n {\n begin: i ? t : f.call(l, t),\n end: i ? n : f.call(l, n)\n };\n if (Array.isArray(t) && (n = l.isRTL ? t[0] : t[1], t = l.isRTL ? t[1] : t[0]), \n void 0 !== t.begin && (n = l.isRTL ? t.begin : t.end, t = l.isRTL ? t.end : t.begin), \n \"number\" == typeof t) {\n t = i ? t : f.call(l, t), n = \"number\" == typeof (n = i ? n : f.call(l, n)) ? n : t;\n var c = parseInt(((e.ownerDocument.defaultView || a.default).getComputedStyle ? (e.ownerDocument.defaultView || a.default).getComputedStyle(e, null) : e.currentStyle).fontSize) * n;\n if (e.scrollLeft = c > e.scrollWidth ? c : 0, e.inputmask.caretPos = {\n begin: t,\n end: n\n }, s.insertModeVisual && !1 === s.insertMode && t === n && (r || n++), e === (e.inputmask.shadowRoot || e.ownerDocument).activeElement) {\n if (\"setSelectionRange\" in e) e.setSelectionRange(t, n); else if (a.default.getSelection) {\n if (o = document.createRange(), void 0 === e.firstChild || null === e.firstChild) {\n var u = document.createTextNode(\"\");\n e.appendChild(u);\n }\n o.setStart(e.firstChild, t < e.inputmask._valueGet().length ? t : e.inputmask._valueGet().length), \n o.setEnd(e.firstChild, n < e.inputmask._valueGet().length ? n : e.inputmask._valueGet().length), \n o.collapse(!0);\n var p = a.default.getSelection();\n p.removeAllRanges(), p.addRange(o);\n } else e.createTextRange && ((o = e.createTextRange()).collapse(!0), o.moveEnd(\"character\", n), \n o.moveStart(\"character\", t), o.select());\n void 0 === e.inputmask.caretHook || e.inputmask.caretHook.call(l, {\n begin: t,\n end: n\n });\n }\n }\n }, t.determineLastRequiredPosition = function(e) {\n var t, n, i = this, a = i.maskset, l = i.dependencyLib, c = r.getMaskTemplate.call(i, !0, s.call(i), !0, !0), u = c.length, f = s.call(i), p = {}, d = a.validPositions[f], h = void 0 !== d ? d.locator.slice() : void 0;\n for (t = f + 1; t < c.length; t++) h = (n = r.getTestTemplate.call(i, t, h, t - 1)).locator.slice(), \n p[t] = l.extend(!0, {}, n);\n var v = d && void 0 !== d.alternation ? d.locator[d.alternation] : void 0;\n for (t = u - 1; t > f && (((n = p[t]).match.optionality || n.match.optionalQuantifier && n.match.newBlockMarker || v && (v !== p[t].locator[d.alternation] && 1 != n.match.static || !0 === n.match.static && n.locator[d.alternation] && o.checkAlternationMatch.call(i, n.locator[d.alternation].toString().split(\",\"), v.toString().split(\",\")) && \"\" !== r.getTests.call(i, t)[0].def)) && c[t] === r.getPlaceholder.call(i, t, n.match)); t--) u--;\n return e ? {\n l: u,\n def: p[u] ? p[u].match : void 0\n } : u;\n }, t.determineNewCaretPosition = function(e, t, n) {\n var i = this, a = i.maskset, o = i.opts;\n t && (i.isRTL ? e.end = e.begin : e.begin = e.end);\n if (e.begin === e.end) {\n switch (n = n || o.positionCaretOnClick) {\n case \"none\":\n break;\n\n case \"select\":\n e = {\n begin: 0,\n end: l.call(i).length\n };\n break;\n\n case \"ignore\":\n e.end = e.begin = u.call(i, s.call(i));\n break;\n\n case \"radixFocus\":\n if (i.clicked > 1 && 0 == a.validPositions.length) break;\n if (function(e) {\n if (\"\" !== o.radixPoint && 0 !== o.digits) {\n var t = a.validPositions;\n if (void 0 === t[e] || t[e].input === r.getPlaceholder.call(i, e)) {\n if (e < u.call(i, -1)) return !0;\n var n = l.call(i).indexOf(o.radixPoint);\n if (-1 !== n) {\n for (var s = 0, c = t.length; s < c; s++) if (t[s] && n < s && t[s].input !== r.getPlaceholder.call(i, s)) return !1;\n return !0;\n }\n }\n }\n return !1;\n }(e.begin)) {\n var f = l.call(i).join(\"\").indexOf(o.radixPoint);\n e.end = e.begin = o.numericInput ? u.call(i, f) : f;\n break;\n }\n\n default:\n var p = e.begin, d = s.call(i, p, !0), h = u.call(i, -1 !== d || c.call(i, 0) ? d : -1);\n if (p <= h) e.end = e.begin = c.call(i, p, !1, !0) ? p : u.call(i, p); else {\n var v = a.validPositions[d], m = r.getTestTemplate.call(i, h, v ? v.match.locator : void 0, v), g = r.getPlaceholder.call(i, h, m.match);\n if (\"\" !== g && l.call(i)[h] !== g && !0 !== m.match.optionalQuantifier && !0 !== m.match.newBlockMarker || !c.call(i, h, o.keepStatic, !0) && m.match.def === g) {\n var y = u.call(i, h);\n (p >= y || p === h) && (h = y);\n }\n e.end = e.begin = h;\n }\n }\n return e;\n }\n }, t.getBuffer = l, t.getBufferTemplate = function() {\n var e = this.maskset;\n void 0 === e._buffer && (e._buffer = r.getMaskTemplate.call(this, !1, 1), void 0 === e.buffer && (e.buffer = e._buffer.slice()));\n return e._buffer;\n }, t.getLastValidPosition = s, t.isMask = c, t.resetMaskSet = function(e) {\n var t = this.maskset;\n t.buffer = void 0, !0 !== e && (t.validPositions = [], t.p = 0);\n !1 === e && (t.tests = {});\n }, t.seekNext = u, t.seekPrevious = function(e, t) {\n var n = this, i = e - 1;\n if (e <= 0) return 0;\n for (;i > 0 && (!0 === t && (!0 !== r.getTest.call(n, i).match.newBlockMarker || !c.call(n, i, void 0, !0)) || !0 !== t && !c.call(n, i, void 0, !0)); ) i--;\n return i;\n }, t.translatePosition = f;\n var i, a = (i = n(9380)) && i.__esModule ? i : {\n default: i\n }, r = n(4713), o = n(7215);\n function l(e) {\n var t = this, n = t.maskset;\n return void 0 !== n.buffer && !0 !== e || (n.buffer = r.getMaskTemplate.call(t, !0, s.call(t), !0), \n void 0 === n._buffer && (n._buffer = n.buffer.slice())), n.buffer;\n }\n function s(e, t, n) {\n var i = this.maskset, a = -1, r = -1, o = n || i.validPositions;\n void 0 === e && (e = -1);\n for (var l = 0, s = o.length; l < s; l++) o[l] && (t || !0 !== o[l].generatedInput) && (l <= e && (a = l), \n l >= e && (r = l));\n return -1 === a || a == e ? r : -1 == r || e - a < r - e ? a : r;\n }\n function c(e, t, n) {\n var i = this, a = this.maskset, o = r.getTestTemplate.call(i, e).match;\n if (\"\" === o.def && (o = r.getTest.call(i, e).match), !0 !== o.static) return o.fn;\n if (!0 === n && void 0 !== a.validPositions[e] && !0 !== a.validPositions[e].generatedInput) return !0;\n if (!0 !== t && e > -1) {\n if (n) {\n var l = r.getTests.call(i, e);\n return l.length > 1 + (\"\" === l[l.length - 1].match.def ? 1 : 0);\n }\n var s = r.determineTestTemplate.call(i, e, r.getTests.call(i, e)), c = r.getPlaceholder.call(i, e, s.match);\n return s.match.def !== c;\n }\n return !1;\n }\n function u(e, t, n) {\n var i = this;\n void 0 === n && (n = !0);\n for (var a = e + 1; \"\" !== r.getTest.call(i, a).match.def && (!0 === t && (!0 !== r.getTest.call(i, a).match.newBlockMarker || !c.call(i, a, void 0, !0)) || !0 !== t && !c.call(i, a, void 0, n)); ) a++;\n return a;\n }\n function f(e) {\n var t = this.opts, n = this.el;\n return !this.isRTL || \"number\" != typeof e || t.greedy && \"\" === t.placeholder || !n || (e = this._valueGet().length - e) < 0 && (e = 0), \n e;\n }\n },\n 4713: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.determineTestTemplate = f, t.getDecisionTaker = s, t.getMaskTemplate = function(e, t, n, i, a) {\n var r = this, o = this.opts, l = this.maskset, s = o.greedy;\n a && o.greedy && (o.greedy = !1, r.maskset.tests = {});\n t = t || 0;\n var p, d, v, m, g = [], y = 0;\n do {\n if (!0 === e && l.validPositions[y]) d = (v = a && l.validPositions[y].match.optionality && void 0 === l.validPositions[y + 1] && (!0 === l.validPositions[y].generatedInput || l.validPositions[y].input == o.skipOptionalPartCharacter && y > 0) ? f.call(r, y, h.call(r, y, p, y - 1)) : l.validPositions[y]).match, \n p = v.locator.slice(), g.push(!0 === n ? v.input : !1 === n ? d.nativeDef : c.call(r, y, d)); else {\n d = (v = u.call(r, y, p, y - 1)).match, p = v.locator.slice();\n var k = !0 !== i && (!1 !== o.jitMasking ? o.jitMasking : d.jit);\n (m = (m || l.validPositions[y - 1]) && d.static && d.def !== o.groupSeparator && null === d.fn) || !1 === k || void 0 === k || \"number\" == typeof k && isFinite(k) && k > y ? g.push(!1 === n ? d.nativeDef : c.call(r, g.length, d)) : m = !1;\n }\n y++;\n } while (!0 !== d.static || \"\" !== d.def || t > y);\n \"\" === g[g.length - 1] && g.pop();\n !1 === n && void 0 !== l.maskLength || (l.maskLength = y - 1);\n return o.greedy = s, g;\n }, t.getPlaceholder = c, t.getTest = p, t.getTestTemplate = u, t.getTests = h, t.isSubsetOf = d;\n var i, a = n(8711), r = (i = n(2394)) && i.__esModule ? i : {\n default: i\n };\n function o(e) {\n return o = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(e) {\n return typeof e;\n } : function(e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, o(e);\n }\n function l(e, t) {\n var n = (null != e.alternation ? e.mloc[s(e)] : e.locator).join(\"\");\n if (\"\" !== n) for (n = n.split(\":\")[0]; n.length < t; ) n += \"0\";\n return n;\n }\n function s(e) {\n var t = e.locator[e.alternation];\n return \"string\" == typeof t && t.length > 0 && (t = t.split(\",\")[0]), void 0 !== t ? t.toString() : \"\";\n }\n function c(e, t, n) {\n var i = this, r = this.opts, l = this.maskset;\n if (void 0 !== (t = t || p.call(i, e).match).placeholder || !0 === n) {\n if (\"\" !== t.placeholder && !0 === t.static && !0 !== t.generated) {\n var s = a.getLastValidPosition.call(i, e), c = a.seekNext.call(i, s);\n return (n ? e <= c : e < c) ? r.staticDefinitionSymbol && t.static ? t.nativeDef : t.def : \"function\" == typeof t.placeholder ? t.placeholder(r) : t.placeholder;\n }\n return \"function\" == typeof t.placeholder ? t.placeholder(r) : t.placeholder;\n }\n if (!0 === t.static) {\n if (e > -1 && void 0 === l.validPositions[e]) {\n var u, f = h.call(i, e), d = [];\n if (\"string\" == typeof r.placeholder && f.length > 1 + (\"\" === f[f.length - 1].match.def ? 1 : 0)) for (var v = 0; v < f.length; v++) if (\"\" !== f[v].match.def && !0 !== f[v].match.optionality && !0 !== f[v].match.optionalQuantifier && (!0 === f[v].match.static || void 0 === u || !1 !== f[v].match.fn.test(u.match.def, l, e, !0, r)) && (d.push(f[v]), \n !0 === f[v].match.static && (u = f[v]), d.length > 1 && /[0-9a-bA-Z]/.test(d[0].match.def))) return r.placeholder.charAt(e % r.placeholder.length);\n }\n return t.def;\n }\n return \"object\" === o(r.placeholder) ? t.def : r.placeholder.charAt(e % r.placeholder.length);\n }\n function u(e, t, n) {\n return this.maskset.validPositions[e] || f.call(this, e, h.call(this, e, t ? t.slice() : t, n));\n }\n function f(e, t) {\n var n = this.opts, i = 0, a = function(e, t) {\n var n = 0, i = !1;\n t.forEach((function(e) {\n e.match.optionality && (0 !== n && n !== e.match.optionality && (i = !0), (0 === n || n > e.match.optionality) && (n = e.match.optionality));\n })), n && (0 == e || 1 == t.length ? n = 0 : i || (n = 0));\n return n;\n }(e, t);\n e = e > 0 ? e - 1 : 0;\n var r, o, s, c = l(p.call(this, e));\n n.greedy && t.length > 1 && \"\" === t[t.length - 1].match.def && (i = 1);\n for (var u = 0; u < t.length - i; u++) {\n var f = t[u];\n r = l(f, c.length);\n var d = Math.abs(r - c);\n (!0 !== f.unMatchedAlternationStopped || t.filter((function(e) {\n return !0 !== e.unMatchedAlternationStopped;\n })).length <= 1) && (void 0 === o || \"\" !== r && d < o || s && !n.greedy && s.match.optionality && s.match.optionality - a > 0 && \"master\" === s.match.newBlockMarker && (!f.match.optionality || f.match.optionality - a < 1 || !f.match.newBlockMarker) || s && !n.greedy && s.match.optionalQuantifier && !f.match.optionalQuantifier) && (o = d, \n s = f);\n }\n return s;\n }\n function p(e, t) {\n var n = this.maskset;\n return n.validPositions[e] ? n.validPositions[e] : (t || h.call(this, e))[0];\n }\n function d(e, t, n) {\n function i(e) {\n for (var t, n = [], i = -1, a = 0, r = e.length; a < r; a++) if (\"-\" === e.charAt(a)) for (t = e.charCodeAt(a + 1); ++i < t; ) n.push(String.fromCharCode(i)); else i = e.charCodeAt(a), \n n.push(e.charAt(a));\n return n.join(\"\");\n }\n return e.match.def === t.match.nativeDef || !(!(n.regex || e.match.fn instanceof RegExp && t.match.fn instanceof RegExp) || !0 === e.match.static || !0 === t.match.static) && (\".\" === t.match.fn.source || -1 !== i(t.match.fn.source.replace(/[[\\]/]/g, \"\")).indexOf(i(e.match.fn.source.replace(/[[\\]/]/g, \"\"))));\n }\n function h(e, t, n) {\n var i, a, o = this, l = this.dependencyLib, s = this.maskset, c = this.opts, u = this.el, p = s.maskToken, h = t ? n : 0, v = t ? t.slice() : [ 0 ], m = [], g = !1, y = t ? t.join(\"\") : \"\", k = !1;\n function b(t, n, a, l) {\n function f(a, l, p) {\n function v(e, t) {\n var n = 0 === t.matches.indexOf(e);\n return n || t.matches.every((function(i, a) {\n return !0 === i.isQuantifier ? n = v(e, t.matches[a - 1]) : Object.prototype.hasOwnProperty.call(i, \"matches\") && (n = v(e, i)), \n !n;\n })), n;\n }\n function w(e, t, n) {\n var i, a;\n if ((s.tests[e] || s.validPositions[e]) && (s.validPositions[e] ? [ s.validPositions[e] ] : s.tests[e]).every((function(e, r) {\n if (e.mloc[t]) return i = e, !1;\n var o = void 0 !== n ? n : e.alternation, l = void 0 !== e.locator[o] ? e.locator[o].toString().indexOf(t) : -1;\n return (void 0 === a || l < a) && -1 !== l && (i = e, a = l), !0;\n })), i) {\n var r = i.locator[i.alternation], o = i.mloc[t] || i.mloc[r] || i.locator;\n if (-1 !== o[o.length - 1].toString().indexOf(\":\")) o.pop();\n return o.slice((void 0 !== n ? n : i.alternation) + 1);\n }\n return void 0 !== n ? w(e, t) : void 0;\n }\n function P(t, n) {\n return !0 === t.match.static && !0 !== n.match.static && n.match.fn.test(t.match.def, s, e, !1, c, !1);\n }\n function S(e, t) {\n var n = e.alternation, i = void 0 === t || n <= t.alternation && -1 === e.locator[n].toString().indexOf(t.locator[n]);\n if (!i && n > t.alternation) for (var a = 0; a < n; a++) if (e.locator[a] !== t.locator[a]) {\n n = a, i = !0;\n break;\n }\n return !!i && function(n) {\n e.mloc = e.mloc || {};\n var i = e.locator[n];\n if (void 0 !== i) {\n if (\"string\" == typeof i && (i = i.split(\",\")[0]), void 0 === e.mloc[i] && (e.mloc[i] = e.locator.slice(), \n e.mloc[i].push(\":\".concat(e.alternation))), void 0 !== t) {\n for (var a in t.mloc) \"string\" == typeof a && (a = parseInt(a.split(\",\")[0])), e.mloc[a + 0] = t.mloc[a];\n e.locator[n] = Object.keys(e.mloc).join(\",\");\n }\n return e.alternation > n && (e.alternation = n), !0;\n }\n return e.alternation = void 0, !1;\n }(n);\n }\n function O(e, t) {\n if (e.locator.length !== t.locator.length) return !1;\n for (var n = e.alternation + 1; n < e.locator.length; n++) if (e.locator[n] !== t.locator[n]) return !1;\n return !0;\n }\n if (h > e + c._maxTestPos) throw \"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. \" + s.mask;\n if (h === e && void 0 === a.matches) {\n if (m.push({\n match: a,\n locator: l.reverse(),\n cd: y,\n mloc: {}\n }), !a.optionality || void 0 !== p || !(c.definitions && c.definitions[a.nativeDef] && c.definitions[a.nativeDef].optional || r.default.prototype.definitions[a.nativeDef] && r.default.prototype.definitions[a.nativeDef].optional)) return !0;\n g = !0, h = e;\n } else if (void 0 !== a.matches) {\n if (a.isGroup && p !== a) return function() {\n if (a = f(t.matches[t.matches.indexOf(a) + 1], l, p)) return !0;\n }();\n if (a.isOptional) return function() {\n var t = a, r = m.length;\n if (a = b(a, n, l, p), m.length > 0) {\n if (m.forEach((function(e, t) {\n t >= r && (e.match.optionality = e.match.optionality ? e.match.optionality + 1 : 1);\n })), i = m[m.length - 1].match, void 0 !== p || !v(i, t)) return a;\n g = !0, h = e;\n }\n }();\n if (a.isAlternator) return function() {\n function i(e) {\n for (var t, n = e.matches[0].matches ? e.matches[0].matches.length : 1, i = 0; i < e.matches.length && n === (t = e.matches[i].matches ? e.matches[i].matches.length : 1); i++) ;\n return n !== t;\n }\n o.hasAlternator = !0;\n var r, v = a, y = [], b = m.slice(), x = l.length, _ = n.length > 0 ? n.shift() : -1;\n if (-1 === _ || \"string\" == typeof _) {\n var M, E = h, j = n.slice(), T = [];\n if (\"string\" == typeof _) T = _.split(\",\"); else for (M = 0; M < v.matches.length; M++) T.push(M.toString());\n if (void 0 !== s.excludes[e]) {\n for (var A = T.slice(), D = 0, L = s.excludes[e].length; D < L; D++) {\n var C = s.excludes[e][D].toString().split(\":\");\n l.length == C[1] && T.splice(T.indexOf(C[0]), 1);\n }\n 0 === T.length && (delete s.excludes[e], T = A);\n }\n (!0 === c.keepStatic || isFinite(parseInt(c.keepStatic)) && E >= c.keepStatic) && (T = T.slice(0, 1));\n for (var B = 0; B < T.length; B++) {\n M = parseInt(T[B]), m = [], n = \"string\" == typeof _ && w(h, M, x) || j.slice();\n var R = v.matches[M];\n if (R && f(R, [ M ].concat(l), p)) a = !0; else if (0 === B && (k = i(v)), R && R.matches && R.matches.length > v.matches[0].matches.length) break;\n r = m.slice(), h = E, m = [];\n for (var I = 0; I < r.length; I++) {\n var F = r[I], N = !1;\n F.alternation = F.alternation || x, S(F);\n for (var V = 0; V < y.length; V++) {\n var G = y[V];\n if (\"string\" != typeof _ || void 0 !== F.alternation && T.includes(F.locator[F.alternation].toString())) {\n if (F.match.nativeDef === G.match.nativeDef) {\n N = !0, S(G, F);\n break;\n }\n if (d(F, G, c)) {\n S(F, G) && (N = !0, y.splice(y.indexOf(G), 0, F));\n break;\n }\n if (d(G, F, c)) {\n S(G, F);\n break;\n }\n if (P(F, G)) {\n O(F, G) || void 0 !== u.inputmask.userOptions.keepStatic ? S(F, G) && (N = !0, y.splice(y.indexOf(G), 0, F)) : c.keepStatic = !0;\n break;\n }\n if (P(G, F)) {\n S(G, F);\n break;\n }\n }\n }\n N || y.push(F);\n }\n }\n m = b.concat(y), h = e, g = m.length > 0 && k, a = y.length > 0 && !k, k && g && !a && m.forEach((function(e, t) {\n e.unMatchedAlternationStopped = !0;\n })), n = j.slice();\n } else a = f(v.matches[_] || t.matches[_], [ _ ].concat(l), p);\n if (a) return !0;\n }();\n if (a.isQuantifier && p !== t.matches[t.matches.indexOf(a) - 1]) return function() {\n for (var r = a, o = !1, u = n.length > 0 ? n.shift() : 0; u < (isNaN(r.quantifier.max) ? u + 1 : r.quantifier.max) && h <= e; u++) {\n var p = t.matches[t.matches.indexOf(r) - 1];\n if (a = f(p, [ u ].concat(l), p)) {\n if (m.forEach((function(t, n) {\n (i = x(p, t.match) ? t.match : m[m.length - 1].match).optionalQuantifier = u >= r.quantifier.min, \n i.jit = (u + 1) * (p.matches.indexOf(i) + 1) > r.quantifier.jit, i.optionalQuantifier && v(i, p) && (g = !0, \n h = e, c.greedy && null == s.validPositions[e - 1] && u > r.quantifier.min && -1 != [ \"*\", \"+\" ].indexOf(r.quantifier.max) && (m.pop(), \n y = void 0), o = !0, a = !1), !o && i.jit && (s.jitOffset[e] = p.matches.length - p.matches.indexOf(i));\n })), o) break;\n return !0;\n }\n }\n }();\n if (a = b(a, n, l, p)) return !0;\n } else h++;\n }\n for (var p = n.length > 0 ? n.shift() : 0; p < t.matches.length; p++) if (!0 !== t.matches[p].isQuantifier) {\n var v = f(t.matches[p], [ p ].concat(a), l);\n if (v && h === e) return v;\n if (h > e) break;\n }\n }\n function x(e, t) {\n var n = -1 != e.matches.indexOf(t);\n return n || e.matches.forEach((function(e, i) {\n void 0 === e.matches || n || (n = x(e, t));\n })), n;\n }\n if (e > -1) {\n if (void 0 === t) {\n for (var w, P = e - 1; void 0 === (w = s.validPositions[P] || s.tests[P]) && P > -1; ) P--;\n void 0 !== w && P > -1 && (v = function(e, t) {\n var n, i = [];\n return Array.isArray(t) || (t = [ t ]), t.length > 0 && (void 0 === t[0].alternation || !0 === c.keepStatic ? 0 === (i = f.call(o, e, t.slice()).locator.slice()).length && (i = t[0].locator.slice()) : t.forEach((function(e) {\n \"\" !== e.def && (0 === i.length ? (n = e.alternation, i = e.locator.slice()) : e.locator[n] && -1 === i[n].toString().indexOf(e.locator[n]) && (i[n] += \",\" + e.locator[n]));\n }))), i;\n }(P, w), y = v.join(\"\"), h = P);\n }\n if (s.tests[e] && s.tests[e][0].cd === y) return s.tests[e];\n for (var S = v.shift(); S < p.length; S++) {\n if (b(p[S], v, [ S ]) && h === e || h > e) break;\n }\n }\n return (0 === m.length || g) && m.push({\n match: {\n fn: null,\n static: !0,\n optionality: !1,\n casing: null,\n def: \"\",\n placeholder: \"\"\n },\n locator: k && 0 === m.filter((function(e) {\n return !0 !== e.unMatchedAlternationStopped;\n })).length ? [ 0 ] : [],\n mloc: {},\n cd: y\n }), void 0 !== t && s.tests[e] ? a = l.extend(!0, [], m) : (s.tests[e] = l.extend(!0, [], m), \n a = s.tests[e]), m.forEach((function(e) {\n e.match.optionality = e.match.defOptionality || !1;\n })), a;\n }\n },\n 7215: function(e, t, n) {\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.alternate = l, t.checkAlternationMatch = function(e, t, n) {\n for (var i, a = this.opts.greedy ? t : t.slice(0, 1), r = !1, o = void 0 !== n ? n.split(\",\") : [], l = 0; l < o.length; l++) -1 !== (i = e.indexOf(o[l])) && e.splice(i, 1);\n for (var s = 0; s < e.length; s++) if (a.includes(e[s])) {\n r = !0;\n break;\n }\n return r;\n }, t.handleRemove = function(e, t, n, o, s) {\n var c = this, u = this.maskset, f = this.opts;\n if ((f.numericInput || c.isRTL) && (t === a.keys.Backspace ? t = a.keys.Delete : t === a.keys.Delete && (t = a.keys.Backspace), \n c.isRTL)) {\n var p = n.end;\n n.end = n.begin, n.begin = p;\n }\n var d, h = r.getLastValidPosition.call(c, void 0, !0);\n n.end >= r.getBuffer.call(c).length && h >= n.end && (n.end = h + 1);\n t === a.keys.Backspace ? n.end - n.begin < 1 && (n.begin = r.seekPrevious.call(c, n.begin)) : t === a.keys.Delete && n.begin === n.end && (n.end = r.isMask.call(c, n.end, !0, !0) ? n.end + 1 : r.seekNext.call(c, n.end) + 1);\n if (!1 !== (d = v.call(c, n))) {\n if (!0 !== o && !1 !== f.keepStatic || null !== f.regex && -1 !== i.getTest.call(c, n.begin).match.def.indexOf(\"|\")) {\n var m = l.call(c, !0);\n if (m) {\n var g = void 0 !== m.caret ? m.caret : m.pos ? r.seekNext.call(c, m.pos.begin ? m.pos.begin : m.pos) : r.getLastValidPosition.call(c, -1, !0);\n (t !== a.keys.Delete || n.begin > g) && n.begin;\n }\n }\n !0 !== o && (u.p = t === a.keys.Delete ? n.begin + d : n.begin, u.p = r.determineNewCaretPosition.call(c, {\n begin: u.p,\n end: u.p\n }, !1, !1 === f.insertMode && t === a.keys.Backspace ? \"none\" : void 0).begin);\n }\n }, t.isComplete = c, t.isSelection = u, t.isValid = f, t.refreshFromBuffer = d, \n t.revalidateMask = v;\n var i = n(4713), a = n(2839), r = n(8711), o = n(6030);\n function l(e, t, n, a, o, s) {\n var c, u, p, d, h, v, m, g, y, k, b, x = this, w = this.dependencyLib, P = this.opts, S = x.maskset, O = w.extend(!0, [], S.validPositions), _ = w.extend(!0, {}, S.tests), M = !1, E = !1, j = void 0 !== o ? o : r.getLastValidPosition.call(x);\n if (s && (k = s.begin, b = s.end, s.begin > s.end && (k = s.end, b = s.begin)), \n -1 === j && void 0 === o) c = 0, u = (d = i.getTest.call(x, c)).alternation; else for (;j >= 0; j--) if ((p = S.validPositions[j]) && void 0 !== p.alternation) {\n if (j <= (e || 0) && d && d.locator[p.alternation] !== p.locator[p.alternation]) break;\n c = j, u = S.validPositions[c].alternation, d = p;\n }\n if (void 0 !== u) {\n m = parseInt(c), S.excludes[m] = S.excludes[m] || [], !0 !== e && S.excludes[m].push((0, \n i.getDecisionTaker)(d) + \":\" + d.alternation);\n var T = [], A = -1;\n for (h = m; m < r.getLastValidPosition.call(x, void 0, !0) + 1; h++) -1 === A && e <= h && void 0 !== t && (T.push(t), \n A = T.length - 1), (v = S.validPositions[m]) && !0 !== v.generatedInput && (void 0 === s || h < k || h >= b) && T.push(v.input), \n S.validPositions.splice(m, 1);\n for (-1 === A && void 0 !== t && (T.push(t), A = T.length - 1); void 0 !== S.excludes[m] && S.excludes[m].length < 10; ) {\n for (S.tests = {}, r.resetMaskSet.call(x, !0), M = !0, h = 0; h < T.length && (g = M.caret || 0 == P.insertMode && null != g ? r.seekNext.call(x, g) : r.getLastValidPosition.call(x, void 0, !0) + 1, \n y = T[h], M = f.call(x, g, y, !1, a, !0)); h++) h === A && (E = M), 1 == e && M && (E = {\n caretPos: h\n });\n if (M) break;\n if (r.resetMaskSet.call(x), d = i.getTest.call(x, m), S.validPositions = w.extend(!0, [], O), \n S.tests = w.extend(!0, {}, _), !S.excludes[m]) {\n E = l.call(x, e, t, n, a, m - 1, s);\n break;\n }\n if (null != d.alternation) {\n var D = (0, i.getDecisionTaker)(d);\n if (-1 !== S.excludes[m].indexOf(D + \":\" + d.alternation)) {\n E = l.call(x, e, t, n, a, m - 1, s);\n break;\n }\n for (S.excludes[m].push(D + \":\" + d.alternation), h = m; h < r.getLastValidPosition.call(x, void 0, !0) + 1; h++) S.validPositions.splice(m);\n } else delete S.excludes[m];\n }\n }\n return E && !1 === P.keepStatic || delete S.excludes[m], E;\n }\n function s(e, t, n) {\n var i = this.opts, r = this.maskset;\n switch (i.casing || t.casing) {\n case \"upper\":\n e = e.toUpperCase();\n break;\n\n case \"lower\":\n e = e.toLowerCase();\n break;\n\n case \"title\":\n var o = r.validPositions[n - 1];\n e = 0 === n || o && o.input === String.fromCharCode(a.keyCode.Space) ? e.toUpperCase() : e.toLowerCase();\n break;\n\n default:\n if (\"function\" == typeof i.casing) {\n var l = Array.prototype.slice.call(arguments);\n l.push(r.validPositions), e = i.casing.apply(this, l);\n }\n }\n return e;\n }\n function c(e) {\n var t = this, n = this.opts, a = this.maskset;\n if (\"function\" == typeof n.isComplete) return n.isComplete(e, n);\n if (\"*\" !== n.repeat) {\n var o = !1, l = r.determineLastRequiredPosition.call(t, !0), s = l.l;\n if (void 0 === l.def || l.def.newBlockMarker || l.def.optionality || l.def.optionalQuantifier) {\n o = !0;\n for (var c = 0; c <= s; c++) {\n var u = i.getTestTemplate.call(t, c).match;\n if (!0 !== u.static && void 0 === a.validPositions[c] && (!1 === u.optionality || void 0 === u.optionality || u.optionality && 0 == u.newBlockMarker) && (!1 === u.optionalQuantifier || void 0 === u.optionalQuantifier) || !0 === u.static && \"\" != u.def && e[c] !== i.getPlaceholder.call(t, c, u)) {\n o = !1;\n break;\n }\n }\n }\n return o;\n }\n }\n function u(e) {\n var t = this.opts.insertMode ? 0 : 1;\n return this.isRTL ? e.begin - e.end > t : e.end - e.begin > t;\n }\n function f(e, t, n, a, o, p, m) {\n var g = this, y = this.dependencyLib, k = this.opts, b = g.maskset;\n n = !0 === n;\n var x = e;\n function w(e) {\n if (void 0 !== e) {\n if (void 0 !== e.remove && (Array.isArray(e.remove) || (e.remove = [ e.remove ]), \n e.remove.sort((function(e, t) {\n return g.isRTL ? e.pos - t.pos : t.pos - e.pos;\n })).forEach((function(e) {\n v.call(g, {\n begin: e,\n end: e + 1\n });\n })), e.remove = void 0), void 0 !== e.insert && (Array.isArray(e.insert) || (e.insert = [ e.insert ]), \n e.insert.sort((function(e, t) {\n return g.isRTL ? t.pos - e.pos : e.pos - t.pos;\n })).forEach((function(e) {\n \"\" !== e.c && f.call(g, e.pos, e.c, void 0 === e.strict || e.strict, void 0 !== e.fromIsValid ? e.fromIsValid : a);\n })), e.insert = void 0), e.refreshFromBuffer && e.buffer) {\n var t = e.refreshFromBuffer;\n d.call(g, !0 === t ? t : t.start, t.end, e.buffer), e.refreshFromBuffer = void 0;\n }\n void 0 !== e.rewritePosition && (x = e.rewritePosition, e = !0);\n }\n return e;\n }\n function P(t, n, o) {\n var l = !1;\n return i.getTests.call(g, t).every((function(c, f) {\n var p = c.match;\n if (r.getBuffer.call(g, !0), !1 !== (l = (!p.jit || void 0 !== b.validPositions[r.seekPrevious.call(g, t)]) && (null != p.fn ? p.fn.test(n, b, t, o, k, u.call(g, e)) : (n === p.def || n === k.skipOptionalPartCharacter) && \"\" !== p.def && {\n c: i.getPlaceholder.call(g, t, p, !0) || p.def,\n pos: t\n }))) {\n var d = void 0 !== l.c ? l.c : n, h = t;\n return d = d === k.skipOptionalPartCharacter && !0 === p.static ? i.getPlaceholder.call(g, t, p, !0) || p.def : d, \n !0 !== (l = w(l)) && void 0 !== l.pos && l.pos !== t && (h = l.pos), !0 !== l && void 0 === l.pos && void 0 === l.c ? !1 : (!1 === v.call(g, e, y.extend({}, c, {\n input: s.call(g, d, p, h)\n }), a, h) && (l = !1), !1);\n }\n return !0;\n })), l;\n }\n void 0 !== e.begin && (x = g.isRTL ? e.end : e.begin);\n var S = !0, O = y.extend(!0, [], b.validPositions);\n if (!1 === k.keepStatic && void 0 !== b.excludes[x] && !0 !== o && !0 !== a) for (var _ = x; _ < (g.isRTL ? e.begin : e.end); _++) void 0 !== b.excludes[_] && (b.excludes[_] = void 0, \n delete b.tests[_]);\n if (\"function\" == typeof k.preValidation && !0 !== a && !0 !== p && (S = w(S = k.preValidation.call(g, r.getBuffer.call(g), x, t, u.call(g, e), k, b, e, n || o))), \n !0 === S) {\n if (S = P(x, t, n), (!n || !0 === a) && !1 === S && !0 !== p) {\n var M = b.validPositions[x];\n if (!M || !0 !== M.match.static || M.match.def !== t && t !== k.skipOptionalPartCharacter) {\n if (k.insertMode || void 0 === b.validPositions[r.seekNext.call(g, x)] || e.end > x) {\n var E = !1;\n if (b.jitOffset[x] && void 0 === b.validPositions[r.seekNext.call(g, x)] && !1 !== (S = f.call(g, x + b.jitOffset[x], t, !0, !0)) && (!0 !== o && (S.caret = x), \n E = !0), e.end > x && (b.validPositions[x] = void 0), !E && !r.isMask.call(g, x, k.keepStatic && 0 === x)) for (var j = x + 1, T = r.seekNext.call(g, x, !1, 0 !== x); j <= T; j++) if (!1 !== (S = P(j, t, n))) {\n S = h.call(g, x, void 0 !== S.pos ? S.pos : j) || S, x = j;\n break;\n }\n }\n } else S = {\n caret: r.seekNext.call(g, x)\n };\n }\n g.hasAlternator && !0 !== o && !n && (o = !0, !1 === S && k.keepStatic && (c.call(g, r.getBuffer.call(g)) || 0 === x) ? S = l.call(g, x, t, n, a, void 0, e) : (u.call(g, e) && b.tests[x] && b.tests[x].length > 1 && k.keepStatic || 1 == S && !0 !== k.numericInput && b.tests[x] && b.tests[x].length > 1 && r.getLastValidPosition.call(g, void 0, !0) > x) && (S = l.call(g, !0))), \n !0 === S && (S = {\n pos: x\n });\n }\n if (\"function\" == typeof k.postValidation && !0 !== a && !0 !== p) {\n var A = k.postValidation.call(g, r.getBuffer.call(g, !0), void 0 !== e.begin ? g.isRTL ? e.end : e.begin : e, t, S, k, b, n, m);\n void 0 !== A && (S = !0 === A ? S : A);\n }\n S && void 0 === S.pos && (S.pos = x), !1 === S || !0 === p ? (r.resetMaskSet.call(g, !0), \n b.validPositions = y.extend(!0, [], O)) : h.call(g, void 0, x, !0);\n var D = w(S);\n void 0 !== g.maxLength && (r.getBuffer.call(g).length > g.maxLength && !a && (r.resetMaskSet.call(g, !0), \n b.validPositions = y.extend(!0, [], O), D = !1));\n return D;\n }\n function p(e, t, n) {\n for (var a = this.maskset, r = !1, o = i.getTests.call(this, e), l = 0; l < o.length; l++) {\n if (o[l].match && (o[l].match.nativeDef === t.match[n.shiftPositions ? \"def\" : \"nativeDef\"] && (!n.shiftPositions || !t.match.static) || o[l].match.nativeDef === t.match.nativeDef || n.regex && !o[l].match.static && o[l].match.fn.test(t.input, a, e, !1, n))) {\n r = !0;\n break;\n }\n if (o[l].match && o[l].match.def === t.match.nativeDef) {\n r = void 0;\n break;\n }\n }\n return !1 === r && void 0 !== a.jitOffset[e] && (r = p.call(this, e + a.jitOffset[e], t, n)), \n r;\n }\n function d(e, t, n) {\n var i, a, l = this, s = this.maskset, c = this.opts, u = this.dependencyLib, f = c.skipOptionalPartCharacter, p = l.isRTL ? n.slice().reverse() : n;\n if (c.skipOptionalPartCharacter = \"\", !0 === e) r.resetMaskSet.call(l, !1), e = 0, \n t = n.length, a = r.determineNewCaretPosition.call(l, {\n begin: 0,\n end: 0\n }, !1).begin; else {\n for (i = e; i < t; i++) s.validPositions.splice(e, 0);\n a = e;\n }\n var d = new u.Event(\"keypress\");\n for (i = e; i < t; i++) {\n d.key = p[i].toString(), l.ignorable = !1;\n var h = o.EventHandlers.keypressEvent.call(l, d, !0, !1, !1, a);\n !1 !== h && void 0 !== h && (a = h.forwardPosition);\n }\n c.skipOptionalPartCharacter = f;\n }\n function h(e, t, n) {\n var a = this, o = this.maskset, l = this.dependencyLib;\n if (void 0 === e) for (e = t - 1; e > 0 && !o.validPositions[e]; e--) ;\n for (var s = e; s < t; s++) {\n if (void 0 === o.validPositions[s] && !r.isMask.call(a, s, !1)) if (0 == s ? i.getTest.call(a, s) : o.validPositions[s - 1]) {\n var c = i.getTests.call(a, s).slice();\n \"\" === c[c.length - 1].match.def && c.pop();\n var u, p = i.determineTestTemplate.call(a, s, c);\n if (p && (!0 !== p.match.jit || \"master\" === p.match.newBlockMarker && (u = o.validPositions[s + 1]) && !0 === u.match.optionalQuantifier) && ((p = l.extend({}, p, {\n input: i.getPlaceholder.call(a, s, p.match, !0) || p.match.def\n })).generatedInput = !0, v.call(a, s, p, !0), !0 !== n)) {\n var d = o.validPositions[t].input;\n return o.validPositions[t] = void 0, f.call(a, t, d, !0, !0);\n }\n }\n }\n }\n function v(e, t, n, a) {\n var o = this, l = this.maskset, s = this.opts, c = this.dependencyLib;\n function d(e, t, n) {\n var i = t[e];\n if (void 0 !== i && !0 === i.match.static && !0 !== i.match.optionality && (void 0 === t[0] || void 0 === t[0].alternation)) {\n var a = n.begin <= e - 1 ? t[e - 1] && !0 === t[e - 1].match.static && t[e - 1] : t[e - 1], r = n.end > e + 1 ? t[e + 1] && !0 === t[e + 1].match.static && t[e + 1] : t[e + 1];\n return a && r;\n }\n return !1;\n }\n var h = 0, v = void 0 !== e.begin ? e.begin : e, m = void 0 !== e.end ? e.end : e, g = !0;\n if (e.begin > e.end && (v = e.end, m = e.begin), a = void 0 !== a ? a : v, void 0 === n && (v !== m || s.insertMode && void 0 !== l.validPositions[a] || void 0 === t || t.match.optionalQuantifier || t.match.optionality)) {\n var y, k = c.extend(!0, [], l.validPositions), b = r.getLastValidPosition.call(o, void 0, !0);\n l.p = v;\n var x = u.call(o, e) ? v : a;\n for (y = b; y >= x; y--) l.validPositions.splice(y, 1), void 0 === t && delete l.tests[y + 1];\n var w, P, S = a, O = S;\n for (t && (l.validPositions[a] = c.extend(!0, {}, t), O++, S++), null == k[m] && l.jitOffset[m] && (m += l.jitOffset[m] + 1), \n y = t ? m : m - 1; y <= b; y++) {\n if (void 0 !== (w = k[y]) && !0 !== w.generatedInput && (y >= m || y >= v && d(y, k, {\n begin: v,\n end: m\n }))) {\n for (;\"\" !== i.getTest.call(o, O).match.def; ) {\n if (!1 !== (P = p.call(o, O, w, s)) || \"+\" === w.match.def) {\n \"+\" === w.match.def && r.getBuffer.call(o, !0);\n var _ = f.call(o, O, w.input, \"+\" !== w.match.def, !0);\n if (g = !1 !== _, S = (_.pos || O) + 1, !g && P) break;\n } else g = !1;\n if (g) {\n void 0 === t && w.match.static && y === e.begin && h++;\n break;\n }\n if (!g && r.getBuffer.call(o), O > l.maskLength) break;\n O++;\n }\n \"\" == i.getTest.call(o, O).match.def && (g = !1), O = S;\n }\n if (!g) break;\n }\n if (!g) return l.validPositions = c.extend(!0, [], k), r.resetMaskSet.call(o, !0), \n !1;\n } else t && i.getTest.call(o, a).match.cd === t.match.cd && (l.validPositions[a] = c.extend(!0, {}, t));\n return r.resetMaskSet.call(o, !0), h;\n }\n }\n }, t = {};\n function n(i) {\n var a = t[i];\n if (void 0 !== a) return a.exports;\n var r = t[i] = {\n exports: {}\n };\n return e[i](r, r.exports, n), r.exports;\n }\n var i = {};\n return function() {\n var e = i;\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.default = void 0, n(7149), n(3194), n(9302), n(4013), n(3851), n(219), n(207), \n n(5296);\n var t, a = (t = n(2394)) && t.__esModule ? t : {\n default: t\n };\n e.default = a.default;\n }(), i;\n }();\n}));\n\n//# sourceURL=webpack://Formio/../core/node_modules/inputmask/dist/inputmask.js?");
|
1968
2001
|
|
1969
2002
|
/***/ }),
|
1970
2003
|
|
@@ -4257,7 +4290,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
4257
4290
|
\***********************************************/
|
4258
4291
|
/***/ (function(module) {
|
4259
4292
|
|
4260
|
-
eval("/*! @license DOMPurify 3.0.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.9/LICENSE */\n\n(function (global, factory) {\n true ? module.exports = factory() :\n 0;\n})(this, (function () { 'use strict';\n\n const {\n entries,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor\n } = Object;\n let {\n freeze,\n seal,\n create\n } = Object; // eslint-disable-line import/no-mutable-exports\n let {\n apply,\n construct\n } = typeof Reflect !== 'undefined' && Reflect;\n if (!freeze) {\n freeze = function freeze(x) {\n return x;\n };\n }\n if (!seal) {\n seal = function seal(x) {\n return x;\n };\n }\n if (!apply) {\n apply = function apply(fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n }\n if (!construct) {\n construct = function construct(Func, args) {\n return new Func(...args);\n };\n }\n const arrayForEach = unapply(Array.prototype.forEach);\n const arrayPop = unapply(Array.prototype.pop);\n const arrayPush = unapply(Array.prototype.push);\n const stringToLowerCase = unapply(String.prototype.toLowerCase);\n const stringToString = unapply(String.prototype.toString);\n const stringMatch = unapply(String.prototype.match);\n const stringReplace = unapply(String.prototype.replace);\n const stringIndexOf = unapply(String.prototype.indexOf);\n const stringTrim = unapply(String.prototype.trim);\n const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);\n const regExpTest = unapply(RegExp.prototype.test);\n const typeErrorCreate = unconstruct(TypeError);\n\n /**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param {Function} func - The function to be wrapped and called.\n * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.\n */\n function unapply(func) {\n return function (thisArg) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n return apply(func, thisArg, args);\n };\n }\n\n /**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param {Function} func - The constructor function to be wrapped and called.\n * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.\n */\n function unconstruct(func) {\n return function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return construct(func, args);\n };\n }\n\n /**\n * Add properties to a lookup table\n *\n * @param {Object} set - The set to which elements will be added.\n * @param {Array} array - The array containing elements to be added to the set.\n * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns {Object} The modified set with added elements.\n */\n function addToSet(set, array) {\n let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n let l = array.length;\n while (l--) {\n let element = array[l];\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n element = lcElement;\n }\n }\n set[element] = true;\n }\n return set;\n }\n\n /**\n * Clean up an array to harden against CSPP\n *\n * @param {Array} array - The array to be cleaned.\n * @returns {Array} The cleaned version of the array\n */\n function cleanArray(array) {\n for (let index = 0; index < array.length; index++) {\n const isPropertyExist = objectHasOwnProperty(array, index);\n if (!isPropertyExist) {\n array[index] = null;\n }\n }\n return array;\n }\n\n /**\n * Shallow clone an object\n *\n * @param {Object} object - The object to be cloned.\n * @returns {Object} A new object that copies the original.\n */\n function clone(object) {\n const newObject = create(null);\n for (const [property, value] of entries(object)) {\n const isPropertyExist = objectHasOwnProperty(object, property);\n if (isPropertyExist) {\n if (Array.isArray(value)) {\n newObject[property] = cleanArray(value);\n } else if (value && typeof value === 'object' && value.constructor === Object) {\n newObject[property] = clone(value);\n } else {\n newObject[property] = value;\n }\n }\n }\n return newObject;\n }\n\n /**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param {Object} object - The object to look up the getter function in its prototype chain.\n * @param {String} prop - The property name for which to find the getter function.\n * @returns {Function} The getter function found in the prototype chain or a fallback function.\n */\n function lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n object = getPrototypeOf(object);\n }\n function fallbackValue() {\n return null;\n }\n return fallbackValue;\n }\n\n const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);\n\n // SVG\n const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\n const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);\n\n // List of SVG elements that are disallowed by default.\n // We still need to know them so that we can do namespace\n // checks properly in case one wants to add them to\n // allow-list.\n const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\n const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);\n\n // Similarly to SVG, we want to know all MathML elements,\n // even those that we disallow by default.\n const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\n const text = freeze(['#text']);\n\n const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\n const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\n const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\n const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n // eslint-disable-next-line unicorn/better-regex\n const MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n const ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\n const TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\n const DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n const ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n );\n\n const IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\n const ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n );\n\n const DOCTYPE_NAME = seal(/^html$/i);\n\n var EXPRESSIONS = /*#__PURE__*/Object.freeze({\n __proto__: null,\n MUSTACHE_EXPR: MUSTACHE_EXPR,\n ERB_EXPR: ERB_EXPR,\n TMPLIT_EXPR: TMPLIT_EXPR,\n DATA_ATTR: DATA_ATTR,\n ARIA_ATTR: ARIA_ATTR,\n IS_ALLOWED_URI: IS_ALLOWED_URI,\n IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE: ATTR_WHITESPACE,\n DOCTYPE_NAME: DOCTYPE_NAME\n });\n\n const getGlobal = function getGlobal() {\n return typeof window === 'undefined' ? null : window;\n };\n\n /**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\n const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n return null;\n }\n\n // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n suffix = purifyHostElement.getAttribute(ATTR_NAME);\n }\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n createScriptURL(scriptUrl) {\n return scriptUrl;\n }\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n return null;\n }\n };\n function createDOMPurify() {\n let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n const DOMPurify = root => createDOMPurify(root);\n\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n DOMPurify.version = '3.0.9';\n\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n DOMPurify.removed = [];\n if (!window || !window.document || window.document.nodeType !== 9) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n return DOMPurify;\n }\n let {\n document\n } = window;\n const originalDocument = document;\n const currentScript = originalDocument.currentScript;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes\n } = window;\n const ElementPrototype = Element.prototype;\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n\n // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n let trustedTypesPolicy;\n let emptyHTML = '';\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName\n } = document;\n const {\n importNode\n } = originalDocument;\n let hooks = {};\n\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n TMPLIT_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE\n } = EXPRESSIONS;\n let {\n IS_ALLOWED_URI: IS_ALLOWED_URI$1\n } = EXPRESSIONS;\n\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n\n /* Allowed attribute names */\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false\n }\n }));\n\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n let FORBID_TAGS = null;\n\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n let FORBID_ATTR = null;\n\n /* Decide if ARIA attributes are okay */\n let ALLOW_ARIA_ATTR = true;\n\n /* Decide if custom data attributes are okay */\n let ALLOW_DATA_ATTR = true;\n\n /* Decide if unknown protocols are okay */\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n\n /* Decide if self-closing tags in attributes are allowed.\n * Usually removed due to a mXSS issue in jQuery 3.0 */\n let ALLOW_SELF_CLOSE_IN_ATTR = true;\n\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n let SAFE_FOR_TEMPLATES = false;\n\n /* Decide if document with <html>... should be returned */\n let WHOLE_DOCUMENT = false;\n\n /* Track whether config is already set on this instance of DOMPurify. */\n let SET_CONFIG = false;\n\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n let FORCE_BODY = false;\n\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n let RETURN_DOM = false;\n\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n let RETURN_DOM_FRAGMENT = false;\n\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n let RETURN_TRUSTED_TYPE = false;\n\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n let SANITIZE_DOM = true;\n\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n let SANITIZE_NAMED_PROPS = false;\n const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n\n /* Keep element content when removing element? */\n let KEEP_CONTENT = true;\n\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n let IN_PLACE = false;\n\n /* Allow usage of profiles like html, svg and mathMl */\n let USE_PROFILES = {};\n\n /* Tags to ignore content of when KEEP_CONTENT is true */\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n\n /* Tags that are safe for data: URIs */\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n\n /* Attributes safe for values like \"javascript:\" */\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n\n /* Allowed XHTML+XML namespaces */\n let ALLOWED_NAMESPACES = null;\n const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n\n /* Parsing of strict XHTML documents */\n let PARSER_MEDIA_TYPE = null;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc = null;\n\n /* Keep a reference to config to pass to hooks */\n let CONFIG = null;\n\n /* Ideally, do not touch anything below this line */\n /* ______________________________________________ */\n\n const formElement = document.createElement('form');\n const isRegexOrFunction = function isRegexOrFunction(testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n const _parseConfig = function _parseConfig() {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n\n /* Shield configuration object from tampering */\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n\n /* Shield configuration object from prototype pollution */\n cfg = clone(cfg);\n PARSER_MEDIA_TYPE =\n // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;\n\n // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n\n /* Set configuration parameters */\n ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),\n // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR,\n // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS),\n // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS,\n // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n\n /* Parse profile info */\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, text);\n ALLOWED_ATTR = [];\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, html$1);\n addToSet(ALLOWED_ATTR, html);\n }\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, svg$1);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, svgFilters);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, mathMl$1);\n addToSet(ALLOWED_ATTR, mathMl);\n addToSet(ALLOWED_ATTR, xml);\n }\n }\n\n /* Merge configuration parameters */\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n\n /* Add #text in case KEEP_CONTENT is set to true */\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n if (cfg.TRUSTED_TYPES_POLICY) {\n if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n }\n if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n }\n\n // Overwrite existing TrustedTypes policy.\n trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;\n\n // Sign local variables required by `sanitize`.\n emptyHTML = trustedTypesPolicy.createHTML('');\n } else {\n // Uninitialized policy, attempt to initialize the internal dompurify policy.\n if (trustedTypesPolicy === undefined) {\n trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n }\n\n // If creating the internal policy succeeded sign internal variables.\n if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n emptyHTML = trustedTypesPolicy.createHTML('');\n }\n }\n\n // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n if (freeze) {\n freeze(cfg);\n }\n CONFIG = cfg;\n };\n const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);\n\n // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);\n const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);\n\n /**\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n const _checkValidNamespace = function _checkValidNamespace(element) {\n let parent = getParentNode(element);\n\n // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template'\n };\n }\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via <svg>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n }\n\n // The only way to switch from MathML to SVG is via`\n // svg if parent is either <annotation-xml> or MathML\n // text integration points.\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n }\n\n // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via <math>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n }\n\n // The only way to switch from SVG to MathML is via\n // <math> and HTML integration points\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n }\n\n // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n\n // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n }\n\n // For XHTML and XML documents that support custom namespaces\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n return true;\n }\n\n // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n return false;\n };\n\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n const _forceRemove = function _forceRemove(node) {\n arrayPush(DOMPurify.removed, {\n element: node\n });\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n node.parentNode.removeChild(node);\n } catch (_) {\n node.remove();\n }\n };\n\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n const _removeAttribute = function _removeAttribute(name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node\n });\n }\n node.removeAttribute(name);\n\n // We void attribute values for unremovable \"is\"\" attributes\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n const _initDocument = function _initDocument(dirty) {\n /* Create a HTML document */\n let doc = null;\n let leadingWhitespace = null;\n if (FORCE_BODY) {\n dirty = '<remove></remove>' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n }\n const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n\n /* Use createHTMLDocument in case DOMParser is not available */\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n } catch (_) {\n // Syntax error if dirtyPayload is invalid xml\n }\n }\n const body = doc.body || doc.documentElement;\n if (dirty && leadingWhitespace) {\n body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n }\n\n /* Work on whole document or just its body */\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n }\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n *\n * @param {Node} root The root element or node to start traversing on.\n * @return {NodeIterator} The created NodeIterator\n */\n const _createNodeIterator = function _createNodeIterator(root) {\n return createNodeIterator.call(root.ownerDocument || root, root,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);\n };\n\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n const _isClobbered = function _isClobbered(elm) {\n return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n };\n\n /**\n * Checks whether the given object is a DOM node.\n *\n * @param {Node} object object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n const _isNode = function _isNode(object) {\n return typeof Node === 'function' && object instanceof Node;\n };\n\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n const _executeHook = function _executeHook(entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n arrayForEach(hooks[entryPoint], hook => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n const _sanitizeElements = function _sanitizeElements(currentNode) {\n let content = null;\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeElements', currentNode, null);\n\n /* Check if element is clobbered or can clobber */\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Now let's check the element's type and name */\n const tagName = transformCaseFunc(currentNode.nodeName);\n\n /* Execute a hook if present */\n _executeHook('uponSanitizeElement', currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS\n });\n\n /* Detect mXSS attempts abusing namespace confusion */\n if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove element if anything forbids its presence */\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n /* Check if we have a custom element to handle */\n if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {\n return false;\n }\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {\n return false;\n }\n }\n\n /* Keep content except for bad-listed elements */\n if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n if (childNodes && parentNode) {\n const childCount = childNodes.length;\n for (let i = childCount - 1; i >= 0; --i) {\n parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n }\n }\n }\n _forceRemove(currentNode);\n return true;\n }\n\n /* Check whether element has a valid namespace */\n if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Make sure that older browsers don't get fallback-tag mXSS */\n if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Sanitize element content to be template-safe */\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n /* Get the element's text content */\n content = currentNode.textContent;\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n content = stringReplace(content, expr, ' ');\n });\n if (currentNode.textContent !== content) {\n arrayPush(DOMPurify.removed, {\n element: currentNode.cloneNode()\n });\n currentNode.textContent = content;\n }\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeElements', currentNode, null);\n return false;\n };\n\n /**\n * _isValidAttribute\n *\n * @param {string} lcTag Lowercase tag name of containing element.\n * @param {string} lcName Lowercase attribute name.\n * @param {string} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid, otherwise false.\n */\n // eslint-disable-next-line complexity\n const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n /* Make sure attribute cannot clobber */\n if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n return false;\n }\n\n /* Allow valid data-* attributes: At least one character after \"-\"\n (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n We don't need to check the value; it's always URI safe. */\n if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n if (\n // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||\n // Alternative, second condition checks if it's an `is`-attribute, AND\n // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {\n return false;\n }\n /* Check value is safe. First, is attr inert? If so, is safe */\n } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {\n return false;\n } else ;\n return true;\n };\n\n /**\n * _isBasicCustomElement\n * checks if at least one dash is included in tagName, and it's not the first char\n * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n *\n * @param {string} tagName name of the tag of the node to sanitize\n * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n */\n const _isBasicCustomElement = function _isBasicCustomElement(tagName) {\n return tagName !== 'annotation-xml' && tagName.indexOf('-') > 0;\n };\n\n /**\n * _sanitizeAttributes\n *\n * @protect attributes\n * @protect nodeName\n * @protect removeAttribute\n * @protect setAttribute\n *\n * @param {Node} currentNode to sanitize\n */\n const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n /* Execute a hook if present */\n _executeHook('beforeSanitizeAttributes', currentNode, null);\n const {\n attributes\n } = currentNode;\n\n /* Check if we have attributes; if not we might have a text node */\n if (!attributes) {\n return;\n }\n const hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR\n };\n let l = attributes.length;\n\n /* Go backwards over all attributes; safely remove bad ones */\n while (l--) {\n const attr = attributes[l];\n const {\n name,\n namespaceURI,\n value: attrValue\n } = attr;\n const lcName = transformCaseFunc(name);\n let value = name === 'value' ? attrValue : stringTrim(attrValue);\n\n /* Execute a hook if present */\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n value = hookEvent.attrValue;\n /* Did the hooks approve of the attribute? */\n if (hookEvent.forceKeepAttr) {\n continue;\n }\n\n /* Remove attribute */\n _removeAttribute(name, currentNode);\n\n /* Did the hooks approve of the attribute? */\n if (!hookEvent.keepAttr) {\n continue;\n }\n\n /* Work around a security issue in jQuery 3.0 */\n if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n\n /* Sanitize attribute content to be template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n value = stringReplace(value, expr, ' ');\n });\n }\n\n /* Is `value` valid for this attribute? */\n const lcTag = transformCaseFunc(currentNode.nodeName);\n if (!_isValidAttribute(lcTag, lcName, value)) {\n continue;\n }\n\n /* Full DOM Clobbering protection via namespace isolation,\n * Prefix id and name attributes with `user-content-`\n */\n if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n // Remove the attribute with this value\n _removeAttribute(name, currentNode);\n\n // Prefix the value and later re-create the attribute with the sanitized value\n value = SANITIZE_NAMED_PROPS_PREFIX + value;\n }\n\n /* Handle attributes that require Trusted Types */\n if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n if (namespaceURI) ; else {\n switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n case 'TrustedHTML':\n {\n value = trustedTypesPolicy.createHTML(value);\n break;\n }\n case 'TrustedScriptURL':\n {\n value = trustedTypesPolicy.createScriptURL(value);\n break;\n }\n }\n }\n }\n\n /* Handle invalid data-* attribute set by try-catching it */\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n arrayPop(DOMPurify.removed);\n } catch (_) {}\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeAttributes', currentNode, null);\n };\n\n /**\n * _sanitizeShadowDOM\n *\n * @param {DocumentFragment} fragment to iterate over recursively\n */\n const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n let shadowNode = null;\n const shadowIterator = _createNodeIterator(fragment);\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeShadowDOM', fragment, null);\n while (shadowNode = shadowIterator.nextNode()) {\n /* Execute a hook if present */\n _executeHook('uponSanitizeShadowNode', shadowNode, null);\n\n /* Sanitize tags and elements */\n if (_sanitizeElements(shadowNode)) {\n continue;\n }\n\n /* Deep shadow DOM detected */\n if (shadowNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(shadowNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(shadowNode);\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeShadowDOM', fragment, null);\n };\n\n /**\n * Sanitize\n * Public method providing core sanitation functionality\n *\n * @param {String|Node} dirty string or DOM node\n * @param {Object} cfg object\n */\n // eslint-disable-next-line complexity\n DOMPurify.sanitize = function (dirty) {\n let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n let body = null;\n let importedNode = null;\n let currentNode = null;\n let returnNode = null;\n /* Make sure we have a string to sanitize.\n DO NOT return early, as this will return the wrong type if\n the user has requested a DOM object rather than a string */\n IS_EMPTY_INPUT = !dirty;\n if (IS_EMPTY_INPUT) {\n dirty = '<!-->';\n }\n\n /* Stringify, in case dirty is an object */\n if (typeof dirty !== 'string' && !_isNode(dirty)) {\n if (typeof dirty.toString === 'function') {\n dirty = dirty.toString();\n if (typeof dirty !== 'string') {\n throw typeErrorCreate('dirty is not a string, aborting');\n }\n } else {\n throw typeErrorCreate('toString is not a function');\n }\n }\n\n /* Return dirty HTML if DOMPurify cannot run */\n if (!DOMPurify.isSupported) {\n return dirty;\n }\n\n /* Assign config vars */\n if (!SET_CONFIG) {\n _parseConfig(cfg);\n }\n\n /* Clean up removed elements */\n DOMPurify.removed = [];\n\n /* Check if dirty is correctly typed for IN_PLACE */\n if (typeof dirty === 'string') {\n IN_PLACE = false;\n }\n if (IN_PLACE) {\n /* Do some early pre-sanitization to avoid unsafe root nodes */\n if (dirty.nodeName) {\n const tagName = transformCaseFunc(dirty.nodeName);\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n }\n }\n } else if (dirty instanceof Node) {\n /* If dirty is a DOM element, append to an empty document to avoid\n elements being stripped by the parser */\n body = _initDocument('<!---->');\n importedNode = body.ownerDocument.importNode(dirty, true);\n if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n /* Node is already a body, use as is */\n body = importedNode;\n } else if (importedNode.nodeName === 'HTML') {\n body = importedNode;\n } else {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n body.appendChild(importedNode);\n }\n } else {\n /* Exit directly if we have nothing to do */\n if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&\n // eslint-disable-next-line unicorn/prefer-includes\n dirty.indexOf('<') === -1) {\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n }\n\n /* Initialize the document to work on */\n body = _initDocument(dirty);\n\n /* Check we have a DOM node from the data */\n if (!body) {\n return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n }\n }\n\n /* Remove first element node (ours) if FORCE_BODY is set */\n if (body && FORCE_BODY) {\n _forceRemove(body.firstChild);\n }\n\n /* Get node iterator */\n const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n\n /* Now start iterating over the created document */\n while (currentNode = nodeIterator.nextNode()) {\n /* Sanitize tags and elements */\n if (_sanitizeElements(currentNode)) {\n continue;\n }\n\n /* Shadow DOM detected, sanitize it */\n if (currentNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(currentNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(currentNode);\n }\n\n /* If we sanitized `dirty` in-place, return it. */\n if (IN_PLACE) {\n return dirty;\n }\n\n /* Return sanitized string or DOM */\n if (RETURN_DOM) {\n if (RETURN_DOM_FRAGMENT) {\n returnNode = createDocumentFragment.call(body.ownerDocument);\n while (body.firstChild) {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n returnNode.appendChild(body.firstChild);\n }\n } else {\n returnNode = body;\n }\n if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n /*\n AdoptNode() is not used because internal state is not reset\n (e.g. the past names map of a HTMLFormElement), this is safe\n in theory but we would rather not risk another attack vector.\n The state that is cloned by importNode() is explicitly defined\n by the specs.\n */\n returnNode = importNode.call(originalDocument, returnNode, true);\n }\n return returnNode;\n }\n let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n\n /* Serialize doctype if allowed */\n if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n }\n\n /* Sanitize final string template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n serializedHTML = stringReplace(serializedHTML, expr, ' ');\n });\n }\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n };\n\n /**\n * Public method to set the configuration once\n * setConfig\n *\n * @param {Object} cfg configuration object\n */\n DOMPurify.setConfig = function () {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _parseConfig(cfg);\n SET_CONFIG = true;\n };\n\n /**\n * Public method to remove the configuration\n * clearConfig\n *\n */\n DOMPurify.clearConfig = function () {\n CONFIG = null;\n SET_CONFIG = false;\n };\n\n /**\n * Public method to check if an attribute value is valid.\n * Uses last set config, if any. Otherwise, uses config defaults.\n * isValidAttribute\n *\n * @param {String} tag Tag name of containing element.\n * @param {String} attr Attribute name.\n * @param {String} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n */\n DOMPurify.isValidAttribute = function (tag, attr, value) {\n /* Initialize shared config vars if necessary. */\n if (!CONFIG) {\n _parseConfig({});\n }\n const lcTag = transformCaseFunc(tag);\n const lcName = transformCaseFunc(attr);\n return _isValidAttribute(lcTag, lcName, value);\n };\n\n /**\n * AddHook\n * Public method to add DOMPurify hooks\n *\n * @param {String} entryPoint entry point for the hook to add\n * @param {Function} hookFunction function to execute\n */\n DOMPurify.addHook = function (entryPoint, hookFunction) {\n if (typeof hookFunction !== 'function') {\n return;\n }\n hooks[entryPoint] = hooks[entryPoint] || [];\n arrayPush(hooks[entryPoint], hookFunction);\n };\n\n /**\n * RemoveHook\n * Public method to remove a DOMPurify hook at a given entryPoint\n * (pops it from the stack of hooks if more are present)\n *\n * @param {String} entryPoint entry point for the hook to remove\n * @return {Function} removed(popped) hook\n */\n DOMPurify.removeHook = function (entryPoint) {\n if (hooks[entryPoint]) {\n return arrayPop(hooks[entryPoint]);\n }\n };\n\n /**\n * RemoveHooks\n * Public method to remove all DOMPurify hooks at a given entryPoint\n *\n * @param {String} entryPoint entry point for the hooks to remove\n */\n DOMPurify.removeHooks = function (entryPoint) {\n if (hooks[entryPoint]) {\n hooks[entryPoint] = [];\n }\n };\n\n /**\n * RemoveAllHooks\n * Public method to remove all DOMPurify hooks\n */\n DOMPurify.removeAllHooks = function () {\n hooks = {};\n };\n return DOMPurify;\n }\n var purify = createDOMPurify();\n\n return purify;\n\n}));\n//# sourceMappingURL=purify.js.map\n\n\n//# sourceURL=webpack://Formio/./node_modules/dompurify/dist/purify.js?");
|
4293
|
+
eval("/*! @license DOMPurify 3.0.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.11/LICENSE */\n\n(function (global, factory) {\n true ? module.exports = factory() :\n 0;\n})(this, (function () { 'use strict';\n\n const {\n entries,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor\n } = Object;\n let {\n freeze,\n seal,\n create\n } = Object; // eslint-disable-line import/no-mutable-exports\n let {\n apply,\n construct\n } = typeof Reflect !== 'undefined' && Reflect;\n if (!freeze) {\n freeze = function freeze(x) {\n return x;\n };\n }\n if (!seal) {\n seal = function seal(x) {\n return x;\n };\n }\n if (!apply) {\n apply = function apply(fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n }\n if (!construct) {\n construct = function construct(Func, args) {\n return new Func(...args);\n };\n }\n const arrayForEach = unapply(Array.prototype.forEach);\n const arrayPop = unapply(Array.prototype.pop);\n const arrayPush = unapply(Array.prototype.push);\n const stringToLowerCase = unapply(String.prototype.toLowerCase);\n const stringToString = unapply(String.prototype.toString);\n const stringMatch = unapply(String.prototype.match);\n const stringReplace = unapply(String.prototype.replace);\n const stringIndexOf = unapply(String.prototype.indexOf);\n const stringTrim = unapply(String.prototype.trim);\n const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);\n const regExpTest = unapply(RegExp.prototype.test);\n const typeErrorCreate = unconstruct(TypeError);\n\n /**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param {Function} func - The function to be wrapped and called.\n * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.\n */\n function unapply(func) {\n return function (thisArg) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n return apply(func, thisArg, args);\n };\n }\n\n /**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param {Function} func - The constructor function to be wrapped and called.\n * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.\n */\n function unconstruct(func) {\n return function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return construct(func, args);\n };\n }\n\n /**\n * Add properties to a lookup table\n *\n * @param {Object} set - The set to which elements will be added.\n * @param {Array} array - The array containing elements to be added to the set.\n * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns {Object} The modified set with added elements.\n */\n function addToSet(set, array) {\n let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n let l = array.length;\n while (l--) {\n let element = array[l];\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n element = lcElement;\n }\n }\n set[element] = true;\n }\n return set;\n }\n\n /**\n * Clean up an array to harden against CSPP\n *\n * @param {Array} array - The array to be cleaned.\n * @returns {Array} The cleaned version of the array\n */\n function cleanArray(array) {\n for (let index = 0; index < array.length; index++) {\n const isPropertyExist = objectHasOwnProperty(array, index);\n if (!isPropertyExist) {\n array[index] = null;\n }\n }\n return array;\n }\n\n /**\n * Shallow clone an object\n *\n * @param {Object} object - The object to be cloned.\n * @returns {Object} A new object that copies the original.\n */\n function clone(object) {\n const newObject = create(null);\n for (const [property, value] of entries(object)) {\n const isPropertyExist = objectHasOwnProperty(object, property);\n if (isPropertyExist) {\n if (Array.isArray(value)) {\n newObject[property] = cleanArray(value);\n } else if (value && typeof value === 'object' && value.constructor === Object) {\n newObject[property] = clone(value);\n } else {\n newObject[property] = value;\n }\n }\n }\n return newObject;\n }\n\n /**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param {Object} object - The object to look up the getter function in its prototype chain.\n * @param {String} prop - The property name for which to find the getter function.\n * @returns {Function} The getter function found in the prototype chain or a fallback function.\n */\n function lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n object = getPrototypeOf(object);\n }\n function fallbackValue() {\n return null;\n }\n return fallbackValue;\n }\n\n const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);\n\n // SVG\n const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\n const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);\n\n // List of SVG elements that are disallowed by default.\n // We still need to know them so that we can do namespace\n // checks properly in case one wants to add them to\n // allow-list.\n const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\n const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);\n\n // Similarly to SVG, we want to know all MathML elements,\n // even those that we disallow by default.\n const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\n const text = freeze(['#text']);\n\n const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\n const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\n const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\n const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n // eslint-disable-next-line unicorn/better-regex\n const MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n const ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\n const TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\n const DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n const ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n );\n\n const IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\n const ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n );\n\n const DOCTYPE_NAME = seal(/^html$/i);\n const CUSTOM_ELEMENT = seal(/^[a-z][.\\w]*(-[.\\w]+)+$/i);\n\n var EXPRESSIONS = /*#__PURE__*/Object.freeze({\n __proto__: null,\n MUSTACHE_EXPR: MUSTACHE_EXPR,\n ERB_EXPR: ERB_EXPR,\n TMPLIT_EXPR: TMPLIT_EXPR,\n DATA_ATTR: DATA_ATTR,\n ARIA_ATTR: ARIA_ATTR,\n IS_ALLOWED_URI: IS_ALLOWED_URI,\n IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE: ATTR_WHITESPACE,\n DOCTYPE_NAME: DOCTYPE_NAME,\n CUSTOM_ELEMENT: CUSTOM_ELEMENT\n });\n\n const getGlobal = function getGlobal() {\n return typeof window === 'undefined' ? null : window;\n };\n\n /**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\n const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n return null;\n }\n\n // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n suffix = purifyHostElement.getAttribute(ATTR_NAME);\n }\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n createScriptURL(scriptUrl) {\n return scriptUrl;\n }\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n return null;\n }\n };\n function createDOMPurify() {\n let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n const DOMPurify = root => createDOMPurify(root);\n\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n DOMPurify.version = '3.0.11';\n\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n DOMPurify.removed = [];\n if (!window || !window.document || window.document.nodeType !== 9) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n return DOMPurify;\n }\n let {\n document\n } = window;\n const originalDocument = document;\n const currentScript = originalDocument.currentScript;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes\n } = window;\n const ElementPrototype = Element.prototype;\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n\n // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n let trustedTypesPolicy;\n let emptyHTML = '';\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName\n } = document;\n const {\n importNode\n } = originalDocument;\n let hooks = {};\n\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n TMPLIT_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE,\n CUSTOM_ELEMENT\n } = EXPRESSIONS;\n let {\n IS_ALLOWED_URI: IS_ALLOWED_URI$1\n } = EXPRESSIONS;\n\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n\n /* Allowed attribute names */\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false\n }\n }));\n\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n let FORBID_TAGS = null;\n\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n let FORBID_ATTR = null;\n\n /* Decide if ARIA attributes are okay */\n let ALLOW_ARIA_ATTR = true;\n\n /* Decide if custom data attributes are okay */\n let ALLOW_DATA_ATTR = true;\n\n /* Decide if unknown protocols are okay */\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n\n /* Decide if self-closing tags in attributes are allowed.\n * Usually removed due to a mXSS issue in jQuery 3.0 */\n let ALLOW_SELF_CLOSE_IN_ATTR = true;\n\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n let SAFE_FOR_TEMPLATES = false;\n\n /* Decide if document with <html>... should be returned */\n let WHOLE_DOCUMENT = false;\n\n /* Track whether config is already set on this instance of DOMPurify. */\n let SET_CONFIG = false;\n\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n let FORCE_BODY = false;\n\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n let RETURN_DOM = false;\n\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n let RETURN_DOM_FRAGMENT = false;\n\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n let RETURN_TRUSTED_TYPE = false;\n\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n let SANITIZE_DOM = true;\n\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n let SANITIZE_NAMED_PROPS = false;\n const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n\n /* Keep element content when removing element? */\n let KEEP_CONTENT = true;\n\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n let IN_PLACE = false;\n\n /* Allow usage of profiles like html, svg and mathMl */\n let USE_PROFILES = {};\n\n /* Tags to ignore content of when KEEP_CONTENT is true */\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n\n /* Tags that are safe for data: URIs */\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n\n /* Attributes safe for values like \"javascript:\" */\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n\n /* Allowed XHTML+XML namespaces */\n let ALLOWED_NAMESPACES = null;\n const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n\n /* Parsing of strict XHTML documents */\n let PARSER_MEDIA_TYPE = null;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc = null;\n\n /* Keep a reference to config to pass to hooks */\n let CONFIG = null;\n\n /* Ideally, do not touch anything below this line */\n /* ______________________________________________ */\n\n const formElement = document.createElement('form');\n const isRegexOrFunction = function isRegexOrFunction(testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n const _parseConfig = function _parseConfig() {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n\n /* Shield configuration object from tampering */\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n\n /* Shield configuration object from prototype pollution */\n cfg = clone(cfg);\n PARSER_MEDIA_TYPE =\n // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;\n\n // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n\n /* Set configuration parameters */\n ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),\n // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR,\n // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS),\n // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS,\n // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n\n /* Parse profile info */\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, text);\n ALLOWED_ATTR = [];\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, html$1);\n addToSet(ALLOWED_ATTR, html);\n }\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, svg$1);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, svgFilters);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, mathMl$1);\n addToSet(ALLOWED_ATTR, mathMl);\n addToSet(ALLOWED_ATTR, xml);\n }\n }\n\n /* Merge configuration parameters */\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n\n /* Add #text in case KEEP_CONTENT is set to true */\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n if (cfg.TRUSTED_TYPES_POLICY) {\n if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n }\n if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n }\n\n // Overwrite existing TrustedTypes policy.\n trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;\n\n // Sign local variables required by `sanitize`.\n emptyHTML = trustedTypesPolicy.createHTML('');\n } else {\n // Uninitialized policy, attempt to initialize the internal dompurify policy.\n if (trustedTypesPolicy === undefined) {\n trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n }\n\n // If creating the internal policy succeeded sign internal variables.\n if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n emptyHTML = trustedTypesPolicy.createHTML('');\n }\n }\n\n // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n if (freeze) {\n freeze(cfg);\n }\n CONFIG = cfg;\n };\n const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);\n\n // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);\n const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);\n\n /**\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n const _checkValidNamespace = function _checkValidNamespace(element) {\n let parent = getParentNode(element);\n\n // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template'\n };\n }\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via <svg>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n }\n\n // The only way to switch from MathML to SVG is via`\n // svg if parent is either <annotation-xml> or MathML\n // text integration points.\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n }\n\n // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via <math>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n }\n\n // The only way to switch from SVG to MathML is via\n // <math> and HTML integration points\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n }\n\n // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n\n // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n }\n\n // For XHTML and XML documents that support custom namespaces\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n return true;\n }\n\n // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n return false;\n };\n\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n const _forceRemove = function _forceRemove(node) {\n arrayPush(DOMPurify.removed, {\n element: node\n });\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n node.parentNode.removeChild(node);\n } catch (_) {\n node.remove();\n }\n };\n\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n const _removeAttribute = function _removeAttribute(name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node\n });\n }\n node.removeAttribute(name);\n\n // We void attribute values for unremovable \"is\"\" attributes\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n const _initDocument = function _initDocument(dirty) {\n /* Create a HTML document */\n let doc = null;\n let leadingWhitespace = null;\n if (FORCE_BODY) {\n dirty = '<remove></remove>' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n }\n const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n\n /* Use createHTMLDocument in case DOMParser is not available */\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n } catch (_) {\n // Syntax error if dirtyPayload is invalid xml\n }\n }\n const body = doc.body || doc.documentElement;\n if (dirty && leadingWhitespace) {\n body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n }\n\n /* Work on whole document or just its body */\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n }\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n *\n * @param {Node} root The root element or node to start traversing on.\n * @return {NodeIterator} The created NodeIterator\n */\n const _createNodeIterator = function _createNodeIterator(root) {\n return createNodeIterator.call(root.ownerDocument || root, root,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);\n };\n\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n const _isClobbered = function _isClobbered(elm) {\n return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n };\n\n /**\n * Checks whether the given object is a DOM node.\n *\n * @param {Node} object object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n const _isNode = function _isNode(object) {\n return typeof Node === 'function' && object instanceof Node;\n };\n\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n const _executeHook = function _executeHook(entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n arrayForEach(hooks[entryPoint], hook => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n const _sanitizeElements = function _sanitizeElements(currentNode) {\n let content = null;\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeElements', currentNode, null);\n\n /* Check if element is clobbered or can clobber */\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Now let's check the element's type and name */\n const tagName = transformCaseFunc(currentNode.nodeName);\n\n /* Execute a hook if present */\n _executeHook('uponSanitizeElement', currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS\n });\n\n /* Detect mXSS attempts abusing namespace confusion */\n if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove any ocurrence of processing instructions */\n if (currentNode.nodeType === 7) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove element if anything forbids its presence */\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n /* Check if we have a custom element to handle */\n if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {\n return false;\n }\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {\n return false;\n }\n }\n\n /* Keep content except for bad-listed elements */\n if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n if (childNodes && parentNode) {\n const childCount = childNodes.length;\n for (let i = childCount - 1; i >= 0; --i) {\n parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n }\n }\n }\n _forceRemove(currentNode);\n return true;\n }\n\n /* Check whether element has a valid namespace */\n if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Make sure that older browsers don't get fallback-tag mXSS */\n if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Sanitize element content to be template-safe */\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n /* Get the element's text content */\n content = currentNode.textContent;\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n content = stringReplace(content, expr, ' ');\n });\n if (currentNode.textContent !== content) {\n arrayPush(DOMPurify.removed, {\n element: currentNode.cloneNode()\n });\n currentNode.textContent = content;\n }\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeElements', currentNode, null);\n return false;\n };\n\n /**\n * _isValidAttribute\n *\n * @param {string} lcTag Lowercase tag name of containing element.\n * @param {string} lcName Lowercase attribute name.\n * @param {string} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid, otherwise false.\n */\n // eslint-disable-next-line complexity\n const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n /* Make sure attribute cannot clobber */\n if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n return false;\n }\n\n /* Allow valid data-* attributes: At least one character after \"-\"\n (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n We don't need to check the value; it's always URI safe. */\n if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n if (\n // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||\n // Alternative, second condition checks if it's an `is`-attribute, AND\n // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {\n return false;\n }\n /* Check value is safe. First, is attr inert? If so, is safe */\n } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {\n return false;\n } else ;\n return true;\n };\n\n /**\n * _isBasicCustomElement\n * checks if at least one dash is included in tagName, and it's not the first char\n * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n *\n * @param {string} tagName name of the tag of the node to sanitize\n * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n */\n const _isBasicCustomElement = function _isBasicCustomElement(tagName) {\n return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);\n };\n\n /**\n * _sanitizeAttributes\n *\n * @protect attributes\n * @protect nodeName\n * @protect removeAttribute\n * @protect setAttribute\n *\n * @param {Node} currentNode to sanitize\n */\n const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n /* Execute a hook if present */\n _executeHook('beforeSanitizeAttributes', currentNode, null);\n const {\n attributes\n } = currentNode;\n\n /* Check if we have attributes; if not we might have a text node */\n if (!attributes) {\n return;\n }\n const hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR\n };\n let l = attributes.length;\n\n /* Go backwards over all attributes; safely remove bad ones */\n while (l--) {\n const attr = attributes[l];\n const {\n name,\n namespaceURI,\n value: attrValue\n } = attr;\n const lcName = transformCaseFunc(name);\n let value = name === 'value' ? attrValue : stringTrim(attrValue);\n\n /* Execute a hook if present */\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n value = hookEvent.attrValue;\n /* Did the hooks approve of the attribute? */\n if (hookEvent.forceKeepAttr) {\n continue;\n }\n\n /* Remove attribute */\n _removeAttribute(name, currentNode);\n\n /* Did the hooks approve of the attribute? */\n if (!hookEvent.keepAttr) {\n continue;\n }\n\n /* Work around a security issue in jQuery 3.0 */\n if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n\n /* Sanitize attribute content to be template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n value = stringReplace(value, expr, ' ');\n });\n }\n\n /* Is `value` valid for this attribute? */\n const lcTag = transformCaseFunc(currentNode.nodeName);\n if (!_isValidAttribute(lcTag, lcName, value)) {\n continue;\n }\n\n /* Full DOM Clobbering protection via namespace isolation,\n * Prefix id and name attributes with `user-content-`\n */\n if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n // Remove the attribute with this value\n _removeAttribute(name, currentNode);\n\n // Prefix the value and later re-create the attribute with the sanitized value\n value = SANITIZE_NAMED_PROPS_PREFIX + value;\n }\n\n /* Handle attributes that require Trusted Types */\n if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n if (namespaceURI) ; else {\n switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n case 'TrustedHTML':\n {\n value = trustedTypesPolicy.createHTML(value);\n break;\n }\n case 'TrustedScriptURL':\n {\n value = trustedTypesPolicy.createScriptURL(value);\n break;\n }\n }\n }\n }\n\n /* Handle invalid data-* attribute set by try-catching it */\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n arrayPop(DOMPurify.removed);\n } catch (_) {}\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeAttributes', currentNode, null);\n };\n\n /**\n * _sanitizeShadowDOM\n *\n * @param {DocumentFragment} fragment to iterate over recursively\n */\n const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n let shadowNode = null;\n const shadowIterator = _createNodeIterator(fragment);\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeShadowDOM', fragment, null);\n while (shadowNode = shadowIterator.nextNode()) {\n /* Execute a hook if present */\n _executeHook('uponSanitizeShadowNode', shadowNode, null);\n\n /* Sanitize tags and elements */\n if (_sanitizeElements(shadowNode)) {\n continue;\n }\n\n /* Deep shadow DOM detected */\n if (shadowNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(shadowNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(shadowNode);\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeShadowDOM', fragment, null);\n };\n\n /**\n * Sanitize\n * Public method providing core sanitation functionality\n *\n * @param {String|Node} dirty string or DOM node\n * @param {Object} cfg object\n */\n // eslint-disable-next-line complexity\n DOMPurify.sanitize = function (dirty) {\n let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n let body = null;\n let importedNode = null;\n let currentNode = null;\n let returnNode = null;\n /* Make sure we have a string to sanitize.\n DO NOT return early, as this will return the wrong type if\n the user has requested a DOM object rather than a string */\n IS_EMPTY_INPUT = !dirty;\n if (IS_EMPTY_INPUT) {\n dirty = '<!-->';\n }\n\n /* Stringify, in case dirty is an object */\n if (typeof dirty !== 'string' && !_isNode(dirty)) {\n if (typeof dirty.toString === 'function') {\n dirty = dirty.toString();\n if (typeof dirty !== 'string') {\n throw typeErrorCreate('dirty is not a string, aborting');\n }\n } else {\n throw typeErrorCreate('toString is not a function');\n }\n }\n\n /* Return dirty HTML if DOMPurify cannot run */\n if (!DOMPurify.isSupported) {\n return dirty;\n }\n\n /* Assign config vars */\n if (!SET_CONFIG) {\n _parseConfig(cfg);\n }\n\n /* Clean up removed elements */\n DOMPurify.removed = [];\n\n /* Check if dirty is correctly typed for IN_PLACE */\n if (typeof dirty === 'string') {\n IN_PLACE = false;\n }\n if (IN_PLACE) {\n /* Do some early pre-sanitization to avoid unsafe root nodes */\n if (dirty.nodeName) {\n const tagName = transformCaseFunc(dirty.nodeName);\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n }\n }\n } else if (dirty instanceof Node) {\n /* If dirty is a DOM element, append to an empty document to avoid\n elements being stripped by the parser */\n body = _initDocument('<!---->');\n importedNode = body.ownerDocument.importNode(dirty, true);\n if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n /* Node is already a body, use as is */\n body = importedNode;\n } else if (importedNode.nodeName === 'HTML') {\n body = importedNode;\n } else {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n body.appendChild(importedNode);\n }\n } else {\n /* Exit directly if we have nothing to do */\n if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&\n // eslint-disable-next-line unicorn/prefer-includes\n dirty.indexOf('<') === -1) {\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n }\n\n /* Initialize the document to work on */\n body = _initDocument(dirty);\n\n /* Check we have a DOM node from the data */\n if (!body) {\n return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n }\n }\n\n /* Remove first element node (ours) if FORCE_BODY is set */\n if (body && FORCE_BODY) {\n _forceRemove(body.firstChild);\n }\n\n /* Get node iterator */\n const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n\n /* Now start iterating over the created document */\n while (currentNode = nodeIterator.nextNode()) {\n /* Sanitize tags and elements */\n if (_sanitizeElements(currentNode)) {\n continue;\n }\n\n /* Shadow DOM detected, sanitize it */\n if (currentNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(currentNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(currentNode);\n }\n\n /* If we sanitized `dirty` in-place, return it. */\n if (IN_PLACE) {\n return dirty;\n }\n\n /* Return sanitized string or DOM */\n if (RETURN_DOM) {\n if (RETURN_DOM_FRAGMENT) {\n returnNode = createDocumentFragment.call(body.ownerDocument);\n while (body.firstChild) {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n returnNode.appendChild(body.firstChild);\n }\n } else {\n returnNode = body;\n }\n if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n /*\n AdoptNode() is not used because internal state is not reset\n (e.g. the past names map of a HTMLFormElement), this is safe\n in theory but we would rather not risk another attack vector.\n The state that is cloned by importNode() is explicitly defined\n by the specs.\n */\n returnNode = importNode.call(originalDocument, returnNode, true);\n }\n return returnNode;\n }\n let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n\n /* Serialize doctype if allowed */\n if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n }\n\n /* Sanitize final string template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n serializedHTML = stringReplace(serializedHTML, expr, ' ');\n });\n }\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n };\n\n /**\n * Public method to set the configuration once\n * setConfig\n *\n * @param {Object} cfg configuration object\n */\n DOMPurify.setConfig = function () {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _parseConfig(cfg);\n SET_CONFIG = true;\n };\n\n /**\n * Public method to remove the configuration\n * clearConfig\n *\n */\n DOMPurify.clearConfig = function () {\n CONFIG = null;\n SET_CONFIG = false;\n };\n\n /**\n * Public method to check if an attribute value is valid.\n * Uses last set config, if any. Otherwise, uses config defaults.\n * isValidAttribute\n *\n * @param {String} tag Tag name of containing element.\n * @param {String} attr Attribute name.\n * @param {String} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n */\n DOMPurify.isValidAttribute = function (tag, attr, value) {\n /* Initialize shared config vars if necessary. */\n if (!CONFIG) {\n _parseConfig({});\n }\n const lcTag = transformCaseFunc(tag);\n const lcName = transformCaseFunc(attr);\n return _isValidAttribute(lcTag, lcName, value);\n };\n\n /**\n * AddHook\n * Public method to add DOMPurify hooks\n *\n * @param {String} entryPoint entry point for the hook to add\n * @param {Function} hookFunction function to execute\n */\n DOMPurify.addHook = function (entryPoint, hookFunction) {\n if (typeof hookFunction !== 'function') {\n return;\n }\n hooks[entryPoint] = hooks[entryPoint] || [];\n arrayPush(hooks[entryPoint], hookFunction);\n };\n\n /**\n * RemoveHook\n * Public method to remove a DOMPurify hook at a given entryPoint\n * (pops it from the stack of hooks if more are present)\n *\n * @param {String} entryPoint entry point for the hook to remove\n * @return {Function} removed(popped) hook\n */\n DOMPurify.removeHook = function (entryPoint) {\n if (hooks[entryPoint]) {\n return arrayPop(hooks[entryPoint]);\n }\n };\n\n /**\n * RemoveHooks\n * Public method to remove all DOMPurify hooks at a given entryPoint\n *\n * @param {String} entryPoint entry point for the hooks to remove\n */\n DOMPurify.removeHooks = function (entryPoint) {\n if (hooks[entryPoint]) {\n hooks[entryPoint] = [];\n }\n };\n\n /**\n * RemoveAllHooks\n * Public method to remove all DOMPurify hooks\n */\n DOMPurify.removeAllHooks = function () {\n hooks = {};\n };\n return DOMPurify;\n }\n var purify = createDOMPurify();\n\n return purify;\n\n}));\n//# sourceMappingURL=purify.js.map\n\n\n//# sourceURL=webpack://Formio/./node_modules/dompurify/dist/purify.js?");
|
4261
4294
|
|
4262
4295
|
/***/ }),
|
4263
4296
|
|
@@ -6051,7 +6084,7 @@ eval("/* module decorator */ module = __webpack_require__.nmd(module);\n//! mome
|
|
6051
6084
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
6052
6085
|
|
6053
6086
|
"use strict";
|
6054
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SignaturePad; }\n/* harmony export */ });\n/*!\n * Signature Pad v4.1.7 | https://github.com/szimek/signature_pad\n * (c) 2023 Szymon Nowak | Released under the MIT license\n */\n\nclass Point {\n constructor(x, y, pressure, time) {\n if (isNaN(x) || isNaN(y)) {\n throw new Error(`Point is invalid: (${x}, ${y})`);\n }\n this.x = +x;\n this.y = +y;\n this.pressure = pressure || 0;\n this.time = time || Date.now();\n }\n distanceTo(start) {\n return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));\n }\n equals(other) {\n return (this.x === other.x &&\n this.y === other.y &&\n this.pressure === other.pressure &&\n this.time === other.time);\n }\n velocityFrom(start) {\n return this.time !== start.time\n ? this.distanceTo(start) / (this.time - start.time)\n : 0;\n }\n}\n\nclass Bezier {\n static fromPoints(points, widths) {\n const c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;\n const c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;\n return new Bezier(points[1], c2, c3, points[2], widths.start, widths.end);\n }\n static calculateControlPoints(s1, s2, s3) {\n const dx1 = s1.x - s2.x;\n const dy1 = s1.y - s2.y;\n const dx2 = s2.x - s3.x;\n const dy2 = s2.y - s3.y;\n const m1 = { x: (s1.x + s2.x) / 2.0, y: (s1.y + s2.y) / 2.0 };\n const m2 = { x: (s2.x + s3.x) / 2.0, y: (s2.y + s3.y) / 2.0 };\n const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);\n const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);\n const dxm = m1.x - m2.x;\n const dym = m1.y - m2.y;\n const k = l2 / (l1 + l2);\n const cm = { x: m2.x + dxm * k, y: m2.y + dym * k };\n const tx = s2.x - cm.x;\n const ty = s2.y - cm.y;\n return {\n c1: new Point(m1.x + tx, m1.y + ty),\n c2: new Point(m2.x + tx, m2.y + ty),\n };\n }\n constructor(startPoint, control2, control1, endPoint, startWidth, endWidth) {\n this.startPoint = startPoint;\n this.control2 = control2;\n this.control1 = control1;\n this.endPoint = endPoint;\n this.startWidth = startWidth;\n this.endWidth = endWidth;\n }\n length() {\n const steps = 10;\n let length = 0;\n let px;\n let py;\n for (let i = 0; i <= steps; i += 1) {\n const t = i / steps;\n const cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);\n const cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);\n if (i > 0) {\n const xdiff = cx - px;\n const ydiff = cy - py;\n length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n }\n px = cx;\n py = cy;\n }\n return length;\n }\n point(t, start, c1, c2, end) {\n return (start * (1.0 - t) * (1.0 - t) * (1.0 - t))\n + (3.0 * c1 * (1.0 - t) * (1.0 - t) * t)\n + (3.0 * c2 * (1.0 - t) * t * t)\n + (end * t * t * t);\n }\n}\n\nclass SignatureEventTarget {\n constructor() {\n try {\n this._et = new EventTarget();\n }\n catch (error) {\n this._et = document;\n }\n }\n addEventListener(type, listener, options) {\n this._et.addEventListener(type, listener, options);\n }\n dispatchEvent(event) {\n return this._et.dispatchEvent(event);\n }\n removeEventListener(type, callback, options) {\n this._et.removeEventListener(type, callback, options);\n }\n}\n\nfunction throttle(fn, wait = 250) {\n let previous = 0;\n let timeout = null;\n let result;\n let storedContext;\n let storedArgs;\n const later = () => {\n previous = Date.now();\n timeout = null;\n result = fn.apply(storedContext, storedArgs);\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n };\n return function wrapper(...args) {\n const now = Date.now();\n const remaining = wait - (now - previous);\n storedContext = this;\n storedArgs = args;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n result = fn.apply(storedContext, storedArgs);\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n }\n else if (!timeout) {\n timeout = window.setTimeout(later, remaining);\n }\n return result;\n };\n}\n\nclass SignaturePad extends SignatureEventTarget {\n constructor(canvas, options = {}) {\n super();\n this.canvas = canvas;\n this._drawingStroke = false;\n this._isEmpty = true;\n this._lastPoints = [];\n this._data = [];\n this._lastVelocity = 0;\n this._lastWidth = 0;\n this._handleMouseDown = (event) => {\n if (event.buttons === 1) {\n this._strokeBegin(event);\n }\n };\n this._handleMouseMove = (event) => {\n this._strokeMoveUpdate(event);\n };\n this._handleMouseUp = (event) => {\n if (event.buttons === 1) {\n this._strokeEnd(event);\n }\n };\n this._handleTouchStart = (event) => {\n if (event.cancelable) {\n event.preventDefault();\n }\n if (event.targetTouches.length === 1) {\n const touch = event.changedTouches[0];\n this._strokeBegin(touch);\n }\n };\n this._handleTouchMove = (event) => {\n if (event.cancelable) {\n event.preventDefault();\n }\n const touch = event.targetTouches[0];\n this._strokeMoveUpdate(touch);\n };\n this._handleTouchEnd = (event) => {\n const wasCanvasTouched = event.target === this.canvas;\n if (wasCanvasTouched) {\n if (event.cancelable) {\n event.preventDefault();\n }\n const touch = event.changedTouches[0];\n this._strokeEnd(touch);\n }\n };\n this._handlePointerStart = (event) => {\n event.preventDefault();\n this._strokeBegin(event);\n };\n this._handlePointerMove = (event) => {\n this._strokeMoveUpdate(event);\n };\n this._handlePointerEnd = (event) => {\n if (this._drawingStroke) {\n event.preventDefault();\n this._strokeEnd(event);\n }\n };\n this.velocityFilterWeight = options.velocityFilterWeight || 0.7;\n this.minWidth = options.minWidth || 0.5;\n this.maxWidth = options.maxWidth || 2.5;\n this.throttle = ('throttle' in options ? options.throttle : 16);\n this.minDistance = ('minDistance' in options ? options.minDistance : 5);\n this.dotSize = options.dotSize || 0;\n this.penColor = options.penColor || 'black';\n this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)';\n this.compositeOperation = options.compositeOperation || 'source-over';\n this._strokeMoveUpdate = this.throttle\n ? throttle(SignaturePad.prototype._strokeUpdate, this.throttle)\n : SignaturePad.prototype._strokeUpdate;\n this._ctx = canvas.getContext('2d');\n this.clear();\n this.on();\n }\n clear() {\n const { _ctx: ctx, canvas } = this;\n ctx.fillStyle = this.backgroundColor;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n this._data = [];\n this._reset(this._getPointGroupOptions());\n this._isEmpty = true;\n }\n fromDataURL(dataUrl, options = {}) {\n return new Promise((resolve, reject) => {\n const image = new Image();\n const ratio = options.ratio || window.devicePixelRatio || 1;\n const width = options.width || this.canvas.width / ratio;\n const height = options.height || this.canvas.height / ratio;\n const xOffset = options.xOffset || 0;\n const yOffset = options.yOffset || 0;\n this._reset(this._getPointGroupOptions());\n image.onload = () => {\n this._ctx.drawImage(image, xOffset, yOffset, width, height);\n resolve();\n };\n image.onerror = (error) => {\n reject(error);\n };\n image.crossOrigin = 'anonymous';\n image.src = dataUrl;\n this._isEmpty = false;\n });\n }\n toDataURL(type = 'image/png', encoderOptions) {\n switch (type) {\n case 'image/svg+xml':\n if (typeof encoderOptions !== 'object') {\n encoderOptions = undefined;\n }\n return `data:image/svg+xml;base64,${btoa(this.toSVG(encoderOptions))}`;\n default:\n if (typeof encoderOptions !== 'number') {\n encoderOptions = undefined;\n }\n return this.canvas.toDataURL(type, encoderOptions);\n }\n }\n on() {\n this.canvas.style.touchAction = 'none';\n this.canvas.style.msTouchAction = 'none';\n this.canvas.style.userSelect = 'none';\n const isIOS = /Macintosh/.test(navigator.userAgent) && 'ontouchstart' in document;\n if (window.PointerEvent && !isIOS) {\n this._handlePointerEvents();\n }\n else {\n this._handleMouseEvents();\n if ('ontouchstart' in window) {\n this._handleTouchEvents();\n }\n }\n }\n off() {\n this.canvas.style.touchAction = 'auto';\n this.canvas.style.msTouchAction = 'auto';\n this.canvas.style.userSelect = 'auto';\n this.canvas.removeEventListener('pointerdown', this._handlePointerStart);\n this.canvas.removeEventListener('pointermove', this._handlePointerMove);\n this.canvas.ownerDocument.removeEventListener('pointerup', this._handlePointerEnd);\n this.canvas.removeEventListener('mousedown', this._handleMouseDown);\n this.canvas.removeEventListener('mousemove', this._handleMouseMove);\n this.canvas.ownerDocument.removeEventListener('mouseup', this._handleMouseUp);\n this.canvas.removeEventListener('touchstart', this._handleTouchStart);\n this.canvas.removeEventListener('touchmove', this._handleTouchMove);\n this.canvas.removeEventListener('touchend', this._handleTouchEnd);\n }\n isEmpty() {\n return this._isEmpty;\n }\n fromData(pointGroups, { clear = true } = {}) {\n if (clear) {\n this.clear();\n }\n this._fromData(pointGroups, this._drawCurve.bind(this), this._drawDot.bind(this));\n this._data = this._data.concat(pointGroups);\n }\n toData() {\n return this._data;\n }\n _getPointGroupOptions(group) {\n return {\n penColor: group && 'penColor' in group ? group.penColor : this.penColor,\n dotSize: group && 'dotSize' in group ? group.dotSize : this.dotSize,\n minWidth: group && 'minWidth' in group ? group.minWidth : this.minWidth,\n maxWidth: group && 'maxWidth' in group ? group.maxWidth : this.maxWidth,\n velocityFilterWeight: group && 'velocityFilterWeight' in group\n ? group.velocityFilterWeight\n : this.velocityFilterWeight,\n compositeOperation: group && 'compositeOperation' in group\n ? group.compositeOperation\n : this.compositeOperation,\n };\n }\n _strokeBegin(event) {\n const cancelled = !this.dispatchEvent(new CustomEvent('beginStroke', { detail: event, cancelable: true }));\n if (cancelled) {\n return;\n }\n this._drawingStroke = true;\n const pointGroupOptions = this._getPointGroupOptions();\n const newPointGroup = Object.assign(Object.assign({}, pointGroupOptions), { points: [] });\n this._data.push(newPointGroup);\n this._reset(pointGroupOptions);\n this._strokeUpdate(event);\n }\n _strokeUpdate(event) {\n if (!this._drawingStroke) {\n return;\n }\n if (this._data.length === 0) {\n this._strokeBegin(event);\n return;\n }\n this.dispatchEvent(new CustomEvent('beforeUpdateStroke', { detail: event }));\n const x = event.clientX;\n const y = event.clientY;\n const pressure = event.pressure !== undefined\n ? event.pressure\n : event.force !== undefined\n ? event.force\n : 0;\n const point = this._createPoint(x, y, pressure);\n const lastPointGroup = this._data[this._data.length - 1];\n const lastPoints = lastPointGroup.points;\n const lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];\n const isLastPointTooClose = lastPoint\n ? point.distanceTo(lastPoint) <= this.minDistance\n : false;\n const pointGroupOptions = this._getPointGroupOptions(lastPointGroup);\n if (!lastPoint || !(lastPoint && isLastPointTooClose)) {\n const curve = this._addPoint(point, pointGroupOptions);\n if (!lastPoint) {\n this._drawDot(point, pointGroupOptions);\n }\n else if (curve) {\n this._drawCurve(curve, pointGroupOptions);\n }\n lastPoints.push({\n time: point.time,\n x: point.x,\n y: point.y,\n pressure: point.pressure,\n });\n }\n this.dispatchEvent(new CustomEvent('afterUpdateStroke', { detail: event }));\n }\n _strokeEnd(event) {\n if (!this._drawingStroke) {\n return;\n }\n this._strokeUpdate(event);\n this._drawingStroke = false;\n this.dispatchEvent(new CustomEvent('endStroke', { detail: event }));\n }\n _handlePointerEvents() {\n this._drawingStroke = false;\n this.canvas.addEventListener('pointerdown', this._handlePointerStart);\n this.canvas.addEventListener('pointermove', this._handlePointerMove);\n this.canvas.ownerDocument.addEventListener('pointerup', this._handlePointerEnd);\n }\n _handleMouseEvents() {\n this._drawingStroke = false;\n this.canvas.addEventListener('mousedown', this._handleMouseDown);\n this.canvas.addEventListener('mousemove', this._handleMouseMove);\n this.canvas.ownerDocument.addEventListener('mouseup', this._handleMouseUp);\n }\n _handleTouchEvents() {\n this.canvas.addEventListener('touchstart', this._handleTouchStart);\n this.canvas.addEventListener('touchmove', this._handleTouchMove);\n this.canvas.addEventListener('touchend', this._handleTouchEnd);\n }\n _reset(options) {\n this._lastPoints = [];\n this._lastVelocity = 0;\n this._lastWidth = (options.minWidth + options.maxWidth) / 2;\n this._ctx.fillStyle = options.penColor;\n this._ctx.globalCompositeOperation = options.compositeOperation;\n }\n _createPoint(x, y, pressure) {\n const rect = this.canvas.getBoundingClientRect();\n return new Point(x - rect.left, y - rect.top, pressure, new Date().getTime());\n }\n _addPoint(point, options) {\n const { _lastPoints } = this;\n _lastPoints.push(point);\n if (_lastPoints.length > 2) {\n if (_lastPoints.length === 3) {\n _lastPoints.unshift(_lastPoints[0]);\n }\n const widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2], options);\n const curve = Bezier.fromPoints(_lastPoints, widths);\n _lastPoints.shift();\n return curve;\n }\n return null;\n }\n _calculateCurveWidths(startPoint, endPoint, options) {\n const velocity = options.velocityFilterWeight * endPoint.velocityFrom(startPoint) +\n (1 - options.velocityFilterWeight) * this._lastVelocity;\n const newWidth = this._strokeWidth(velocity, options);\n const widths = {\n end: newWidth,\n start: this._lastWidth,\n };\n this._lastVelocity = velocity;\n this._lastWidth = newWidth;\n return widths;\n }\n _strokeWidth(velocity, options) {\n return Math.max(options.maxWidth / (velocity + 1), options.minWidth);\n }\n _drawCurveSegment(x, y, width) {\n const ctx = this._ctx;\n ctx.moveTo(x, y);\n ctx.arc(x, y, width, 0, 2 * Math.PI, false);\n this._isEmpty = false;\n }\n _drawCurve(curve, options) {\n const ctx = this._ctx;\n const widthDelta = curve.endWidth - curve.startWidth;\n const drawSteps = Math.ceil(curve.length()) * 2;\n ctx.beginPath();\n ctx.fillStyle = options.penColor;\n for (let i = 0; i < drawSteps; i += 1) {\n const t = i / drawSteps;\n const tt = t * t;\n const ttt = tt * t;\n const u = 1 - t;\n const uu = u * u;\n const uuu = uu * u;\n let x = uuu * curve.startPoint.x;\n x += 3 * uu * t * curve.control1.x;\n x += 3 * u * tt * curve.control2.x;\n x += ttt * curve.endPoint.x;\n let y = uuu * curve.startPoint.y;\n y += 3 * uu * t * curve.control1.y;\n y += 3 * u * tt * curve.control2.y;\n y += ttt * curve.endPoint.y;\n const width = Math.min(curve.startWidth + ttt * widthDelta, options.maxWidth);\n this._drawCurveSegment(x, y, width);\n }\n ctx.closePath();\n ctx.fill();\n }\n _drawDot(point, options) {\n const ctx = this._ctx;\n const width = options.dotSize > 0\n ? options.dotSize\n : (options.minWidth + options.maxWidth) / 2;\n ctx.beginPath();\n this._drawCurveSegment(point.x, point.y, width);\n ctx.closePath();\n ctx.fillStyle = options.penColor;\n ctx.fill();\n }\n _fromData(pointGroups, drawCurve, drawDot) {\n for (const group of pointGroups) {\n const { points } = group;\n const pointGroupOptions = this._getPointGroupOptions(group);\n if (points.length > 1) {\n for (let j = 0; j < points.length; j += 1) {\n const basicPoint = points[j];\n const point = new Point(basicPoint.x, basicPoint.y, basicPoint.pressure, basicPoint.time);\n if (j === 0) {\n this._reset(pointGroupOptions);\n }\n const curve = this._addPoint(point, pointGroupOptions);\n if (curve) {\n drawCurve(curve, pointGroupOptions);\n }\n }\n }\n else {\n this._reset(pointGroupOptions);\n drawDot(points[0], pointGroupOptions);\n }\n }\n }\n toSVG({ includeBackgroundColor = false } = {}) {\n const pointGroups = this._data;\n const ratio = Math.max(window.devicePixelRatio || 1, 1);\n const minX = 0;\n const minY = 0;\n const maxX = this.canvas.width / ratio;\n const maxY = this.canvas.height / ratio;\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n svg.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');\n svg.setAttribute('viewBox', `${minX} ${minY} ${maxX} ${maxY}`);\n svg.setAttribute('width', maxX.toString());\n svg.setAttribute('height', maxY.toString());\n if (includeBackgroundColor && this.backgroundColor) {\n const rect = document.createElement('rect');\n rect.setAttribute('width', '100%');\n rect.setAttribute('height', '100%');\n rect.setAttribute('fill', this.backgroundColor);\n svg.appendChild(rect);\n }\n this._fromData(pointGroups, (curve, { penColor }) => {\n const path = document.createElement('path');\n if (!isNaN(curve.control1.x) &&\n !isNaN(curve.control1.y) &&\n !isNaN(curve.control2.x) &&\n !isNaN(curve.control2.y)) {\n const attr = `M ${curve.startPoint.x.toFixed(3)},${curve.startPoint.y.toFixed(3)} ` +\n `C ${curve.control1.x.toFixed(3)},${curve.control1.y.toFixed(3)} ` +\n `${curve.control2.x.toFixed(3)},${curve.control2.y.toFixed(3)} ` +\n `${curve.endPoint.x.toFixed(3)},${curve.endPoint.y.toFixed(3)}`;\n path.setAttribute('d', attr);\n path.setAttribute('stroke-width', (curve.endWidth * 2.25).toFixed(3));\n path.setAttribute('stroke', penColor);\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke-linecap', 'round');\n svg.appendChild(path);\n }\n }, (point, { penColor, dotSize, minWidth, maxWidth }) => {\n const circle = document.createElement('circle');\n const size = dotSize > 0 ? dotSize : (minWidth + maxWidth) / 2;\n circle.setAttribute('r', size.toString());\n circle.setAttribute('cx', point.x.toString());\n circle.setAttribute('cy', point.y.toString());\n circle.setAttribute('fill', penColor);\n svg.appendChild(circle);\n });\n return svg.outerHTML;\n }\n}\n\n\n//# sourceMappingURL=signature_pad.js.map\n\n\n//# sourceURL=webpack://Formio/./node_modules/signature_pad/dist/signature_pad.js?");
|
6087
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SignaturePad; }\n/* harmony export */ });\n/*!\n * Signature Pad v4.2.0 | https://github.com/szimek/signature_pad\n * (c) 2024 Szymon Nowak | Released under the MIT license\n */\n\nclass Point {\n constructor(x, y, pressure, time) {\n if (isNaN(x) || isNaN(y)) {\n throw new Error(`Point is invalid: (${x}, ${y})`);\n }\n this.x = +x;\n this.y = +y;\n this.pressure = pressure || 0;\n this.time = time || Date.now();\n }\n distanceTo(start) {\n return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));\n }\n equals(other) {\n return (this.x === other.x &&\n this.y === other.y &&\n this.pressure === other.pressure &&\n this.time === other.time);\n }\n velocityFrom(start) {\n return this.time !== start.time\n ? this.distanceTo(start) / (this.time - start.time)\n : 0;\n }\n}\n\nclass Bezier {\n static fromPoints(points, widths) {\n const c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;\n const c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;\n return new Bezier(points[1], c2, c3, points[2], widths.start, widths.end);\n }\n static calculateControlPoints(s1, s2, s3) {\n const dx1 = s1.x - s2.x;\n const dy1 = s1.y - s2.y;\n const dx2 = s2.x - s3.x;\n const dy2 = s2.y - s3.y;\n const m1 = { x: (s1.x + s2.x) / 2.0, y: (s1.y + s2.y) / 2.0 };\n const m2 = { x: (s2.x + s3.x) / 2.0, y: (s2.y + s3.y) / 2.0 };\n const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);\n const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);\n const dxm = m1.x - m2.x;\n const dym = m1.y - m2.y;\n const k = l2 / (l1 + l2);\n const cm = { x: m2.x + dxm * k, y: m2.y + dym * k };\n const tx = s2.x - cm.x;\n const ty = s2.y - cm.y;\n return {\n c1: new Point(m1.x + tx, m1.y + ty),\n c2: new Point(m2.x + tx, m2.y + ty),\n };\n }\n constructor(startPoint, control2, control1, endPoint, startWidth, endWidth) {\n this.startPoint = startPoint;\n this.control2 = control2;\n this.control1 = control1;\n this.endPoint = endPoint;\n this.startWidth = startWidth;\n this.endWidth = endWidth;\n }\n length() {\n const steps = 10;\n let length = 0;\n let px;\n let py;\n for (let i = 0; i <= steps; i += 1) {\n const t = i / steps;\n const cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);\n const cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);\n if (i > 0) {\n const xdiff = cx - px;\n const ydiff = cy - py;\n length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n }\n px = cx;\n py = cy;\n }\n return length;\n }\n point(t, start, c1, c2, end) {\n return (start * (1.0 - t) * (1.0 - t) * (1.0 - t))\n + (3.0 * c1 * (1.0 - t) * (1.0 - t) * t)\n + (3.0 * c2 * (1.0 - t) * t * t)\n + (end * t * t * t);\n }\n}\n\nclass SignatureEventTarget {\n constructor() {\n try {\n this._et = new EventTarget();\n }\n catch (error) {\n this._et = document;\n }\n }\n addEventListener(type, listener, options) {\n this._et.addEventListener(type, listener, options);\n }\n dispatchEvent(event) {\n return this._et.dispatchEvent(event);\n }\n removeEventListener(type, callback, options) {\n this._et.removeEventListener(type, callback, options);\n }\n}\n\nfunction throttle(fn, wait = 250) {\n let previous = 0;\n let timeout = null;\n let result;\n let storedContext;\n let storedArgs;\n const later = () => {\n previous = Date.now();\n timeout = null;\n result = fn.apply(storedContext, storedArgs);\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n };\n return function wrapper(...args) {\n const now = Date.now();\n const remaining = wait - (now - previous);\n storedContext = this;\n storedArgs = args;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n result = fn.apply(storedContext, storedArgs);\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n }\n else if (!timeout) {\n timeout = window.setTimeout(later, remaining);\n }\n return result;\n };\n}\n\nclass SignaturePad extends SignatureEventTarget {\n constructor(canvas, options = {}) {\n super();\n this.canvas = canvas;\n this._drawingStroke = false;\n this._isEmpty = true;\n this._lastPoints = [];\n this._data = [];\n this._lastVelocity = 0;\n this._lastWidth = 0;\n this._handleMouseDown = (event) => {\n if (event.buttons === 1) {\n this._strokeBegin(event);\n }\n };\n this._handleMouseMove = (event) => {\n this._strokeMoveUpdate(event);\n };\n this._handleMouseUp = (event) => {\n if (event.buttons === 1) {\n this._strokeEnd(event);\n }\n };\n this._handleTouchStart = (event) => {\n if (event.cancelable) {\n event.preventDefault();\n }\n if (event.targetTouches.length === 1) {\n const touch = event.changedTouches[0];\n this._strokeBegin(touch);\n }\n };\n this._handleTouchMove = (event) => {\n if (event.cancelable) {\n event.preventDefault();\n }\n const touch = event.targetTouches[0];\n this._strokeMoveUpdate(touch);\n };\n this._handleTouchEnd = (event) => {\n const wasCanvasTouched = event.target === this.canvas;\n if (wasCanvasTouched) {\n if (event.cancelable) {\n event.preventDefault();\n }\n const touch = event.changedTouches[0];\n this._strokeEnd(touch);\n }\n };\n this._handlePointerStart = (event) => {\n event.preventDefault();\n this._strokeBegin(event);\n };\n this._handlePointerMove = (event) => {\n this._strokeMoveUpdate(event);\n };\n this._handlePointerEnd = (event) => {\n if (this._drawingStroke) {\n event.preventDefault();\n this._strokeEnd(event);\n }\n };\n this.velocityFilterWeight = options.velocityFilterWeight || 0.7;\n this.minWidth = options.minWidth || 0.5;\n this.maxWidth = options.maxWidth || 2.5;\n this.throttle = ('throttle' in options ? options.throttle : 16);\n this.minDistance = ('minDistance' in options ? options.minDistance : 5);\n this.dotSize = options.dotSize || 0;\n this.penColor = options.penColor || 'black';\n this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)';\n this.compositeOperation = options.compositeOperation || 'source-over';\n this.canvasContextOptions = ('canvasContextOptions' in options ? options.canvasContextOptions : {});\n this._strokeMoveUpdate = this.throttle\n ? throttle(SignaturePad.prototype._strokeUpdate, this.throttle)\n : SignaturePad.prototype._strokeUpdate;\n this._ctx = canvas.getContext('2d', this.canvasContextOptions);\n this.clear();\n this.on();\n }\n clear() {\n const { _ctx: ctx, canvas } = this;\n ctx.fillStyle = this.backgroundColor;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n this._data = [];\n this._reset(this._getPointGroupOptions());\n this._isEmpty = true;\n }\n fromDataURL(dataUrl, options = {}) {\n return new Promise((resolve, reject) => {\n const image = new Image();\n const ratio = options.ratio || window.devicePixelRatio || 1;\n const width = options.width || this.canvas.width / ratio;\n const height = options.height || this.canvas.height / ratio;\n const xOffset = options.xOffset || 0;\n const yOffset = options.yOffset || 0;\n this._reset(this._getPointGroupOptions());\n image.onload = () => {\n this._ctx.drawImage(image, xOffset, yOffset, width, height);\n resolve();\n };\n image.onerror = (error) => {\n reject(error);\n };\n image.crossOrigin = 'anonymous';\n image.src = dataUrl;\n this._isEmpty = false;\n });\n }\n toDataURL(type = 'image/png', encoderOptions) {\n switch (type) {\n case 'image/svg+xml':\n if (typeof encoderOptions !== 'object') {\n encoderOptions = undefined;\n }\n return `data:image/svg+xml;base64,${btoa(this.toSVG(encoderOptions))}`;\n default:\n if (typeof encoderOptions !== 'number') {\n encoderOptions = undefined;\n }\n return this.canvas.toDataURL(type, encoderOptions);\n }\n }\n on() {\n this.canvas.style.touchAction = 'none';\n this.canvas.style.msTouchAction = 'none';\n this.canvas.style.userSelect = 'none';\n const isIOS = /Macintosh/.test(navigator.userAgent) && 'ontouchstart' in document;\n if (window.PointerEvent && !isIOS) {\n this._handlePointerEvents();\n }\n else {\n this._handleMouseEvents();\n if ('ontouchstart' in window) {\n this._handleTouchEvents();\n }\n }\n }\n off() {\n this.canvas.style.touchAction = 'auto';\n this.canvas.style.msTouchAction = 'auto';\n this.canvas.style.userSelect = 'auto';\n this.canvas.removeEventListener('pointerdown', this._handlePointerStart);\n this.canvas.removeEventListener('pointermove', this._handlePointerMove);\n this.canvas.ownerDocument.removeEventListener('pointerup', this._handlePointerEnd);\n this.canvas.removeEventListener('mousedown', this._handleMouseDown);\n this.canvas.removeEventListener('mousemove', this._handleMouseMove);\n this.canvas.ownerDocument.removeEventListener('mouseup', this._handleMouseUp);\n this.canvas.removeEventListener('touchstart', this._handleTouchStart);\n this.canvas.removeEventListener('touchmove', this._handleTouchMove);\n this.canvas.removeEventListener('touchend', this._handleTouchEnd);\n }\n isEmpty() {\n return this._isEmpty;\n }\n fromData(pointGroups, { clear = true } = {}) {\n if (clear) {\n this.clear();\n }\n this._fromData(pointGroups, this._drawCurve.bind(this), this._drawDot.bind(this));\n this._data = this._data.concat(pointGroups);\n }\n toData() {\n return this._data;\n }\n _getPointGroupOptions(group) {\n return {\n penColor: group && 'penColor' in group ? group.penColor : this.penColor,\n dotSize: group && 'dotSize' in group ? group.dotSize : this.dotSize,\n minWidth: group && 'minWidth' in group ? group.minWidth : this.minWidth,\n maxWidth: group && 'maxWidth' in group ? group.maxWidth : this.maxWidth,\n velocityFilterWeight: group && 'velocityFilterWeight' in group\n ? group.velocityFilterWeight\n : this.velocityFilterWeight,\n compositeOperation: group && 'compositeOperation' in group\n ? group.compositeOperation\n : this.compositeOperation,\n };\n }\n _strokeBegin(event) {\n const cancelled = !this.dispatchEvent(new CustomEvent('beginStroke', { detail: event, cancelable: true }));\n if (cancelled) {\n return;\n }\n this._drawingStroke = true;\n const pointGroupOptions = this._getPointGroupOptions();\n const newPointGroup = Object.assign(Object.assign({}, pointGroupOptions), { points: [] });\n this._data.push(newPointGroup);\n this._reset(pointGroupOptions);\n this._strokeUpdate(event);\n }\n _strokeUpdate(event) {\n if (!this._drawingStroke) {\n return;\n }\n if (this._data.length === 0) {\n this._strokeBegin(event);\n return;\n }\n this.dispatchEvent(new CustomEvent('beforeUpdateStroke', { detail: event }));\n const x = event.clientX;\n const y = event.clientY;\n const pressure = event.pressure !== undefined\n ? event.pressure\n : event.force !== undefined\n ? event.force\n : 0;\n const point = this._createPoint(x, y, pressure);\n const lastPointGroup = this._data[this._data.length - 1];\n const lastPoints = lastPointGroup.points;\n const lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];\n const isLastPointTooClose = lastPoint\n ? point.distanceTo(lastPoint) <= this.minDistance\n : false;\n const pointGroupOptions = this._getPointGroupOptions(lastPointGroup);\n if (!lastPoint || !(lastPoint && isLastPointTooClose)) {\n const curve = this._addPoint(point, pointGroupOptions);\n if (!lastPoint) {\n this._drawDot(point, pointGroupOptions);\n }\n else if (curve) {\n this._drawCurve(curve, pointGroupOptions);\n }\n lastPoints.push({\n time: point.time,\n x: point.x,\n y: point.y,\n pressure: point.pressure,\n });\n }\n this.dispatchEvent(new CustomEvent('afterUpdateStroke', { detail: event }));\n }\n _strokeEnd(event) {\n if (!this._drawingStroke) {\n return;\n }\n this._strokeUpdate(event);\n this._drawingStroke = false;\n this.dispatchEvent(new CustomEvent('endStroke', { detail: event }));\n }\n _handlePointerEvents() {\n this._drawingStroke = false;\n this.canvas.addEventListener('pointerdown', this._handlePointerStart);\n this.canvas.addEventListener('pointermove', this._handlePointerMove);\n this.canvas.ownerDocument.addEventListener('pointerup', this._handlePointerEnd);\n }\n _handleMouseEvents() {\n this._drawingStroke = false;\n this.canvas.addEventListener('mousedown', this._handleMouseDown);\n this.canvas.addEventListener('mousemove', this._handleMouseMove);\n this.canvas.ownerDocument.addEventListener('mouseup', this._handleMouseUp);\n }\n _handleTouchEvents() {\n this.canvas.addEventListener('touchstart', this._handleTouchStart);\n this.canvas.addEventListener('touchmove', this._handleTouchMove);\n this.canvas.addEventListener('touchend', this._handleTouchEnd);\n }\n _reset(options) {\n this._lastPoints = [];\n this._lastVelocity = 0;\n this._lastWidth = (options.minWidth + options.maxWidth) / 2;\n this._ctx.fillStyle = options.penColor;\n this._ctx.globalCompositeOperation = options.compositeOperation;\n }\n _createPoint(x, y, pressure) {\n const rect = this.canvas.getBoundingClientRect();\n return new Point(x - rect.left, y - rect.top, pressure, new Date().getTime());\n }\n _addPoint(point, options) {\n const { _lastPoints } = this;\n _lastPoints.push(point);\n if (_lastPoints.length > 2) {\n if (_lastPoints.length === 3) {\n _lastPoints.unshift(_lastPoints[0]);\n }\n const widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2], options);\n const curve = Bezier.fromPoints(_lastPoints, widths);\n _lastPoints.shift();\n return curve;\n }\n return null;\n }\n _calculateCurveWidths(startPoint, endPoint, options) {\n const velocity = options.velocityFilterWeight * endPoint.velocityFrom(startPoint) +\n (1 - options.velocityFilterWeight) * this._lastVelocity;\n const newWidth = this._strokeWidth(velocity, options);\n const widths = {\n end: newWidth,\n start: this._lastWidth,\n };\n this._lastVelocity = velocity;\n this._lastWidth = newWidth;\n return widths;\n }\n _strokeWidth(velocity, options) {\n return Math.max(options.maxWidth / (velocity + 1), options.minWidth);\n }\n _drawCurveSegment(x, y, width) {\n const ctx = this._ctx;\n ctx.moveTo(x, y);\n ctx.arc(x, y, width, 0, 2 * Math.PI, false);\n this._isEmpty = false;\n }\n _drawCurve(curve, options) {\n const ctx = this._ctx;\n const widthDelta = curve.endWidth - curve.startWidth;\n const drawSteps = Math.ceil(curve.length()) * 2;\n ctx.beginPath();\n ctx.fillStyle = options.penColor;\n for (let i = 0; i < drawSteps; i += 1) {\n const t = i / drawSteps;\n const tt = t * t;\n const ttt = tt * t;\n const u = 1 - t;\n const uu = u * u;\n const uuu = uu * u;\n let x = uuu * curve.startPoint.x;\n x += 3 * uu * t * curve.control1.x;\n x += 3 * u * tt * curve.control2.x;\n x += ttt * curve.endPoint.x;\n let y = uuu * curve.startPoint.y;\n y += 3 * uu * t * curve.control1.y;\n y += 3 * u * tt * curve.control2.y;\n y += ttt * curve.endPoint.y;\n const width = Math.min(curve.startWidth + ttt * widthDelta, options.maxWidth);\n this._drawCurveSegment(x, y, width);\n }\n ctx.closePath();\n ctx.fill();\n }\n _drawDot(point, options) {\n const ctx = this._ctx;\n const width = options.dotSize > 0\n ? options.dotSize\n : (options.minWidth + options.maxWidth) / 2;\n ctx.beginPath();\n this._drawCurveSegment(point.x, point.y, width);\n ctx.closePath();\n ctx.fillStyle = options.penColor;\n ctx.fill();\n }\n _fromData(pointGroups, drawCurve, drawDot) {\n for (const group of pointGroups) {\n const { points } = group;\n const pointGroupOptions = this._getPointGroupOptions(group);\n if (points.length > 1) {\n for (let j = 0; j < points.length; j += 1) {\n const basicPoint = points[j];\n const point = new Point(basicPoint.x, basicPoint.y, basicPoint.pressure, basicPoint.time);\n if (j === 0) {\n this._reset(pointGroupOptions);\n }\n const curve = this._addPoint(point, pointGroupOptions);\n if (curve) {\n drawCurve(curve, pointGroupOptions);\n }\n }\n }\n else {\n this._reset(pointGroupOptions);\n drawDot(points[0], pointGroupOptions);\n }\n }\n }\n toSVG({ includeBackgroundColor = false } = {}) {\n const pointGroups = this._data;\n const ratio = Math.max(window.devicePixelRatio || 1, 1);\n const minX = 0;\n const minY = 0;\n const maxX = this.canvas.width / ratio;\n const maxY = this.canvas.height / ratio;\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n svg.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');\n svg.setAttribute('viewBox', `${minX} ${minY} ${maxX} ${maxY}`);\n svg.setAttribute('width', maxX.toString());\n svg.setAttribute('height', maxY.toString());\n if (includeBackgroundColor && this.backgroundColor) {\n const rect = document.createElement('rect');\n rect.setAttribute('width', '100%');\n rect.setAttribute('height', '100%');\n rect.setAttribute('fill', this.backgroundColor);\n svg.appendChild(rect);\n }\n this._fromData(pointGroups, (curve, { penColor }) => {\n const path = document.createElement('path');\n if (!isNaN(curve.control1.x) &&\n !isNaN(curve.control1.y) &&\n !isNaN(curve.control2.x) &&\n !isNaN(curve.control2.y)) {\n const attr = `M ${curve.startPoint.x.toFixed(3)},${curve.startPoint.y.toFixed(3)} ` +\n `C ${curve.control1.x.toFixed(3)},${curve.control1.y.toFixed(3)} ` +\n `${curve.control2.x.toFixed(3)},${curve.control2.y.toFixed(3)} ` +\n `${curve.endPoint.x.toFixed(3)},${curve.endPoint.y.toFixed(3)}`;\n path.setAttribute('d', attr);\n path.setAttribute('stroke-width', (curve.endWidth * 2.25).toFixed(3));\n path.setAttribute('stroke', penColor);\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke-linecap', 'round');\n svg.appendChild(path);\n }\n }, (point, { penColor, dotSize, minWidth, maxWidth }) => {\n const circle = document.createElement('circle');\n const size = dotSize > 0 ? dotSize : (minWidth + maxWidth) / 2;\n circle.setAttribute('r', size.toString());\n circle.setAttribute('cx', point.x.toString());\n circle.setAttribute('cy', point.y.toString());\n circle.setAttribute('fill', penColor);\n svg.appendChild(circle);\n });\n return svg.outerHTML;\n }\n}\n\n\n//# sourceMappingURL=signature_pad.js.map\n\n\n//# sourceURL=webpack://Formio/./node_modules/signature_pad/dist/signature_pad.js?");
|
6055
6088
|
|
6056
6089
|
/***/ }),
|
6057
6090
|
|
@@ -7437,7 +7470,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
7437
7470
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
7438
7471
|
|
7439
7472
|
"use strict";
|
7440
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst Element_1 = __importDefault(__webpack_require__(/*! ./Element */ \"./lib/cjs/Element.js\"));\nconst Formio_1 = __webpack_require__(/*! ./Formio */ \"./lib/cjs/Formio.js\");\nconst displays_1 = __importDefault(__webpack_require__(/*! ./displays */ \"./lib/cjs/displays/index.js\"));\nconst templates_1 = __importDefault(__webpack_require__(/*! ./templates */ \"./lib/cjs/templates/index.js\"));\nconst FormioUtils = __importStar(__webpack_require__(/*! ./utils/utils */ \"./lib/cjs/utils/utils.js\"));\nclass Form extends Element_1.default {\n /**\n * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.\n *\n * @param {Object} element - The DOM element you wish to render this form within.\n * @param {Object | string} form - Either a Form JSON schema or the URL of a hosted form via. form.io.\n * @param {Object} options - The options to create a new form instance.\n * @param {boolean} options.readOnly - Set this form to readOnly\n * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.\n * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js\n * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.\n *\n * @example\n * import Form from '@formio/js/Form';\n * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');\n * form.build();\n */\n constructor(...args) {\n let options = args[0] instanceof HTMLElement ? args[2] : args[1];\n if (Formio_1.Formio.options && Formio_1.Formio.options.form) {\n options = Object.assign(options, Formio_1.Formio.options.form);\n }\n super(options);\n if (this.options.useSessionToken) {\n Formio_1.Formio.useSessionToken(this.options);\n }\n this.ready = new Promise((resolve, reject) => {\n this.readyResolve = resolve;\n this.readyReject = reject;\n });\n this.instance = null;\n if (args[0] instanceof HTMLElement) {\n if (this.element) {\n delete this.element.component;\n }\n this.element = args[0];\n this.options = args[2] || {};\n this.options.events = this.events;\n this.setForm(args[1])\n .then(() => this.readyResolve(this.instance))\n .catch(this.readyReject);\n }\n else if (args[0]) {\n this.element = null;\n this.options = args[1] || {};\n this.options.events = this.events;\n this.setForm(args[0])\n .then(() => this.readyResolve(this.instance))\n .catch(this.readyReject);\n }\n else {\n this.element = null;\n this.options = {};\n this.options.events = this.events;\n }\n this.display = '';\n }\n createElement(tag, attrs, children) {\n const element = document.createElement(tag);\n for (const attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n (children || []).forEach(child => {\n element.appendChild(this.createElement(child.tag, child.attrs, child.children));\n });\n return element;\n }\n set loading(load) {\n if (!this.element || this.options.noLoader) {\n return;\n }\n if (load) {\n if (this.loader) {\n return;\n }\n this.loader = this.createElement('div', {\n 'class': 'formio-loader'\n }, [{\n tag: 'div',\n attrs: {\n class: 'loader-wrapper'\n },\n children: [{\n tag: 'div',\n attrs: {\n class: 'loader text-center'\n }\n }]\n }]);\n this.element.appendChild(this.loader);\n }\n else if (this.loader) {\n this.element.removeChild(this.loader);\n this.loader = null;\n }\n }\n /**\n * Create a new form instance provided the display of the form.\n *\n * @param {string} display - The display of the form, either \"wizard\", \"form\", or \"pdf\"\n * @return {*}\n */\n create(display) {\n if (this.options && (this.options.flatten || this.options.renderMode === 'flat')) {\n display = 'form';\n }\n this.display = display;\n if (displays_1.default.displays[display]) {\n return new displays_1.default.displays[display](this.element, this.options);\n }\n else {\n // eslint-disable-next-line new-cap\n return new displays_1.default.displays['webform'](this.element, this.options);\n }\n }\n /**\n * Sets the form. Either as JSON or a URL to a form JSON schema.\n *\n * @param {string|object} formParam - Either the form JSON or the URL of the form json.\n * @return {*}\n */\n set form(formParam) {\n this.setForm(formParam);\n }\n errorForm(err) {\n return {\n components: [\n {\n 'label': 'HTML',\n 'tag': 'div',\n 'className': 'error error-message alert alert-danger ui red message',\n 'attrs': [\n {\n 'attr': 'role',\n 'value': 'alert'\n }\n ],\n 'key': 'errorMessage',\n 'type': 'htmlelement',\n 'input': false,\n 'content': typeof err === 'string' ? err : err.message,\n }\n ]\n };\n }\n setForm(formParam) {\n let result;\n formParam = formParam || this.form;\n if (typeof formParam === 'string') {\n const formio = new Formio_1.Formio(formParam);\n let error;\n this.loading = true;\n result = this.getSubmission(formio, this.options)\n .catch((err) => {\n error = err;\n })\n .then((submission) => {\n return formio.loadForm()\n // If the form returned an error, show it instead of the form.\n .catch(err => {\n error = err;\n })\n .then((form) => {\n // If the submission returned an error, show it instead of the form.\n if (error) {\n form = this.errorForm(error);\n }\n this.loading = false;\n this.instance = this.instance || this.create(form.display);\n this.instance.url = formParam;\n this.instance.nosubmit = false;\n this._form = this.instance.form = form;\n if (submission) {\n this.instance.submission = submission;\n }\n if (error) {\n throw error;\n }\n return this.instance;\n });\n });\n }\n else {\n this.instance = this.instance || this.create(formParam.display);\n this._form = this.instance.form = formParam;\n result = this.instance.ready;\n }\n // A redraw has occurred so save off the new element in case of a setDisplay causing a rebuild.\n return result.then(() => {\n if (this.element) {\n delete this.element.component;\n }\n this.element = this.instance.element;\n return this.instance;\n });\n }\n getSubmission(formio, opts) {\n if (formio.submissionId) {\n return formio.loadSubmission(null, opts);\n }\n return Promise.resolve();\n }\n /**\n * Returns the loaded forms JSON.\n *\n * @return {object} - The loaded form's JSON\n */\n get form() {\n return this._form;\n }\n /**\n * Changes the display of the form.\n *\n * @param {string} display - The display to set this form. Either \"wizard\", \"form\", or \"pdf\"\n * @return {Promise<T>}\n */\n setDisplay(display) {\n if ((this.display === display) && this.instance) {\n return Promise.resolve(this.instance);\n }\n this.form.display = display;\n this.instance.destroy();\n this.instance = this.create(display);\n return this.setForm(this.form);\n }\n empty() {\n if (this.element) {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild);\n }\n }\n }\n static embed(embed) {\n return new Promise((resolve) => {\n if (!embed || !embed.src) {\n resolve();\n }\n const id = this.id || `formio-${Math.random().toString(36).substring(7)}`;\n const className = embed.class || 'formio-form-wrapper';\n let code = embed.styles ? `<link rel=\"stylesheet\" href=\"${embed.styles}\">` : '';\n code += `<div id=\"${id}\" class=\"${className}\"></div>`;\n document.write(code);\n let attempts = 0;\n const wait = setInterval(() => {\n attempts++;\n const formElement = document.getElementById(id);\n if (formElement || attempts > 10) {\n resolve(new Form(formElement, embed.src).ready);\n clearInterval(wait);\n }\n }, 10);\n });\n }\n /**\n * Sanitize an html string.\n *\n * @param string\n * @returns {*}\n */\n sanitize(dirty, forceSanitize) {\n // If Sanitize is turned off\n if (this.options.sanitize === false && !forceSanitize) {\n return dirty;\n }\n return FormioUtils.sanitize(dirty, this.options);\n }\n setContent(element, content, forceSanitize) {\n if (element instanceof HTMLElement) {\n element.innerHTML = this.sanitize(content, forceSanitize);\n return true;\n }\n return false;\n }\n /**\n * Build a new form.\n *\n * @return {Promise<T>}\n */\n build() {\n if (!this.instance) {\n return Promise.reject('Form not ready. Use form.ready promise');\n }\n if (!this.element) {\n return Promise.reject('No DOM element for form.');\n }\n // Add temporary loader.\n const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';\n const loader = templates_1.default[template].loader || templates_1.default.bootstrap.loader;\n this.setContent(this.element, loader.form);\n return this.render().then(html => {\n this.setContent(this.element, html);\n return this.attach(this.element).then(() => this.instance);\n })\n .then((param) => {\n this.emit('build', param);\n return param;\n });\n }\n render() {\n if (!this.instance) {\n return Promise.reject('Form not ready. Use form.ready promise');\n }\n return Promise.resolve(this.instance.render())\n .then((param) => {\n this.emit('render', param);\n return param;\n });\n }\n attach(element) {\n if (!this.instance) {\n return Promise.reject('Form not ready. Use form.ready promise');\n }\n if (this.element) {\n delete this.element.component;\n }\n this.element = element;\n return this.instance.attach(this.element)\n .then((param) => {\n this.emit('attach', param);\n return param;\n });\n }\n teardown() {\n super.teardown();\n delete this.instance;\n delete this.ready;\n }\n}\nexports[\"default\"] = Form;\n// Allow simple embedding.\nFormio_1.Formio.embedForm = (embed) => Form.embed(embed);\n/**\n * Factory that creates a new form based on the form parameters.\n *\n * @param element {HMTLElement} - The HTML Element to add this form to.\n * @param form {string|Object} - The src of the form, or a form object.\n * @param options {Object} - The options to create this form.\n *\n * @return {Promise} - When the form is instance is ready.\n */\nFormio_1.Formio.createForm = (...args) => {\n return (new Form(...args)).ready;\n};\nFormio_1.Formio.Form = Form;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Form.js?");
|
7473
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst Element_1 = __importDefault(__webpack_require__(/*! ./Element */ \"./lib/cjs/Element.js\"));\nconst Formio_1 = __webpack_require__(/*! ./Formio */ \"./lib/cjs/Formio.js\");\nconst displays_1 = __importDefault(__webpack_require__(/*! ./displays */ \"./lib/cjs/displays/index.js\"));\nconst templates_1 = __importDefault(__webpack_require__(/*! ./templates */ \"./lib/cjs/templates/index.js\"));\nconst FormioUtils = __importStar(__webpack_require__(/*! ./utils/utils */ \"./lib/cjs/utils/utils.js\"));\nclass Form extends Element_1.default {\n /**\n * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.\n *\n * @param {Object} element - The DOM element you wish to render this form within.\n * @param {Object | string} form - Either a Form JSON schema or the URL of a hosted form via. form.io.\n * @param {Object} options - The options to create a new form instance.\n * @param {boolean} options.readOnly - Set this form to readOnly\n * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.\n * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js\n * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.\n *\n * @example\n * import Form from '@formio/js/Form';\n * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');\n * form.build();\n */\n constructor(...args) {\n let options = args[0] instanceof HTMLElement ? args[2] : args[1];\n if (Formio_1.Formio.options && Formio_1.Formio.options.form) {\n options = Object.assign(options, Formio_1.Formio.options.form);\n }\n super(options);\n if (this.options.useSessionToken) {\n Formio_1.Formio.useSessionToken(this.options);\n }\n this.ready = new Promise((resolve, reject) => {\n this.readyResolve = resolve;\n this.readyReject = reject;\n });\n this.instance = null;\n if (args[0] instanceof HTMLElement) {\n if (this.element) {\n delete this.element.component;\n }\n this.element = args[0];\n this.options = args[2] || {};\n this.options.events = this.events;\n this.setForm(args[1])\n .then(() => this.readyResolve(this.instance))\n .catch(this.readyReject);\n }\n else if (args[0]) {\n this.element = null;\n this.options = args[1] || {};\n this.options.events = this.events;\n this.setForm(args[0])\n .then(() => this.readyResolve(this.instance))\n .catch(this.readyReject);\n }\n else {\n this.element = null;\n this.options = {};\n this.options.events = this.events;\n }\n this.display = '';\n }\n createElement(tag, attrs, children) {\n const element = document.createElement(tag);\n for (const attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n (children || []).forEach(child => {\n element.appendChild(this.createElement(child.tag, child.attrs, child.children));\n });\n return element;\n }\n set loading(load) {\n if (!this.element || this.options.noLoader) {\n return;\n }\n if (load) {\n if (this.loader) {\n return;\n }\n this.loader = this.createElement('div', {\n 'class': 'formio-loader'\n }, [{\n tag: 'div',\n attrs: {\n class: 'loader-wrapper'\n },\n children: [{\n tag: 'div',\n attrs: {\n class: 'loader text-center'\n }\n }]\n }]);\n this.element.appendChild(this.loader);\n }\n else if (this.loader) {\n this.element.removeChild(this.loader);\n this.loader = null;\n }\n }\n /**\n * Create a new form instance provided the display of the form.\n *\n * @param {string} display - The display of the form, either \"wizard\", \"form\", or \"pdf\"\n * @return {*}\n */\n create(display) {\n if (this.options && (this.options.flatten || this.options.renderMode === 'flat')) {\n display = 'form';\n }\n this.display = display;\n if (displays_1.default.displays[display]) {\n return new displays_1.default.displays[display](this.element, this.options);\n }\n else {\n // eslint-disable-next-line new-cap\n return new displays_1.default.displays['webform'](this.element, this.options);\n }\n }\n /**\n * Sets the form. Either as JSON or a URL to a form JSON schema.\n *\n * @param {string|object} formParam - Either the form JSON or the URL of the form json.\n * @return {*}\n */\n set form(formParam) {\n this.setForm(formParam);\n }\n errorForm(err) {\n return {\n components: [\n {\n 'label': 'HTML',\n 'tag': 'div',\n 'className': 'error error-message alert alert-danger ui red message',\n 'attrs': [\n {\n 'attr': 'role',\n 'value': 'alert'\n }\n ],\n 'key': 'errorMessage',\n 'type': 'htmlelement',\n 'input': false,\n 'content': typeof err === 'string' ? err : err.message,\n }\n ]\n };\n }\n /**\n * Check Subdirectories path and provide correct options\n *\n * @param {string} url - The the URL of the form json.\n * @param {form} object - The form json.\n * @return {object} The initial options with base and project.\n */\n getFormInitOptions(url, form) {\n const options = {};\n const index = url.indexOf(form === null || form === void 0 ? void 0 : form.path);\n // form url doesn't include form path\n if (index === -1) {\n return options;\n }\n const projectUrl = url.substring(0, index - 1);\n const urlParts = Formio_1.Formio.getUrlParts(projectUrl);\n // project url doesn't include subdirectories path\n if (!urlParts || urlParts.filter(part => !!part).length < 4) {\n return options;\n }\n const baseUrl = `${urlParts[1]}${urlParts[2]}`;\n // Skip if baseUrl has already been set\n if (baseUrl !== Formio_1.Formio.baseUrl) {\n return {\n base: baseUrl,\n project: projectUrl,\n };\n }\n return {};\n }\n setForm(formParam) {\n let result;\n formParam = formParam || this.form;\n if (typeof formParam === 'string') {\n const formio = new Formio_1.Formio(formParam);\n let error;\n this.loading = true;\n result = this.getSubmission(formio, this.options)\n .catch((err) => {\n error = err;\n })\n .then((submission) => {\n return formio.loadForm()\n // If the form returned an error, show it instead of the form.\n .catch(err => {\n error = err;\n })\n .then((form) => {\n // If the submission returned an error, show it instead of the form.\n if (error) {\n form = this.errorForm(error);\n }\n this.loading = false;\n this.instance = this.instance || this.create(form.display);\n const options = this.getFormInitOptions(formParam, form);\n this.instance.setUrl(formParam, options);\n this.instance.nosubmit = false;\n this._form = this.instance.form = form;\n if (submission) {\n this.instance.submission = submission;\n }\n if (error) {\n throw error;\n }\n return this.instance;\n });\n });\n }\n else {\n this.instance = this.instance || this.create(formParam.display);\n this._form = this.instance.form = formParam;\n result = this.instance.ready;\n }\n // A redraw has occurred so save off the new element in case of a setDisplay causing a rebuild.\n return result.then(() => {\n if (this.element) {\n delete this.element.component;\n }\n this.element = this.instance.element;\n return this.instance;\n });\n }\n getSubmission(formio, opts) {\n if (formio.submissionId) {\n return formio.loadSubmission(null, opts);\n }\n return Promise.resolve();\n }\n /**\n * Returns the loaded forms JSON.\n *\n * @return {object} - The loaded form's JSON\n */\n get form() {\n return this._form;\n }\n /**\n * Changes the display of the form.\n *\n * @param {string} display - The display to set this form. Either \"wizard\", \"form\", or \"pdf\"\n * @return {Promise<T>}\n */\n setDisplay(display) {\n if ((this.display === display) && this.instance) {\n return Promise.resolve(this.instance);\n }\n this.form.display = display;\n this.instance.destroy();\n this.instance = this.create(display);\n return this.setForm(this.form);\n }\n empty() {\n if (this.element) {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild);\n }\n }\n }\n static embed(embed) {\n return new Promise((resolve) => {\n if (!embed || !embed.src) {\n resolve();\n }\n const id = this.id || `formio-${Math.random().toString(36).substring(7)}`;\n const className = embed.class || 'formio-form-wrapper';\n let code = embed.styles ? `<link rel=\"stylesheet\" href=\"${embed.styles}\">` : '';\n code += `<div id=\"${id}\" class=\"${className}\"></div>`;\n document.write(code);\n let attempts = 0;\n const wait = setInterval(() => {\n attempts++;\n const formElement = document.getElementById(id);\n if (formElement || attempts > 10) {\n resolve(new Form(formElement, embed.src).ready);\n clearInterval(wait);\n }\n }, 10);\n });\n }\n /**\n * Sanitize an html string.\n *\n * @param string\n * @returns {*}\n */\n sanitize(dirty, forceSanitize) {\n // If Sanitize is turned off\n if (this.options.sanitize === false && !forceSanitize) {\n return dirty;\n }\n return FormioUtils.sanitize(dirty, this.options);\n }\n setContent(element, content, forceSanitize) {\n if (element instanceof HTMLElement) {\n element.innerHTML = this.sanitize(content, forceSanitize);\n return true;\n }\n return false;\n }\n /**\n * Build a new form.\n *\n * @return {Promise<T>}\n */\n build() {\n if (!this.instance) {\n return Promise.reject('Form not ready. Use form.ready promise');\n }\n if (!this.element) {\n return Promise.reject('No DOM element for form.');\n }\n // Add temporary loader.\n const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';\n const loader = templates_1.default[template].loader || templates_1.default.bootstrap.loader;\n this.setContent(this.element, loader.form);\n return this.render().then(html => {\n this.setContent(this.element, html);\n return this.attach(this.element).then(() => this.instance);\n })\n .then((param) => {\n this.emit('build', param);\n return param;\n });\n }\n render() {\n if (!this.instance) {\n return Promise.reject('Form not ready. Use form.ready promise');\n }\n return Promise.resolve(this.instance.render())\n .then((param) => {\n this.emit('render', param);\n return param;\n });\n }\n attach(element) {\n if (!this.instance) {\n return Promise.reject('Form not ready. Use form.ready promise');\n }\n if (this.element) {\n delete this.element.component;\n }\n this.element = element;\n return this.instance.attach(this.element)\n .then((param) => {\n this.emit('attach', param);\n return param;\n });\n }\n teardown() {\n super.teardown();\n delete this.instance;\n delete this.ready;\n }\n}\nexports[\"default\"] = Form;\n// Allow simple embedding.\nFormio_1.Formio.embedForm = (embed) => Form.embed(embed);\n/**\n * Factory that creates a new form based on the form parameters.\n *\n * @param element {HMTLElement} - The HTML Element to add this form to.\n * @param form {string|Object} - The src of the form, or a form object.\n * @param options {Object} - The options to create this form.\n *\n * @return {Promise} - When the form is instance is ready.\n */\nFormio_1.Formio.createForm = (...args) => {\n return (new Form(...args)).ready;\n};\nFormio_1.Formio.Form = Form;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Form.js?");
|
7441
7474
|
|
7442
7475
|
/***/ }),
|
7443
7476
|
|
@@ -7459,7 +7492,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7459
7492
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
7460
7493
|
|
7461
7494
|
"use strict";
|
7462
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\nconst compare_versions_1 = __webpack_require__(/*! compare-versions */ \"./node_modules/compare-versions/lib/esm/index.js\");\nconst EventEmitter_1 = __importDefault(__webpack_require__(/*! ./EventEmitter */ \"./lib/cjs/EventEmitter.js\"));\nconst i18n_1 = __importDefault(__webpack_require__(/*! ./i18n */ \"./lib/cjs/i18n.js\"));\nconst Formio_1 = __webpack_require__(/*! ./Formio */ \"./lib/cjs/Formio.js\");\nconst Components_1 = __importDefault(__webpack_require__(/*! ./components/Components */ \"./lib/cjs/components/Components.js\"));\nconst NestedDataComponent_1 = __importDefault(__webpack_require__(/*! ./components/_classes/nesteddata/NestedDataComponent */ \"./lib/cjs/components/_classes/nesteddata/NestedDataComponent.js\"));\nconst utils_1 = __webpack_require__(/*! ./utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst formUtils_1 = __webpack_require__(/*! ./utils/formUtils */ \"./lib/cjs/utils/formUtils.js\");\n// Initialize the available forms.\nFormio_1.Formio.forms = {};\n// Allow people to register components.\nFormio_1.Formio.registerComponent = Components_1.default.setComponent;\nfunction getIconSet(icons) {\n if (icons === 'fontawesome') {\n return 'fa';\n }\n return icons || '';\n}\nfunction getOptions(options) {\n options = lodash_1.default.defaults(options, {\n submitOnEnter: false,\n iconset: getIconSet((options && options.icons) ? options.icons : Formio_1.Formio.icons),\n i18next: null,\n saveDraft: false,\n alwaysDirty: false,\n saveDraftThrottle: 5000,\n display: 'form',\n cdnUrl: Formio_1.Formio.cdn.baseUrl\n });\n if (!options.events) {\n options.events = new EventEmitter_1.default();\n }\n return options;\n}\n/**\n * Renders a Form.io form within the webpage.\n */\nclass Webform extends NestedDataComponent_1.default {\n /**\n * Creates a new Form instance.\n *\n * @param {Object} options - The options to create a new form instance.\n * @param {boolean} options.saveDraft - Set this if you would like to enable the save draft feature.\n * @param {boolean} options.saveDraftThrottle - The throttle for the save draft feature.\n * @param {boolean} options.readOnly - Set this form to readOnly\n * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.\n * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js\n * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.\n */\n /* eslint-disable max-statements */\n constructor() {\n let element, options;\n if (arguments[0] instanceof HTMLElement || arguments[1]) {\n element = arguments[0];\n options = arguments[1];\n }\n else {\n options = arguments[0];\n }\n super(null, getOptions(options));\n this.executeShortcuts = (event) => {\n const { target } = event;\n if (!this.keyboardCatchableElement(target)) {\n return;\n }\n const ctrl = event.ctrlKey || event.metaKey;\n const keyCode = event.keyCode;\n let char = '';\n if (65 <= keyCode && keyCode <= 90) {\n char = String.fromCharCode(keyCode);\n }\n else if (keyCode === 13) {\n char = 'Enter';\n }\n else if (keyCode === 27) {\n char = 'Esc';\n }\n lodash_1.default.each(this.shortcuts, (shortcut) => {\n if (shortcut.ctrl && !ctrl) {\n return;\n }\n if (shortcut.shortcut === char) {\n shortcut.element.click();\n event.preventDefault();\n }\n });\n };\n this.setElement(element);\n // Keep track of all available forms globally.\n Formio_1.Formio.forms[this.id] = this;\n // Set the base url.\n if (this.options.baseUrl) {\n Formio_1.Formio.setBaseUrl(this.options.baseUrl);\n }\n /**\n * The type of this element.\n * @type {string}\n */\n this.type = 'form';\n this._src = '';\n this._loading = false;\n this._form = {};\n this.draftEnabled = false;\n this.savingDraft = true;\n if (this.options.saveDraftThrottle) {\n this.triggerSaveDraft = lodash_1.default.throttle(this.saveDraft.bind(this), this.options.saveDraftThrottle);\n }\n else {\n this.triggerSaveDraft = this.saveDraft.bind(this);\n }\n /**\n * Determines if this form should submit the API on submit.\n * @type {boolean}\n */\n this.nosubmit = false;\n /**\n * Determines if the form has tried to be submitted, error or not.\n *\n * @type {boolean}\n */\n this.submitted = false;\n /**\n * Determines if the form is being submitted at the moment.\n *\n * @type {boolean}\n */\n this.submitting = false;\n /**\n * The Formio instance for this form.\n * @type {Formio}\n */\n this.formio = null;\n /**\n * The loader HTML element.\n * @type {HTMLElement}\n */\n this.loader = null;\n /**\n * The alert HTML element\n * @type {HTMLElement}\n */\n this.alert = null;\n /**\n * Promise that is triggered when the submission is done loading.\n * @type {Promise}\n */\n this.onSubmission = null;\n /**\n * Determines if this submission is explicitly set.\n * @type {boolean}\n */\n this.submissionSet = false;\n /**\n * Promise that executes when the form is ready and rendered.\n * @type {Promise}\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.formReady.then(() => {\n * console.log('The form is ready!');\n * });\n * form.src = 'https://examples.form.io/example';\n */\n this.formReady = new Promise((resolve, reject) => {\n /**\n * Called when the formReady state of this form has been resolved.\n *\n * @type {function}\n */\n this.formReadyResolve = resolve;\n /**\n * Called when this form could not load and is rejected.\n *\n * @type {function}\n */\n this.formReadyReject = reject;\n });\n /**\n * Promise that executes when the submission is ready and rendered.\n * @type {Promise}\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.submissionReady.then(() => {\n * console.log('The submission is ready!');\n * });\n * form.src = 'https://examples.form.io/example/submission/234234234234234243';\n */\n this.submissionReady = new Promise((resolve, reject) => {\n /**\n * Called when the formReady state of this form has been resolved.\n *\n * @type {function}\n */\n this.submissionReadyResolve = resolve;\n /**\n * Called when this form could not load and is rejected.\n *\n * @type {function}\n */\n this.submissionReadyReject = reject;\n });\n this.shortcuts = [];\n // Set language after everything is established.\n this.language = this.i18next.language;\n // See if we need to restore the draft from a user.\n if (this.options.saveDraft && !this.options.skipDraftRestore) {\n this.formReady.then(() => {\n const user = Formio_1.Formio.getUser();\n // Only restore a draft if the submission isn't explicitly set.\n if (user && !this.submissionSet) {\n this.restoreDraft(user._id);\n }\n });\n }\n this.component.clearOnHide = false;\n // Ensure the root is set to this component.\n this.root = this;\n this.localRoot = this;\n }\n /* eslint-enable max-statements */\n get language() {\n return this.options.language;\n }\n get emptyValue() {\n return null;\n }\n componentContext() {\n return this._data;\n }\n /**\n * Sets the language for this form.\n *\n * @param lang\n * @return {Promise}\n */\n set language(lang) {\n if (!this.i18next) {\n return;\n }\n this.options.language = lang;\n if (this.i18next.language === lang) {\n return;\n }\n this.i18next.changeLanguage(lang, (err) => {\n if (err) {\n return;\n }\n this.rebuild();\n this.emit('languageChanged');\n });\n }\n get componentComponents() {\n return this.form.components;\n }\n get shadowRoot() {\n return this.options.shadowRoot;\n }\n /**\n * Add a language for translations\n *\n * @param code\n * @param lang\n * @param active\n * @return {*}\n */\n addLanguage(code, lang, active = false) {\n if (this.i18next) {\n var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);\n this.i18next.addResourceBundle(code, 'translation', translations, true, true);\n if (active) {\n this.language = code;\n }\n }\n }\n keyboardCatchableElement(element) {\n if (element.nodeName === 'TEXTAREA') {\n return false;\n }\n if (element.nodeName === 'INPUT') {\n return [\n 'text',\n 'email',\n 'password'\n ].indexOf(element.type) === -1;\n }\n return true;\n }\n addShortcut(element, shortcut) {\n if (!shortcut || !/^([A-Z]|Enter|Esc)$/i.test(shortcut)) {\n return;\n }\n shortcut = lodash_1.default.capitalize(shortcut);\n if (shortcut === 'Enter' || shortcut === 'Esc') {\n // Restrict Enter and Esc only for buttons\n if (element.tagName !== 'BUTTON') {\n return;\n }\n this.shortcuts.push({\n shortcut,\n element\n });\n }\n else {\n this.shortcuts.push({\n ctrl: true,\n shortcut,\n element\n });\n }\n }\n removeShortcut(element, shortcut) {\n if (!shortcut || !/^([A-Z]|Enter|Esc)$/i.test(shortcut)) {\n return;\n }\n lodash_1.default.remove(this.shortcuts, {\n shortcut,\n element\n });\n }\n /**\n * Get the embed source of the form.\n *\n * @returns {string}\n */\n get src() {\n return this._src;\n }\n /**\n * Loads the submission if applicable.\n */\n loadSubmission() {\n this.loadingSubmission = true;\n if (this.formio.submissionId) {\n this.onSubmission = this.formio.loadSubmission().then((submission) => this.setSubmission(submission), (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));\n }\n else {\n this.submissionReadyResolve();\n }\n return this.submissionReady;\n }\n /**\n * Set the src of the form renderer.\n *\n * @param value\n * @param options\n */\n setSrc(value, options) {\n if (this.setUrl(value, options)) {\n this.nosubmit = false;\n return this.formio.loadForm({ params: { live: 1 } }).then((form) => {\n const setForm = this.setForm(form);\n this.loadSubmission();\n return setForm;\n }).catch((err) => {\n console.warn(err);\n this.formReadyReject(err);\n });\n }\n return Promise.resolve();\n }\n /**\n * Set the Form source, which is typically the Form.io embed URL.\n *\n * @param {string} value - The value of the form embed url.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.formReady.then(() => {\n * console.log('The form is formReady!');\n * });\n * form.src = 'https://examples.form.io/example';\n */\n set src(value) {\n this.setSrc(value);\n }\n /**\n * Get the embed source of the form.\n *\n * @returns {string}\n */\n get url() {\n return this._src;\n }\n /**\n * Sets the url of the form renderer.\n *\n * @param value\n * @param options\n */\n setUrl(value, options) {\n if (!value ||\n (typeof value !== 'string') ||\n (value === this._src)) {\n return false;\n }\n this._src = value;\n this.nosubmit = true;\n this.formio = this.options.formio = new Formio_1.Formio(value, options);\n if (this.type === 'form') {\n // Set the options source so this can be passed to other components.\n this.options.src = value;\n }\n return true;\n }\n /**\n * Set the form source but don't initialize the form and submission from the url.\n *\n * @param {string} value - The value of the form embed url.\n */\n set url(value) {\n this.setUrl(value);\n }\n /**\n * Called when both the form and submission have been loaded.\n *\n * @returns {Promise} - The promise to trigger when both form and submission have loaded.\n */\n get ready() {\n return this.formReady.then(() => {\n return super.ready.then(() => {\n return this.loadingSubmission ? this.submissionReady : true;\n });\n });\n }\n /**\n * Returns if this form is loading.\n *\n * @returns {boolean} - TRUE means the form is loading, FALSE otherwise.\n */\n get loading() {\n return this._loading;\n }\n /**\n * Set the loading state for this form, and also show the loader spinner.\n *\n * @param {boolean} loading - If this form should be \"loading\" or not.\n */\n set loading(loading) {\n if (this._loading !== loading) {\n this._loading = loading;\n if (!this.loader && loading) {\n this.loader = this.ce('div', {\n class: 'loader-wrapper'\n });\n const spinner = this.ce('div', {\n class: 'loader text-center'\n });\n this.loader.appendChild(spinner);\n }\n /* eslint-disable max-depth */\n if (this.loader) {\n try {\n if (loading) {\n this.prependTo(this.loader, this.wrapper);\n }\n else {\n this.removeChildFrom(this.loader, this.wrapper);\n }\n }\n catch (err) {\n // ingore\n }\n }\n /* eslint-enable max-depth */\n }\n }\n /**\n * Sets the JSON schema for the form to be rendered.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.setForm({\n * components: [\n * {\n * type: 'textfield',\n * key: 'firstName',\n * label: 'First Name',\n * placeholder: 'Enter your first name.',\n * input: true\n * },\n * {\n * type: 'textfield',\n * key: 'lastName',\n * label: 'Last Name',\n * placeholder: 'Enter your last name',\n * input: true\n * },\n * {\n * type: 'button',\n * action: 'submit',\n * label: 'Submit',\n * theme: 'primary'\n * }\n * ]\n * });\n *\n * @param {Object} form - The JSON schema of the form @see https://examples.form.io/example for an example JSON schema.\n * @param flags\n * @returns {*}\n */\n setForm(form, flags) {\n var _a, _b, _c;\n const isFormAlreadySet = this._form && ((_a = this._form.components) === null || _a === void 0 ? void 0 : _a.length);\n try {\n // Do not set the form again if it has been already set\n if (isFormAlreadySet && JSON.stringify(this._form) === JSON.stringify(form)) {\n return Promise.resolve();\n }\n // Create the form.\n this._form = (flags === null || flags === void 0 ? void 0 : flags.keepAsReference) ? form : lodash_1.default.cloneDeep(form);\n if (this.onSetForm) {\n this.onSetForm(lodash_1.default.cloneDeep(this._form), form);\n }\n if ((_c = (_b = this.parent) === null || _b === void 0 ? void 0 : _b.component) === null || _c === void 0 ? void 0 : _c.modalEdit) {\n return Promise.resolve();\n }\n }\n catch (err) {\n console.warn(err);\n // If provided form is not a valid JSON object, do not set it too\n return Promise.resolve();\n }\n // Allow the form to provide component overrides.\n if (form && form.settings && form.settings.components) {\n this.options.components = form.settings.components;\n }\n if (form && form.properties) {\n this.options.properties = form.properties;\n }\n // Use the sanitize config from the form settings or the global sanitize config if it is not provided in the options\n if (!this.options.sanitizeConfig && !this.builderMode) {\n this.options.sanitizeConfig = lodash_1.default.get(form, 'settings.sanitizeConfig') || lodash_1.default.get(form, 'globalSettings.sanitizeConfig');\n }\n if ('schema' in form && (0, compare_versions_1.compareVersions)(form.schema, '1.x') > 0) {\n this.ready.then(() => {\n this.setAlert('alert alert-danger', 'Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.');\n });\n }\n // See if they pass a module, and evaluate it if so.\n if (form && form.module) {\n let formModule = null;\n if (typeof form.module === 'string') {\n try {\n formModule = this.evaluate(`return ${form.module}`);\n }\n catch (err) {\n console.warn(err);\n }\n }\n else {\n formModule = form.module;\n }\n if (formModule) {\n Formio_1.Formio.use(formModule);\n // Since we got here after instantiation, we need to manually apply form options.\n if (formModule.options && formModule.options.form) {\n this.options = Object.assign(this.options, formModule.options.form);\n }\n }\n }\n this.initialized = false;\n const rebuild = this.rebuild() || Promise.resolve();\n return rebuild.then(() => {\n this.emit('formLoad', form);\n this.triggerRecaptcha();\n // Make sure to trigger onChange after a render event occurs to speed up form rendering.\n setTimeout(() => {\n this.onChange(flags);\n this.formReadyResolve();\n }, 0);\n return this.formReady;\n });\n }\n /**\n * Gets the form object.\n *\n * @returns {Object} - The form JSON schema.\n */\n get form() {\n if (!this._form) {\n this._form = {\n components: []\n };\n }\n return this._form;\n }\n /**\n * Sets the form value.\n *\n * @alias setForm\n * @param {Object} form - The form schema object.\n */\n set form(form) {\n this.setForm(form);\n }\n /**\n * Returns the submission object that was set within this form.\n *\n * @returns {Object}\n */\n get submission() {\n return this.getValue();\n }\n /**\n * Sets the submission of a form.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.src = 'https://examples.form.io/example';\n * form.submission = {data: {\n * firstName: 'Joe',\n * lastName: 'Smith',\n * email: 'joe@example.com'\n * }};\n *\n * @param {Object} submission - The Form.io submission object.\n */\n set submission(submission) {\n this.setSubmission(submission);\n }\n /**\n * Sets a submission and returns the promise when it is ready.\n * @param submission\n * @param flags\n * @return {Promise.<TResult>}\n */\n setSubmission(submission, flags = {}) {\n flags = Object.assign(Object.assign({}, flags), { fromSubmission: lodash_1.default.has(flags, 'fromSubmission') ? flags.fromSubmission : true });\n return this.onSubmission = this.formReady.then((resolveFlags) => {\n if (resolveFlags) {\n flags = Object.assign(Object.assign({}, flags), resolveFlags);\n }\n this.submissionSet = true;\n this.triggerChange(flags);\n this.emit('beforeSetSubmission', submission);\n this.setValue(submission, flags);\n return this.submissionReadyResolve(submission);\n }, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));\n }\n handleDraftError(errName, errDetails, restoreDraft) {\n const errorMessage = lodash_1.default.trim(`${this.t(errName)} ${errDetails || ''}`);\n console.warn(errorMessage);\n this.emit(restoreDraft ? 'restoreDraftError' : 'saveDraftError', errDetails || errorMessage);\n }\n /**\n * Saves a submission draft.\n */\n saveDraft() {\n if (!this.draftEnabled) {\n return;\n }\n if (!this.formio) {\n this.handleDraftError('saveDraftInstanceError');\n return;\n }\n if (!Formio_1.Formio.getUser()) {\n this.handleDraftError('saveDraftAuthError');\n return;\n }\n const draft = (0, utils_1.fastCloneDeep)(this.submission);\n draft.state = 'draft';\n if (!this.savingDraft) {\n this.emit('saveDraftBegin');\n this.savingDraft = true;\n this.formio.saveSubmission(draft).then((sub) => {\n // Set id to submission to avoid creating new draft submission\n this.submission._id = sub._id;\n this.savingDraft = false;\n this.emit('saveDraft', sub);\n })\n .catch(err => {\n this.savingDraft = false;\n this.handleDraftError('saveDraftError', err);\n });\n }\n }\n /**\n * Restores a draft submission based on the user who is authenticated.\n *\n * @param {userId} - The user id where we need to restore the draft from.\n */\n restoreDraft(userId) {\n if (!this.formio) {\n this.handleDraftError('restoreDraftInstanceError', null, true);\n return;\n }\n this.savingDraft = true;\n this.formio.loadSubmissions({\n params: {\n state: 'draft',\n owner: userId\n }\n }).then(submissions => {\n if (submissions.length > 0 && !this.options.skipDraftRestore) {\n const draft = (0, utils_1.fastCloneDeep)(submissions[0]);\n return this.setSubmission(draft).then(() => {\n this.draftEnabled = true;\n this.savingDraft = false;\n this.emit('restoreDraft', draft);\n });\n }\n // Enable drafts so that we can keep track of changes.\n this.draftEnabled = true;\n this.savingDraft = false;\n this.emit('restoreDraft', null);\n })\n .catch(err => {\n this.draftEnabled = true;\n this.savingDraft = false;\n this.handleDraftError('restoreDraftError', err, true);\n });\n }\n get schema() {\n const schema = (0, utils_1.fastCloneDeep)(lodash_1.default.omit(this._form, ['components']));\n schema.components = [];\n this.eachComponent((component) => schema.components.push(component.schema));\n return schema;\n }\n mergeData(_this, _that) {\n lodash_1.default.mergeWith(_this, _that, (thisValue, thatValue) => {\n if (Array.isArray(thisValue) && Array.isArray(thatValue) && thisValue.length !== thatValue.length) {\n return thatValue;\n }\n });\n }\n setValue(submission, flags = {}) {\n if (!submission || !submission.data) {\n submission = {\n data: {},\n metadata: submission.metadata,\n };\n }\n // Metadata needs to be available before setValue\n this._submission.metadata = submission.metadata || {};\n this.editing = !!submission._id;\n // Set the timezone in the options if available.\n if (!this.options.submissionTimezone &&\n submission.metadata &&\n submission.metadata.timezone) {\n this.options.submissionTimezone = submission.metadata.timezone;\n }\n const changed = super.setValue(submission.data, flags);\n if (!flags.sanitize) {\n this.mergeData(this.data, submission.data);\n }\n submission.data = this.data;\n this._submission = submission;\n return changed;\n }\n getValue() {\n if (!this._submission.data) {\n this._submission.data = {};\n }\n if (this.viewOnly) {\n return this._submission;\n }\n const submission = this._submission;\n submission.data = this.data;\n return this._submission;\n }\n /**\n * Build the form.\n */\n init() {\n if (this.options.submission) {\n const submission = lodash_1.default.extend({}, this.options.submission);\n this._submission = submission;\n this._data = submission.data;\n }\n else {\n this._submission = this._submission || { data: {} };\n }\n // Remove any existing components.\n if (this.components && this.components.length) {\n this.destroyComponents();\n this.components = [];\n }\n if (this.component) {\n this.component.components = this.form ? this.form.components : [];\n }\n else {\n this.component = this.form;\n }\n this.component.type = 'form';\n this.component.input = false;\n this.addComponents();\n this.on('submitButton', options => {\n this.submit(false, options).catch(e => {\n options.instance.loading = false;\n return e !== false && e !== undefined && console.log(e);\n });\n }, true);\n this.on('checkValidity', (data) => this.validate(data, { dirty: true, process: 'change' }), true);\n this.on('requestUrl', (args) => (this.submitUrl(args.url, args.headers)), true);\n this.on('resetForm', () => this.resetValue(), true);\n this.on('deleteSubmission', () => this.deleteSubmission(), true);\n this.on('refreshData', () => this.updateValue(), true);\n this.executeFormController();\n return this.formReady;\n }\n executeFormController() {\n // If no controller value or\n // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)\n if (!this.form || !this.form.controller\n || ((!this.visible || this.component.hidden) && this.component.clearOnHide && !this.rootPristine)) {\n return false;\n }\n this.formReady.then(() => {\n this.evaluate(this.form.controller, {\n components: this.components,\n instance: this,\n });\n });\n }\n teardown() {\n this.emit('formDelete', this.id);\n delete Formio_1.Formio.forms[this.id];\n delete this.executeShortcuts;\n delete this.triggerSaveDraft;\n super.teardown();\n }\n destroy(all = false) {\n this.off('submitButton');\n this.off('checkValidity');\n this.off('requestUrl');\n this.off('resetForm');\n this.off('deleteSubmission');\n this.off('refreshData');\n return super.destroy(all);\n }\n build(element) {\n if (element || this.element) {\n return this.ready.then(() => {\n element = element || this.element;\n super.build(element);\n });\n }\n return this.ready;\n }\n getClassName() {\n let classes = 'formio-form';\n if (this.options.readOnly) {\n classes += ' formio-read-only';\n }\n return classes;\n }\n render() {\n return super.render(this.renderTemplate('webform', {\n classes: this.getClassName(),\n children: this.renderComponents(),\n }), this.builderMode ? 'builder' : 'form', true);\n }\n redraw() {\n // Don't bother if we have not built yet.\n if (!this.element) {\n return Promise.resolve();\n }\n this.clear();\n this.setContent(this.element, this.render());\n return this.attach(this.element);\n }\n attach(element) {\n this.setElement(element);\n this.loadRefs(element, { webform: 'single' });\n const childPromise = this.attachComponents(this.refs.webform);\n this.addEventListener(document, 'keydown', this.executeShortcuts);\n this.currentForm = this;\n this.hook('attachWebform', element, this);\n return childPromise.then(() => {\n this.emit('render', this.element);\n return this.setValue(this._submission, {\n noUpdateEvent: true,\n });\n });\n }\n hasRequiredFields() {\n let result = false;\n (0, formUtils_1.eachComponent)(this.form.components, (component) => {\n if (component.validate.required) {\n result = true;\n return true;\n }\n }, true);\n return result;\n }\n resetValue() {\n lodash_1.default.each(this.getComponents(), (comp) => (comp.resetValue()));\n this.setPristine(true);\n this.onChange({ resetValue: true });\n }\n /**\n * Sets a new alert to display in the error dialog of the form.\n *\n * @param {string} type - The type of alert to display. \"danger\", \"success\", \"warning\", etc.\n * @param {string} message - The message to show in the alert.\n * @param {Object} options\n */\n setAlert(type, message, options) {\n if (!type && this.submitted) {\n if (this.alert) {\n if (this.refs.errorRef && this.refs.errorRef.length) {\n this.refs.errorRef.forEach(el => {\n this.removeEventListener(el, 'click');\n this.removeEventListener(el, 'keypress');\n });\n }\n this.removeChild(this.alert);\n this.alert = null;\n }\n return;\n }\n if (this.options.noAlerts) {\n if (!message) {\n this.emit('error', false);\n }\n return;\n }\n if (this.alert) {\n try {\n if (this.refs.errorRef && this.refs.errorRef.length) {\n this.refs.errorRef.forEach(el => {\n this.removeEventListener(el, 'click');\n this.removeEventListener(el, 'keypress');\n });\n }\n this.removeChild(this.alert);\n this.alert = null;\n }\n catch (err) {\n // ignore\n }\n }\n if (message) {\n const attrs = {\n class: (options && options.classes) || `alert alert-${type}`,\n id: `error-list-${this.id}`,\n };\n const templateOptions = {\n message: message instanceof HTMLElement ? message.outerHTML : message,\n attrs: attrs,\n type\n };\n this.alert = (0, utils_1.convertStringToHTMLElement)(this.renderTemplate('alert', templateOptions), `#${attrs.id}`);\n }\n if (!this.alert) {\n return;\n }\n this.loadRefs(this.alert, { errorRef: 'multiple' });\n if (this.refs.errorRef && this.refs.errorRef.length) {\n this.refs.errorRef.forEach(el => {\n this.addEventListener(el, 'click', (e) => {\n const key = e.currentTarget.dataset.componentKey;\n this.focusOnComponent(key);\n });\n this.addEventListener(el, 'keydown', (e) => {\n if (e.keyCode === 13) {\n e.preventDefault();\n const key = e.currentTarget.dataset.componentKey;\n this.focusOnComponent(key);\n }\n });\n });\n }\n this.prepend(this.alert);\n }\n /**\n * Focus on selected component.\n *\n * @param {string} key - The key of selected component.\n * @returns {*}\n */\n focusOnComponent(key) {\n if (key) {\n const component = this.getComponent(key);\n if (component) {\n component.focus();\n }\n }\n }\n /**\n * Show the errors of this form within the alert dialog.\n *\n * @param {Object} error - An optional additional error to display along with the component errors.\n * @returns {*}\n */\n /* eslint-disable no-unused-vars */\n showErrors(errors, triggerEvent, onChange) {\n if (!errors) {\n return;\n }\n this.loading = false;\n if (!Array.isArray(errors)) {\n errors = [errors];\n }\n errors = errors.concat(this.customErrors);\n if (!errors.length) {\n this.setAlert(false);\n return;\n }\n // Mark any components as invalid if in a custom message.\n errors.forEach((err) => {\n const { components = [] } = err;\n if (err.component) {\n components.push(err.component);\n }\n if (err.path) {\n components.push(err.path);\n }\n components.forEach((path) => {\n const originalPath = (0, utils_1.getStringFromComponentPath)(path);\n const component = this.getComponent(path, lodash_1.default.identity, originalPath);\n if (err.fromServer) {\n if (component.serverErrors) {\n component.serverErrors.push(err);\n }\n else {\n component.serverErrors = [err];\n }\n }\n const components = lodash_1.default.compact(Array.isArray(component) ? component : [component]);\n components.forEach((component) => component.setCustomValidity(err.message, true));\n });\n });\n const displayedErrors = [];\n if (errors.length) {\n errors = lodash_1.default.uniqBy(errors, error => error.message);\n const createListItem = (message, index) => {\n var _a, _b, _c;\n const err = errors[index];\n const messageFromIndex = !lodash_1.default.isUndefined(index) && errors && errors[index];\n const keyOrPath = ((messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.formattedKeyOrPath) || (messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.path) || ((_a = messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.context) === null || _a === void 0 ? void 0 : _a.path)) || (((_b = err.context) === null || _b === void 0 ? void 0 : _b.component) && ((_c = err.context) === null || _c === void 0 ? void 0 : _c.component.key)) || (err.component && err.component.key) || err.fromServer && err.path;\n const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : '';\n if (typeof err !== 'string' && !err.formattedKeyOrPath) {\n err.formattedKeyOrPath = formattedKeyOrPath;\n }\n return {\n message: (0, utils_1.unescapeHTML)(message),\n keyOrPath: formattedKeyOrPath\n };\n };\n errors.forEach(({ message, context, fromServer, component }, index) => {\n const text = !(component === null || component === void 0 ? void 0 : component.label) || (context === null || context === void 0 ? void 0 : context.hasLabel) || fromServer\n ? this.t('alertMessage', { message: this.t(message) })\n : this.t('alertMessageWithLabel', {\n label: this.t(component === null || component === void 0 ? void 0 : component.label),\n message: this.t(message),\n });\n displayedErrors.push(createListItem(text, index));\n });\n }\n const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });\n this.root.setAlert('danger', errorsList);\n if (triggerEvent) {\n this.emit('error', errors);\n }\n return errors;\n }\n /* eslint-enable no-unused-vars */\n /**\n * Called when the submission has completed, or if the submission needs to be sent to an external library.\n *\n * @param {Object} submission - The submission object.\n * @param {boolean} saved - Whether or not this submission was saved to the server.\n * @returns {object} - The submission object.\n */\n onSubmit(submission, saved) {\n var _a;\n this.loading = false;\n this.submitting = false;\n this.setPristine(true);\n // We want to return the submitted submission and setValue will mutate the submission so cloneDeep it here.\n this.setValue((0, utils_1.fastCloneDeep)(submission), {\n noValidate: true,\n noCheck: true\n });\n this.setAlert('success', `<p>${this.t('complete')}</p>`);\n // Cancel triggered saveDraft to prevent overriding the submitted state\n if (this.draftEnabled && ((_a = this.triggerSaveDraft) === null || _a === void 0 ? void 0 : _a.cancel)) {\n this.triggerSaveDraft.cancel();\n }\n this.emit('submit', submission, saved);\n if (saved) {\n this.emit('submitDone', submission);\n }\n return submission;\n }\n normalizeError(error) {\n if (error) {\n if (typeof error === 'object' && 'details' in error) {\n error = error.details;\n }\n if (typeof error === 'string') {\n error = { message: error };\n }\n }\n return error;\n }\n /**\n * Called when an error occurs during the submission.\n *\n * @param {Object} error - The error that occured.\n */\n onSubmissionError(error) {\n error = this.normalizeError(error);\n this.submitting = false;\n this.setPristine(false);\n this.emit('submitError', error || this.errors);\n // Allow for silent cancellations (no error message, no submit button error state)\n if (error && error.silent) {\n this.emit('change', { isValid: true }, { silent: true });\n return false;\n }\n const errors = this.showErrors(error, true);\n if (this.root && this.root.alert) {\n this.scrollIntoView(this.root.alert);\n }\n return errors;\n }\n /**\n * Trigger the change event for this form.\n *\n * @param changed\n * @param flags\n */\n onChange(flags, changed, modified, changes) {\n flags = flags || {};\n let isChangeEventEmitted = false;\n super.onChange(flags, true);\n const value = lodash_1.default.clone(this.submission);\n flags.changed = value.changed = changed;\n flags.changes = changes;\n if (modified && this.pristine) {\n this.pristine = false;\n }\n this.checkData(value.data, flags);\n const shouldValidate = !flags.noValidate || flags.fromIFrame || (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);\n const errors = shouldValidate ? this.validate(value.data, Object.assign(Object.assign({}, flags), { process: 'change' })) : [];\n value.isValid = errors.length === 0;\n this.loading = false;\n if (this.submitted) {\n // show server errors while they are not cleaned/fixed\n const nonComponentServerErrors = lodash_1.default.filter(this.serverErrors || [], err => !err.component && !err.path);\n this.showErrors(nonComponentServerErrors.length ? nonComponentServerErrors : null);\n }\n // See if we need to save the draft of the form.\n if (modified && this.options.saveDraft) {\n this.triggerSaveDraft();\n }\n if (!flags || !flags.noEmit) {\n this.emit('change', value, flags, modified);\n isChangeEventEmitted = true;\n }\n // The form is initialized after the first change event occurs.\n if (isChangeEventEmitted && !this.initialized) {\n this.emit('initialized');\n this.initialized = true;\n }\n }\n /**\n * Send a delete request to the server.\n */\n deleteSubmission() {\n return this.formio.deleteSubmission()\n .then(() => {\n this.emit('submissionDeleted', this.submission);\n this.resetValue();\n });\n }\n /**\n * Cancels the submission.\n *\n * @alias reset\n */\n cancel(noconfirm) {\n const shouldReset = this.hook('beforeCancel', true);\n if (shouldReset && (noconfirm || confirm(this.t('confirmCancel')))) {\n this.resetValue();\n return true;\n }\n else {\n this.emit('cancelSubmit');\n return false;\n }\n }\n setMetadata(submission) {\n // Add in metadata about client submitting the form\n submission.metadata = submission.metadata || {};\n lodash_1.default.defaults(submission.metadata, {\n timezone: lodash_1.default.get(this, '_submission.metadata.timezone', (0, utils_1.currentTimezone)()),\n offset: parseInt(lodash_1.default.get(this, '_submission.metadata.offset', (0, moment_1.default)().utcOffset()), 10),\n origin: document.location.origin,\n referrer: document.referrer,\n browserName: navigator.appName,\n userAgent: navigator.userAgent,\n pathName: window.location.pathname,\n onLine: navigator.onLine\n });\n }\n submitForm(options = {}) {\n this.clearServerErrors();\n return new Promise((resolve, reject) => {\n // Read-only forms should never submit.\n if (this.options.readOnly) {\n return resolve({\n submission: this.submission,\n saved: false\n });\n }\n const submission = (0, utils_1.fastCloneDeep)(this.submission || {});\n this.setMetadata(submission);\n submission.state = options.state || submission.state || 'submitted';\n const isDraft = (submission.state === 'draft');\n this.hook('beforeSubmit', Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {\n var _a;\n if (err) {\n return reject(err);\n }\n submission._vnote = data && data._vnote ? data._vnote : '';\n try {\n if (!isDraft && !options.noValidate) {\n if (!submission.data) {\n return reject('Invalid Submission');\n }\n const errors = this.validate(submission.data, {\n dirty: true,\n silentCheck: false,\n process: 'submit'\n });\n if (errors.length || ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === 'rejected'))) {\n return reject(errors);\n }\n }\n }\n catch (err) {\n console.error(err);\n }\n this.everyComponent((comp) => {\n if (submission._vnote && comp.type === 'form' && comp.component.reference) {\n lodash_1.default.get(submission.data, comp.path, {})._vnote = submission._vnote;\n }\n const { persistent } = comp.component;\n if (persistent === 'client-only') {\n lodash_1.default.unset(submission.data, comp.path);\n }\n });\n this.hook('customValidation', Object.assign(Object.assign({}, submission), { component: options.component }), (err) => {\n if (err) {\n // If string is returned, cast to object.\n if (typeof err === 'string') {\n err = {\n message: err\n };\n }\n // Ensure err is an array.\n err = Array.isArray(err) ? err : [err];\n return reject(err);\n }\n this.loading = true;\n // Use the form action to submit the form if available.\n if (this._form && this._form.action) {\n const method = (submission.data._id && this._form.action.includes(submission.data._id)) ? 'PUT' : 'POST';\n return Formio_1.Formio.makeStaticRequest(this._form.action, method, submission, this.formio ? this.formio.options : {})\n .then((result) => resolve({\n submission: result,\n saved: true,\n }))\n .catch((error) => {\n this.setServerErrors(error);\n return reject(error);\n });\n }\n const submitFormio = this.formio;\n if (this.nosubmit || !submitFormio) {\n return resolve({\n submission,\n saved: false,\n });\n }\n // If this is an actionUrl, then make sure to save the action and not the submission.\n const submitMethod = submitFormio.actionUrl ? 'saveAction' : 'saveSubmission';\n submitFormio[submitMethod](submission)\n .then((result) => resolve({\n submission: result,\n saved: true,\n }))\n .catch((error) => {\n this.setServerErrors(error);\n return reject(error);\n });\n });\n });\n });\n }\n setServerErrors(error) {\n if (error.details) {\n this.serverErrors = error.details.filter((err) => err.level ? err.level === 'error' : err).map((err) => {\n err.fromServer = true;\n return err;\n });\n }\n else if (typeof error === 'string') {\n this.serverErrors = [{ fromServer: true, level: 'error', message: error }];\n }\n }\n executeSubmit(options) {\n this.submitted = true;\n this.submitting = true;\n return this.submitForm(options)\n .then(({ submission, saved }) => this.onSubmit(submission, saved))\n .then((results) => {\n this.submissionInProcess = false;\n return results;\n })\n .catch((err) => {\n this.submissionInProcess = false;\n return Promise.reject(this.onSubmissionError(err));\n });\n }\n clearServerErrors() {\n var _a;\n (_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.forEach((error) => {\n if (error.path) {\n const pathArray = (0, utils_1.getArrayFromComponentPath)(error.path);\n const component = this.getComponent(pathArray, lodash_1.default.identity, error.formattedKeyOrPath);\n if (component) {\n component.serverErrors = [];\n }\n }\n });\n this.serverErrors = [];\n }\n /**\n * Submits the form.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.src = 'https://examples.form.io/example';\n * form.submission = {data: {\n * firstName: 'Joe',\n * lastName: 'Smith',\n * email: 'joe@example.com'\n * }};\n * form.submit().then((submission) => {\n * console.log(submission);\n * });\n *\n * @param {boolean} before - If this submission occured from the before handlers.\n *\n * @returns {Promise} - A promise when the form is done submitting.\n */\n submit(before, options = {}) {\n this.submissionInProcess = true;\n if (!before) {\n return this.beforeSubmit(options).then(() => this.executeSubmit(options));\n }\n else {\n return this.executeSubmit(options);\n }\n }\n submitUrl(URL, headers) {\n if (!URL) {\n return console.warn('Missing URL argument');\n }\n const submission = this.submission || {};\n const API_URL = URL;\n const settings = {\n method: 'POST',\n headers: {}\n };\n if (headers && headers.length > 0) {\n headers.map((e) => {\n if (e.header !== '' && e.value !== '') {\n settings.headers[e.header] = this.interpolate(e.value, submission);\n }\n });\n }\n if (API_URL && settings) {\n Formio_1.Formio.makeStaticRequest(API_URL, settings.method, submission, { headers: settings.headers }).then(() => {\n this.emit('requestDone');\n this.setAlert('success', '<p> Success </p>');\n }).catch((e) => {\n const message = `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`;\n this.emit('error', message);\n console.error(message);\n this.setAlert('danger', `<p> ${message} </p>`);\n return Promise.reject(this.onSubmissionError(e));\n });\n }\n else {\n this.emit('error', 'You should add a URL to this button.');\n this.setAlert('warning', 'You should add a URL to this button.');\n return console.warn('You should add a URL to this button.');\n }\n }\n triggerRecaptcha() {\n if (!this || !this.components) {\n return;\n }\n const recaptchaComponent = (0, utils_1.searchComponents)(this.components, {\n 'component.type': 'recaptcha',\n 'component.eventType': 'formLoad'\n });\n if (recaptchaComponent.length > 0) {\n recaptchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);\n }\n }\n set nosubmit(value) {\n this._nosubmit = !!value;\n this.emit('nosubmit', this._nosubmit);\n }\n get nosubmit() {\n return this._nosubmit || false;\n }\n get conditions() {\n var _a, _b;\n return (_b = (_a = this.schema.settings) === null || _a === void 0 ? void 0 : _a.conditions) !== null && _b !== void 0 ? _b : [];\n }\n get variables() {\n var _a, _b;\n return (_b = (_a = this.schema.settings) === null || _a === void 0 ? void 0 : _a.variables) !== null && _b !== void 0 ? _b : [];\n }\n}\nexports[\"default\"] = Webform;\nWebform.setBaseUrl = Formio_1.Formio.setBaseUrl;\nWebform.setApiUrl = Formio_1.Formio.setApiUrl;\nWebform.setAppUrl = Formio_1.Formio.setAppUrl;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Webform.js?");
|
7495
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\nconst compare_versions_1 = __webpack_require__(/*! compare-versions */ \"./node_modules/compare-versions/lib/esm/index.js\");\nconst EventEmitter_1 = __importDefault(__webpack_require__(/*! ./EventEmitter */ \"./lib/cjs/EventEmitter.js\"));\nconst i18n_1 = __importDefault(__webpack_require__(/*! ./i18n */ \"./lib/cjs/i18n.js\"));\nconst Formio_1 = __webpack_require__(/*! ./Formio */ \"./lib/cjs/Formio.js\");\nconst Components_1 = __importDefault(__webpack_require__(/*! ./components/Components */ \"./lib/cjs/components/Components.js\"));\nconst NestedDataComponent_1 = __importDefault(__webpack_require__(/*! ./components/_classes/nesteddata/NestedDataComponent */ \"./lib/cjs/components/_classes/nesteddata/NestedDataComponent.js\"));\nconst utils_1 = __webpack_require__(/*! ./utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst formUtils_1 = __webpack_require__(/*! ./utils/formUtils */ \"./lib/cjs/utils/formUtils.js\");\n// Initialize the available forms.\nFormio_1.Formio.forms = {};\n// Allow people to register components.\nFormio_1.Formio.registerComponent = Components_1.default.setComponent;\nfunction getIconSet(icons) {\n if (icons === 'fontawesome') {\n return 'fa';\n }\n return icons || '';\n}\nfunction getOptions(options) {\n options = lodash_1.default.defaults(options, {\n submitOnEnter: false,\n iconset: getIconSet((options && options.icons) ? options.icons : Formio_1.Formio.icons),\n i18next: null,\n saveDraft: false,\n alwaysDirty: false,\n saveDraftThrottle: 5000,\n display: 'form',\n cdnUrl: Formio_1.Formio.cdn.baseUrl\n });\n if (!options.events) {\n options.events = new EventEmitter_1.default();\n }\n return options;\n}\n/**\n * Renders a Form.io form within the webpage.\n */\nclass Webform extends NestedDataComponent_1.default {\n /**\n * Creates a new Form instance.\n *\n * @param {Object} options - The options to create a new form instance.\n * @param {boolean} options.saveDraft - Set this if you would like to enable the save draft feature.\n * @param {boolean} options.saveDraftThrottle - The throttle for the save draft feature.\n * @param {boolean} options.readOnly - Set this form to readOnly\n * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.\n * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js\n * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.\n */\n /* eslint-disable max-statements */\n constructor() {\n let element, options;\n if (arguments[0] instanceof HTMLElement || arguments[1]) {\n element = arguments[0];\n options = arguments[1];\n }\n else {\n options = arguments[0];\n }\n super(null, getOptions(options));\n this.executeShortcuts = (event) => {\n const { target } = event;\n if (!this.keyboardCatchableElement(target)) {\n return;\n }\n const ctrl = event.ctrlKey || event.metaKey;\n const keyCode = event.keyCode;\n let char = '';\n if (65 <= keyCode && keyCode <= 90) {\n char = String.fromCharCode(keyCode);\n }\n else if (keyCode === 13) {\n char = 'Enter';\n }\n else if (keyCode === 27) {\n char = 'Esc';\n }\n lodash_1.default.each(this.shortcuts, (shortcut) => {\n if (shortcut.ctrl && !ctrl) {\n return;\n }\n if (shortcut.shortcut === char) {\n shortcut.element.click();\n event.preventDefault();\n }\n });\n };\n this.setElement(element);\n // Keep track of all available forms globally.\n Formio_1.Formio.forms[this.id] = this;\n // Set the base url.\n if (this.options.baseUrl) {\n Formio_1.Formio.setBaseUrl(this.options.baseUrl);\n }\n /**\n * The type of this element.\n * @type {string}\n */\n this.type = 'form';\n this._src = '';\n this._loading = false;\n this._form = {};\n this.draftEnabled = false;\n this.savingDraft = true;\n if (this.options.saveDraftThrottle) {\n this.triggerSaveDraft = lodash_1.default.throttle(this.saveDraft.bind(this), this.options.saveDraftThrottle);\n }\n else {\n this.triggerSaveDraft = this.saveDraft.bind(this);\n }\n /**\n * Determines if this form should submit the API on submit.\n * @type {boolean}\n */\n this.nosubmit = false;\n /**\n * Determines if the form has tried to be submitted, error or not.\n *\n * @type {boolean}\n */\n this.submitted = false;\n /**\n * Determines if the form is being submitted at the moment.\n *\n * @type {boolean}\n */\n this.submitting = false;\n /**\n * The Formio instance for this form.\n * @type {Formio}\n */\n this.formio = null;\n /**\n * The loader HTML element.\n * @type {HTMLElement}\n */\n this.loader = null;\n /**\n * The alert HTML element\n * @type {HTMLElement}\n */\n this.alert = null;\n /**\n * Promise that is triggered when the submission is done loading.\n * @type {Promise}\n */\n this.onSubmission = null;\n /**\n * Determines if this submission is explicitly set.\n * @type {boolean}\n */\n this.submissionSet = false;\n /**\n * Promise that executes when the form is ready and rendered.\n * @type {Promise}\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.formReady.then(() => {\n * console.log('The form is ready!');\n * });\n * form.src = 'https://examples.form.io/example';\n */\n this.formReady = new Promise((resolve, reject) => {\n /**\n * Called when the formReady state of this form has been resolved.\n *\n * @type {function}\n */\n this.formReadyResolve = resolve;\n /**\n * Called when this form could not load and is rejected.\n *\n * @type {function}\n */\n this.formReadyReject = reject;\n });\n /**\n * Promise that executes when the submission is ready and rendered.\n * @type {Promise}\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.submissionReady.then(() => {\n * console.log('The submission is ready!');\n * });\n * form.src = 'https://examples.form.io/example/submission/234234234234234243';\n */\n this.submissionReady = new Promise((resolve, reject) => {\n /**\n * Called when the formReady state of this form has been resolved.\n *\n * @type {function}\n */\n this.submissionReadyResolve = resolve;\n /**\n * Called when this form could not load and is rejected.\n *\n * @type {function}\n */\n this.submissionReadyReject = reject;\n });\n this.shortcuts = [];\n // Set language after everything is established.\n this.language = this.i18next.language;\n // See if we need to restore the draft from a user.\n if (this.options.saveDraft && !this.options.skipDraftRestore) {\n this.formReady.then(() => {\n const user = Formio_1.Formio.getUser();\n // Only restore a draft if the submission isn't explicitly set.\n if (user && !this.submissionSet) {\n this.restoreDraft(user._id);\n }\n });\n }\n this.component.clearOnHide = false;\n // Ensure the root is set to this component.\n this.root = this;\n this.localRoot = this;\n }\n /* eslint-enable max-statements */\n get language() {\n return this.options.language;\n }\n get emptyValue() {\n return null;\n }\n componentContext() {\n return this._data;\n }\n /**\n * Sets the language for this form.\n *\n * @param lang\n * @return {Promise}\n */\n set language(lang) {\n if (!this.i18next) {\n return;\n }\n this.options.language = lang;\n if (this.i18next.language === lang) {\n return;\n }\n this.i18next.changeLanguage(lang, (err) => {\n if (err) {\n return;\n }\n this.rebuild();\n this.emit('languageChanged');\n });\n }\n get componentComponents() {\n return this.form.components;\n }\n get shadowRoot() {\n return this.options.shadowRoot;\n }\n /**\n * Add a language for translations\n *\n * @param code\n * @param lang\n * @param active\n * @return {*}\n */\n addLanguage(code, lang, active = false) {\n if (this.i18next) {\n var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);\n this.i18next.addResourceBundle(code, 'translation', translations, true, true);\n if (active) {\n this.language = code;\n }\n }\n }\n keyboardCatchableElement(element) {\n if (element.nodeName === 'TEXTAREA') {\n return false;\n }\n if (element.nodeName === 'INPUT') {\n return [\n 'text',\n 'email',\n 'password'\n ].indexOf(element.type) === -1;\n }\n return true;\n }\n addShortcut(element, shortcut) {\n if (!shortcut || !/^([A-Z]|Enter|Esc)$/i.test(shortcut)) {\n return;\n }\n shortcut = lodash_1.default.capitalize(shortcut);\n if (shortcut === 'Enter' || shortcut === 'Esc') {\n // Restrict Enter and Esc only for buttons\n if (element.tagName !== 'BUTTON') {\n return;\n }\n this.shortcuts.push({\n shortcut,\n element\n });\n }\n else {\n this.shortcuts.push({\n ctrl: true,\n shortcut,\n element\n });\n }\n }\n removeShortcut(element, shortcut) {\n if (!shortcut || !/^([A-Z]|Enter|Esc)$/i.test(shortcut)) {\n return;\n }\n lodash_1.default.remove(this.shortcuts, {\n shortcut,\n element\n });\n }\n /**\n * Get the embed source of the form.\n *\n * @returns {string}\n */\n get src() {\n return this._src;\n }\n /**\n * Loads the submission if applicable.\n */\n loadSubmission() {\n this.loadingSubmission = true;\n if (this.formio.submissionId) {\n this.onSubmission = this.formio.loadSubmission().then((submission) => this.setSubmission(submission), (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));\n }\n else {\n this.submissionReadyResolve();\n }\n return this.submissionReady;\n }\n /**\n * Set the src of the form renderer.\n *\n * @param value\n * @param options\n */\n setSrc(value, options) {\n if (this.setUrl(value, options)) {\n this.nosubmit = false;\n return this.formio.loadForm({ params: { live: 1 } }).then((form) => {\n const setForm = this.setForm(form);\n this.loadSubmission();\n return setForm;\n }).catch((err) => {\n console.warn(err);\n this.formReadyReject(err);\n });\n }\n return Promise.resolve();\n }\n /**\n * Set the Form source, which is typically the Form.io embed URL.\n *\n * @param {string} value - The value of the form embed url.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.formReady.then(() => {\n * console.log('The form is formReady!');\n * });\n * form.src = 'https://examples.form.io/example';\n */\n set src(value) {\n this.setSrc(value);\n }\n /**\n * Get the embed source of the form.\n *\n * @returns {string}\n */\n get url() {\n return this._src;\n }\n /**\n * Sets the url of the form renderer.\n *\n * @param value\n * @param options\n */\n setUrl(value, options) {\n if (!value ||\n (typeof value !== 'string') ||\n (value === this._src)) {\n return false;\n }\n this._src = value;\n this.nosubmit = true;\n this.formio = this.options.formio = new Formio_1.Formio(value, options);\n if (this.type === 'form') {\n // Set the options source so this can be passed to other components.\n this.options.src = value;\n }\n return true;\n }\n /**\n * Set the form source but don't initialize the form and submission from the url.\n *\n * @param {string} value - The value of the form embed url.\n */\n set url(value) {\n this.setUrl(value);\n }\n /**\n * Called when both the form and submission have been loaded.\n *\n * @returns {Promise} - The promise to trigger when both form and submission have loaded.\n */\n get ready() {\n return this.formReady.then(() => {\n return super.ready.then(() => {\n return this.loadingSubmission ? this.submissionReady : true;\n });\n });\n }\n /**\n * Returns if this form is loading.\n *\n * @returns {boolean} - TRUE means the form is loading, FALSE otherwise.\n */\n get loading() {\n return this._loading;\n }\n /**\n * Set the loading state for this form, and also show the loader spinner.\n *\n * @param {boolean} loading - If this form should be \"loading\" or not.\n */\n set loading(loading) {\n if (this._loading !== loading) {\n this._loading = loading;\n if (!this.loader && loading) {\n this.loader = this.ce('div', {\n class: 'loader-wrapper'\n });\n const spinner = this.ce('div', {\n class: 'loader text-center'\n });\n this.loader.appendChild(spinner);\n }\n /* eslint-disable max-depth */\n if (this.loader) {\n try {\n if (loading) {\n this.prependTo(this.loader, this.wrapper);\n }\n else {\n this.removeChildFrom(this.loader, this.wrapper);\n }\n }\n catch (err) {\n // ingore\n }\n }\n /* eslint-enable max-depth */\n }\n }\n /**\n * Sets the JSON schema for the form to be rendered.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.setForm({\n * components: [\n * {\n * type: 'textfield',\n * key: 'firstName',\n * label: 'First Name',\n * placeholder: 'Enter your first name.',\n * input: true\n * },\n * {\n * type: 'textfield',\n * key: 'lastName',\n * label: 'Last Name',\n * placeholder: 'Enter your last name',\n * input: true\n * },\n * {\n * type: 'button',\n * action: 'submit',\n * label: 'Submit',\n * theme: 'primary'\n * }\n * ]\n * });\n *\n * @param {Object} form - The JSON schema of the form @see https://examples.form.io/example for an example JSON schema.\n * @param flags\n * @returns {*}\n */\n setForm(form, flags) {\n var _a, _b, _c;\n const isFormAlreadySet = this._form && ((_a = this._form.components) === null || _a === void 0 ? void 0 : _a.length);\n try {\n // Do not set the form again if it has been already set\n if (isFormAlreadySet && JSON.stringify(this._form) === JSON.stringify(form)) {\n return Promise.resolve();\n }\n // Create the form.\n this._form = (flags === null || flags === void 0 ? void 0 : flags.keepAsReference) ? form : lodash_1.default.cloneDeep(form);\n if (this.onSetForm) {\n this.onSetForm(lodash_1.default.cloneDeep(this._form), form);\n }\n if ((_c = (_b = this.parent) === null || _b === void 0 ? void 0 : _b.component) === null || _c === void 0 ? void 0 : _c.modalEdit) {\n return Promise.resolve();\n }\n }\n catch (err) {\n console.warn(err);\n // If provided form is not a valid JSON object, do not set it too\n return Promise.resolve();\n }\n // Allow the form to provide component overrides.\n if (form && form.settings && form.settings.components) {\n this.options.components = form.settings.components;\n }\n if (form && form.properties) {\n this.options.properties = form.properties;\n }\n // Use the sanitize config from the form settings or the global sanitize config if it is not provided in the options\n if (!this.options.sanitizeConfig && !this.builderMode) {\n this.options.sanitizeConfig = lodash_1.default.get(form, 'settings.sanitizeConfig') || lodash_1.default.get(form, 'globalSettings.sanitizeConfig');\n }\n if ('schema' in form && (0, compare_versions_1.compareVersions)(form.schema, '1.x') > 0) {\n this.ready.then(() => {\n this.setAlert('alert alert-danger', 'Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.');\n });\n }\n // See if they pass a module, and evaluate it if so.\n if (form && form.module) {\n let formModule = null;\n if (typeof form.module === 'string') {\n try {\n formModule = this.evaluate(`return ${form.module}`);\n }\n catch (err) {\n console.warn(err);\n }\n }\n else {\n formModule = form.module;\n }\n if (formModule) {\n Formio_1.Formio.use(formModule);\n // Since we got here after instantiation, we need to manually apply form options.\n if (formModule.options && formModule.options.form) {\n this.options = Object.assign(this.options, formModule.options.form);\n }\n }\n }\n this.initialized = false;\n const rebuild = this.rebuild() || Promise.resolve();\n return rebuild.then(() => {\n this.emit('formLoad', form);\n this.triggerRecaptcha();\n // Make sure to trigger onChange after a render event occurs to speed up form rendering.\n setTimeout(() => {\n this.onChange(flags);\n this.formReadyResolve();\n }, 0);\n return this.formReady;\n });\n }\n /**\n * Gets the form object.\n *\n * @returns {Object} - The form JSON schema.\n */\n get form() {\n if (!this._form) {\n this._form = {\n components: []\n };\n }\n return this._form;\n }\n /**\n * Sets the form value.\n *\n * @alias setForm\n * @param {Object} form - The form schema object.\n */\n set form(form) {\n this.setForm(form);\n }\n /**\n * Returns the submission object that was set within this form.\n *\n * @returns {Object}\n */\n get submission() {\n return this.getValue();\n }\n /**\n * Sets the submission of a form.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.src = 'https://examples.form.io/example';\n * form.submission = {data: {\n * firstName: 'Joe',\n * lastName: 'Smith',\n * email: 'joe@example.com'\n * }};\n *\n * @param {Object} submission - The Form.io submission object.\n */\n set submission(submission) {\n this.setSubmission(submission);\n }\n /**\n * Sets a submission and returns the promise when it is ready.\n * @param submission\n * @param flags\n * @return {Promise.<TResult>}\n */\n setSubmission(submission, flags = {}) {\n flags = Object.assign(Object.assign({}, flags), { fromSubmission: lodash_1.default.has(flags, 'fromSubmission') ? flags.fromSubmission : true });\n return this.onSubmission = this.formReady.then((resolveFlags) => {\n if (resolveFlags) {\n flags = Object.assign(Object.assign({}, flags), resolveFlags);\n }\n this.submissionSet = true;\n this.triggerChange(flags);\n this.emit('beforeSetSubmission', submission);\n this.setValue(submission, flags);\n return this.submissionReadyResolve(submission);\n }, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));\n }\n handleDraftError(errName, errDetails, restoreDraft) {\n const errorMessage = lodash_1.default.trim(`${this.t(errName)} ${errDetails || ''}`);\n console.warn(errorMessage);\n this.emit(restoreDraft ? 'restoreDraftError' : 'saveDraftError', errDetails || errorMessage);\n }\n /**\n * Saves a submission draft.\n */\n saveDraft() {\n if (!this.draftEnabled) {\n return;\n }\n if (!this.formio) {\n this.handleDraftError('saveDraftInstanceError');\n return;\n }\n if (!Formio_1.Formio.getUser()) {\n this.handleDraftError('saveDraftAuthError');\n return;\n }\n const draft = (0, utils_1.fastCloneDeep)(this.submission);\n draft.state = 'draft';\n if (!this.savingDraft) {\n this.emit('saveDraftBegin');\n this.savingDraft = true;\n this.formio.saveSubmission(draft).then((sub) => {\n // Set id to submission to avoid creating new draft submission\n this.submission._id = sub._id;\n this.savingDraft = false;\n this.emit('saveDraft', sub);\n })\n .catch(err => {\n this.savingDraft = false;\n this.handleDraftError('saveDraftError', err);\n });\n }\n }\n /**\n * Restores a draft submission based on the user who is authenticated.\n *\n * @param {userId} - The user id where we need to restore the draft from.\n */\n restoreDraft(userId) {\n if (!this.formio) {\n this.handleDraftError('restoreDraftInstanceError', null, true);\n return;\n }\n this.savingDraft = true;\n this.formio.loadSubmissions({\n params: {\n state: 'draft',\n owner: userId\n }\n }).then(submissions => {\n if (submissions.length > 0 && !this.options.skipDraftRestore) {\n const draft = (0, utils_1.fastCloneDeep)(submissions[0]);\n return this.setSubmission(draft).then(() => {\n this.draftEnabled = true;\n this.savingDraft = false;\n this.emit('restoreDraft', draft);\n });\n }\n // Enable drafts so that we can keep track of changes.\n this.draftEnabled = true;\n this.savingDraft = false;\n this.emit('restoreDraft', null);\n })\n .catch(err => {\n this.draftEnabled = true;\n this.savingDraft = false;\n this.handleDraftError('restoreDraftError', err, true);\n });\n }\n get schema() {\n const schema = (0, utils_1.fastCloneDeep)(lodash_1.default.omit(this._form, ['components']));\n schema.components = [];\n this.eachComponent((component) => schema.components.push(component.schema));\n return schema;\n }\n mergeData(_this, _that) {\n lodash_1.default.mergeWith(_this, _that, (thisValue, thatValue) => {\n if (Array.isArray(thisValue) && Array.isArray(thatValue) && thisValue.length !== thatValue.length) {\n return thatValue;\n }\n });\n }\n setValue(submission, flags = {}) {\n if (!submission || !submission.data) {\n submission = {\n data: {},\n metadata: submission.metadata,\n };\n }\n // Metadata needs to be available before setValue\n this._submission.metadata = submission.metadata || {};\n this.editing = !!submission._id;\n // Set the timezone in the options if available.\n if (!this.options.submissionTimezone &&\n submission.metadata &&\n submission.metadata.timezone) {\n this.options.submissionTimezone = submission.metadata.timezone;\n }\n const changed = super.setValue(submission.data, flags);\n if (!flags.sanitize) {\n this.mergeData(this.data, submission.data);\n }\n submission.data = this.data;\n this._submission = submission;\n return changed;\n }\n getValue() {\n if (!this._submission.data) {\n this._submission.data = {};\n }\n if (this.viewOnly) {\n return this._submission;\n }\n const submission = this._submission;\n submission.data = this.data;\n return this._submission;\n }\n /**\n * Build the form.\n */\n init() {\n if (this.options.submission) {\n const submission = lodash_1.default.extend({}, this.options.submission);\n this._submission = submission;\n this._data = submission.data;\n }\n else {\n this._submission = this._submission || { data: {} };\n }\n // Remove any existing components.\n if (this.components && this.components.length) {\n this.destroyComponents();\n this.components = [];\n }\n if (this.component) {\n this.component.components = this.form ? this.form.components : [];\n }\n else {\n this.component = this.form;\n }\n this.component.type = 'form';\n this.component.input = false;\n this.addComponents();\n this.on('submitButton', options => {\n this.submit(false, options).catch(e => {\n options.instance.loading = false;\n return e !== false && e !== undefined && console.log(e);\n });\n }, true);\n this.on('checkValidity', (data) => this.validate(data, { dirty: true, process: 'change' }), true);\n this.on('requestUrl', (args) => (this.submitUrl(args.url, args.headers)), true);\n this.on('resetForm', () => this.resetValue(), true);\n this.on('deleteSubmission', () => this.deleteSubmission(), true);\n this.on('refreshData', () => this.updateValue(), true);\n this.executeFormController();\n return this.formReady;\n }\n executeFormController() {\n // If no controller value or\n // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)\n if (!this.form || !this.form.controller\n || ((!this.visible || this.component.hidden) && this.component.clearOnHide && !this.rootPristine)) {\n return false;\n }\n this.formReady.then(() => {\n this.evaluate(this.form.controller, {\n components: this.components,\n instance: this,\n });\n });\n }\n teardown() {\n this.emit('formDelete', this.id);\n delete Formio_1.Formio.forms[this.id];\n delete this.executeShortcuts;\n delete this.triggerSaveDraft;\n super.teardown();\n }\n destroy(all = false) {\n this.off('submitButton');\n this.off('checkValidity');\n this.off('requestUrl');\n this.off('resetForm');\n this.off('deleteSubmission');\n this.off('refreshData');\n return super.destroy(all);\n }\n build(element) {\n if (element || this.element) {\n return this.ready.then(() => {\n element = element || this.element;\n super.build(element);\n });\n }\n return this.ready;\n }\n getClassName() {\n let classes = 'formio-form';\n if (this.options.readOnly) {\n classes += ' formio-read-only';\n }\n return classes;\n }\n render() {\n return super.render(this.renderTemplate('webform', {\n classes: this.getClassName(),\n children: this.renderComponents(),\n }), this.builderMode ? 'builder' : 'form', true);\n }\n redraw() {\n // Don't bother if we have not built yet.\n if (!this.element) {\n return Promise.resolve();\n }\n this.clear();\n this.setContent(this.element, this.render());\n return this.attach(this.element);\n }\n attach(element) {\n this.setElement(element);\n this.loadRefs(element, { webform: 'single' });\n const childPromise = this.attachComponents(this.refs.webform);\n this.addEventListener(document, 'keydown', this.executeShortcuts);\n this.currentForm = this;\n this.hook('attachWebform', element, this);\n return childPromise.then(() => {\n this.emit('render', this.element);\n return this.setValue(this._submission, {\n noUpdateEvent: true,\n });\n });\n }\n hasRequiredFields() {\n let result = false;\n (0, formUtils_1.eachComponent)(this.form.components, (component) => {\n if (component.validate.required) {\n result = true;\n return true;\n }\n }, true);\n return result;\n }\n resetValue() {\n lodash_1.default.each(this.getComponents(), (comp) => (comp.resetValue()));\n this.setPristine(true);\n this.onChange({ resetValue: true });\n }\n /**\n * Sets a new alert to display in the error dialog of the form.\n *\n * @param {string} type - The type of alert to display. \"danger\", \"success\", \"warning\", etc.\n * @param {string} message - The message to show in the alert.\n * @param {Object} options\n */\n setAlert(type, message, options) {\n if (!type && this.submitted) {\n if (this.alert) {\n if (this.refs.errorRef && this.refs.errorRef.length) {\n this.refs.errorRef.forEach(el => {\n this.removeEventListener(el, 'click');\n this.removeEventListener(el, 'keypress');\n });\n }\n this.removeChild(this.alert);\n this.alert = null;\n }\n return;\n }\n if (this.options.noAlerts) {\n if (!message) {\n this.emit('error', false);\n }\n return;\n }\n if (this.alert) {\n try {\n if (this.refs.errorRef && this.refs.errorRef.length) {\n this.refs.errorRef.forEach(el => {\n this.removeEventListener(el, 'click');\n this.removeEventListener(el, 'keypress');\n });\n }\n this.removeChild(this.alert);\n this.alert = null;\n }\n catch (err) {\n // ignore\n }\n }\n if (message) {\n const attrs = {\n class: (options && options.classes) || `alert alert-${type}`,\n id: `error-list-${this.id}`,\n };\n const templateOptions = {\n message: message instanceof HTMLElement ? message.outerHTML : message,\n attrs: attrs,\n type\n };\n this.alert = (0, utils_1.convertStringToHTMLElement)(this.renderTemplate('alert', templateOptions), `#${attrs.id}`);\n }\n if (!this.alert) {\n return;\n }\n this.loadRefs(this.alert, { errorRef: 'multiple' });\n if (this.refs.errorRef && this.refs.errorRef.length) {\n this.refs.errorRef.forEach(el => {\n this.addEventListener(el, 'click', (e) => {\n const key = e.currentTarget.dataset.componentKey;\n this.focusOnComponent(key);\n });\n this.addEventListener(el, 'keydown', (e) => {\n if (e.keyCode === 13) {\n e.preventDefault();\n const key = e.currentTarget.dataset.componentKey;\n this.focusOnComponent(key);\n }\n });\n });\n }\n this.prepend(this.alert);\n }\n /**\n * Focus on selected component.\n *\n * @param {string} key - The key of selected component.\n * @returns {*}\n */\n focusOnComponent(key) {\n if (key) {\n const component = this.getComponent(key);\n if (component) {\n component.focus();\n }\n }\n }\n /**\n * Show the errors of this form within the alert dialog.\n *\n * @param {Object} error - An optional additional error to display along with the component errors.\n * @returns {*}\n */\n /* eslint-disable no-unused-vars */\n showErrors(errors, triggerEvent, onChange) {\n if (!errors) {\n return;\n }\n this.loading = false;\n if (!Array.isArray(errors)) {\n errors = [errors];\n }\n errors = errors.concat(this.customErrors).filter((err) => !!err);\n if (!errors.length) {\n this.setAlert(false);\n return;\n }\n // Mark any components as invalid if in a custom message.\n errors.forEach((err) => {\n const { components = [] } = err;\n if (err.component) {\n components.push(err.component);\n }\n if (err.path) {\n components.push(err.path);\n }\n components.forEach((path) => {\n const originalPath = (0, utils_1.getStringFromComponentPath)(path);\n const component = this.getComponent(path, lodash_1.default.identity, originalPath);\n if (err.fromServer) {\n if (component.serverErrors) {\n component.serverErrors.push(err);\n }\n else {\n component.serverErrors = [err];\n }\n }\n const components = lodash_1.default.compact(Array.isArray(component) ? component : [component]);\n components.forEach((component) => component.setCustomValidity(err.message, true));\n });\n });\n const displayedErrors = [];\n if (errors.length) {\n errors = lodash_1.default.uniqBy(errors, error => error.message);\n const createListItem = (message, index) => {\n var _a, _b, _c;\n const err = errors[index];\n const messageFromIndex = !lodash_1.default.isUndefined(index) && errors && errors[index];\n const keyOrPath = ((messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.formattedKeyOrPath) || (messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.path) || ((_a = messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.context) === null || _a === void 0 ? void 0 : _a.path)) || (((_b = err.context) === null || _b === void 0 ? void 0 : _b.component) && ((_c = err.context) === null || _c === void 0 ? void 0 : _c.component.key)) || (err.component && err.component.key) || err.fromServer && err.path;\n const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : '';\n if (typeof err !== 'string' && !err.formattedKeyOrPath) {\n err.formattedKeyOrPath = formattedKeyOrPath;\n }\n return {\n message: (0, utils_1.unescapeHTML)(message),\n keyOrPath: formattedKeyOrPath\n };\n };\n errors.forEach(({ message, context, fromServer, component }, index) => {\n const text = !(component === null || component === void 0 ? void 0 : component.label) || (context === null || context === void 0 ? void 0 : context.hasLabel) || fromServer\n ? this.t('alertMessage', { message: this.t(message) })\n : this.t('alertMessageWithLabel', {\n label: this.t(component === null || component === void 0 ? void 0 : component.label),\n message: this.t(message),\n });\n displayedErrors.push(createListItem(text, index));\n });\n }\n const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });\n this.root.setAlert('danger', errorsList);\n if (triggerEvent) {\n this.emit('error', errors);\n }\n return errors;\n }\n /* eslint-enable no-unused-vars */\n /**\n * Called when the submission has completed, or if the submission needs to be sent to an external library.\n *\n * @param {Object} submission - The submission object.\n * @param {boolean} saved - Whether or not this submission was saved to the server.\n * @returns {object} - The submission object.\n */\n onSubmit(submission, saved) {\n var _a;\n this.loading = false;\n this.submitting = false;\n this.setPristine(true);\n // We want to return the submitted submission and setValue will mutate the submission so cloneDeep it here.\n this.setValue((0, utils_1.fastCloneDeep)(submission), {\n noValidate: true,\n noCheck: true\n });\n this.setAlert('success', `<p>${this.t('complete')}</p>`);\n // Cancel triggered saveDraft to prevent overriding the submitted state\n if (this.draftEnabled && ((_a = this.triggerSaveDraft) === null || _a === void 0 ? void 0 : _a.cancel)) {\n this.triggerSaveDraft.cancel();\n }\n this.emit('submit', submission, saved);\n if (saved) {\n this.emit('submitDone', submission);\n }\n return submission;\n }\n normalizeError(error) {\n if (error) {\n if (typeof error === 'object' && 'details' in error) {\n error = error.details;\n }\n if (typeof error === 'string') {\n error = { message: error };\n }\n }\n return error;\n }\n /**\n * Called when an error occurs during the submission.\n *\n * @param {Object} error - The error that occured.\n */\n onSubmissionError(error) {\n error = this.normalizeError(error);\n this.submitting = false;\n this.setPristine(false);\n this.emit('submitError', error || this.errors);\n // Allow for silent cancellations (no error message, no submit button error state)\n if (error && error.silent) {\n this.emit('change', { isValid: true }, { silent: true });\n return false;\n }\n const errors = this.showErrors(error, true);\n if (this.root && this.root.alert) {\n this.scrollIntoView(this.root.alert);\n }\n return errors;\n }\n /**\n * Trigger the change event for this form.\n *\n * @param changed\n * @param flags\n */\n onChange(flags, changed, modified, changes) {\n flags = flags || {};\n let isChangeEventEmitted = false;\n super.onChange(flags, true);\n const value = lodash_1.default.clone(this.submission);\n flags.changed = value.changed = changed;\n flags.changes = changes;\n if (modified && this.pristine) {\n this.pristine = false;\n }\n this.checkData(value.data, flags);\n const shouldValidate = !flags.noValidate || flags.fromIFrame || (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);\n const errors = shouldValidate ? this.validate(value.data, Object.assign(Object.assign({}, flags), { process: 'change' })) : [];\n value.isValid = errors.length === 0;\n this.loading = false;\n if (this.submitted) {\n // show server errors while they are not cleaned/fixed\n const nonComponentServerErrors = lodash_1.default.filter(this.serverErrors || [], err => !err.component && !err.path);\n this.showErrors(nonComponentServerErrors.length ? nonComponentServerErrors : null);\n }\n // See if we need to save the draft of the form.\n if (modified && this.options.saveDraft) {\n this.triggerSaveDraft();\n }\n if (!flags || !flags.noEmit) {\n this.emit('change', value, flags, modified);\n isChangeEventEmitted = true;\n }\n // The form is initialized after the first change event occurs.\n if (isChangeEventEmitted && !this.initialized) {\n this.emit('initialized');\n this.initialized = true;\n }\n }\n /**\n * Send a delete request to the server.\n */\n deleteSubmission() {\n return this.formio.deleteSubmission()\n .then(() => {\n this.emit('submissionDeleted', this.submission);\n this.resetValue();\n });\n }\n /**\n * Cancels the submission.\n *\n * @alias reset\n */\n cancel(noconfirm) {\n const shouldReset = this.hook('beforeCancel', true);\n if (shouldReset && (noconfirm || confirm(this.t('confirmCancel')))) {\n this.resetValue();\n return true;\n }\n else {\n this.emit('cancelSubmit');\n return false;\n }\n }\n setMetadata(submission) {\n // Add in metadata about client submitting the form\n submission.metadata = submission.metadata || {};\n lodash_1.default.defaults(submission.metadata, {\n timezone: lodash_1.default.get(this, '_submission.metadata.timezone', (0, utils_1.currentTimezone)()),\n offset: parseInt(lodash_1.default.get(this, '_submission.metadata.offset', (0, moment_1.default)().utcOffset()), 10),\n origin: document.location.origin,\n referrer: document.referrer,\n browserName: navigator.appName,\n userAgent: navigator.userAgent,\n pathName: window.location.pathname,\n onLine: navigator.onLine\n });\n }\n submitForm(options = {}) {\n this.clearServerErrors();\n return new Promise((resolve, reject) => {\n // Read-only forms should never submit.\n if (this.options.readOnly) {\n return resolve({\n submission: this.submission,\n saved: false\n });\n }\n const submission = (0, utils_1.fastCloneDeep)(this.submission || {});\n this.setMetadata(submission);\n submission.state = options.state || submission.state || 'submitted';\n const isDraft = (submission.state === 'draft');\n this.hook('beforeSubmit', Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {\n var _a;\n if (err) {\n return reject(err);\n }\n submission._vnote = data && data._vnote ? data._vnote : '';\n try {\n if (!isDraft && !options.noValidate) {\n if (!submission.data) {\n return reject('Invalid Submission');\n }\n const errors = this.validate(submission.data, {\n dirty: true,\n silentCheck: false,\n process: 'submit'\n });\n if (errors.length || ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === 'rejected'))) {\n return reject(errors);\n }\n }\n }\n catch (err) {\n console.error(err);\n }\n this.everyComponent((comp) => {\n if (submission._vnote && comp.type === 'form' && comp.component.reference) {\n lodash_1.default.get(submission.data, comp.path, {})._vnote = submission._vnote;\n }\n const { persistent } = comp.component;\n if (persistent === 'client-only') {\n lodash_1.default.unset(submission.data, comp.path);\n }\n });\n this.hook('customValidation', Object.assign(Object.assign({}, submission), { component: options.component }), (err) => {\n if (err) {\n // If string is returned, cast to object.\n if (typeof err === 'string') {\n err = {\n message: err\n };\n }\n // Ensure err is an array.\n err = Array.isArray(err) ? err : [err];\n return reject(err);\n }\n this.loading = true;\n // Use the form action to submit the form if available.\n if (this._form && this._form.action) {\n const method = (submission.data._id && this._form.action.includes(submission.data._id)) ? 'PUT' : 'POST';\n return Formio_1.Formio.makeStaticRequest(this._form.action, method, submission, this.formio ? this.formio.options : {})\n .then((result) => resolve({\n submission: result,\n saved: true,\n }))\n .catch((error) => {\n this.setServerErrors(error);\n return reject(error);\n });\n }\n const submitFormio = this.formio;\n if (this.nosubmit || !submitFormio) {\n return resolve({\n submission,\n saved: false,\n });\n }\n // If this is an actionUrl, then make sure to save the action and not the submission.\n const submitMethod = submitFormio.actionUrl ? 'saveAction' : 'saveSubmission';\n submitFormio[submitMethod](submission)\n .then((result) => resolve({\n submission: result,\n saved: true,\n }))\n .catch((error) => {\n this.setServerErrors(error);\n return reject(error);\n });\n });\n });\n });\n }\n setServerErrors(error) {\n if (error.details) {\n this.serverErrors = error.details.filter((err) => err.level ? err.level === 'error' : err).map((err) => {\n err.fromServer = true;\n return err;\n });\n }\n else if (typeof error === 'string') {\n this.serverErrors = [{ fromServer: true, level: 'error', message: error }];\n }\n }\n executeSubmit(options) {\n this.submitted = true;\n this.submitting = true;\n return this.submitForm(options)\n .then(({ submission, saved }) => this.onSubmit(submission, saved))\n .then((results) => {\n this.submissionInProcess = false;\n return results;\n })\n .catch((err) => {\n this.submissionInProcess = false;\n return Promise.reject(this.onSubmissionError(err));\n });\n }\n clearServerErrors() {\n var _a;\n (_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.forEach((error) => {\n if (error.path) {\n const pathArray = (0, utils_1.getArrayFromComponentPath)(error.path);\n const component = this.getComponent(pathArray, lodash_1.default.identity, error.formattedKeyOrPath);\n if (component) {\n component.serverErrors = [];\n }\n }\n });\n this.serverErrors = [];\n }\n /**\n * Submits the form.\n *\n * @example\n * import Webform from '@formio/js/Webform';\n * let form = new Webform(document.getElementById('formio'));\n * form.src = 'https://examples.form.io/example';\n * form.submission = {data: {\n * firstName: 'Joe',\n * lastName: 'Smith',\n * email: 'joe@example.com'\n * }};\n * form.submit().then((submission) => {\n * console.log(submission);\n * });\n *\n * @param {boolean} before - If this submission occured from the before handlers.\n *\n * @returns {Promise} - A promise when the form is done submitting.\n */\n submit(before, options = {}) {\n this.submissionInProcess = true;\n if (!before) {\n return this.beforeSubmit(options).then(() => this.executeSubmit(options));\n }\n else {\n return this.executeSubmit(options);\n }\n }\n submitUrl(URL, headers) {\n if (!URL) {\n return console.warn('Missing URL argument');\n }\n const submission = this.submission || {};\n const API_URL = URL;\n const settings = {\n method: 'POST',\n headers: {}\n };\n if (headers && headers.length > 0) {\n headers.map((e) => {\n if (e.header !== '' && e.value !== '') {\n settings.headers[e.header] = this.interpolate(e.value, submission);\n }\n });\n }\n if (API_URL && settings) {\n Formio_1.Formio.makeStaticRequest(API_URL, settings.method, submission, { headers: settings.headers }).then(() => {\n this.emit('requestDone');\n this.setAlert('success', '<p> Success </p>');\n }).catch((e) => {\n const message = `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`;\n this.emit('error', message);\n console.error(message);\n this.setAlert('danger', `<p> ${message} </p>`);\n return Promise.reject(this.onSubmissionError(e));\n });\n }\n else {\n this.emit('error', 'You should add a URL to this button.');\n this.setAlert('warning', 'You should add a URL to this button.');\n return console.warn('You should add a URL to this button.');\n }\n }\n triggerRecaptcha() {\n if (!this || !this.components) {\n return;\n }\n const recaptchaComponent = (0, utils_1.searchComponents)(this.components, {\n 'component.type': 'recaptcha',\n 'component.eventType': 'formLoad'\n });\n if (recaptchaComponent.length > 0) {\n recaptchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);\n }\n }\n set nosubmit(value) {\n this._nosubmit = !!value;\n this.emit('nosubmit', this._nosubmit);\n }\n get nosubmit() {\n return this._nosubmit || false;\n }\n get conditions() {\n var _a, _b;\n return (_b = (_a = this.schema.settings) === null || _a === void 0 ? void 0 : _a.conditions) !== null && _b !== void 0 ? _b : [];\n }\n get variables() {\n var _a, _b;\n return (_b = (_a = this.schema.settings) === null || _a === void 0 ? void 0 : _a.variables) !== null && _b !== void 0 ? _b : [];\n }\n}\nexports[\"default\"] = Webform;\nWebform.setBaseUrl = Formio_1.Formio.setBaseUrl;\nWebform.setApiUrl = Formio_1.Formio.setApiUrl;\nWebform.setAppUrl = Formio_1.Formio.setAppUrl;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Webform.js?");
|
7463
7496
|
|
7464
7497
|
/***/ }),
|
7465
7498
|
|
@@ -7822,7 +7855,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7822
7855
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
7823
7856
|
|
7824
7857
|
"use strict";
|
7825
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst NestedArrayComponent_1 = __importDefault(__webpack_require__(/*! ../_classes/nestedarray/NestedArrayComponent */ \"./lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js\"));\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst Components_1 = __webpack_require__(/*! ../Components */ \"./lib/cjs/components/Components.js\");\nclass DataGridComponent extends NestedArrayComponent_1.default {\n static schema(...extend) {\n return NestedArrayComponent_1.default.schema({\n label: 'Data Grid',\n key: 'dataGrid',\n type: 'datagrid',\n clearOnHide: true,\n input: true,\n tree: true,\n components: []\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Data Grid',\n icon: 'th',\n group: 'data',\n documentation: '/userguide/form-building/data-components#data-grid',\n showPreview: false,\n weight: 30,\n schema: DataGridComponent.schema()\n };\n }\n constructor(...args) {\n super(...args);\n this.type = 'datagrid';\n this.tabIndex = 0;\n }\n init() {\n this.components = this.components || [];\n // Add new values based on minLength.\n this.rows = [];\n this.columns = [...this.component.components];\n if (this.initRows || !lodash_1.default.isEqual(this.dataValue, this.emptyValue)) {\n this.createRows(true);\n }\n this.visibleColumns = {};\n this.prevHasAddButton = this.hasAddButton();\n this.checkColumns();\n }\n get dataValue() {\n const dataValue = super.dataValue;\n if (!dataValue || !Array.isArray(dataValue)) {\n return this.emptyValue;\n }\n return dataValue;\n }\n set dataValue(value) {\n super.dataValue = value;\n }\n get defaultSchema() {\n return DataGridComponent.schema();\n }\n get initEmpty() {\n return this.component.initEmpty || this.component.noFirstRow;\n }\n get initRows() {\n return this.builderMode || this.path === 'defaultValue' || !this.initEmpty;\n }\n get emptyValue() {\n return this.initEmpty ? [] : [{}];\n }\n get addAnotherPosition() {\n return lodash_1.default.get(this.component, 'addAnotherPosition', 'bottom');\n }\n get minLength() {\n if (this.hasRowGroups()) {\n return lodash_1.default.sum(this.getGroupSizes());\n }\n else {\n return lodash_1.default.get(this.component, 'validate.minLength', 0);\n }\n }\n get defaultValue() {\n const isBuilderMode = this.builderMode;\n const isEmptyInit = this.initEmpty;\n // Ensure we have one and only one row in builder mode.\n if (isBuilderMode || (isEmptyInit && !this.dataValue.length)) {\n return isEmptyInit && !isBuilderMode ? [] : [{}];\n }\n const value = super.defaultValue;\n let defaultValue;\n if (Array.isArray(value)) {\n defaultValue = value;\n }\n else if (value && (typeof value === 'object')) {\n defaultValue = [value];\n }\n else {\n defaultValue = this.emptyValue;\n }\n for (let dIndex = defaultValue.length; dIndex < this.minLength; dIndex++) {\n defaultValue.push({});\n }\n return defaultValue;\n }\n set disabled(disabled) {\n super.disabled = disabled;\n lodash_1.default.each(this.refs[`${this.datagridKey}-addRow`], (button) => {\n button.disabled = disabled;\n });\n lodash_1.default.each(this.refs[`${this.datagridKey}-removeRow`], (button) => {\n button.disabled = disabled;\n });\n }\n get disabled() {\n return super.disabled;\n }\n get datagridKey() {\n return `datagrid-${this.key}`;\n }\n get allowReorder() {\n return !this.options.readOnly && lodash_1.default.get(this.component, 'reorder', false);\n }\n get iteratableRows() {\n return this.rows.map((row, index) => ({\n components: row,\n data: this.dataValue[index],\n }));\n }\n isEmpty(value = this.dataValue) {\n var _a;\n const isEmpty = super.isEmpty(value);\n if ((_a = this.components) === null || _a === void 0 ? void 0 : _a.length) {\n return this.components.reduce((isEmpty, component) => {\n return isEmpty && component.isEmpty();\n }, true);\n }\n return isEmpty;\n }\n /**\n * Split rows into chunks.\n * @param {Number[]} groups - array of numbers where each item is size of group\n * @param {Array<T>} rows - rows collection\n * @return {Array<T[]>}\n */\n getRowChunks(groups, rows) {\n const [, chunks] = groups.reduce(([startIndex, acc], size) => {\n const endIndex = startIndex + size;\n return [endIndex, [...acc, [startIndex, endIndex]]];\n }, [0, []]);\n return chunks.map(range => lodash_1.default.slice(rows, ...range));\n }\n /**\n * Create groups object.\n * Each key in object represents index of first row in group.\n * @return {Object}\n */\n getGroups() {\n const groups = lodash_1.default.get(this.component, 'rowGroups', []);\n const sizes = lodash_1.default.map(groups, 'numberOfRows').slice(0, -1);\n const indexes = sizes.reduce((groupIndexes, size) => {\n const last = groupIndexes[groupIndexes.length - 1];\n return groupIndexes.concat(last + size);\n }, [0]);\n return groups.reduce((gidxs, group, idx) => {\n return Object.assign(Object.assign({}, gidxs), { [indexes[idx]]: group });\n }, {});\n }\n /**\n * Retrun group sizes.\n * @return {Number[]}\n */\n getGroupSizes() {\n return lodash_1.default.map(lodash_1.default.get(this.component, 'rowGroups', []), 'numberOfRows');\n }\n hasRowGroups() {\n return lodash_1.default.get(this, 'component.enableRowGroups', false) && !this.builderMode;\n }\n totalRowsNumber(groups) {\n return lodash_1.default.sum(lodash_1.default.map(groups, 'numberOfRows'));\n }\n setStaticValue(n) {\n this.dataValue = lodash_1.default.range(n).map(() => ({}));\n }\n hasExtraColumn() {\n return (this.hasRemoveButtons() || this.canAddColumn);\n }\n hasRemoveButtons() {\n return !this.builderMode && !this.component.disableAddingRemovingRows &&\n !this.options.readOnly &&\n !this.disabled &&\n this.fullMode &&\n (this.dataValue.length > lodash_1.default.get(this.component, 'validate.minLength', 0));\n }\n hasTopSubmit() {\n return this.hasAddButton() && ['top', 'both'].includes(this.addAnotherPosition);\n }\n hasBottomSubmit() {\n return this.hasAddButton() && ['bottom', 'both'].includes(this.addAnotherPosition);\n }\n get canAddColumn() {\n return this.builderMode;\n }\n render() {\n const columns = this.getColumns();\n let columnExtra = 0;\n const hasRemoveButtons = this.hasRemoveButtons();\n if (this.component.reorder) {\n columnExtra++;\n }\n if (hasRemoveButtons) {\n columnExtra++;\n }\n if (this.canAddColumn) {\n columnExtra++;\n }\n const colWidth = Math.floor(12 / (columns.length + columnExtra));\n return super.render(this.renderTemplate('datagrid', {\n rows: this.getRows(),\n columns: columns,\n groups: this.hasRowGroups() ? this.getGroups() : [],\n visibleColumns: this.visibleColumns,\n hasToggle: lodash_1.default.get(this, 'component.groupToggle', false),\n hasHeader: this.hasHeader(),\n hasExtraColumn: this.hasExtraColumn(),\n hasAddButton: this.hasAddButton(),\n hasRemoveButtons,\n hasTopSubmit: this.hasTopSubmit(),\n hasBottomSubmit: this.hasBottomSubmit(),\n hasGroups: this.hasRowGroups(),\n numColumns: columns.length + (this.hasExtraColumn() ? 1 : 0),\n datagridKey: this.datagridKey,\n allowReorder: this.allowReorder,\n builder: this.builderMode,\n canAddColumn: this.canAddColumn,\n tabIndex: this.tabIndex,\n placeholder: this.renderTemplate('builderPlaceholder', {\n position: this.componentComponents.length,\n }),\n colWidth: colWidth.toString()\n }));\n }\n getRows() {\n return this.rows.map(row => {\n const components = {};\n lodash_1.default.each(row, (col, key) => {\n components[key] = col.render();\n });\n return components;\n });\n }\n getColumns() {\n return this.columns.filter((comp) => {\n return (!this.visibleColumns.hasOwnProperty(comp.key) || this.visibleColumns[comp.key]);\n });\n }\n hasHeader() {\n return this.component.components.reduce((hasHeader, col) => {\n // If any of the components has a title and it isn't hidden, display the header.\n return hasHeader || ((col.label || col.title) && !col.hideLabel);\n }, false);\n }\n loadRefs(element, refs) {\n super.loadRefs(element, refs);\n if (refs['messageContainer'] === 'single') {\n const container = lodash_1.default.last(element.querySelectorAll('[ref=messageContainer]'));\n this.refs['messageContainer'] = container || this.refs['messageContainer'];\n }\n }\n attach(element) {\n this.loadRefs(element, {\n [`${this.datagridKey}-row`]: 'multiple',\n [`${this.datagridKey}-tbody`]: 'single',\n [`${this.datagridKey}-addRow`]: 'multiple',\n [`${this.datagridKey}-removeRow`]: 'multiple',\n [`${this.datagridKey}-group-header`]: 'multiple',\n [this.datagridKey]: 'multiple',\n 'messageContainer': 'single'\n });\n if (this.allowReorder) {\n this.refs[`${this.datagridKey}-row`].forEach((row, index) => {\n row.dragInfo = { index };\n });\n if (this.root.dragulaLib) {\n this.dragula = this.root.dragulaLib([this.refs[`${this.datagridKey}-tbody`]], {\n moves: (_draggedElement, _oldParent, clickedElement) => {\n const clickedElementKey = clickedElement.getAttribute('data-key');\n const oldParentKey = _oldParent.getAttribute('data-key');\n //Check if the clicked button belongs to that container, if false, it belongs to the nested container\n if (oldParentKey === clickedElementKey) {\n return clickedElement.classList.contains('formio-drag-button');\n }\n }\n }).on('drop', this.onReorder.bind(this));\n this.dragula.on('cloned', (el, original) => {\n if (el && el.children && original && original.children) {\n lodash_1.default.each(original.children, (child, index) => {\n const styles = getComputedStyle(child, null);\n if (styles.cssText !== '') {\n el.children[index].style.cssText = styles.cssText;\n }\n else {\n const cssText = Object.values(styles).reduce((css, propertyName) => {\n return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;\n }, '');\n el.children[index].style.cssText = cssText;\n }\n });\n }\n });\n }\n }\n this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {\n this.addEventListener(addButton, 'click', this.addRow.bind(this));\n });\n this.refs[`${this.datagridKey}-removeRow`].forEach((removeButton, index) => {\n this.addEventListener(removeButton, 'click', this.removeRow.bind(this, index));\n });\n if (this.hasRowGroups()) {\n this.refs.chunks = this.getRowChunks(this.getGroupSizes(), this.refs[`${this.datagridKey}-row`]);\n this.refs[`${this.datagridKey}-group-header`].forEach((header, index) => {\n this.addEventListener(header, 'click', () => this.toggleGroup(header, index));\n });\n }\n const columns = this.getColumns();\n const rowLength = columns.length;\n this.rows.forEach((row, rowIndex) => {\n let columnIndex = 0;\n columns.forEach((col) => {\n this.attachComponents(this.refs[this.datagridKey][(rowIndex * rowLength) + columnIndex], [this.rows[rowIndex][col.key]], this.getComponentsContainer());\n columnIndex++;\n });\n });\n return super.attach(element);\n }\n getComponentsContainer() {\n return this.component.components;\n }\n onReorder(element, _target, _source, sibling) {\n if (!element.dragInfo || (sibling && !sibling.dragInfo)) {\n console.warn('There is no Drag Info available for either dragged or sibling element');\n return;\n }\n const oldPosition = element.dragInfo.index;\n //should drop at next sibling position; no next sibling means drop to last position\n const newPosition = sibling ? sibling.dragInfo.index : this.dataValue.length;\n const movedBelow = newPosition > oldPosition;\n const dataValue = (0, utils_1.fastCloneDeep)(this.dataValue);\n const draggedRowData = dataValue[oldPosition];\n //insert element at new position\n dataValue.splice(newPosition, 0, draggedRowData);\n //remove element from old position (if was moved above, after insertion it's at +1 index)\n dataValue.splice(movedBelow ? oldPosition : oldPosition + 1, 1);\n //need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)\n this.setValue(dataValue, { isReordered: true });\n this.rebuild();\n }\n focusOnNewRowElement(row) {\n Object.keys(row).find((key) => {\n const element = row[key].element;\n if (element) {\n const focusableElements = (0, utils_1.getFocusableElements)(element);\n if (focusableElements && focusableElements[0]) {\n focusableElements[0].focus();\n return true;\n }\n }\n return false;\n });\n }\n addRow() {\n const index = this.rows.length;\n // Handle length mismatch between rows and dataValue\n if (this.dataValue.length === index) {\n this.dataValue.push({});\n }\n let row;\n const dataValue = this.dataValue;\n const defaultValue = this.defaultValue;\n if (this.initEmpty && defaultValue[index]) {\n row = defaultValue[index];\n dataValue[index] = row;\n }\n else {\n row = dataValue[index];\n }\n this.rows[index] = this.createRowComponents(row, index);\n this.emit('dataGridAddRow', {\n component: this.component,\n row\n });\n this.checkConditions();\n this.triggerChange();\n this.redraw().then(() => {\n this.focusOnNewRowElement(this.rows[index]);\n });\n }\n updateComponentsRowIndex(components, rowIndex) {\n components.forEach((component, colIndex) => {\n var _a;\n if ((_a = component.options) === null || _a === void 0 ? void 0 : _a.name) {\n const newName = `[${this.key}][${rowIndex}]`;\n component.options.name = component.options.name.replace(`[${this.key}][${component.rowIndex}]`, newName);\n }\n component.rowIndex = rowIndex;\n component.row = `${rowIndex}-${colIndex}`;\n component.path = Components_1.Components.getComponentPath(component);\n });\n }\n updateRowsComponents(rowIndex) {\n this.rows.slice(rowIndex).forEach((row, index) => {\n this.updateComponentsRowIndex(Object.values(row), rowIndex + index);\n });\n }\n removeRow(index) {\n const makeEmpty = index === 0 && this.rows.length === 1;\n const flags = { isReordered: !makeEmpty, resetValue: makeEmpty };\n this.splice(index, flags);\n this.emit('dataGridDeleteRow', { index });\n const [row] = this.rows.splice(index, 1);\n this.removeRowComponents(row);\n this.updateRowsComponents(index);\n this.setValue(this.dataValue, flags);\n this.redraw();\n }\n removeRowComponents(row) {\n lodash_1.default.each(row, (component) => this.removeComponent(component));\n }\n getRowValues() {\n return this.dataValue;\n }\n setRowComponentsData(rowIndex, rowData) {\n lodash_1.default.each(this.rows[rowIndex], (component) => {\n component.data = rowData;\n });\n }\n createRows(init, rebuild) {\n let added = false;\n const rowValues = this.getRowValues();\n // Create any missing rows.\n rowValues.forEach((row, index) => {\n if (!rebuild && this.rows[index]) {\n this.setRowComponentsData(index, row);\n }\n else {\n if (this.rows[index]) {\n this.removeRowComponents(this.rows[index]);\n }\n this.rows[index] = this.createRowComponents(row, index);\n added = true;\n }\n });\n // Delete any extra rows.\n const removedRows = this.rows.splice(rowValues.length);\n const removed = !!removedRows.length;\n // Delete components of extra rows (to make sure that this.components contain only components of exisiting rows)\n if (removed) {\n removedRows.forEach(row => this.removeRowComponents(row));\n }\n if (!init && (added || removed)) {\n this.redraw();\n }\n return added;\n }\n createRowComponents(row, rowIndex) {\n const components = {};\n this.tabIndex = 0;\n this.component.components.map((col, colIndex) => {\n const options = lodash_1.default.clone(this.options);\n options.name += `[${rowIndex}]`;\n options.row = `${rowIndex}-${colIndex}`;\n let columnComponent;\n if (this.builderMode) {\n col.id = col.id + rowIndex;\n columnComponent = col;\n }\n else {\n columnComponent = Object.assign(Object.assign({}, col), { id: (col.id + rowIndex) });\n }\n const component = this.createComponent(columnComponent, options, row);\n component.parentDisabled = !!this.disabled;\n component.rowIndex = rowIndex;\n component.inDataGrid = true;\n if (columnComponent.tabindex &&\n parseInt(columnComponent.tabindex) > this.tabIndex) {\n this.tabIndex = parseInt(columnComponent.tabindex);\n }\n components[col.key] = component;\n });\n return components;\n }\n checkColumns(data, flags = {}) {\n data = data || this.rootValue;\n let show = false;\n if (!this.rows || !this.rows.length) {\n return { rebuild: false, show: false };\n }\n if (this.builderMode) {\n return { rebuild: false, show: true };\n }\n const visibility = {};\n let logicRebuild = false;\n const dataValue = this.dataValue;\n this.rows.forEach((row, rowIndex) => {\n lodash_1.default.each(row, (col, key) => {\n if (col && (typeof col.checkConditions === 'function')) {\n const firstRowCheck = visibility[key] === undefined;\n visibility[key] = !!visibility[key] ||\n (col.checkConditions(data, flags, dataValue[rowIndex]) && col.type !== 'hidden');\n if (col.component.logic && firstRowCheck) {\n const compIndex = lodash_1.default.findIndex(this.columns, ['key', key]);\n const equalColumns = lodash_1.default.isEqualWith(this.columns[compIndex], col.component, (col1, col2, key) => {\n // Don't compare columns by their auto-generated ids.\n if (key === 'id') {\n return true;\n }\n });\n if (!equalColumns) {\n logicRebuild = true;\n this.columns[compIndex] = col.component;\n }\n }\n }\n });\n });\n const rebuild = !lodash_1.default.isEqual(visibility, this.visibleColumns) || logicRebuild;\n lodash_1.default.each(visibility, (col) => {\n show |= col;\n });\n this.visibleColumns = visibility;\n return { rebuild, show };\n }\n checkComponentConditions(data, flags, row) {\n const isVisible = this.visible;\n // If table isn't visible, don't bother calculating columns.\n if (!super.checkComponentConditions(data, flags, row)) {\n return false;\n }\n const { rebuild, show } = this.checkColumns(data, flags);\n // Check if a rebuild is needed or the visibility changes.\n if (rebuild || !isVisible) {\n this.createRows(false, rebuild);\n }\n // Return if this table should show.\n return show;\n }\n setValue(value, flags = {}) {\n if (!value) {\n this.dataValue = this.defaultValue;\n this.createRows();\n return false;\n }\n if (!Array.isArray(value)) {\n if (typeof value === 'object') {\n value = [value];\n }\n else {\n this.createRows();\n value = [{}];\n }\n }\n // Make sure we always have at least one row.\n // NOTE: Removing this will break \"Public Configurations\" in portal. ;)\n if (value && !value.length && !this.initEmpty) {\n value.push({});\n }\n const isSettingSubmission = flags.fromSubmission && !lodash_1.default.isEqual(value, this.emptyValue);\n const changed = this.hasChanged(value, this.dataValue);\n this.dataValue = value;\n if (this.initRows || isSettingSubmission ||\n (Array.isArray(this.dataValue) && this.dataValue.length !== this.rows.length)) {\n if (!this.createRows() && changed) {\n this.redraw();\n }\n }\n if (this.componentModal && isSettingSubmission) {\n this.componentModal.setValue(value);\n }\n this.rows.forEach((row, rowIndex) => {\n if (value.length <= rowIndex) {\n return;\n }\n lodash_1.default.each(row, (col) => {\n col.rowIndex = rowIndex;\n this.setNestedValue(col, value[rowIndex], flags);\n });\n });\n this.updateOnChange(flags, changed);\n return changed;\n }\n restoreComponentsContext() {\n this.rows.forEach((row, index) => lodash_1.default.forIn(row, (component) => component.data = this.dataValue[index]));\n }\n getComponent(path, fn) {\n path = Array.isArray(path) ? path : [path];\n const [key, ...remainingPath] = path;\n let result = [];\n if (lodash_1.default.isNumber(key) && remainingPath.length) {\n const compKey = remainingPath.pop();\n result = this.rows[key][compKey];\n // If the component is inside a Layout Component, try to find it among all the row's components\n if (!result) {\n Object.entries(this.rows[key]).forEach(([, comp]) => {\n if ('getComponent' in comp) {\n const possibleResult = comp.getComponent([compKey], fn);\n if (possibleResult) {\n result = possibleResult;\n }\n }\n });\n }\n if (result && lodash_1.default.isFunction(fn)) {\n fn(result, this.getComponents());\n }\n if (remainingPath.length && 'getComponent' in result) {\n return result.getComponent(remainingPath, fn);\n }\n return result;\n }\n if (!lodash_1.default.isString(key)) {\n return result;\n }\n this.everyComponent((component, components) => {\n if (component.component.key === key) {\n let comp = component;\n if (remainingPath.length > 0 && 'getComponent' in component) {\n comp = component.getComponent(remainingPath, fn);\n }\n else if (fn) {\n fn(component, components);\n }\n result = result.concat(comp);\n }\n });\n return result.length > 0 ? result : null;\n }\n toggleGroup(element, index) {\n element.classList.toggle('collapsed');\n lodash_1.default.each(this.refs.chunks[index], row => {\n row.classList.toggle('hidden');\n });\n }\n}\nexports[\"default\"] = DataGridComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/datagrid/DataGrid.js?");
|
7858
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst NestedArrayComponent_1 = __importDefault(__webpack_require__(/*! ../_classes/nestedarray/NestedArrayComponent */ \"./lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js\"));\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst Components_1 = __webpack_require__(/*! ../Components */ \"./lib/cjs/components/Components.js\");\nclass DataGridComponent extends NestedArrayComponent_1.default {\n static schema(...extend) {\n return NestedArrayComponent_1.default.schema({\n label: 'Data Grid',\n key: 'dataGrid',\n type: 'datagrid',\n clearOnHide: true,\n input: true,\n tree: true,\n components: []\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Data Grid',\n icon: 'th',\n group: 'data',\n documentation: '/userguide/form-building/data-components#data-grid',\n showPreview: false,\n weight: 30,\n schema: DataGridComponent.schema()\n };\n }\n constructor(...args) {\n super(...args);\n this.type = 'datagrid';\n this.tabIndex = 0;\n }\n init() {\n this.components = this.components || [];\n // Add new values based on minLength.\n this.rows = [];\n this.columns = [...this.component.components];\n if (this.initRows || !lodash_1.default.isEqual(this.dataValue, this.emptyValue)) {\n this.createRows(true);\n }\n this.visibleColumns = {};\n this.prevHasAddButton = this.hasAddButton();\n this.checkColumns();\n }\n get dataValue() {\n const dataValue = super.dataValue;\n if (!dataValue || !Array.isArray(dataValue)) {\n return this.emptyValue;\n }\n return dataValue;\n }\n set dataValue(value) {\n super.dataValue = value;\n }\n get defaultSchema() {\n return DataGridComponent.schema();\n }\n get initEmpty() {\n return this.component.initEmpty || this.component.noFirstRow;\n }\n get initRows() {\n return this.builderMode || this.path === 'defaultValue' || !this.initEmpty;\n }\n get emptyValue() {\n return this.initEmpty ? [] : [{}];\n }\n get addAnotherPosition() {\n return lodash_1.default.get(this.component, 'addAnotherPosition', 'bottom');\n }\n get minLength() {\n if (this.hasRowGroups()) {\n return lodash_1.default.sum(this.getGroupSizes());\n }\n else {\n return lodash_1.default.get(this.component, 'validate.minLength', 0);\n }\n }\n get defaultValue() {\n const isBuilderMode = this.builderMode;\n const isEmptyInit = this.initEmpty;\n // Ensure we have one and only one row in builder mode.\n if (isBuilderMode || (isEmptyInit && !this.dataValue.length)) {\n return isEmptyInit && !isBuilderMode ? [] : [{}];\n }\n const value = super.defaultValue;\n let defaultValue;\n if (Array.isArray(value)) {\n defaultValue = value;\n }\n else if (value && (typeof value === 'object')) {\n defaultValue = [value];\n }\n else {\n defaultValue = this.emptyValue;\n }\n for (let dIndex = defaultValue.length; dIndex < this.minLength; dIndex++) {\n defaultValue.push({});\n }\n return defaultValue;\n }\n set disabled(disabled) {\n super.disabled = disabled;\n lodash_1.default.each(this.refs[`${this.datagridKey}-addRow`], (button) => {\n button.disabled = disabled;\n });\n lodash_1.default.each(this.refs[`${this.datagridKey}-removeRow`], (button) => {\n button.disabled = disabled;\n });\n }\n get disabled() {\n return super.disabled;\n }\n get datagridKey() {\n return `datagrid-${this.key}`;\n }\n get allowReorder() {\n return !this.options.readOnly && lodash_1.default.get(this.component, 'reorder', false);\n }\n get iteratableRows() {\n return this.rows.map((row, index) => ({\n components: row,\n data: this.dataValue[index],\n }));\n }\n isEmpty(value = this.dataValue) {\n var _a;\n const isEmpty = super.isEmpty(value);\n if ((_a = this.components) === null || _a === void 0 ? void 0 : _a.length) {\n return this.components.reduce((isEmpty, component) => {\n return isEmpty && component.isEmpty();\n }, true);\n }\n return isEmpty;\n }\n /**\n * Split rows into chunks.\n * @param {Number[]} groups - array of numbers where each item is size of group\n * @param {Array<T>} rows - rows collection\n * @return {Array<T[]>}\n */\n getRowChunks(groups, rows) {\n const [, chunks] = groups.reduce(([startIndex, acc], size) => {\n const endIndex = startIndex + size;\n return [endIndex, [...acc, [startIndex, endIndex]]];\n }, [0, []]);\n return chunks.map(range => lodash_1.default.slice(rows, ...range));\n }\n /**\n * Create groups object.\n * Each key in object represents index of first row in group.\n * @return {Object}\n */\n getGroups() {\n const groups = lodash_1.default.get(this.component, 'rowGroups', []);\n const sizes = lodash_1.default.map(groups, 'numberOfRows').slice(0, -1);\n const indexes = sizes.reduce((groupIndexes, size) => {\n const last = groupIndexes[groupIndexes.length - 1];\n return groupIndexes.concat(last + size);\n }, [0]);\n return groups.reduce((gidxs, group, idx) => {\n return Object.assign(Object.assign({}, gidxs), { [indexes[idx]]: group });\n }, {});\n }\n /**\n * Retrun group sizes.\n * @return {Number[]}\n */\n getGroupSizes() {\n return lodash_1.default.map(lodash_1.default.get(this.component, 'rowGroups', []), 'numberOfRows');\n }\n hasRowGroups() {\n return lodash_1.default.get(this, 'component.enableRowGroups', false) && !this.builderMode;\n }\n totalRowsNumber(groups) {\n return lodash_1.default.sum(lodash_1.default.map(groups, 'numberOfRows'));\n }\n setStaticValue(n) {\n this.dataValue = lodash_1.default.range(n).map(() => ({}));\n }\n hasExtraColumn() {\n return (this.hasRemoveButtons() || this.canAddColumn);\n }\n hasRemoveButtons() {\n return !this.builderMode && !this.component.disableAddingRemovingRows &&\n !this.options.readOnly &&\n !this.disabled &&\n this.fullMode &&\n (this.dataValue.length > lodash_1.default.get(this.component, 'validate.minLength', 0));\n }\n hasTopSubmit() {\n return this.hasAddButton() && ['top', 'both'].includes(this.addAnotherPosition);\n }\n hasBottomSubmit() {\n return this.hasAddButton() && ['bottom', 'both'].includes(this.addAnotherPosition);\n }\n get canAddColumn() {\n return this.builderMode && !this.options.design;\n }\n render() {\n const columns = this.getColumns();\n let columnExtra = 0;\n const hasRemoveButtons = this.hasRemoveButtons();\n if (this.component.reorder) {\n columnExtra++;\n }\n if (hasRemoveButtons) {\n columnExtra++;\n }\n if (this.canAddColumn) {\n columnExtra++;\n }\n const colWidth = Math.floor(12 / (columns.length + columnExtra));\n return super.render(this.renderTemplate('datagrid', {\n rows: this.getRows(),\n columns: columns,\n groups: this.hasRowGroups() ? this.getGroups() : [],\n visibleColumns: this.visibleColumns,\n hasToggle: lodash_1.default.get(this, 'component.groupToggle', false),\n hasHeader: this.hasHeader(),\n hasExtraColumn: this.hasExtraColumn(),\n hasAddButton: this.hasAddButton(),\n hasRemoveButtons,\n hasTopSubmit: this.hasTopSubmit(),\n hasBottomSubmit: this.hasBottomSubmit(),\n hasGroups: this.hasRowGroups(),\n numColumns: columns.length + (this.hasExtraColumn() ? 1 : 0),\n datagridKey: this.datagridKey,\n allowReorder: this.allowReorder,\n builder: this.builderMode,\n canAddColumn: this.canAddColumn,\n tabIndex: this.tabIndex,\n placeholder: this.renderTemplate('builderPlaceholder', {\n position: this.componentComponents.length,\n }),\n colWidth: colWidth.toString()\n }));\n }\n getRows() {\n return this.rows.map(row => {\n const components = {};\n lodash_1.default.each(row, (col, key) => {\n components[key] = col.render();\n });\n return components;\n });\n }\n getColumns() {\n return this.columns.filter((comp) => {\n return (!this.visibleColumns.hasOwnProperty(comp.key) || this.visibleColumns[comp.key]);\n });\n }\n hasHeader() {\n return this.component.components.reduce((hasHeader, col) => {\n // If any of the components has a title and it isn't hidden, display the header.\n return hasHeader || ((col.label || col.title) && !col.hideLabel);\n }, false);\n }\n loadRefs(element, refs) {\n super.loadRefs(element, refs);\n if (refs['messageContainer'] === 'single') {\n const container = lodash_1.default.last(element.querySelectorAll('[ref=messageContainer]'));\n this.refs['messageContainer'] = container || this.refs['messageContainer'];\n }\n }\n attach(element) {\n this.loadRefs(element, {\n [`${this.datagridKey}-row`]: 'multiple',\n [`${this.datagridKey}-tbody`]: 'single',\n [`${this.datagridKey}-addRow`]: 'multiple',\n [`${this.datagridKey}-removeRow`]: 'multiple',\n [`${this.datagridKey}-group-header`]: 'multiple',\n [this.datagridKey]: 'multiple',\n 'messageContainer': 'single'\n });\n if (this.allowReorder) {\n this.refs[`${this.datagridKey}-row`].forEach((row, index) => {\n row.dragInfo = { index };\n });\n if (this.root.dragulaLib) {\n this.dragula = this.root.dragulaLib([this.refs[`${this.datagridKey}-tbody`]], {\n moves: (_draggedElement, _oldParent, clickedElement) => {\n const clickedElementKey = clickedElement.getAttribute('data-key');\n const oldParentKey = _oldParent.getAttribute('data-key');\n //Check if the clicked button belongs to that container, if false, it belongs to the nested container\n if (oldParentKey === clickedElementKey) {\n return clickedElement.classList.contains('formio-drag-button');\n }\n }\n }).on('drop', this.onReorder.bind(this));\n this.dragula.on('cloned', (el, original) => {\n if (el && el.children && original && original.children) {\n lodash_1.default.each(original.children, (child, index) => {\n const styles = getComputedStyle(child, null);\n if (styles.cssText !== '') {\n el.children[index].style.cssText = styles.cssText;\n }\n else {\n const cssText = Object.values(styles).reduce((css, propertyName) => {\n return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;\n }, '');\n el.children[index].style.cssText = cssText;\n }\n });\n }\n });\n }\n }\n this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {\n this.addEventListener(addButton, 'click', this.addRow.bind(this));\n });\n this.refs[`${this.datagridKey}-removeRow`].forEach((removeButton, index) => {\n this.addEventListener(removeButton, 'click', this.removeRow.bind(this, index));\n });\n if (this.hasRowGroups()) {\n this.refs.chunks = this.getRowChunks(this.getGroupSizes(), this.refs[`${this.datagridKey}-row`]);\n this.refs[`${this.datagridKey}-group-header`].forEach((header, index) => {\n this.addEventListener(header, 'click', () => this.toggleGroup(header, index));\n });\n }\n const columns = this.getColumns();\n const rowLength = columns.length;\n this.rows.forEach((row, rowIndex) => {\n let columnIndex = 0;\n columns.forEach((col) => {\n this.attachComponents(this.refs[this.datagridKey][(rowIndex * rowLength) + columnIndex], [this.rows[rowIndex][col.key]], this.getComponentsContainer());\n columnIndex++;\n });\n });\n return super.attach(element);\n }\n getComponentsContainer() {\n return this.component.components;\n }\n onReorder(element, _target, _source, sibling) {\n if (!element.dragInfo || (sibling && !sibling.dragInfo)) {\n console.warn('There is no Drag Info available for either dragged or sibling element');\n return;\n }\n const oldPosition = element.dragInfo.index;\n //should drop at next sibling position; no next sibling means drop to last position\n const newPosition = sibling ? sibling.dragInfo.index : this.dataValue.length;\n const movedBelow = newPosition > oldPosition;\n const dataValue = (0, utils_1.fastCloneDeep)(this.dataValue);\n const draggedRowData = dataValue[oldPosition];\n //insert element at new position\n dataValue.splice(newPosition, 0, draggedRowData);\n //remove element from old position (if was moved above, after insertion it's at +1 index)\n dataValue.splice(movedBelow ? oldPosition : oldPosition + 1, 1);\n //need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)\n this.setValue(dataValue, { isReordered: true });\n this.rebuild();\n }\n focusOnNewRowElement(row) {\n Object.keys(row).find((key) => {\n const element = row[key].element;\n if (element) {\n const focusableElements = (0, utils_1.getFocusableElements)(element);\n if (focusableElements && focusableElements[0]) {\n focusableElements[0].focus();\n return true;\n }\n }\n return false;\n });\n }\n addRow() {\n const index = this.rows.length;\n // Handle length mismatch between rows and dataValue\n if (this.dataValue.length === index) {\n this.dataValue.push({});\n }\n let row;\n const dataValue = this.dataValue;\n const defaultValue = this.defaultValue;\n if (this.initEmpty && defaultValue[index]) {\n row = defaultValue[index];\n dataValue[index] = row;\n }\n else {\n row = dataValue[index];\n }\n this.rows[index] = this.createRowComponents(row, index);\n this.emit('dataGridAddRow', {\n component: this.component,\n row\n });\n this.checkConditions();\n this.triggerChange();\n this.redraw().then(() => {\n this.focusOnNewRowElement(this.rows[index]);\n });\n }\n updateComponentsRowIndex(components, rowIndex) {\n components.forEach((component, colIndex) => {\n var _a;\n if ((_a = component.options) === null || _a === void 0 ? void 0 : _a.name) {\n const newName = `[${this.key}][${rowIndex}]`;\n component.options.name = component.options.name.replace(`[${this.key}][${component.rowIndex}]`, newName);\n }\n component.rowIndex = rowIndex;\n component.row = `${rowIndex}-${colIndex}`;\n component.path = Components_1.Components.getComponentPath(component);\n });\n }\n updateRowsComponents(rowIndex) {\n this.rows.slice(rowIndex).forEach((row, index) => {\n this.updateComponentsRowIndex(Object.values(row), rowIndex + index);\n });\n }\n removeRow(index) {\n const makeEmpty = index === 0 && this.rows.length === 1;\n const flags = { isReordered: !makeEmpty, resetValue: makeEmpty };\n this.splice(index, flags);\n this.emit('dataGridDeleteRow', { index });\n const [row] = this.rows.splice(index, 1);\n this.removeRowComponents(row);\n this.updateRowsComponents(index);\n this.setValue(this.dataValue, flags);\n this.redraw();\n }\n removeRowComponents(row) {\n lodash_1.default.each(row, (component) => this.removeComponent(component));\n }\n getRowValues() {\n return this.dataValue;\n }\n setRowComponentsData(rowIndex, rowData) {\n lodash_1.default.each(this.rows[rowIndex], (component) => {\n component.data = rowData;\n });\n }\n createRows(init, rebuild) {\n let added = false;\n const rowValues = this.getRowValues();\n // Create any missing rows.\n rowValues.forEach((row, index) => {\n if (!rebuild && this.rows[index]) {\n this.setRowComponentsData(index, row);\n }\n else {\n if (this.rows[index]) {\n this.removeRowComponents(this.rows[index]);\n }\n this.rows[index] = this.createRowComponents(row, index);\n added = true;\n }\n });\n // Delete any extra rows.\n const removedRows = this.rows.splice(rowValues.length);\n const removed = !!removedRows.length;\n // Delete components of extra rows (to make sure that this.components contain only components of exisiting rows)\n if (removed) {\n removedRows.forEach(row => this.removeRowComponents(row));\n }\n if (!init && (added || removed)) {\n this.redraw();\n }\n return added;\n }\n createRowComponents(row, rowIndex) {\n const components = {};\n this.tabIndex = 0;\n this.component.components.map((col, colIndex) => {\n const options = lodash_1.default.clone(this.options);\n options.name += `[${rowIndex}]`;\n options.row = `${rowIndex}-${colIndex}`;\n let columnComponent;\n if (this.builderMode) {\n col.id = col.id + rowIndex;\n columnComponent = col;\n }\n else {\n columnComponent = Object.assign(Object.assign({}, col), { id: (col.id + rowIndex) });\n }\n const component = this.createComponent(columnComponent, options, row);\n component.parentDisabled = !!this.disabled;\n component.rowIndex = rowIndex;\n component.inDataGrid = true;\n if (columnComponent.tabindex &&\n parseInt(columnComponent.tabindex) > this.tabIndex) {\n this.tabIndex = parseInt(columnComponent.tabindex);\n }\n components[col.key] = component;\n });\n return components;\n }\n checkColumns(data, flags = {}) {\n data = data || this.rootValue;\n let show = false;\n if (!this.rows || !this.rows.length) {\n return { rebuild: false, show: false };\n }\n if (this.builderMode) {\n return { rebuild: false, show: true };\n }\n const visibility = {};\n let logicRebuild = false;\n const dataValue = this.dataValue;\n this.rows.forEach((row, rowIndex) => {\n lodash_1.default.each(row, (col, key) => {\n if (col && (typeof col.checkConditions === 'function')) {\n const firstRowCheck = visibility[key] === undefined;\n visibility[key] = !!visibility[key] ||\n (col.checkConditions(data, flags, dataValue[rowIndex]) && col.type !== 'hidden');\n if (col.component.logic && firstRowCheck) {\n const compIndex = lodash_1.default.findIndex(this.columns, ['key', key]);\n const equalColumns = lodash_1.default.isEqualWith(this.columns[compIndex], col.component, (col1, col2, key) => {\n // Don't compare columns by their auto-generated ids.\n if (key === 'id') {\n return true;\n }\n });\n if (!equalColumns) {\n logicRebuild = true;\n this.columns[compIndex] = col.component;\n }\n }\n }\n });\n });\n const rebuild = !lodash_1.default.isEqual(visibility, this.visibleColumns) || logicRebuild;\n lodash_1.default.each(visibility, (col) => {\n show |= col;\n });\n this.visibleColumns = visibility;\n return { rebuild, show };\n }\n checkComponentConditions(data, flags, row) {\n const isVisible = this.visible;\n // If table isn't visible, don't bother calculating columns.\n if (!super.checkComponentConditions(data, flags, row)) {\n return false;\n }\n const { rebuild, show } = this.checkColumns(data, flags);\n // Check if a rebuild is needed or the visibility changes.\n if (rebuild || !isVisible) {\n this.createRows(false, rebuild);\n }\n // Return if this table should show.\n return show;\n }\n setValue(value, flags = {}) {\n if (!value) {\n this.dataValue = this.defaultValue;\n this.createRows();\n return false;\n }\n if (!Array.isArray(value)) {\n if (typeof value === 'object') {\n value = [value];\n }\n else {\n this.createRows();\n value = [{}];\n }\n }\n // Make sure we always have at least one row.\n // NOTE: Removing this will break \"Public Configurations\" in portal. ;)\n if (value && !value.length && !this.initEmpty) {\n value.push({});\n }\n const isSettingSubmission = flags.fromSubmission && !lodash_1.default.isEqual(value, this.emptyValue);\n const changed = this.hasChanged(value, this.dataValue);\n this.dataValue = value;\n if (this.initRows || isSettingSubmission ||\n (Array.isArray(this.dataValue) && this.dataValue.length !== this.rows.length)) {\n if (!this.createRows() && changed) {\n this.redraw();\n }\n }\n if (this.componentModal && isSettingSubmission) {\n this.componentModal.setValue(value);\n }\n this.rows.forEach((row, rowIndex) => {\n if (value.length <= rowIndex) {\n return;\n }\n lodash_1.default.each(row, (col) => {\n col.rowIndex = rowIndex;\n this.setNestedValue(col, value[rowIndex], flags);\n });\n });\n this.updateOnChange(flags, changed);\n return changed;\n }\n restoreComponentsContext() {\n this.rows.forEach((row, index) => lodash_1.default.forIn(row, (component) => component.data = this.dataValue[index]));\n }\n getComponent(path, fn) {\n path = Array.isArray(path) ? path : [path];\n const [key, ...remainingPath] = path;\n let result = [];\n if (lodash_1.default.isNumber(key) && remainingPath.length) {\n const compKey = remainingPath.pop();\n result = this.rows[key][compKey];\n // If the component is inside a Layout Component, try to find it among all the row's components\n if (!result) {\n Object.entries(this.rows[key]).forEach(([, comp]) => {\n if ('getComponent' in comp) {\n const possibleResult = comp.getComponent([compKey], fn);\n if (possibleResult) {\n result = possibleResult;\n }\n }\n });\n }\n if (result && lodash_1.default.isFunction(fn)) {\n fn(result, this.getComponents());\n }\n if (remainingPath.length && 'getComponent' in result) {\n return result.getComponent(remainingPath, fn);\n }\n return result;\n }\n if (!lodash_1.default.isString(key)) {\n return result;\n }\n this.everyComponent((component, components) => {\n if (component.component.key === key) {\n let comp = component;\n if (remainingPath.length > 0 && 'getComponent' in component) {\n comp = component.getComponent(remainingPath, fn);\n }\n else if (fn) {\n fn(component, components);\n }\n result = result.concat(comp);\n }\n });\n return result.length > 0 ? result : null;\n }\n toggleGroup(element, index) {\n element.classList.toggle('collapsed');\n lodash_1.default.each(this.refs.chunks[index], row => {\n row.classList.toggle('hidden');\n });\n }\n}\nexports[\"default\"] = DataGridComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/datagrid/DataGrid.js?");
|
7826
7859
|
|
7827
7860
|
/***/ }),
|
7828
7861
|
|
@@ -7910,7 +7943,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
7910
7943
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
7911
7944
|
|
7912
7945
|
"use strict";
|
7913
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst Component_1 = __importDefault(__webpack_require__(/*! ../_classes/component/Component */ \"./lib/cjs/components/_classes/component/Component.js\"));\nconst ComponentModal_1 = __importDefault(__webpack_require__(/*! ../_classes/componentModal/ComponentModal */ \"./lib/cjs/components/_classes/componentModal/ComponentModal.js\"));\nconst eventemitter3_1 = __importDefault(__webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\"));\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst Formio_1 = __webpack_require__(/*! ../../Formio */ \"./lib/cjs/Formio.js\");\nconst Form_1 = __importDefault(__webpack_require__(/*! ../../Form */ \"./lib/cjs/Form.js\"));\nclass FormComponent extends Component_1.default {\n static schema(...extend) {\n return Component_1.default.schema({\n label: 'Form',\n type: 'form',\n key: 'form',\n src: '',\n reference: true,\n form: '',\n path: '',\n tableView: true,\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Nested Form',\n icon: 'wpforms',\n group: 'premium',\n documentation: '/userguide/form-building/premium-components#nested-form',\n weight: 110,\n schema: FormComponent.schema()\n };\n }\n static savedValueTypes() {\n return [utils_1.componentValueTypes.object];\n }\n init() {\n super.init();\n this.formObj = {\n display: this.component.display,\n settings: this.component.settings,\n components: this.component.components\n };\n this.valueChanged = false;\n this.subForm = null;\n this.formSrc = '';\n if (this.component.src) {\n this.formSrc = this.component.src;\n }\n if (!this.component.src &&\n !this.options.formio &&\n (this.component.form || this.component.path)) {\n if (this.component.project) {\n this.formSrc = Formio_1.Formio.getBaseUrl();\n // Check to see if it is a MongoID.\n if ((0, utils_1.isMongoId)(this.component.project)) {\n this.formSrc += '/project';\n }\n this.formSrc += `/${this.component.project}`;\n this.options.project = this.formSrc;\n }\n else {\n this.formSrc = Formio_1.Formio.getProjectUrl();\n this.options.project = this.formSrc;\n }\n if (this.component.form) {\n if ((0, utils_1.isMongoId)(this.component.form)) {\n this.formSrc += `/form/${this.component.form}`;\n }\n else {\n this.formSrc += `/${this.component.form}`;\n }\n }\n else if (this.component.path) {\n this.formSrc += `/${this.component.path}`;\n }\n }\n // Build the source based on the root src path.\n if (!this.formSrc && this.options.formio) {\n const rootSrc = this.options.formio.formsUrl;\n if (this.component.form && (0, utils_1.isMongoId)(this.component.form)) {\n this.formSrc = `${rootSrc}/${this.component.form}`;\n }\n else {\n const formPath = this.component.path || this.component.form;\n this.formSrc = `${rootSrc.replace(/\\/form$/, '')}/${formPath}`;\n }\n }\n if (this.builderMode && this.component.hasOwnProperty('formRevision')) {\n this.component.revision = this.component.formRevision;\n delete this.component.formRevision;\n }\n // Add revision version if set.\n if (this.component.revision || this.component.revision === 0 ||\n this.component.formRevision || this.component.formRevision === 0\n || this.component.revisionId) {\n this.setFormRevision(this.component.revisionId || this.component.revision || this.component.formRevision);\n }\n return this.createSubForm();\n }\n get dataReady() {\n return this.subFormReady || Promise.resolve();\n }\n get defaultValue() {\n // Not not provide a default value unless the subform is ready so that it will initialize correctly.\n return this.subForm ? super.defaultValue : null;\n }\n get defaultSchema() {\n return FormComponent.schema();\n }\n get emptyValue() {\n return { data: {} };\n }\n get ready() {\n return this.subFormReady || Promise.resolve();\n }\n get useOriginalRevision() {\n var _a, _b;\n return ((_a = this.component) === null || _a === void 0 ? void 0 : _a.useOriginalRevision) && !!((_b = this.formObj) === null || _b === void 0 ? void 0 : _b.revisions);\n }\n setFormRevision(rev) {\n // Remove current revisions from src if it is\n this.formSrc = this.formSrc.replace(/\\/v\\/[0-9a-z]+/, '');\n const revNumber = Number.parseInt(rev);\n if (!isNaN(revNumber)) {\n this.subFormRevision = rev;\n this.formSrc += `/v/${rev}`;\n }\n else {\n this.subFormRevision = undefined;\n }\n }\n getComponent(path, fn) {\n path = (0, utils_1.getArrayFromComponentPath)(path);\n if (path[0] === 'data') {\n path.shift();\n }\n const originalPathStr = `${this.path}.data.${(0, utils_1.getStringFromComponentPath)(path)}`;\n if (this.subForm) {\n return this.subForm.getComponent(path, fn, originalPathStr);\n }\n }\n getSubOptions(options = {}) {\n options.events = this.createEmitter();\n // Make sure to not show the submit button in wizards in the nested forms.\n lodash_1.default.set(options, 'buttonSettings.showSubmit', false);\n if (!this.options) {\n return options;\n }\n if (this.options.base) {\n options.base = this.options.base;\n }\n if (this.options.project) {\n options.project = this.options.project;\n }\n if (this.options.readOnly || this.component.disabled) {\n options.readOnly = this.options.readOnly || this.component.disabled;\n }\n if (this.options.breadcrumbSettings) {\n options.breadcrumbSettings = this.options.breadcrumbSettings;\n }\n if (this.options.buttonSettings) {\n options.buttonSettings = lodash_1.default.clone(this.options.buttonSettings);\n }\n if (this.options.viewAsHtml) {\n options.viewAsHtml = this.options.viewAsHtml;\n }\n if (this.options.language) {\n options.language = this.options.language;\n }\n if (this.options.template) {\n options.template = this.options.template;\n }\n if (this.options.templates) {\n options.templates = this.options.templates;\n }\n if (this.options.renderMode) {\n options.renderMode = this.options.renderMode;\n }\n if (this.options.attachMode) {\n options.attachMode = this.options.attachMode;\n }\n if (this.options.iconset) {\n options.iconset = this.options.iconset;\n }\n if (this.options.fileService) {\n options.fileService = this.options.fileService;\n }\n if (this.options.onChange) {\n options.onChange = this.options.onChange;\n }\n if (this.options.preview) {\n options.preview = this.options.preview;\n }\n if (this.options.inEditGrid) {\n options.inEditGrid = this.options.inEditGrid;\n }\n return options;\n }\n render() {\n if (this.builderMode) {\n return super.render(this.component.label || 'Nested form');\n }\n const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');\n return super.render(subform);\n }\n asString(value) {\n return this.getValueAsString(value);\n }\n /**\n * Prints out the value of form components as a datagrid value.\n */\n getValueAsString(value, options) {\n if (!value) {\n return 'No data provided';\n }\n if (!value.data && value._id) {\n return value._id;\n }\n if (!value.data || !Object.keys(value.data).length) {\n return 'No data provided';\n }\n if (options === null || options === void 0 ? void 0 : options.email) {\n let result = (`\n <table border=\"1\" style=\"width:100%\">\n <tbody>\n `);\n this.everyComponent((component) => {\n if (component.isInputComponent && component.visible && !component.skipInEmail) {\n result += (`\n <tr>\n <th style=\"padding: 5px 10px;\">${component.label}</th>\n <td style=\"width:100%;padding:5px 10px;\">${component.getView(component.dataValue, options)}</td>\n </tr>\n `);\n }\n }, Object.assign(Object.assign({}, options), { fromRoot: true }));\n result += (`\n </tbody>\n </table>\n `);\n return result;\n }\n if (lodash_1.default.isEmpty(value)) {\n return '';\n }\n return '[Complex Data]';\n }\n attach(element) {\n // Don't attach in builder.\n if (this.builderMode) {\n return super.attach(element);\n }\n return super.attach(element)\n .then(() => {\n if (this.isSubFormLazyLoad() && !this.hasLoadedForm && !this.subFormLoading) {\n this.createSubForm(true);\n }\n return this.subFormReady.then(() => {\n this.empty(element);\n if (this.options.builder) {\n this.setContent(element, this.ce('div', {\n class: 'text-muted text-center p-2'\n }, this.text(this.formObj.title)));\n return;\n }\n this.setContent(element, this.render());\n if (this.subForm) {\n if (this.isNestedWizard) {\n element = this.root.element;\n }\n this.subForm.attach(element);\n this.valueChanged = this.hasSetValue;\n if (!this.valueChanged && this.dataValue.state !== 'submitted') {\n this.setDefaultValue();\n }\n else {\n this.restoreValue();\n }\n }\n if (!this.builderMode && this.component.modalEdit) {\n const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;\n const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;\n this.componentModal = new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue);\n this.setOpenModalElement();\n }\n this.calculateValue();\n });\n });\n }\n detach() {\n if (this.subForm) {\n this.subForm.detach();\n }\n super.detach();\n }\n get currentForm() {\n return this._currentForm;\n }\n get hasLoadedForm() {\n return this.formObj\n && this.formObj.components\n && Array.isArray(this.formObj.components)\n && this.formObj.components.length;\n }\n set currentForm(instance) {\n this._currentForm = instance;\n if (!this.subForm) {\n return;\n }\n this.subForm.getComponents().forEach(component => {\n component.currentForm = this;\n });\n }\n get isRevisionChanged() {\n return lodash_1.default.isNumber(this.subFormRevision)\n && lodash_1.default.isNumber(this.formObj._vid)\n && this.formObj._vid !== this.subFormRevision;\n }\n destroy(all = false) {\n if (this.subForm) {\n this.subForm.destroy(all);\n this.subForm = null;\n this.subFormReady = null;\n }\n super.destroy(all);\n }\n redraw() {\n if (this.subForm) {\n this.subForm.form = this.formObj;\n this.setSubFormDisabled(this.subForm);\n }\n return super.redraw();\n }\n /**\n * Pass everyComponent to subform.\n * @param args\n * @returns {*|void}\n */\n everyComponent(...args) {\n if (this.subForm) {\n this.subForm.everyComponent(...args);\n }\n }\n setSubFormDisabled(subForm) {\n subForm.disabled = this.disabled; // When the Nested Form is disabled make the subForm disabled\n }\n updateSubWizards(subForm) {\n var _a, _b;\n if (this.isNestedWizard && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.subWizards) && ((_b = subForm === null || subForm === void 0 ? void 0 : subForm._form) === null || _b === void 0 ? void 0 : _b.display) === 'wizard') {\n const existedForm = this.root.subWizards.findIndex(form => form.component.form === this.component.form);\n if (existedForm !== -1) {\n this.root.subWizards[existedForm] = this;\n }\n else {\n this.root.subWizards.push(this);\n }\n this.emit('subWizardsUpdated', subForm);\n }\n }\n /**\n * Create a subform instance.\n *\n * @return {*}\n */\n createSubForm(fromAttach) {\n this.subFormReady = this.loadSubForm(fromAttach).then((form) => {\n if (!form) {\n return;\n }\n // Iterate through every component and hide the submit button.\n (0, utils_1.eachComponent)(form.components, (component) => {\n this.hideSubmitButton(component);\n });\n // If the subform is already created then destroy the old one.\n if (this.subForm) {\n this.subForm.destroy();\n }\n // Render the form.\n return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {\n this.subForm = instance;\n this.subForm.currentForm = this;\n this.subForm.parent = this;\n this.subForm.parentVisible = this.visible;\n this.subForm.on('change', () => {\n if (this.subForm) {\n this.dataValue = this.subForm.getValue();\n this.triggerChange({\n noEmit: true\n });\n }\n });\n this.subForm.url = this.formSrc;\n this.subForm.nosubmit = true;\n this.subForm.root = this.root;\n this.subForm.localRoot = this.isNestedWizard ? this.localRoot : this.subForm;\n this.restoreValue();\n this.valueChanged = this.hasSetValue;\n this.onChange();\n return this.subForm;\n });\n }).then((subForm) => {\n this.updateSubWizards(subForm);\n return subForm;\n });\n return this.subFormReady;\n }\n hideSubmitButton(component) {\n const isSubmitButton = (component.type === 'button') &&\n ((component.action === 'submit') || !component.action);\n if (isSubmitButton) {\n component.hidden = true;\n }\n }\n /**\n * Load the subform.\n */\n loadSubForm(fromAttach) {\n var _a;\n if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {\n return Promise.resolve();\n }\n if (this.hasLoadedForm && !this.isRevisionChanged &&\n !(this.options.pdf && ((_a = this.component) === null || _a === void 0 ? void 0 : _a.useOriginalRevision) && lodash_1.default.isNull(this.subForm) && !this.subFormLoading)) {\n // Pass config down to sub forms.\n if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {\n this.formObj.config = this.root.form.config;\n }\n return Promise.resolve(this.formObj);\n }\n else if (this.formSrc) {\n this.subFormLoading = true;\n return (new Formio_1.Formio(this.formSrc)).loadForm({ params: { live: 1 } })\n .then((formObj) => {\n this.formObj = formObj;\n if (this.options.pdf && this.component.useOriginalRevision) {\n this.formObj.display = 'form';\n }\n this.subFormLoading = false;\n return formObj;\n })\n .catch((err) => {\n console.log(err);\n return null;\n });\n }\n return Promise.resolve();\n }\n get subFormData() {\n var _a;\n return ((_a = this.dataValue) === null || _a === void 0 ? void 0 : _a.data) || {};\n }\n checkComponentValidity(data, dirty, row, options, errors = []) {\n options = options || {};\n const silentCheck = options.silentCheck || false;\n if (this.subForm) {\n return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);\n }\n return super.checkComponentValidity(data, dirty, row, options, errors);\n }\n checkComponentConditions(data, flags, row) {\n const visible = super.checkComponentConditions(data, flags, row);\n // Return if already hidden\n if (!visible) {\n return visible;\n }\n if (this.subForm) {\n return this.subForm.checkConditions(this.subFormData);\n }\n // There are few cases when subForm is not loaded when a change is triggered,\n // so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode\n else if (this.subFormReady) {\n this.subFormReady.then(() => {\n if (this.subForm) {\n return this.subForm.checkConditions(this.subFormData);\n }\n });\n }\n return visible;\n }\n calculateValue(data, flags, row) {\n if (this.subForm) {\n return this.subForm.calculateValue(this.subFormData, flags);\n }\n return super.calculateValue(data, flags, row);\n }\n setPristine(pristine) {\n super.setPristine(pristine);\n if (this.subForm) {\n this.subForm.setPristine(pristine);\n }\n }\n /**\n * Determine if the subform should be submitted.\n * @return {*|boolean}\n */\n get shouldSubmit() {\n return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.isHidden();\n }\n /**\n * Returns the data for the subform.\n *\n * @return {*}\n */\n getSubFormData() {\n if (lodash_1.default.get(this.subForm, 'form.display') === 'pdf') {\n return this.subForm.getSubmission();\n }\n else {\n return Promise.resolve(this.dataValue);\n }\n }\n /**\n * Submit the subform if configured to do so.\n *\n * @return {*}\n */\n submitSubForm() {\n // If we wish to submit the form on next page, then do that here.\n if (this.shouldSubmit) {\n return this.subFormReady.then(() => {\n if (!this.subForm) {\n return this.dataValue;\n }\n this.subForm.nosubmit = false;\n this.subForm.submitted = true;\n return this.subForm.submitForm().then(result => {\n this.subForm.loading = false;\n this.subForm.showAllErrors = false;\n this.dataValue = result.submission;\n return this.dataValue;\n }).catch(err => {\n this.subForm.showAllErrors = true;\n this.subForm.onSubmissionError(err);\n return Promise.reject(err);\n });\n });\n }\n return this.getSubFormData();\n }\n /**\n * Submit the form before the next page is triggered.\n */\n beforePage(next) {\n // Should not submit child forms if we are going to the previous page\n if (!next) {\n return super.beforePage(next);\n }\n return this.submitSubForm(true).then(() => super.beforePage(next));\n }\n /**\n * Submit the form before the whole form is triggered.\n */\n beforeSubmit() {\n var _a;\n const submission = this.dataValue;\n const isAlreadySubmitted = submission && submission._id && submission.form;\n // This submission has already been submitted, so just return the reference data.\n if (isAlreadySubmitted && !((_a = this.subForm) === null || _a === void 0 ? void 0 : _a.wizard)) {\n this.dataValue = submission;\n return Promise.resolve(this.dataValue);\n }\n return this.submitSubForm(false)\n .then(() => {\n return this.dataValue;\n })\n .then(() => super.beforeSubmit());\n }\n isSubFormLazyLoad() {\n var _a, _b;\n return ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a._form) === null || _b === void 0 ? void 0 : _b.display) === 'wizard' && this.component.lazyLoad;\n }\n isHidden() {\n if (!this.visible) {\n return true;\n }\n return !super.checkConditions(this.rootValue);\n }\n setValue(submission, flags = {}) {\n var _a;\n const changed = super.setValue(submission, flags);\n this.valueChanged = true;\n if (this.subForm) {\n const revisionPath = submission._frid ? '_frid' : '_vid';\n const shouldLoadOriginalRevision = this.useOriginalRevision\n && (lodash_1.default.isNumber(submission[revisionPath]) || lodash_1.default.isNumber(submission._fvid))\n && lodash_1.default.isNumber((_a = this.subForm.form) === null || _a === void 0 ? void 0 : _a[revisionPath])\n && submission._fvid !== this.subForm.form[revisionPath];\n if (shouldLoadOriginalRevision) {\n this.setFormRevision(submission._frid || submission._fvid);\n this.createSubForm().then(() => {\n this.attach(this.element);\n });\n }\n else {\n this.setSubFormValue(submission, flags);\n }\n }\n return changed;\n }\n setSubFormValue(submission, flags) {\n const shouldLoadSubmissionById = submission\n && submission._id\n && this.subForm.formio\n && lodash_1.default.isEmpty(submission.data);\n if (shouldLoadSubmissionById) {\n const formId = submission.form || this.formObj.form || this.component.form;\n const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;\n this.subForm.setUrl(submissionUrl, this.options);\n this.subForm.loadSubmission().catch((err) => {\n console.error(`Unable to load subform submission ${submission._id}:`, err);\n });\n }\n else {\n this.subForm.setValue(submission, flags);\n }\n }\n isEmpty(value = this.dataValue) {\n return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));\n }\n areAllComponentsEmpty(data) {\n let res = true;\n if (this.subForm) {\n this.subForm.everyComponent((comp) => {\n const componentValue = lodash_1.default.get(data, comp.key);\n res &= comp.isEmpty(componentValue);\n });\n }\n else {\n res = false;\n }\n return res;\n }\n getValue() {\n if (this.subForm) {\n return this.subForm.getValue();\n }\n return this.dataValue;\n }\n get errors() {\n let errors = super.errors;\n if (this.subForm) {\n errors = errors.concat(this.subForm.errors);\n }\n return errors;\n }\n updateSubFormVisibility() {\n if (this.subForm) {\n this.subForm.parentVisible = this.visible;\n }\n }\n /**\n * Determines if this form is a Nested Wizard\n * which means it should be a Wizard itself and should be a direct child of a Wizard's page\n * @returns {boolean}\n */\n get isNestedWizard() {\n var _a, _b, _c, _d, _e;\n return ((_b = (_a = this.subForm) === null || _a === void 0 ? void 0 : _a._form) === null || _b === void 0 ? void 0 : _b.display) === 'wizard' && ((_e = (_d = (_c = this.parent) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d._form) === null || _e === void 0 ? void 0 : _e.display) === 'wizard';\n }\n get visible() {\n return super.visible;\n }\n set visible(value) {\n const isNestedWizard = this.isNestedWizard;\n if (this._visible !== value) {\n this._visible = value;\n // Form doesn't load if hidden. If it becomes visible, create the form.\n if (!this.subForm && value) {\n this.createSubForm();\n this.subFormReady.then(() => {\n this.updateSubFormVisibility();\n this.clearOnHide();\n });\n this.redraw();\n return;\n }\n this.updateSubFormVisibility();\n this.clearOnHide();\n isNestedWizard ? this.rebuild() : this.redraw();\n }\n if (!value && isNestedWizard) {\n this.root.redraw();\n }\n }\n get parentVisible() {\n return super.parentVisible;\n }\n set parentVisible(value) {\n if (this._parentVisible !== value) {\n this._parentVisible = value;\n this.clearOnHide();\n // Form doesn't load if hidden. If it becomes visible, create the form.\n if (!this.subForm && value) {\n this.createSubForm();\n this.subFormReady.then(() => {\n this.updateSubFormVisibility();\n });\n this.redraw();\n return;\n }\n this.updateSubFormVisibility();\n this.redraw();\n }\n }\n isInternalEvent(event) {\n switch (event) {\n case 'focus':\n case 'blur':\n case 'componentChange':\n case 'componentError':\n case 'error':\n case 'formLoad':\n case 'languageChanged':\n case 'render':\n case 'checkValidity':\n case 'initialized':\n case 'submit':\n case 'submitButton':\n case 'nosubmit':\n case 'updateComponent':\n case 'submitDone':\n case 'submissionDeleted':\n case 'requestDone':\n case 'nextPage':\n case 'prevPage':\n case 'wizardNavigationClicked':\n case 'updateWizardNav':\n case 'restoreDraft':\n case 'saveDraft':\n case 'saveComponent':\n case 'pdfUploaded':\n return true;\n default:\n return false;\n }\n }\n createEmitter() {\n const emitter = new eventemitter3_1.default();\n const nativeEmit = emitter.emit;\n const that = this;\n emitter.emit = function (event, ...args) {\n const eventType = event.replace(`${that.options.namespace}.`, '');\n nativeEmit.call(this, event, ...args);\n if (!that.isInternalEvent(eventType)) {\n that.emit(eventType, ...args);\n }\n };\n return emitter;\n }\n deleteValue() {\n super.setValue(null, {\n noUpdateEvent: true,\n noDefault: true\n });\n this.unset();\n }\n}\nexports[\"default\"] = FormComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/form/Form.js?");
|
7946
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/* eslint-disable max-statements */\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst Component_1 = __importDefault(__webpack_require__(/*! ../_classes/component/Component */ \"./lib/cjs/components/_classes/component/Component.js\"));\nconst ComponentModal_1 = __importDefault(__webpack_require__(/*! ../_classes/componentModal/ComponentModal */ \"./lib/cjs/components/_classes/componentModal/ComponentModal.js\"));\nconst eventemitter3_1 = __importDefault(__webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\"));\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst Formio_1 = __webpack_require__(/*! ../../Formio */ \"./lib/cjs/Formio.js\");\nconst Form_1 = __importDefault(__webpack_require__(/*! ../../Form */ \"./lib/cjs/Form.js\"));\nclass FormComponent extends Component_1.default {\n static schema(...extend) {\n return Component_1.default.schema({\n label: 'Form',\n type: 'form',\n key: 'form',\n src: '',\n reference: true,\n form: '',\n path: '',\n tableView: true,\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Nested Form',\n icon: 'wpforms',\n group: 'premium',\n documentation: '/userguide/form-building/premium-components#nested-form',\n weight: 110,\n schema: FormComponent.schema()\n };\n }\n static savedValueTypes() {\n return [utils_1.componentValueTypes.object];\n }\n init() {\n super.init();\n this.formObj = {\n display: this.component.display,\n settings: this.component.settings,\n components: this.component.components\n };\n this.valueChanged = false;\n this.subForm = null;\n this.formSrc = '';\n if (this.component.src) {\n this.formSrc = this.component.src;\n }\n if (!this.component.src &&\n !this.options.formio &&\n (this.component.form || this.component.path)) {\n if (this.component.project) {\n this.formSrc = Formio_1.Formio.getBaseUrl();\n // Check to see if it is a MongoID.\n if ((0, utils_1.isMongoId)(this.component.project)) {\n this.formSrc += '/project';\n }\n this.formSrc += `/${this.component.project}`;\n this.options.project = this.formSrc;\n }\n else {\n this.formSrc = Formio_1.Formio.getProjectUrl();\n this.options.project = this.formSrc;\n }\n if (this.component.form) {\n if ((0, utils_1.isMongoId)(this.component.form)) {\n this.formSrc += `/form/${this.component.form}`;\n }\n else {\n this.formSrc += `/${this.component.form}`;\n }\n }\n else if (this.component.path) {\n this.formSrc += `/${this.component.path}`;\n }\n }\n // Build the source based on the root src path.\n if (!this.formSrc && this.options.formio) {\n const rootSrc = this.options.formio.formsUrl;\n if (this.component.form && (0, utils_1.isMongoId)(this.component.form)) {\n this.formSrc = `${rootSrc}/${this.component.form}`;\n }\n else {\n const formPath = this.component.path || this.component.form;\n this.formSrc = `${rootSrc.replace(/\\/form$/, '')}/${formPath}`;\n }\n }\n if (this.builderMode && this.component.hasOwnProperty('formRevision')) {\n this.component.revision = this.component.formRevision;\n delete this.component.formRevision;\n }\n // Add revision version if set.\n if (this.component.revision || this.component.revision === 0 ||\n this.component.formRevision || this.component.formRevision === 0\n || this.component.revisionId) {\n this.setFormRevision(this.component.revisionId || this.component.revision || this.component.formRevision);\n }\n return this.createSubForm();\n }\n get dataReady() {\n return this.subFormReady || Promise.resolve();\n }\n get defaultValue() {\n // Not not provide a default value unless the subform is ready so that it will initialize correctly.\n return this.subForm ? super.defaultValue : null;\n }\n get defaultSchema() {\n return FormComponent.schema();\n }\n get emptyValue() {\n return { data: {} };\n }\n get ready() {\n return this.subFormReady || Promise.resolve();\n }\n get useOriginalRevision() {\n var _a, _b;\n return ((_a = this.component) === null || _a === void 0 ? void 0 : _a.useOriginalRevision) && !!((_b = this.formObj) === null || _b === void 0 ? void 0 : _b.revisions);\n }\n setFormRevision(rev) {\n // Remove current revisions from src if it is\n this.formSrc = this.formSrc.replace(/\\/v\\/[0-9a-z]+/, '');\n const revNumber = Number.parseInt(rev);\n if (!isNaN(revNumber)) {\n this.subFormRevision = rev;\n this.formSrc += `/v/${rev}`;\n }\n else {\n this.subFormRevision = undefined;\n }\n }\n getComponent(path, fn) {\n path = (0, utils_1.getArrayFromComponentPath)(path);\n if (path[0] === 'data') {\n path.shift();\n }\n const originalPathStr = `${this.path}.data.${(0, utils_1.getStringFromComponentPath)(path)}`;\n if (this.subForm) {\n return this.subForm.getComponent(path, fn, originalPathStr);\n }\n }\n getSubOptions(options = {}) {\n options.events = this.createEmitter();\n // Make sure to not show the submit button in wizards in the nested forms.\n lodash_1.default.set(options, 'buttonSettings.showSubmit', false);\n if (!this.options) {\n return options;\n }\n if (this.options.base) {\n options.base = this.options.base;\n }\n if (this.options.project) {\n options.project = this.options.project;\n }\n if (this.options.readOnly || this.component.disabled) {\n options.readOnly = this.options.readOnly || this.component.disabled;\n }\n if (this.options.breadcrumbSettings) {\n options.breadcrumbSettings = this.options.breadcrumbSettings;\n }\n if (this.options.buttonSettings) {\n options.buttonSettings = lodash_1.default.clone(this.options.buttonSettings);\n }\n if (this.options.viewAsHtml) {\n options.viewAsHtml = this.options.viewAsHtml;\n }\n if (this.options.language) {\n options.language = this.options.language;\n }\n if (this.options.template) {\n options.template = this.options.template;\n }\n if (this.options.templates) {\n options.templates = this.options.templates;\n }\n if (this.options.renderMode) {\n options.renderMode = this.options.renderMode;\n }\n if (this.options.attachMode) {\n options.attachMode = this.options.attachMode;\n }\n if (this.options.iconset) {\n options.iconset = this.options.iconset;\n }\n if (this.options.fileService) {\n options.fileService = this.options.fileService;\n }\n if (this.options.onChange) {\n options.onChange = this.options.onChange;\n }\n if (this.options.preview) {\n options.preview = this.options.preview;\n }\n if (this.options.inEditGrid) {\n options.inEditGrid = this.options.inEditGrid;\n }\n if (this.options.saveDraft) {\n options.saveDraft = this.options.saveDraft;\n }\n if (this.options.saveDraftThrottle) {\n options.saveDraftThrottle = this.options.saveDraftThrottle;\n }\n return options;\n }\n render() {\n if (this.builderMode) {\n return super.render(this.component.label || 'Nested form');\n }\n const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');\n return super.render(subform);\n }\n asString(value) {\n return this.getValueAsString(value);\n }\n /**\n * Prints out the value of form components as a datagrid value.\n */\n getValueAsString(value, options) {\n if (!value) {\n return 'No data provided';\n }\n if (!value.data && value._id) {\n return value._id;\n }\n if (!value.data || !Object.keys(value.data).length) {\n return 'No data provided';\n }\n if (options === null || options === void 0 ? void 0 : options.email) {\n let result = (`\n <table border=\"1\" style=\"width:100%\">\n <tbody>\n `);\n this.everyComponent((component) => {\n if (component.isInputComponent && component.visible && !component.skipInEmail) {\n result += (`\n <tr>\n <th style=\"padding: 5px 10px;\">${component.label}</th>\n <td style=\"width:100%;padding:5px 10px;\">${component.getView(component.dataValue, options)}</td>\n </tr>\n `);\n }\n }, Object.assign(Object.assign({}, options), { fromRoot: true }));\n result += (`\n </tbody>\n </table>\n `);\n return result;\n }\n if (lodash_1.default.isEmpty(value)) {\n return '';\n }\n return '[Complex Data]';\n }\n attach(element) {\n // Don't attach in builder.\n if (this.builderMode) {\n return super.attach(element);\n }\n return super.attach(element)\n .then(() => {\n if (this.isSubFormLazyLoad() && !this.hasLoadedForm && !this.subFormLoading) {\n this.createSubForm(true);\n }\n return this.subFormReady.then(() => {\n this.empty(element);\n if (this.options.builder) {\n this.setContent(element, this.ce('div', {\n class: 'text-muted text-center p-2'\n }, this.text(this.formObj.title)));\n return;\n }\n this.setContent(element, this.render());\n if (this.subForm) {\n if (this.isNestedWizard) {\n element = this.root.element;\n }\n this.subForm.attach(element);\n this.valueChanged = this.hasSetValue;\n if (!this.valueChanged && this.dataValue.state !== 'submitted') {\n this.setDefaultValue();\n }\n else {\n this.restoreValue();\n }\n }\n if (!this.builderMode && this.component.modalEdit) {\n const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;\n const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;\n this.componentModal = new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue);\n this.setOpenModalElement();\n }\n this.calculateValue();\n });\n });\n }\n detach() {\n if (this.subForm) {\n this.subForm.detach();\n }\n super.detach();\n }\n get currentForm() {\n return this._currentForm;\n }\n get hasLoadedForm() {\n return this.formObj\n && this.formObj.components\n && Array.isArray(this.formObj.components)\n && this.formObj.components.length;\n }\n set currentForm(instance) {\n this._currentForm = instance;\n if (!this.subForm) {\n return;\n }\n this.subForm.getComponents().forEach(component => {\n component.currentForm = this;\n });\n }\n get isRevisionChanged() {\n return lodash_1.default.isNumber(this.subFormRevision)\n && lodash_1.default.isNumber(this.formObj._vid)\n && this.formObj._vid !== this.subFormRevision;\n }\n destroy(all = false) {\n if (this.subForm) {\n this.subForm.destroy(all);\n this.subForm = null;\n this.subFormReady = null;\n }\n super.destroy(all);\n }\n redraw() {\n if (this.subForm) {\n this.subForm.form = this.formObj;\n this.setSubFormDisabled(this.subForm);\n }\n return super.redraw();\n }\n /**\n * Pass everyComponent to subform.\n * @param args\n * @returns {*|void}\n */\n everyComponent(...args) {\n if (this.subForm) {\n this.subForm.everyComponent(...args);\n }\n }\n setSubFormDisabled(subForm) {\n subForm.disabled = this.disabled; // When the Nested Form is disabled make the subForm disabled\n }\n updateSubWizards(subForm) {\n var _a, _b;\n if (this.isNestedWizard && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.subWizards) && ((_b = subForm === null || subForm === void 0 ? void 0 : subForm._form) === null || _b === void 0 ? void 0 : _b.display) === 'wizard') {\n const existedForm = this.root.subWizards.findIndex(form => form.component.form === this.component.form);\n if (existedForm !== -1) {\n this.root.subWizards[existedForm] = this;\n }\n else {\n this.root.subWizards.push(this);\n }\n this.emit('subWizardsUpdated', subForm);\n }\n }\n /**\n * Create a subform instance.\n *\n * @return {*}\n */\n createSubForm(fromAttach) {\n this.subFormReady = this.loadSubForm(fromAttach).then((form) => {\n if (!form) {\n return;\n }\n // Iterate through every component and hide the submit button.\n (0, utils_1.eachComponent)(form.components, (component) => {\n this.hideSubmitButton(component);\n });\n // If the subform is already created then destroy the old one.\n if (this.subForm) {\n this.subForm.destroy();\n }\n // Render the form.\n return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {\n this.subForm = instance;\n this.subForm.currentForm = this;\n this.subForm.parent = this;\n this.subForm.parentVisible = this.visible;\n this.subForm.on('change', () => {\n if (this.subForm) {\n this.dataValue = this.subForm.getValue();\n this.triggerChange({\n noEmit: true\n });\n }\n });\n this.subForm.url = this.formSrc;\n this.subForm.nosubmit = true;\n this.subForm.root = this.root;\n this.subForm.localRoot = this.isNestedWizard ? this.localRoot : this.subForm;\n if (this.parent) {\n this.subForm.draftEnabled = this.parent.draftEnabled;\n this.subForm.savingDraft = this.parent.savingDraft;\n }\n this.restoreValue();\n this.valueChanged = this.hasSetValue;\n this.onChange();\n return this.subForm;\n });\n }).then((subForm) => {\n this.updateSubWizards(subForm);\n return subForm;\n });\n return this.subFormReady;\n }\n hideSubmitButton(component) {\n const isSubmitButton = (component.type === 'button') &&\n ((component.action === 'submit') || !component.action);\n if (isSubmitButton) {\n component.hidden = true;\n }\n }\n /**\n * Load the subform.\n */\n loadSubForm(fromAttach) {\n var _a, _b, _c;\n if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {\n return Promise.resolve();\n }\n if (this.hasLoadedForm && !this.isRevisionChanged &&\n !(this.options.pdf && ((_a = this.component) === null || _a === void 0 ? void 0 : _a.useOriginalRevision) && lodash_1.default.isNull(this.subForm) && !this.subFormLoading)) {\n // Pass config down to sub forms.\n if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {\n this.formObj.config = this.root.form.config;\n }\n return Promise.resolve(this.formObj);\n }\n else if (this.formSrc) {\n this.subFormLoading = true;\n const options = ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.base) && ((_c = this.root.formio) === null || _c === void 0 ? void 0 : _c.projectUrl)\n ? {\n base: this.root.formio.base,\n project: this.root.formio.projectUrl,\n }\n : {};\n return (new Formio_1.Formio(this.formSrc, options)).loadForm({ params: { live: 1 } })\n .then((formObj) => {\n this.formObj = formObj;\n if (this.options.pdf && this.component.useOriginalRevision) {\n this.formObj.display = 'form';\n }\n this.subFormLoading = false;\n return formObj;\n })\n .catch((err) => {\n console.log(err);\n return null;\n });\n }\n return Promise.resolve();\n }\n get subFormData() {\n var _a;\n return ((_a = this.dataValue) === null || _a === void 0 ? void 0 : _a.data) || {};\n }\n checkComponentValidity(data, dirty, row, options, errors = []) {\n options = options || {};\n const silentCheck = options.silentCheck || false;\n if (this.subForm) {\n return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);\n }\n return super.checkComponentValidity(data, dirty, row, options, errors);\n }\n checkComponentConditions(data, flags, row) {\n const visible = super.checkComponentConditions(data, flags, row);\n // Return if already hidden\n if (!visible) {\n return visible;\n }\n if (this.subForm) {\n return this.subForm.checkConditions(this.subFormData);\n }\n // There are few cases when subForm is not loaded when a change is triggered,\n // so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode\n else if (this.subFormReady) {\n this.subFormReady.then(() => {\n if (this.subForm) {\n return this.subForm.checkConditions(this.subFormData);\n }\n });\n }\n return visible;\n }\n calculateValue(data, flags, row) {\n if (this.subForm) {\n return this.subForm.calculateValue(this.subFormData, flags);\n }\n return super.calculateValue(data, flags, row);\n }\n setPristine(pristine) {\n super.setPristine(pristine);\n if (this.subForm) {\n this.subForm.setPristine(pristine);\n }\n }\n /**\n * Determine if the subform should be submitted.\n * @return {*|boolean}\n */\n get shouldSubmit() {\n return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.isHidden();\n }\n /**\n * Returns the data for the subform.\n *\n * @return {*}\n */\n getSubFormData() {\n if (lodash_1.default.get(this.subForm, 'form.display') === 'pdf') {\n return this.subForm.getSubmission();\n }\n else {\n return Promise.resolve(this.dataValue);\n }\n }\n /**\n * Submit the subform if configured to do so.\n *\n * @return {*}\n */\n submitSubForm() {\n // If we wish to submit the form on next page, then do that here.\n if (this.shouldSubmit) {\n return this.subFormReady.then(() => {\n if (!this.subForm) {\n return this.dataValue;\n }\n this.subForm.nosubmit = false;\n this.subForm.submitted = true;\n return this.subForm.submitForm().then(result => {\n this.subForm.loading = false;\n this.subForm.showAllErrors = false;\n this.dataValue = result.submission;\n return this.dataValue;\n }).catch(err => {\n this.subForm.showAllErrors = true;\n this.subForm.onSubmissionError(err);\n return Promise.reject(err);\n });\n });\n }\n return this.getSubFormData();\n }\n /**\n * Submit the form before the next page is triggered.\n */\n beforePage(next) {\n // Should not submit child forms if we are going to the previous page\n if (!next) {\n return super.beforePage(next);\n }\n return this.submitSubForm(true).then(() => super.beforePage(next));\n }\n /**\n * Submit the form before the whole form is triggered.\n */\n beforeSubmit() {\n var _a;\n const submission = this.dataValue;\n const isAlreadySubmitted = submission && submission._id && submission.form;\n // This submission has already been submitted, so just return the reference data.\n if (isAlreadySubmitted && !((_a = this.subForm) === null || _a === void 0 ? void 0 : _a.wizard)) {\n this.dataValue = submission;\n return Promise.resolve(this.dataValue);\n }\n return this.submitSubForm(false)\n .then(() => {\n return this.dataValue;\n })\n .then(() => super.beforeSubmit());\n }\n isSubFormLazyLoad() {\n var _a, _b;\n return ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a._form) === null || _b === void 0 ? void 0 : _b.display) === 'wizard' && this.component.lazyLoad;\n }\n isHidden() {\n if (!this.visible) {\n return true;\n }\n return !super.checkConditions(this.rootValue);\n }\n setValue(submission, flags = {}) {\n var _a;\n const changed = super.setValue(submission, flags);\n this.valueChanged = true;\n if (this.subForm) {\n const revisionPath = submission._frid ? '_frid' : '_vid';\n const shouldLoadOriginalRevision = this.useOriginalRevision\n && (lodash_1.default.isNumber(submission[revisionPath]) || lodash_1.default.isNumber(submission._fvid))\n && lodash_1.default.isNumber((_a = this.subForm.form) === null || _a === void 0 ? void 0 : _a[revisionPath])\n && submission._fvid !== this.subForm.form[revisionPath];\n if (shouldLoadOriginalRevision) {\n this.setFormRevision(submission._frid || submission._fvid);\n this.createSubForm().then(() => {\n this.attach(this.element);\n });\n }\n else {\n this.setSubFormValue(submission, flags);\n }\n }\n return changed;\n }\n setSubFormValue(submission, flags) {\n var _a, _b;\n const shouldLoadSubmissionById = submission\n && submission._id\n && this.subForm.formio\n && lodash_1.default.isEmpty(submission.data);\n if (shouldLoadSubmissionById) {\n const formId = submission.form || this.formObj.form || this.component.form;\n const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;\n const options = ((_a = this.root.formio) === null || _a === void 0 ? void 0 : _a.base) && ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.projectUrl)\n ? {\n base: this.root.formio.base,\n project: this.root.formio.projectUrl,\n }\n : {};\n this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));\n this.subForm.loadSubmission().catch((err) => {\n console.error(`Unable to load subform submission ${submission._id}:`, err);\n });\n }\n else {\n this.subForm.setValue(submission, flags);\n }\n }\n isEmpty(value = this.dataValue) {\n return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));\n }\n areAllComponentsEmpty(data) {\n let res = true;\n if (this.subForm) {\n this.subForm.everyComponent((comp) => {\n const componentValue = lodash_1.default.get(data, comp.key);\n res &= comp.isEmpty(componentValue);\n });\n }\n else {\n res = false;\n }\n return res;\n }\n getValue() {\n if (this.subForm) {\n return this.subForm.getValue();\n }\n return this.dataValue;\n }\n get errors() {\n let errors = super.errors;\n if (this.subForm) {\n errors = errors.concat(this.subForm.errors);\n }\n return errors;\n }\n updateSubFormVisibility() {\n if (this.subForm) {\n this.subForm.parentVisible = this.visible;\n }\n }\n /**\n * Determines if this form is a Nested Wizard\n * which means it should be a Wizard itself and should be a direct child of a Wizard's page\n * @returns {boolean}\n */\n get isNestedWizard() {\n var _a, _b, _c, _d, _e;\n return ((_b = (_a = this.subForm) === null || _a === void 0 ? void 0 : _a._form) === null || _b === void 0 ? void 0 : _b.display) === 'wizard' && ((_e = (_d = (_c = this.parent) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d._form) === null || _e === void 0 ? void 0 : _e.display) === 'wizard';\n }\n get visible() {\n return super.visible;\n }\n set visible(value) {\n const isNestedWizard = this.isNestedWizard;\n if (this._visible !== value) {\n this._visible = value;\n // Form doesn't load if hidden. If it becomes visible, create the form.\n if (!this.subForm && value) {\n this.createSubForm();\n this.subFormReady.then(() => {\n this.updateSubFormVisibility();\n this.clearOnHide();\n });\n this.redraw();\n return;\n }\n this.updateSubFormVisibility();\n this.clearOnHide();\n isNestedWizard ? this.rebuild() : this.redraw();\n }\n if (!value && isNestedWizard) {\n this.root.redraw();\n }\n }\n get parentVisible() {\n return super.parentVisible;\n }\n set parentVisible(value) {\n if (this._parentVisible !== value) {\n this._parentVisible = value;\n this.clearOnHide();\n // Form doesn't load if hidden. If it becomes visible, create the form.\n if (!this.subForm && value) {\n this.createSubForm();\n this.subFormReady.then(() => {\n this.updateSubFormVisibility();\n });\n this.redraw();\n return;\n }\n this.updateSubFormVisibility();\n this.redraw();\n }\n }\n isInternalEvent(event) {\n switch (event) {\n case 'focus':\n case 'blur':\n case 'componentChange':\n case 'componentError':\n case 'error':\n case 'formLoad':\n case 'languageChanged':\n case 'render':\n case 'checkValidity':\n case 'initialized':\n case 'submit':\n case 'submitButton':\n case 'nosubmit':\n case 'updateComponent':\n case 'submitDone':\n case 'submissionDeleted':\n case 'requestDone':\n case 'nextPage':\n case 'prevPage':\n case 'wizardNavigationClicked':\n case 'updateWizardNav':\n case 'restoreDraft':\n case 'saveDraft':\n case 'saveComponent':\n case 'pdfUploaded':\n return true;\n default:\n return false;\n }\n }\n createEmitter() {\n const emitter = new eventemitter3_1.default();\n const nativeEmit = emitter.emit;\n const that = this;\n emitter.emit = function (event, ...args) {\n const eventType = event.replace(`${that.options.namespace}.`, '');\n nativeEmit.call(this, event, ...args);\n if (!that.isInternalEvent(eventType)) {\n that.emit(eventType, ...args);\n }\n };\n return emitter;\n }\n deleteValue() {\n super.setValue(null, {\n noUpdateEvent: true,\n noDefault: true\n });\n this.unset();\n }\n}\nexports[\"default\"] = FormComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/form/Form.js?");
|
7914
7947
|
|
7915
7948
|
/***/ }),
|
7916
7949
|
|
@@ -7998,7 +8031,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7998
8031
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
7999
8032
|
|
8000
8033
|
"use strict";
|
8001
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst ListComponent_1 = __importDefault(__webpack_require__(/*! ../_classes/list/ListComponent */ \"./lib/cjs/components/_classes/list/ListComponent.js\"));\nconst Formio_1 = __webpack_require__(/*! ../../Formio */ \"./lib/cjs/Formio.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nclass RadioComponent extends ListComponent_1.default {\n static schema(...extend) {\n return ListComponent_1.default.schema({\n type: 'radio',\n inputType: 'radio',\n label: 'Radio',\n key: 'radio',\n values: [{ label: '', value: '' }],\n data: {\n url: '',\n },\n fieldSet: false\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Radio',\n group: 'basic',\n icon: 'dot-circle-o',\n weight: 80,\n documentation: '/userguide/form-building/form-components#radio',\n schema: RadioComponent.schema()\n };\n }\n static get conditionOperatorsSettings() {\n return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {\n return {\n type: 'select',\n dataSrc: 'custom',\n valueProperty: 'value',\n dataType: classComp.dataType || '',\n data: {\n custom() {\n return classComp.values;\n }\n },\n };\n } });\n }\n static savedValueTypes(schema) {\n const { boolean, string, number, object, array } = utils_1.componentValueTypes;\n const { dataType } = schema;\n const types = (0, utils_1.getComponentSavedTypes)(schema);\n if (types) {\n return types;\n }\n if (dataType === 'object') {\n return [object, array];\n }\n if (utils_1.componentValueTypes[dataType]) {\n return [utils_1.componentValueTypes[dataType]];\n }\n return [boolean, string, number, object, array];\n }\n constructor(component, options, data) {\n super(component, options, data);\n this.previousValue = this.dataValue || null;\n }\n get defaultSchema() {\n return RadioComponent.schema();\n }\n get defaultValue() {\n let defaultValue = super.defaultValue;\n if (!defaultValue && this.component.defaultValue === false) {\n defaultValue = this.component.defaultValue;\n }\n return defaultValue;\n }\n get inputInfo() {\n var _a;\n const info = super.elementInfo();\n info.type = 'input';\n info.changeEvent = 'click';\n info.attr.class = 'form-check-input';\n info.attr.name = info.attr.name += `[${(_a = this.root) === null || _a === void 0 ? void 0 : _a.id}-${this.id}]`;\n return info;\n }\n get emptyValue() {\n return '';\n }\n get isRadio() {\n return this.component.inputType === 'radio';\n }\n get optionSelectedClass() {\n return 'radio-selected';\n }\n get listData() {\n const listData = lodash_1.default.get(this.root, 'submission.metadata.listData', {});\n return lodash_1.default.get(listData, this.path);\n }\n init() {\n super.init();\n this.templateData = {};\n // Trigger an update.//\n let updateArgs = [];\n const triggerUpdate = lodash_1.default.debounce((...args) => {\n updateArgs = [];\n return this.updateItems.apply(this, args);\n }, 100);\n this.triggerUpdate = (...args) => {\n // Make sure we always resolve the previous promise before reassign it\n if (typeof this.itemsLoadedResolve === 'function') {\n this.itemsLoadedResolve();\n }\n this.itemsLoaded = new Promise((resolve) => {\n this.itemsLoadedResolve = resolve;\n });\n if (args.length) {\n updateArgs = args;\n }\n return triggerUpdate(...updateArgs);\n };\n this.itemsLoaded = new Promise((resolve) => {\n this.itemsLoadedResolve = resolve;\n });\n this.optionsLoaded = false;\n this.loadedOptions = [];\n // Get the template keys for this radio component.\n this.getTemplateKeys();\n }\n render() {\n return super.render(this.renderTemplate('radio', {\n input: this.inputInfo,\n inline: this.component.inline,\n values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,\n value: this.dataValue,\n row: this.row,\n }));\n }\n attach(element) {\n this.loadRefs(element, { input: 'multiple', wrapper: 'multiple' });\n this.refs.input.forEach((input, index) => {\n this.addEventListener(input, this.inputInfo.changeEvent, () => {\n this.updateValue(null, {\n modified: true,\n });\n });\n if (this.component.values[index]) {\n this.addShortcut(input, this.component.values[index].shortcut);\n }\n if (this.isRadio) {\n let dataValue = this.dataValue;\n if (!lodash_1.default.isString(this.dataValue)) {\n dataValue = lodash_1.default.toString(this.dataValue);\n }\n if (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) {\n input.checked = lodash_1.default.isEqual(this.loadedOptions[index].value, this.dataValue);\n }\n else {\n input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));\n }\n this.addEventListener(input, 'keyup', (event) => {\n if (event.key === ' ' && dataValue === input.value) {\n event.preventDefault();\n this.updateValue(null, {\n modified: true,\n });\n }\n });\n }\n });\n this.triggerUpdate();\n this.setSelectedClasses();\n return super.attach(element);\n }\n detach(element) {\n if (element && this.refs.input) {\n this.refs.input.forEach((input, index) => {\n if (this.component.values[index]) {\n this.removeShortcut(input, this.component.values[index].shortcut);\n }\n });\n }\n super.detach();\n }\n getValue() {\n if (this.viewOnly || !this.refs.input || !this.refs.input.length) {\n return this.dataValue;\n }\n let value = this.dataValue;\n this.refs.input.forEach((input, index) => {\n if (input.checked) {\n value = (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) ?\n this.loadedOptions[index].value :\n input.value;\n }\n });\n return value;\n }\n validateValueProperty() {\n if (this.component.dataSrc === 'values') {\n return true;\n }\n return !lodash_1.default.some(this.refs.wrapper, (wrapper, index) => this.refs.input[index].checked && this.loadedOptions[index].invalid);\n }\n validateValueAvailability(setting, value) {\n if (!(0, utils_1.boolValue)(setting) || !value) {\n return true;\n }\n const values = this.component.values;\n if (values) {\n return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;\n }\n return false;\n }\n getValueAsString(value) {\n if (lodash_1.default.isObject(value)) {\n value = JSON.stringify(value);\n }\n else if (!lodash_1.default.isString(value)) {\n value = lodash_1.default.toString(value);\n }\n if (this.component.dataSrc !== 'values') {\n return value;\n }\n const option = lodash_1.default.find(this.component.values, (v) => v.value === value);\n if (!value) {\n return lodash_1.default.get(option, 'label', '');\n }\n return lodash_1.default.get(option, 'label', '');\n }\n setValueAt(index, value) {\n if (this.refs.input && this.refs.input[index] && value !== null && value !== undefined) {\n const inputValue = this.refs.input[index].value;\n this.refs.input[index].checked = (inputValue === value.toString());\n }\n }\n loadItems(url, search, headers, options, method, body) {\n if (this.optionsLoaded) {\n return;\n }\n if (!this.shouldLoad && this.listData) {\n this.loadItemsFromMetadata();\n return;\n }\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n // Make the request.\n options.header = headers;\n this.loading = true;\n Formio_1.Formio.makeRequest(this.options.formio, 'select', url, method, body, options)\n .then((response) => {\n this.loading = false;\n this.setItems(response);\n this.optionsLoaded = true;\n this.redraw();\n })\n .catch((err) => {\n this.handleLoadingError(err);\n });\n }\n loadItemsFromMetadata() {\n this.listData.forEach((item, i) => {\n this.loadedOptions[i] = {\n label: this.itemTemplate(item)\n };\n if (lodash_1.default.isEqual(item, this.selectData || lodash_1.default.pick(this.dataValue, lodash_1.default.keys(item)))) {\n this.loadedOptions[i].value = this.dataValue;\n }\n });\n this.optionsLoaded = true;\n this.redraw();\n }\n setItems(items) {\n const listData = [];\n items === null || items === void 0 ? void 0 : items.forEach((item, i) => {\n this.loadedOptions[i] = {\n value: this.component.valueProperty ? item[this.component.valueProperty] : item,\n label: this.component.valueProperty ? this.itemTemplate(item, item[this.component.valueProperty]) : this.itemTemplate(item, item, i)\n };\n listData.push(this.templateData[this.component.valueProperty ? item[this.component.valueProperty] : i]);\n if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(item[this.component.valueProperty]) ||\n (!this.isRadio && lodash_1.default.isObject(item[this.component.valueProperty])) ||\n (!this.isRadio && lodash_1.default.isBoolean(item[this.component.valueProperty])))) {\n this.loadedOptions[i].invalid = true;\n }\n });\n if (this.isSelectURL) {\n const submission = this.root.submission;\n if (!submission.metadata) {\n submission.metadata = {};\n }\n if (!submission.metadata.listData) {\n submission.metadata.listData = {};\n }\n lodash_1.default.set(submission.metadata.listData, this.path, listData);\n }\n }\n setSelectedClasses() {\n if (this.refs.wrapper) {\n //add/remove selected option class\n const value = this.dataValue;\n this.refs.wrapper.forEach((wrapper, index) => {\n const input = this.refs.input[index];\n const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());\n if (checked) {\n //add class to container when selected\n this.addClass(wrapper, this.optionSelectedClass);\n //change \"checked\" attribute\n input.setAttribute('checked', 'true');\n }\n else {\n this.removeClass(wrapper, this.optionSelectedClass);\n input.removeAttribute('checked');\n }\n });\n }\n }\n updateValue(value, flags) {\n const changed = super.updateValue(value, flags);\n if (changed) {\n this.setSelectedClasses();\n }\n if (!flags || !flags.modified || !this.isRadio) {\n if (changed) {\n this.previousValue = this.dataValue;\n }\n return changed;\n }\n // If they clicked on the radio that is currently selected, it needs to reset the value.\n this.currentValue = this.dataValue;\n const shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;\n if (shouldResetValue) {\n this.resetValue();\n this.triggerChange(flags);\n this.setSelectedClasses();\n }\n this.previousValue = this.dataValue;\n return changed;\n }\n /**\n * Normalize values coming into updateValue.\n *\n * @param value\n * @return {*}\n */\n normalizeValue(value) {\n if (value === this.emptyValue) {\n return value;\n }\n const isEquivalent = lodash_1.default.toString(value) === Number(value).toString();\n if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {\n value = +value;\n }\n if (value === 'true') {\n value = true;\n }\n if (value === 'false') {\n value = false;\n }\n if (this.isSelectURL && this.templateData && this.templateData[value]) {\n const submission = this.root.submission;\n if (!submission.metadata.selectData) {\n submission.metadata.selectData = {};\n }\n lodash_1.default.set(submission.metadata.selectData, this.path, this.templateData[value]);\n }\n return super.normalizeValue(value);\n }\n}\nexports[\"default\"] = RadioComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/radio/Radio.js?");
|
8034
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst ListComponent_1 = __importDefault(__webpack_require__(/*! ../_classes/list/ListComponent */ \"./lib/cjs/components/_classes/list/ListComponent.js\"));\nconst Formio_1 = __webpack_require__(/*! ../../Formio */ \"./lib/cjs/Formio.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nclass RadioComponent extends ListComponent_1.default {\n static schema(...extend) {\n return ListComponent_1.default.schema({\n type: 'radio',\n inputType: 'radio',\n label: 'Radio',\n key: 'radio',\n values: [{ label: '', value: '' }],\n data: {\n url: '',\n },\n fieldSet: false\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Radio',\n group: 'basic',\n icon: 'dot-circle-o',\n weight: 80,\n documentation: '/userguide/form-building/form-components#radio',\n schema: RadioComponent.schema()\n };\n }\n static get conditionOperatorsSettings() {\n return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {\n return {\n type: 'select',\n dataSrc: 'custom',\n valueProperty: 'value',\n dataType: classComp.dataType || '',\n data: {\n custom() {\n return classComp.values;\n }\n },\n };\n } });\n }\n static get serverConditionSettings() {\n return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {\n return {\n type: 'select',\n dataSrc: 'custom',\n valueProperty: 'value',\n dataType: classComp.dataType || '',\n data: {\n custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,\n },\n };\n } });\n }\n static savedValueTypes(schema) {\n const { boolean, string, number, object, array } = utils_1.componentValueTypes;\n const { dataType } = schema;\n const types = (0, utils_1.getComponentSavedTypes)(schema);\n if (types) {\n return types;\n }\n if (dataType === 'object') {\n return [object, array];\n }\n if (utils_1.componentValueTypes[dataType]) {\n return [utils_1.componentValueTypes[dataType]];\n }\n return [boolean, string, number, object, array];\n }\n constructor(component, options, data) {\n super(component, options, data);\n this.previousValue = this.dataValue || null;\n }\n get defaultSchema() {\n return RadioComponent.schema();\n }\n get defaultValue() {\n let defaultValue = super.defaultValue;\n if (!defaultValue && this.component.defaultValue === false) {\n defaultValue = this.component.defaultValue;\n }\n return defaultValue;\n }\n get inputInfo() {\n var _a;\n const info = super.elementInfo();\n info.type = 'input';\n info.changeEvent = 'click';\n info.attr.class = 'form-check-input';\n info.attr.name = info.attr.name += `[${(_a = this.root) === null || _a === void 0 ? void 0 : _a.id}-${this.id}]`;\n return info;\n }\n get emptyValue() {\n return '';\n }\n get isRadio() {\n return this.component.inputType === 'radio';\n }\n get optionSelectedClass() {\n return 'radio-selected';\n }\n get listData() {\n const listData = lodash_1.default.get(this.root, 'submission.metadata.listData', {});\n return lodash_1.default.get(listData, this.path);\n }\n init() {\n super.init();\n this.templateData = {};\n // Trigger an update.//\n let updateArgs = [];\n const triggerUpdate = lodash_1.default.debounce((...args) => {\n updateArgs = [];\n return this.updateItems.apply(this, args);\n }, 100);\n this.triggerUpdate = (...args) => {\n // Make sure we always resolve the previous promise before reassign it\n if (typeof this.itemsLoadedResolve === 'function') {\n this.itemsLoadedResolve();\n }\n this.itemsLoaded = new Promise((resolve) => {\n this.itemsLoadedResolve = resolve;\n });\n if (args.length) {\n updateArgs = args;\n }\n return triggerUpdate(...updateArgs);\n };\n this.itemsLoaded = new Promise((resolve) => {\n this.itemsLoadedResolve = resolve;\n });\n this.optionsLoaded = false;\n this.loadedOptions = [];\n // Get the template keys for this radio component.\n this.getTemplateKeys();\n }\n render() {\n return super.render(this.renderTemplate('radio', {\n input: this.inputInfo,\n inline: this.component.inline,\n values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,\n value: this.dataValue,\n row: this.row,\n }));\n }\n attach(element) {\n this.loadRefs(element, { input: 'multiple', wrapper: 'multiple' });\n this.refs.input.forEach((input, index) => {\n this.addEventListener(input, this.inputInfo.changeEvent, () => {\n this.updateValue(null, {\n modified: true,\n });\n });\n if (this.component.values[index]) {\n this.addShortcut(input, this.component.values[index].shortcut);\n }\n if (this.isRadio) {\n let dataValue = this.dataValue;\n if (!lodash_1.default.isString(this.dataValue)) {\n dataValue = lodash_1.default.toString(this.dataValue);\n }\n if (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) {\n input.checked = lodash_1.default.isEqual(this.loadedOptions[index].value, this.dataValue);\n }\n else {\n input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));\n }\n this.addEventListener(input, 'keyup', (event) => {\n if (event.key === ' ' && dataValue === input.value) {\n event.preventDefault();\n this.updateValue(null, {\n modified: true,\n });\n }\n });\n }\n });\n this.triggerUpdate();\n this.setSelectedClasses();\n return super.attach(element);\n }\n detach(element) {\n if (element && this.refs.input) {\n this.refs.input.forEach((input, index) => {\n if (this.component.values[index]) {\n this.removeShortcut(input, this.component.values[index].shortcut);\n }\n });\n }\n super.detach();\n }\n getValue() {\n if (this.viewOnly || !this.refs.input || !this.refs.input.length) {\n return this.dataValue;\n }\n let value = this.dataValue;\n this.refs.input.forEach((input, index) => {\n if (input.checked) {\n value = (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) ?\n this.loadedOptions[index].value :\n input.value;\n }\n });\n return value;\n }\n validateValueProperty() {\n if (this.component.dataSrc === 'values') {\n return true;\n }\n return !lodash_1.default.some(this.refs.wrapper, (wrapper, index) => this.refs.input[index].checked && this.loadedOptions[index].invalid);\n }\n validateValueAvailability(setting, value) {\n if (!(0, utils_1.boolValue)(setting) || !value) {\n return true;\n }\n const values = this.component.values;\n if (values) {\n return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;\n }\n return false;\n }\n getValueAsString(value) {\n if (lodash_1.default.isObject(value)) {\n value = JSON.stringify(value);\n }\n else if (!lodash_1.default.isString(value)) {\n value = lodash_1.default.toString(value);\n }\n if (this.component.dataSrc !== 'values') {\n return value;\n }\n const option = lodash_1.default.find(this.component.values, (v) => v.value === value);\n if (!value) {\n return lodash_1.default.get(option, 'label', '');\n }\n return lodash_1.default.get(option, 'label', '');\n }\n setValueAt(index, value) {\n if (this.refs.input && this.refs.input[index] && value !== null && value !== undefined) {\n const inputValue = this.refs.input[index].value;\n this.refs.input[index].checked = (inputValue === value.toString());\n }\n }\n loadItems(url, search, headers, options, method, body) {\n if (this.optionsLoaded) {\n return;\n }\n if (!this.shouldLoad && this.listData) {\n this.loadItemsFromMetadata();\n return;\n }\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n // Make the request.\n options.header = headers;\n this.loading = true;\n Formio_1.Formio.makeRequest(this.options.formio, 'select', url, method, body, options)\n .then((response) => {\n this.loading = false;\n this.setItems(response);\n this.optionsLoaded = true;\n this.redraw();\n })\n .catch((err) => {\n this.handleLoadingError(err);\n });\n }\n loadItemsFromMetadata() {\n this.listData.forEach((item, i) => {\n this.loadedOptions[i] = {\n label: this.itemTemplate(item)\n };\n if (lodash_1.default.isEqual(item, this.selectData || lodash_1.default.pick(this.dataValue, lodash_1.default.keys(item)))) {\n this.loadedOptions[i].value = this.dataValue;\n }\n });\n this.optionsLoaded = true;\n this.redraw();\n }\n setItems(items) {\n const listData = [];\n items === null || items === void 0 ? void 0 : items.forEach((item, i) => {\n this.loadedOptions[i] = {\n value: this.component.valueProperty ? item[this.component.valueProperty] : item,\n label: this.component.valueProperty ? this.itemTemplate(item, item[this.component.valueProperty]) : this.itemTemplate(item, item, i)\n };\n listData.push(this.templateData[this.component.valueProperty ? item[this.component.valueProperty] : i]);\n if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(item[this.component.valueProperty]) ||\n (!this.isRadio && lodash_1.default.isObject(item[this.component.valueProperty])) ||\n (!this.isRadio && lodash_1.default.isBoolean(item[this.component.valueProperty])))) {\n this.loadedOptions[i].invalid = true;\n }\n });\n if (this.isSelectURL) {\n const submission = this.root.submission;\n if (!submission.metadata) {\n submission.metadata = {};\n }\n if (!submission.metadata.listData) {\n submission.metadata.listData = {};\n }\n lodash_1.default.set(submission.metadata.listData, this.path, listData);\n }\n }\n setSelectedClasses() {\n if (this.refs.wrapper) {\n //add/remove selected option class\n const value = this.dataValue;\n this.refs.wrapper.forEach((wrapper, index) => {\n const input = this.refs.input[index];\n const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());\n if (checked) {\n //add class to container when selected\n this.addClass(wrapper, this.optionSelectedClass);\n //change \"checked\" attribute\n input.setAttribute('checked', 'true');\n }\n else {\n this.removeClass(wrapper, this.optionSelectedClass);\n input.removeAttribute('checked');\n }\n });\n }\n }\n updateValue(value, flags) {\n const changed = super.updateValue(value, flags);\n if (changed) {\n this.setSelectedClasses();\n }\n if (!flags || !flags.modified || !this.isRadio) {\n if (changed) {\n this.previousValue = this.dataValue;\n }\n return changed;\n }\n // If they clicked on the radio that is currently selected, it needs to reset the value.\n this.currentValue = this.dataValue;\n const shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;\n if (shouldResetValue) {\n this.resetValue();\n this.triggerChange(flags);\n this.setSelectedClasses();\n }\n this.previousValue = this.dataValue;\n return changed;\n }\n /**\n * Normalize values coming into updateValue.\n *\n * @param value\n * @return {*}\n */\n normalizeValue(value) {\n if (value === this.emptyValue) {\n return value;\n }\n const isEquivalent = lodash_1.default.toString(value) === Number(value).toString();\n if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {\n value = +value;\n }\n if (value === 'true') {\n value = true;\n }\n if (value === 'false') {\n value = false;\n }\n if (this.isSelectURL && this.templateData && this.templateData[value]) {\n const submission = this.root.submission;\n if (!submission.metadata.selectData) {\n submission.metadata.selectData = {};\n }\n lodash_1.default.set(submission.metadata.selectData, this.path, this.templateData[value]);\n }\n return super.normalizeValue(value);\n }\n}\nexports[\"default\"] = RadioComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/radio/Radio.js?");
|
8002
8035
|
|
8003
8036
|
/***/ }),
|
8004
8037
|
|
@@ -8427,7 +8460,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunc
|
|
8427
8460
|
/***/ (function(__unused_webpack_module, exports) {
|
8428
8461
|
|
8429
8462
|
"use strict";
|
8430
|
-
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.withRetries = void 0;\nfunction withRetries(
|
8463
|
+
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.withRetries = void 0;\nfunction withRetries(fn, args, retries = 3, err = null) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!retries) {\n throw new Error(err);\n }\n return fn(...args).catch(() => withRetries(fn, args, retries - 1, err));\n });\n}\nexports.withRetries = withRetries;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/providers/storage/util.js?");
|
8431
8464
|
|
8432
8465
|
/***/ }),
|
8433
8466
|
|
@@ -8636,7 +8669,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8636
8669
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
8637
8670
|
|
8638
8671
|
"use strict";
|
8639
|
-
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 */ \"./lib/cjs/utils/conditionOperators/ConditionOperator.js\"));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst utils_1 = __webpack_require__(/*! ../utils */ \"./lib/cjs/utils/utils.js\");\nclass IsEqualTo extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'isEqual';\n }\n static get displayedName() {\n return 'Is Equal To';\n }\n execute({ value, comparedValue, instance, conditionComponentPath }) {\n var _a;\n if (value && comparedValue && typeof value !== typeof comparedValue && lodash_1.default.isString(comparedValue)) {\n try {\n comparedValue = JSON.parse(comparedValue);\n }\n // eslint-disable-next-line no-empty\n catch (e) { }\n }\n if (instance && instance.root) {\n const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);\n if (conditionTriggerComponent\n && (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)\n && ((_a = conditionTriggerComponent.component) === null || _a === void 0 ? void 0 : _a.template)) {\n if (!value || !lodash_1.default.isPlainObject(value)) {\n return false;\n }\n const { template, valueProperty } = conditionTriggerComponent.component;\n if (valueProperty === 'data') {\n value = { data: value };\n comparedValue = { data: comparedValue };\n }\n return lodash_1.default.every((0, utils_1.getItemTemplateKeys)(template) || [], k => lodash_1.default.isEqual(lodash_1.default.get(value, k), lodash_1.default.get(comparedValue, k)));\n }\n }\n //special check for select boxes\n if (lodash_1.default.isObject(value) && comparedValue && lodash_1.default.isBoolean(value[comparedValue])) {\n return value[comparedValue];\n }\n return lodash_1.default.isEqual(value, comparedValue);\n }\n}\nexports[\"default\"] = IsEqualTo;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/utils/conditionOperators/IsEqualTo.js?");
|
8672
|
+
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 */ \"./lib/cjs/utils/conditionOperators/ConditionOperator.js\"));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst utils_1 = __webpack_require__(/*! ../utils */ \"./lib/cjs/utils/utils.js\");\nclass IsEqualTo extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'isEqual';\n }\n static get displayedName() {\n return 'Is Equal To';\n }\n execute({ value, comparedValue, instance, conditionComponentPath }) {\n var _a;\n if ((value || value === false) && comparedValue && typeof value !== typeof comparedValue && lodash_1.default.isString(comparedValue)) {\n try {\n comparedValue = JSON.parse(comparedValue);\n }\n // eslint-disable-next-line no-empty\n catch (e) { }\n }\n if (instance && instance.root) {\n const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);\n if (conditionTriggerComponent\n && (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)\n && ((_a = conditionTriggerComponent.component) === null || _a === void 0 ? void 0 : _a.template)) {\n if (!value || !lodash_1.default.isPlainObject(value)) {\n return false;\n }\n const { template, valueProperty } = conditionTriggerComponent.component;\n if (valueProperty === 'data') {\n value = { data: value };\n comparedValue = { data: comparedValue };\n }\n return lodash_1.default.every((0, utils_1.getItemTemplateKeys)(template) || [], k => lodash_1.default.isEqual(lodash_1.default.get(value, k), lodash_1.default.get(comparedValue, k)));\n }\n }\n //special check for select boxes\n if (lodash_1.default.isObject(value) && comparedValue && lodash_1.default.isBoolean(value[comparedValue])) {\n return value[comparedValue];\n }\n return lodash_1.default.isEqual(value, comparedValue);\n }\n}\nexports[\"default\"] = IsEqualTo;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/utils/conditionOperators/IsEqualTo.js?");
|
8640
8673
|
|
8641
8674
|
/***/ }),
|
8642
8675
|
|
@@ -8790,7 +8823,7 @@ eval("\n/* global jQuery */\nvar __createBinding = (this && this.__createBinding
|
|
8790
8823
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
8791
8824
|
|
8792
8825
|
"use strict";
|
8793
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst Formio_1 = __webpack_require__(/*! ../Formio */ \"./lib/cjs/Formio.js\");\nconst InputWidget_1 = __importDefault(__webpack_require__(/*! ./InputWidget */ \"./lib/cjs/widgets/InputWidget.js\"));\nconst utils_1 = __webpack_require__(/*! ../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';\nconst ISO_8601_FORMAT = 'yyyy-MM-ddTHH:mm:ssZ';\nconst isIEBrowser = (0, utils_1.getBrowserInfo)().ie;\nclass CalendarWidget extends InputWidget_1.default {\n /* eslint-disable camelcase */\n static get defaultSettings() {\n return {\n type: 'calendar',\n altInput: true,\n allowInput: true,\n clickOpens: true,\n enableDate: true,\n enableTime: true,\n mode: 'single',\n noCalendar: false,\n format: DEFAULT_FORMAT,\n dateFormat: ISO_8601_FORMAT,\n useLocaleSettings: false,\n language: 'us-en',\n hourIncrement: 1,\n minuteIncrement: 5,\n time_24hr: false,\n saveAs: 'date',\n displayInTimezone: '',\n timezone: '',\n disable: [],\n minDate: '',\n maxDate: ''\n };\n }\n /* eslint-enable camelcase */\n constructor(settings, component, instance, index) {\n super(settings, component, instance, index);\n // Change the format to map to the settings.\n if (this.settings.noCalendar) {\n this.settings.format = this.settings.format.replace(/yyyy-MM-dd /g, '');\n }\n if (!this.settings.enableTime) {\n this.settings.format = this.settings.format.replace(/ hh:mm a$/g, '');\n }\n else if (this.settings.time_24hr) {\n this.settings.format = this.settings.format.replace(/hh:mm a$/g, 'HH:mm');\n }\n this.zoneLoading = false;\n this.timezonesUrl = `${Formio_1.Formio.cdn['moment-timezone']}/data/packed/latest.json`;\n }\n /**\n * Load the timezones.\n *\n * @return {boolean} TRUE if the zones are loading, FALSE otherwise.\n */\n loadZones() {\n const timezone = this.timezone;\n if (this.zoneLoading) {\n return true;\n }\n if (!(0, utils_1.zonesLoaded)() && (0, utils_1.shouldLoadZones)(timezone)) {\n this.zoneLoading = true;\n (0, utils_1.loadZones)(this.timezonesUrl, timezone).then(() => {\n this.zoneLoading = false;\n this.emit('redraw');\n });\n // Return zones are loading.\n return true;\n }\n // Zones are already loaded.\n return false;\n }\n attach(input) {\n var _a;\n const superAttach = super.attach(input);\n const dateFormatInfo = (0, utils_1.getLocaleDateFormatInfo)(this.settings.language);\n this.defaultFormat = {\n date: dateFormatInfo.dayFirst ? 'd/m/Y ' : 'm/d/Y ',\n time: 'G:i K'\n };\n this.closedOn = 0;\n this.valueFormat = (this.settings.saveAs === 'date') ? ISO_8601_FORMAT : this.settings.dateFormat || ISO_8601_FORMAT;\n this.valueMomentFormat = (0, utils_1.convertFormatToMoment)(this.valueFormat);\n const isReadOnly = this.settings.readOnly;\n this.settings.minDate = isReadOnly ? null : (0, utils_1.getDateSetting)(this.settings.minDate);\n this.settings.maxDate = isReadOnly ? null : (0, utils_1.getDateSetting)(this.settings.maxDate);\n this.settings.disable = this.disabledDates;\n this.settings.disableWeekends ? this.settings.disable.push(this.disableWeekends) : '';\n this.settings.disableWeekdays ? this.settings.disable.push(this.disableWeekdays) : '';\n this.settings.disableFunction ? this.settings.disable.push(this.disableFunction) : '';\n this.settings.wasDefaultValueChanged = false;\n this.settings.defaultValue = '';\n this.settings.manualInputValue = '';\n this.settings.isManuallyOverriddenValue = false;\n this.settings.currentValue = '';\n this.settings.altFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.format);\n this.settings.dateFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.dateFormat);\n this.settings.position = 'auto center';\n this.settings.onChange = () => {\n if (this.settings.allowInput) {\n if (this.settings.isManuallyOverriddenValue && this.settings.enableTime) {\n this.calendar._input.value = this.settings.manualInputValue;\n }\n else {\n this.settings.manualInputValue = '';\n }\n this.settings.isManuallyOverriddenValue = false;\n }\n this.emit('update');\n };\n this.settings.onOpen = () => this.hook('onCalendarOpen');\n this.settings.onClose = () => {\n this.hook('onCalendarClose');\n this.closedOn = Date.now();\n if (this.settings.allowInput && this.settings.enableTime) {\n this.calendar._input.value = this.settings.manualInputValue || this.calendar._input.value;\n this.settings.isManuallyOverriddenValue = false;\n this.emit('update');\n }\n if (this.settings.wasDefaultValueChanged) {\n this.calendar._input.value = this.settings.defaultValue;\n this.settings.wasDefaultValueChanged = false;\n }\n if (this.calendar) {\n this.emit('blur');\n }\n };\n Formio_1.Formio.requireLibrary('flatpickr-css', 'flatpickr', [\n { type: 'styles', src: `${Formio_1.Formio.cdn['flatpickr-formio']}/flatpickr.min.css` }\n ], true);\n if (this.component.shortcutButtons) {\n this.component.shortcutButtons = this.component.shortcutButtons.filter((btn) => btn.label && btn.onClick);\n }\n if ((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) {\n Formio_1.Formio.requireLibrary('shortcut-buttons-flatpickr-css', 'ShortcutButtonsPlugin', [\n { type: 'styles', src: `${Formio_1.Formio.cdn['shortcut-buttons-flatpickr']}/themes/light.min.css` }\n ], true);\n }\n return superAttach\n .then(() => {\n var _a;\n if ((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) {\n return Formio_1.Formio.requireLibrary('shortcut-buttons-flatpickr', 'ShortcutButtonsPlugin', `${Formio_1.Formio.cdn['shortcut-buttons-flatpickr']}/shortcut-buttons-flatpickr.min.js`, true);\n }\n })\n .then((ShortcutButtonsPlugin) => {\n return Formio_1.Formio.requireLibrary('flatpickr', 'flatpickr', `${Formio_1.Formio.cdn['flatpickr-formio']}/flatpickr.min.js`, true)\n .then((Flatpickr) => {\n var _a;\n if (((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) && ShortcutButtonsPlugin) {\n this.initShortcutButtonsPlugin(ShortcutButtonsPlugin);\n }\n this.settings.formatDate = this.getFlatpickrFormatDate(Flatpickr);\n if (this._input) {\n const { locale } = this.settings;\n if (locale && locale.length >= 2 && locale !== 'en') {\n return Formio_1.Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr-${locale}`, `${Formio_1.Formio.cdn['flatpickr-formio']}/l10n/flatpickr-${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));\n }\n else {\n this.initFlatpickr(Flatpickr);\n }\n }\n });\n })\n .catch((err) => {\n console.warn(err);\n });\n }\n get disableWeekends() {\n return function (date) {\n return (date.getDay() === 0 || date.getDay() === 6);\n };\n }\n get disableWeekdays() {\n return (date) => !this.disableWeekends(date);\n }\n get disableFunction() {\n return (date) => this.evaluate(`return ${this.settings.disableFunction}`, {\n date\n });\n }\n get timezone() {\n return this.componentInstance.getTimezone(this.settings);\n }\n get defaultSettings() {\n return CalendarWidget.defaultSettings;\n }\n addSuffix(suffix) {\n this.addEventListener(suffix, 'click', () => {\n setTimeout(() => {\n if (this.calendar) {\n if (!this.calendar.isOpen && ((Date.now() - this.closedOn) > 200)) {\n this.calendar.open();\n }\n else if (this.calendar.isOpen) {\n this.calendar.close();\n }\n }\n }, 0);\n });\n return suffix;\n }\n set disabled(disabled) {\n super.disabled = disabled;\n if (this.calendar) {\n if (disabled) {\n this.calendar._input.setAttribute('disabled', 'disabled');\n }\n else {\n this.calendar._input.removeAttribute('disabled');\n }\n this.calendar.close();\n this.calendar.redraw();\n }\n }\n get input() {\n return this.calendar ? this.calendar.altInput : null;\n }\n get disabledDates() {\n if (this.settings.disabledDates) {\n const disabledDates = this.settings.disabledDates.split(',');\n return disabledDates.map((item) => {\n const dateMask = /\\d{4}-\\d{2}-\\d{2}/g;\n const dates = item.match(dateMask);\n if (dates && dates.length) {\n return dates.length === 1 ? item.match(dateMask)[0] : {\n from: item.match(dateMask)[0],\n to: item.match(dateMask)[1],\n };\n }\n });\n }\n return [];\n }\n get localeFormat() {\n let format = '';\n if (this.settings.enableDate) {\n format += this.defaultFormat.date;\n }\n if (this.settings.enableTime) {\n format += this.defaultFormat.time;\n }\n return format;\n }\n get dateTimeFormat() {\n return this.settings.useLocaleSettings ? this.localeFormat : (0, utils_1.convertFormatToFlatpickr)(this.dateFormat);\n }\n get dateFormat() {\n return lodash_1.default.get(this.settings, 'format', DEFAULT_FORMAT);\n }\n /**\n * Return the date value.\n *\n * @param date\n * @param format\n * @return {string}\n */\n getDateValue(date, format, useTimezone) {\n if (useTimezone) {\n return (0, utils_1.momentDate)(date, this.valueFormat, this.timezone).format((0, utils_1.convertFormatToMoment)(format));\n }\n return (0, moment_1.default)(date).format((0, utils_1.convertFormatToMoment)(format));\n }\n /**\n * Return the value of the selected date.\n *\n * @return {*}\n */\n getValue() {\n // Standard output format.\n if (!this.calendar) {\n return super.getValue();\n }\n // Get the selected dates from the calendar widget.\n const dates = this.calendar.selectedDates;\n if (!dates || !dates.length) {\n return super.getValue();\n }\n if (!(dates[0] instanceof Date)) {\n return 'Invalid Date';\n }\n return this.getDateValue(dates[0], this.valueFormat, (this.settings.saveAs === 'date'));\n }\n isValueISO8601(value) {\n return value && (typeof value === 'string') && value.match(/-[0-9]{2}T[0-9]{2}:/);\n }\n /**\n * Set the selected date value.\n *\n * @param value\n */\n setValue(value) {\n const saveAsText = (this.settings.saveAs === 'text');\n if (!this.calendar) {\n value = value ? (0, utils_1.formatDate)(this.timezonesUrl, value, (0, utils_1.convertFormatToMoment)(this.settings.format), this.timezone, (0, utils_1.convertFormatToMoment)(this.valueMomentFormat)) : value;\n return super.setValue(value);\n }\n const zonesLoading = this.loadZones();\n if (value) {\n if (!saveAsText && this.settings.readOnly && !zonesLoading) {\n this.calendar.setDate((0, utils_1.momentDate)(value, this.valueFormat, this.timezone).format(), false);\n }\n else if (this.isValueISO8601(value)) {\n this.calendar.setDate(value, false);\n }\n else {\n this.calendar.setDate((0, moment_1.default)(value, this.valueMomentFormat).toDate(), false);\n }\n }\n else {\n this.calendar.clear(false);\n }\n }\n getValueAsString(value, format) {\n const inputFormat = format || this.dateFormat;\n const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;\n if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {\n return (0, moment_1.default)(value, (0, utils_1.convertFormatToMoment)(valueFormat)).format((0, utils_1.convertFormatToMoment)(valueFormat));\n }\n return (0, utils_1.formatDate)(this.timezonesUrl, value, inputFormat, this.timezone, (0, utils_1.convertFormatToMoment)(valueFormat));\n }\n setErrorClasses(hasErrors) {\n if (!this.input) {\n return;\n }\n if (hasErrors) {\n this.addClass(this.input, 'is-invalid');\n this.input.setAttribute('aria-invalid', 'true');\n }\n else {\n this.removeClass(this.input, 'is-invalid');\n this.input.setAttribute('aria-invalid', 'false');\n }\n }\n validationValue(value) {\n if (typeof value === 'string') {\n return new Date(value);\n }\n return value.map(val => new Date(val));\n }\n isCalendarElement(element) {\n var _a, _b, _c, _d, _e;\n if (!element) {\n return true;\n }\n if ((_c = (_b = (_a = this.calendar) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.appendTo) === null || _c === void 0 ? void 0 : _c.contains(element)) {\n return true;\n }\n return (_e = (_d = this.calendar) === null || _d === void 0 ? void 0 : _d.calendarContainer) === null || _e === void 0 ? void 0 : _e.contains(element);\n }\n initFlatpickr(Flatpickr) {\n // Create a new flatpickr.\n this.calendar = new Flatpickr(this._input, Object.assign(Object.assign({}, this.settings), { disableMobile: true }));\n this.calendar.altInput.addEventListener('input', (event) => {\n if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {\n this.settings.manualInputValue = event.target.value;\n this.settings.isManuallyOverriddenValue = true;\n this.settings.currentValue = event.target.value;\n }\n if (event.target.value === '' && this.calendar.selectedDates.length > 0) {\n this.settings.wasDefaultValueChanged = true;\n this.settings.defaultValue = event.target.value;\n this.calendar.clear();\n }\n else {\n this.settings.wasDefaultValueChanged = false;\n }\n });\n const excludedFromMaskFormats = ['MMMM'];\n if (!this.settings.readOnly && !lodash_1.default.some(excludedFromMaskFormats, format => lodash_1.default.includes(this.settings.format, format))) {\n // Enforce the input mask of the format.\n this.setInputMask(this.calendar._input, (0, utils_1.convertFormatToMask)(this.settings.format));\n }\n // Fixes an issue with IE11 where value is set only after the second click\n // TODO: Remove when the issue is solved in the flatpickr library\n if (isIEBrowser) {\n // Remove the original blur listener, because value will be set to empty since relatedTarget is null in IE11\n const originalBlurListener = this.calendar._handlers.find(({ event, element }) => event === 'blur' && element === this.calendar._input);\n this.calendar._input.removeEventListener('blur', originalBlurListener.handler);\n // Add the same event listener as in the original library, but with workaround for IE11 issue\n this.addEventListener(this.calendar._input, 'blur', (event) => {\n const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;\n const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;\n const isInput = event.target === this.calendar._input;\n if (isInput && !this.isCalendarElement(relatedTarget)) {\n this.calendar.setDate(this.calendar._input.value, true, event.target === this.calendar.altInput\n ? this.calendar.config.altFormat\n : this.calendar.config.dateFormat);\n }\n });\n }\n // Make sure we commit the value after a blur event occurs.\n this.addEventListener(this.calendar._input, 'blur', (event) => {\n var _a, _b, _c, _d;\n const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;\n const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;\n if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {\n const inputValue = this.calendar.input.value;\n const dateValue = inputValue ? (0, moment_1.default)(this.calendar.input.value, (0, utils_1.convertFormatToMoment)(this.valueFormat)).toDate() : inputValue;\n this.calendar.setDate(dateValue, true, this.settings.altFormat);\n }\n else if (!this.calendar.input.value && this.calendar.config.noCalendar) {\n const value = (0, moment_1.default)({ hour: (_b = (_a = this.calendar) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.defaultHour, minute: (_d = (_c = this.calendar) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.defaultMinute }).toDate();\n this.calendar.setDate(value, true, this.settings.format);\n }\n });\n // FJS-1103: When hit the enter button, the field not saving the year correctly\n this.addEventListener(this.calendar.altInput, 'keydown', (event) => {\n if (event.keyCode === 13) {\n if (this.calendar.isOpen) {\n this.calendar.close();\n event.stopPropagation();\n }\n }\n });\n // Restore the calendar value from the component value.\n this.setValue(this.componentValue);\n }\n initShortcutButtonsPlugin(ShortcutButtonsPlugin) {\n this.settings.plugins = [\n // eslint-disable-next-line new-cap\n ShortcutButtonsPlugin({\n button: this.component.shortcutButtons.map((btn) => ({ label: btn.label, attributes: btn.attribute })),\n onClick: (index) => {\n const getValue = this.component.shortcutButtons[index].onClick;\n const date = this.evaluate(getValue, { date: new Date() }, 'date');\n this.calendar.setDate(date, true);\n }\n })\n ];\n }\n get componentValue() {\n let compValue = this.componentInstance.dataValue;\n if (Array.isArray(compValue)) {\n compValue = compValue[this.valueIndex];\n }\n return compValue;\n }\n getFlatpickrFormatDate(Flatpickr) {\n return (date, format) => {\n // Only format this if this is the altFormat and the form is readOnly.\n if (this.settings.readOnly && (format === this.settings.altFormat)) {\n if (!this.settings.enableTime || this.loadZones()) {\n return Flatpickr.formatDate(date, format);\n }\n const currentValue = new Date(this.getValue());\n if (currentValue.toString() === date.toString()) {\n return (0, utils_1.formatOffset)(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), new Date(this.componentValue), format, this.timezone);\n }\n return (0, utils_1.formatOffset)(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), date, format, this.timezone);\n }\n return Flatpickr.formatDate(date, format);\n };\n }\n destroy(all = false) {\n if (this.calendar) {\n this.calendar.destroy();\n }\n super.destroy(all);\n }\n}\nexports[\"default\"] = CalendarWidget;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/widgets/CalendarWidget.js?");
|
8826
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst Formio_1 = __webpack_require__(/*! ../Formio */ \"./lib/cjs/Formio.js\");\nconst InputWidget_1 = __importDefault(__webpack_require__(/*! ./InputWidget */ \"./lib/cjs/widgets/InputWidget.js\"));\nconst utils_1 = __webpack_require__(/*! ../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';\nconst ISO_8601_FORMAT = 'yyyy-MM-ddTHH:mm:ssZ';\nconst isIEBrowser = (0, utils_1.getBrowserInfo)().ie;\nclass CalendarWidget extends InputWidget_1.default {\n /* eslint-disable camelcase */\n static get defaultSettings() {\n return {\n type: 'calendar',\n altInput: true,\n allowInput: true,\n clickOpens: true,\n enableDate: true,\n enableTime: true,\n mode: 'single',\n noCalendar: false,\n format: DEFAULT_FORMAT,\n dateFormat: ISO_8601_FORMAT,\n useLocaleSettings: false,\n language: 'us-en',\n hourIncrement: 1,\n minuteIncrement: 5,\n time_24hr: false,\n saveAs: 'date',\n displayInTimezone: '',\n timezone: '',\n disable: [],\n minDate: '',\n maxDate: ''\n };\n }\n /* eslint-enable camelcase */\n constructor(settings, component, instance, index) {\n super(settings, component, instance, index);\n // Change the format to map to the settings.\n if (this.settings.noCalendar) {\n this.settings.format = this.settings.format.replace(/yyyy-MM-dd /g, '');\n }\n if (!this.settings.enableTime) {\n this.settings.format = this.settings.format.replace(/ hh:mm a$/g, '');\n }\n else if (this.settings.time_24hr) {\n this.settings.format = this.settings.format.replace(/hh:mm a$/g, 'HH:mm');\n }\n this.zoneLoading = false;\n this.timezonesUrl = `${Formio_1.Formio.cdn['moment-timezone']}/data/packed/latest.json`;\n }\n /**\n * Load the timezones.\n *\n * @return {boolean} TRUE if the zones are loading, FALSE otherwise.\n */\n loadZones() {\n const timezone = this.timezone;\n if (this.zoneLoading) {\n return true;\n }\n if (!(0, utils_1.zonesLoaded)() && (0, utils_1.shouldLoadZones)(timezone)) {\n this.zoneLoading = true;\n (0, utils_1.loadZones)(this.timezonesUrl, timezone).then(() => {\n this.zoneLoading = false;\n this.emit('redraw');\n });\n // Return zones are loading.\n return true;\n }\n // Zones are already loaded.\n return false;\n }\n attach(input) {\n var _a;\n const superAttach = super.attach(input);\n const dateFormatInfo = (0, utils_1.getLocaleDateFormatInfo)(this.settings.language);\n this.defaultFormat = {\n date: dateFormatInfo.dayFirst ? 'd/m/Y ' : 'm/d/Y ',\n time: 'G:i K'\n };\n this.closedOn = 0;\n this.valueFormat = (this.settings.saveAs === 'date') ? ISO_8601_FORMAT : this.settings.dateFormat || ISO_8601_FORMAT;\n this.valueMomentFormat = (0, utils_1.convertFormatToMoment)(this.valueFormat);\n const isReadOnly = this.settings.readOnly;\n this.settings.minDate = isReadOnly ? null : (0, utils_1.getDateSetting)(this.settings.minDate);\n this.settings.maxDate = isReadOnly ? null : (0, utils_1.getDateSetting)(this.settings.maxDate);\n this.settings.disable = this.disabledDates;\n this.settings.disableWeekends ? this.settings.disable.push(this.disableWeekends) : '';\n this.settings.disableWeekdays ? this.settings.disable.push(this.disableWeekdays) : '';\n this.settings.disableFunction ? this.settings.disable.push(this.disableFunction) : '';\n this.settings.wasDefaultValueChanged = false;\n this.settings.defaultValue = '';\n this.settings.manualInputValue = '';\n this.settings.isManuallyOverriddenValue = false;\n this.settings.currentValue = '';\n this.settings.altFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.format);\n this.settings.dateFormat = (0, utils_1.convertFormatToFlatpickr)(this.settings.dateFormat);\n this.settings.position = 'auto center';\n this.settings.onChange = () => {\n if (this.settings.allowInput) {\n if (this.settings.isManuallyOverriddenValue && this.settings.enableTime) {\n this.calendar._input.value = this.settings.manualInputValue;\n }\n else {\n this.settings.manualInputValue = '';\n }\n this.settings.isManuallyOverriddenValue = false;\n }\n this.emit('update');\n };\n this.settings.onOpen = () => this.hook('onCalendarOpen');\n this.settings.onClose = () => {\n this.hook('onCalendarClose');\n this.closedOn = Date.now();\n if (this.settings.allowInput && this.settings.enableTime) {\n this.calendar._input.value = this.settings.manualInputValue || this.calendar._input.value;\n this.settings.isManuallyOverriddenValue = false;\n this.emit('update');\n }\n if (this.settings.wasDefaultValueChanged) {\n this.calendar._input.value = this.settings.defaultValue;\n this.settings.wasDefaultValueChanged = false;\n }\n if (this.calendar) {\n this.emit('blur');\n }\n };\n Formio_1.Formio.requireLibrary('flatpickr-css', 'flatpickr', [\n { type: 'styles', src: `${Formio_1.Formio.cdn['flatpickr-formio']}/flatpickr.min.css` }\n ], true);\n if (this.component.shortcutButtons) {\n this.component.shortcutButtons = this.component.shortcutButtons.filter((btn) => btn.label && btn.onClick);\n }\n if ((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) {\n Formio_1.Formio.requireLibrary('shortcut-buttons-flatpickr-css', 'ShortcutButtonsPlugin', [\n { type: 'styles', src: `${Formio_1.Formio.cdn['shortcut-buttons-flatpickr']}/themes/light.min.css` }\n ], true);\n }\n return superAttach\n .then(() => {\n var _a;\n if ((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) {\n return Formio_1.Formio.requireLibrary('shortcut-buttons-flatpickr', 'ShortcutButtonsPlugin', `${Formio_1.Formio.cdn['shortcut-buttons-flatpickr']}/shortcut-buttons-flatpickr.min.js`, true);\n }\n })\n .then((ShortcutButtonsPlugin) => {\n return Formio_1.Formio.requireLibrary('flatpickr', 'flatpickr', `${Formio_1.Formio.cdn['flatpickr-formio']}/flatpickr.min.js`, true)\n .then((Flatpickr) => {\n var _a;\n if (((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) && ShortcutButtonsPlugin) {\n this.initShortcutButtonsPlugin(ShortcutButtonsPlugin);\n }\n this.settings.formatDate = this.getFlatpickrFormatDate(Flatpickr);\n if (this._input) {\n const { locale } = this.settings;\n if (locale && locale.length >= 2 && locale !== 'en') {\n return Formio_1.Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr-${locale}`, `${Formio_1.Formio.cdn['flatpickr-formio']}/l10n/flatpickr-${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));\n }\n else {\n this.initFlatpickr(Flatpickr);\n }\n }\n });\n })\n .catch((err) => {\n console.warn(err);\n });\n }\n get disableWeekends() {\n return function (date) {\n return (date.getDay() === 0 || date.getDay() === 6);\n };\n }\n get disableWeekdays() {\n return (date) => !this.disableWeekends(date);\n }\n get disableFunction() {\n return (date) => this.evaluate(`return ${this.settings.disableFunction}`, {\n date\n });\n }\n get timezone() {\n return this.componentInstance.getTimezone(this.settings);\n }\n get defaultSettings() {\n return CalendarWidget.defaultSettings;\n }\n addSuffix(suffix) {\n this.addEventListener(suffix, 'click', () => {\n setTimeout(() => {\n if (this.calendar) {\n if (!this.calendar.isOpen && ((Date.now() - this.closedOn) > 200)) {\n this.calendar.open();\n }\n else if (this.calendar.isOpen) {\n this.calendar.close();\n }\n }\n }, 0);\n });\n return suffix;\n }\n set disabled(disabled) {\n super.disabled = disabled;\n if (this.calendar) {\n if (disabled) {\n this.calendar._input.setAttribute('disabled', 'disabled');\n }\n else {\n this.calendar._input.removeAttribute('disabled');\n }\n this.calendar.close();\n this.calendar.redraw();\n }\n }\n get input() {\n return this.calendar ? this.calendar.altInput : null;\n }\n get disabledDates() {\n if (this.settings.disabledDates) {\n const disabledDates = this.settings.disabledDates.split(',');\n return disabledDates.map((item) => {\n const dateMask = /\\d{4}-\\d{2}-\\d{2}/g;\n const dates = item.match(dateMask);\n if (dates && dates.length) {\n return dates.length === 1 ? item.match(dateMask)[0] : {\n from: item.match(dateMask)[0],\n to: item.match(dateMask)[1],\n };\n }\n });\n }\n return [];\n }\n get localeFormat() {\n let format = '';\n if (this.settings.enableDate) {\n format += this.defaultFormat.date;\n }\n if (this.settings.enableTime) {\n format += this.defaultFormat.time;\n }\n return format;\n }\n get dateTimeFormat() {\n return this.settings.useLocaleSettings ? this.localeFormat : (0, utils_1.convertFormatToFlatpickr)(this.dateFormat);\n }\n get dateFormat() {\n return lodash_1.default.get(this.settings, 'format', DEFAULT_FORMAT);\n }\n /**\n * Return the date value.\n *\n * @param date\n * @param format\n * @return {string}\n */\n getDateValue(date, format, useTimezone) {\n if (useTimezone) {\n return (0, utils_1.momentDate)(date, this.valueFormat, this.timezone).format((0, utils_1.convertFormatToMoment)(format));\n }\n return (0, moment_1.default)(date).format((0, utils_1.convertFormatToMoment)(format));\n }\n /**\n * Return the value of the selected date.\n *\n * @return {*}\n */\n getValue() {\n // Standard output format.\n if (!this.calendar) {\n return super.getValue();\n }\n // Get the selected dates from the calendar widget.\n const dates = this.calendar.selectedDates;\n if (!dates || !dates.length) {\n return super.getValue();\n }\n if (!(dates[0] instanceof Date)) {\n return 'Invalid Date';\n }\n return this.getDateValue(dates[0], this.valueFormat, (this.settings.saveAs === 'date'));\n }\n isValueISO8601(value) {\n return value && (typeof value === 'string') && value.match(/-[0-9]{2}T[0-9]{2}:/);\n }\n /**\n * Set the selected date value.\n *\n * @param value\n */\n setValue(value) {\n const saveAsText = (this.settings.saveAs === 'text');\n if (!this.calendar) {\n value = value ? (0, utils_1.formatDate)(this.timezonesUrl, value, (0, utils_1.convertFormatToMoment)(this.settings.format), this.timezone, (0, utils_1.convertFormatToMoment)(this.valueMomentFormat)) : value;\n return super.setValue(value);\n }\n const zonesLoading = this.loadZones();\n if (value) {\n if (!saveAsText && this.settings.readOnly && !zonesLoading) {\n this.calendar.setDate((0, utils_1.momentDate)(value, this.valueFormat, this.timezone).format(), false);\n }\n else if (this.isValueISO8601(value)) {\n this.calendar.setDate(value, false);\n }\n else {\n this.calendar.setDate((0, moment_1.default)(value, this.valueMomentFormat).toDate(), false);\n }\n }\n else {\n this.calendar.clear(false);\n }\n }\n getValueAsString(value, format) {\n const inputFormat = format || this.dateFormat;\n const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;\n if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {\n return (0, moment_1.default)(value, (0, utils_1.convertFormatToMoment)(valueFormat)).format((0, utils_1.convertFormatToMoment)(valueFormat));\n }\n return (0, utils_1.formatDate)(this.timezonesUrl, value, inputFormat, this.timezone, (0, utils_1.convertFormatToMoment)(valueFormat));\n }\n setErrorClasses(hasErrors) {\n if (!this.input) {\n return;\n }\n if (hasErrors) {\n this.addClass(this.input, 'is-invalid');\n this.input.setAttribute('aria-invalid', 'true');\n }\n else {\n this.removeClass(this.input, 'is-invalid');\n this.input.setAttribute('aria-invalid', 'false');\n }\n }\n validationValue(value) {\n if (typeof value === 'string') {\n return new Date(value);\n }\n return value.map(val => new Date(val));\n }\n isCalendarElement(element) {\n var _a, _b, _c, _d, _e;\n if (!element) {\n return true;\n }\n if ((_c = (_b = (_a = this.calendar) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.appendTo) === null || _c === void 0 ? void 0 : _c.contains(element)) {\n return true;\n }\n return (_e = (_d = this.calendar) === null || _d === void 0 ? void 0 : _d.calendarContainer) === null || _e === void 0 ? void 0 : _e.contains(element);\n }\n initFlatpickr(Flatpickr) {\n // Create a new flatpickr.\n this.calendar = new Flatpickr(this._input, Object.assign(Object.assign({}, this.settings), { disableMobile: true }));\n this.calendar.altInput.addEventListener('input', (event) => {\n if (this.settings.allowInput && this.settings.currentValue !== event.target.value) {\n this.settings.manualInputValue = event.target.value;\n this.settings.isManuallyOverriddenValue = true;\n this.settings.currentValue = event.target.value;\n }\n if (event.target.value === '' && this.calendar.selectedDates.length > 0) {\n this.settings.wasDefaultValueChanged = true;\n this.settings.defaultValue = event.target.value;\n this.calendar.clear();\n }\n else {\n this.settings.wasDefaultValueChanged = false;\n }\n });\n const excludedFromMaskFormats = ['MMMM'];\n if (!this.settings.readOnly && !lodash_1.default.some(excludedFromMaskFormats, format => lodash_1.default.includes(this.settings.format, format))) {\n // Enforce the input mask of the format.\n this.setInputMask(this.calendar._input, (0, utils_1.convertFormatToMask)(this.settings.format));\n }\n // Fixes an issue with IE11 where value is set only after the second click\n // TODO: Remove when the issue is solved in the flatpickr library\n if (isIEBrowser) {\n // Remove the original blur listener, because value will be set to empty since relatedTarget is null in IE11\n const originalBlurListener = this.calendar._handlers.find(({ event, element }) => event === 'blur' && element === this.calendar._input);\n this.calendar._input.removeEventListener('blur', originalBlurListener.handler);\n // Add the same event listener as in the original library, but with workaround for IE11 issue\n this.addEventListener(this.calendar._input, 'blur', (event) => {\n const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;\n const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;\n const isInput = event.target === this.calendar._input;\n if (isInput && !this.isCalendarElement(relatedTarget)) {\n this.calendar.setDate(this.calendar._input.value, true, event.target === this.calendar.altInput\n ? this.calendar.config.altFormat\n : this.calendar.config.dateFormat);\n }\n });\n }\n // Make sure we commit the value after a blur event occurs.\n this.addEventListener(this.calendar._input, 'blur', (event) => {\n var _a, _b, _c, _d;\n const activeElement = this.settings.shadowRoot ? this.settings.shadowRoot.activeElement : document.activeElement;\n const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;\n if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {\n const inputValue = this.calendar.input.value;\n const dateValue = inputValue ? (0, moment_1.default)(this.calendar.input.value, (0, utils_1.convertFormatToMoment)(this.valueFormat)).toDate() : inputValue;\n this.calendar.setDate(dateValue, true, this.settings.altFormat);\n }\n else if (!this.calendar.input.value && this.calendar.config.noCalendar) {\n const value = (0, moment_1.default)({ hour: (_b = (_a = this.calendar) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.defaultHour, minute: (_d = (_c = this.calendar) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.defaultMinute }).toDate();\n this.calendar.setDate(value, true, this.settings.format);\n }\n });\n // FJS-1103: When hit the enter button, the field not saving the year correctly\n this.addEventListener(this.calendar.altInput, 'keydown', (event) => {\n if (event.keyCode === 13) {\n if (this.calendar.isOpen) {\n this.calendar.close();\n event.stopPropagation();\n }\n }\n });\n // If other fields are used to calculate disabled dates, we need to redraw calendar to refresh disabled dates\n if (this.settings.disableFunction && this.componentInstance && this.componentInstance.root) {\n this.componentInstance.root.on('change', (e) => {\n if (e.changed && this.calendar) {\n this.calendar.redraw();\n }\n });\n }\n // Restore the calendar value from the component value.\n this.setValue(this.componentValue);\n }\n initShortcutButtonsPlugin(ShortcutButtonsPlugin) {\n this.settings.plugins = [\n // eslint-disable-next-line new-cap\n ShortcutButtonsPlugin({\n button: this.component.shortcutButtons.map((btn) => ({ label: btn.label, attributes: btn.attribute })),\n onClick: (index) => {\n const getValue = this.component.shortcutButtons[index].onClick;\n const date = this.evaluate(getValue, { date: new Date() }, 'date');\n this.calendar.setDate(date, true);\n }\n })\n ];\n }\n get componentValue() {\n let compValue = this.componentInstance.dataValue;\n if (Array.isArray(compValue)) {\n compValue = compValue[this.valueIndex];\n }\n return compValue;\n }\n getFlatpickrFormatDate(Flatpickr) {\n return (date, format) => {\n // Only format this if this is the altFormat and the form is readOnly.\n if (this.settings.readOnly && (format === this.settings.altFormat)) {\n if (!this.settings.enableTime || this.loadZones()) {\n return Flatpickr.formatDate(date, format);\n }\n const currentValue = new Date(this.getValue());\n if (currentValue.toString() === date.toString()) {\n return (0, utils_1.formatOffset)(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), new Date(this.componentValue), format, this.timezone);\n }\n return (0, utils_1.formatOffset)(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), date, format, this.timezone);\n }\n return Flatpickr.formatDate(date, format);\n };\n }\n destroy(all = false) {\n if (this.calendar) {\n this.calendar.destroy();\n }\n super.destroy(all);\n }\n}\nexports[\"default\"] = CalendarWidget;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/widgets/CalendarWidget.js?");
|
8794
8827
|
|
8795
8828
|
/***/ }),
|
8796
8829
|
|
@@ -9524,7 +9557,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\ncons
|
|
9524
9557
|
\***************************************************************************************/
|
9525
9558
|
/***/ (function(__unused_webpack_module, exports) {
|
9526
9559
|
|
9527
|
-
eval("Object.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"]=function(ctx) {\nvar __t, __p = '', __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n\n if (ctx.prefix || ctx.suffix) { ;\n__p += '\\n<div class=\"input-group\">\\n ';\n } ;\n__p += '\\n ';\n if (ctx.prefix) { ;\n__p += '\\n <div class=\"input-group-text\" ref=\"prefix\">\\n ';\n if(ctx.prefix instanceof HTMLElement){ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.prefix.outerHTML, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } else{ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.prefix, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (!ctx.component.editor && !ctx.component.wysiwyg) { ;\n__p += '\\n <' +\n((__t = (ctx.input.type)) == null ? '' : __t) +\n'\\n ref=\"' +\n((__t = (ctx.input.ref ? ctx.input.ref : 'input')) == null ? '' : __t) +\n'\"\\n ';\n for (var attr in ctx.input.attr) { ;\n__p += '\\n ' +\n((__t = (attr)) == null ? '' : __t) +\n'=\"' +\n((__t = (ctx.input.attr[attr])) == null ? '' : __t) +\n'\"\\n ';\n } ;\n__p += '\\n id=\"' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t) +\n'\"\\n aria-labelledby=\"l-' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t) +\n' ';\n if (ctx.component.description) { ;\n__p += 'd-' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t);\n } ;\n__p += '\"\\n aria-required=\"' +\n((__t = (ctx.input.ref === 'input' || !ctx.input.ref ? ctx.component.validate.required :\n ctx.component.fields && ctx.component.fields[ctx.input.ref] && ctx.component.fields[ctx.input.ref].required || false)) == null ? '' : __t) +\n'\"\\n >' +\n((__t = (ctx.input.content)) == null ? '' : __t) +\n'</' +\n((__t = (ctx.input.type)) == null ? '' : __t) +\n'>\\n ';\n if (ctx.hasValueMaskInput) { ;\n__p += '\\n <input ref=\"valueMaskInput\" />\\n ';\n } ;\n__p += '\\n';\n } ;\n__p += '\\n';\n if (ctx.component.editor || ctx.component.wysiwyg) { ;\n__p += '\\n <div ref=\"input\"></div>\\n';\n } ;\n__p += '\\n';\n if (ctx.component.type === 'datetime') { ;\n__p += '\\n<span aria-live=\"assertive\" id=\"' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-liveRegion\" class=\"visually-hidden\" ref=\"liveRegion\"></span>\\n';\n } ;\n__p += '\\n';\n if (ctx.suffix) { ;\n__p += '\\n <div class=\"input-group-text\" ref=\"suffix\">\\n ';\n if(ctx.suffix instanceof HTMLElement){ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.suffix.outerHTML, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } else{ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.suffix, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (ctx.prefix || ctx.suffix) { ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (ctx.component.showCharCount || ctx.component.showWordCount) { ;\n__p += '\\n<div class=\"form-text {{ctx.component.description ? float-end : text-end\">\\n ';\n if (ctx.component.showCharCount) { ;\n__p += '\\n <span class=\"text-muted\" ref=\"charcount\" aria-live=\"polite\"></span>\\n ';\n } ;\n__p += '\\n ';\n if (ctx.component.showWordCount) { ;\n__p += '\\n <span class=\"text-muted\" ref=\"wordcount\" aria-live=\"polite\"></span>\\n ';\n } ;\n__p += '\\n</div>\\n';\n } ;\n__p += '\\n';\nreturn __p\n}\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/bootstrap/lib/cjs/templates/bootstrap5/input/form.ejs.js?");
|
9560
|
+
eval("Object.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"]=function(ctx) {\nvar __t, __p = '', __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n\n if (ctx.prefix || ctx.suffix) { ;\n__p += '\\n<div class=\"input-group\">\\n ';\n } ;\n__p += '\\n ';\n if (ctx.prefix) { ;\n__p += '\\n <div class=\"input-group-text\" ref=\"prefix\">\\n ';\n if(ctx.prefix instanceof HTMLElement){ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.prefix.outerHTML, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } else{ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.prefix, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (ctx.options.floatingLabels) { ;\n__p += '\\n <div class=\"form-floating\">\\n ';\n } ;\n__p += '\\n ';\n if (!ctx.component.editor && !ctx.component.wysiwyg) { ;\n__p += '\\n <' +\n((__t = (ctx.input.type)) == null ? '' : __t) +\n'\\n ref=\"' +\n((__t = (ctx.input.ref ? ctx.input.ref : 'input')) == null ? '' : __t) +\n'\"\\n ';\n for (var attr in ctx.input.attr) { ;\n__p += '\\n ' +\n((__t = (attr)) == null ? '' : __t) +\n'=\"' +\n((__t = (ctx.input.attr[attr])) == null ? '' : __t) +\n'\"\\n ';\n } ;\n__p += '\\n id=\"' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t) +\n'\"\\n aria-labelledby=\"l-' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t) +\n' ';\n if (ctx.component.description) { ;\n__p += 'd-' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t);\n } ;\n__p += '\"\\n aria-required=\"' +\n((__t = (ctx.input.ref === 'input' || !ctx.input.ref ? ctx.component.validate.required :\n ctx.component.fields && ctx.component.fields[ctx.input.ref] && ctx.component.fields[ctx.input.ref].required || false)) == null ? '' : __t) +\n'\"\\n >' +\n((__t = (ctx.input.content)) == null ? '' : __t) +\n'</' +\n((__t = (ctx.input.type)) == null ? '' : __t) +\n'>\\n ';\n if (ctx.options.floatingLabels) { ;\n__p += '\\n <label ref=\"label\" class=\"col-form-label ' +\n((__t = (ctx.label.className)) == null ? '' : __t) +\n'\"\\n for=\"' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t) +\n'\"\\n id=\"l-' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-' +\n((__t = (ctx.component.key)) == null ? '' : __t) +\n'\"\\n >' +\n((__t = ( ctx.t(ctx.component.label, { _userInput: true }) )) == null ? '' : __t) +\n'</label>\\n ';\n } ;\n__p += '\\n ';\n if (ctx.hasValueMaskInput) { ;\n__p += '\\n <input ref=\"valueMaskInput\" />\\n ';\n } ;\n__p += '\\n';\n } ;\n__p += '\\n';\n if (ctx.component.editor || ctx.component.wysiwyg) { ;\n__p += '\\n <div ref=\"input\"></div>\\n';\n } ;\n__p += '\\n';\n if (ctx.component.type === 'datetime') { ;\n__p += '\\n<span aria-live=\"assertive\" id=\"' +\n((__t = (ctx.instance.id)) == null ? '' : __t) +\n'-liveRegion\" class=\"visually-hidden\" ref=\"liveRegion\"></span>\\n';\n } ;\n__p += '\\n';\n if (ctx.suffix) { ;\n__p += '\\n <div class=\"input-group-text\" ref=\"suffix\">\\n ';\n if(ctx.suffix instanceof HTMLElement){ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.suffix.outerHTML, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } else{ ;\n__p += '\\n ' +\n((__t = ( ctx.t(ctx.suffix, { _userInput: true }) )) == null ? '' : __t) +\n'\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (ctx.prefix || ctx.suffix || ctx.options.floatingLabels) { ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (ctx.component.showCharCount || ctx.component.showWordCount) { ;\n__p += '\\n<div class=\"form-text {{ctx.component.description ? float-end : text-end\">\\n ';\n if (ctx.component.showCharCount) { ;\n__p += '\\n <span class=\"text-muted\" ref=\"charcount\" aria-live=\"polite\"></span>\\n ';\n } ;\n__p += '\\n ';\n if (ctx.component.showWordCount) { ;\n__p += '\\n <span class=\"text-muted\" ref=\"wordcount\" aria-live=\"polite\"></span>\\n ';\n } ;\n__p += '\\n</div>\\n';\n } ;\n__p += '\\n';\nreturn __p\n}\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/bootstrap/lib/cjs/templates/bootstrap5/input/form.ejs.js?");
|
9528
9561
|
|
9529
9562
|
/***/ }),
|
9530
9563
|
|
@@ -10381,7 +10414,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
10381
10414
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
10382
10415
|
|
10383
10416
|
"use strict";
|
10384
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar _a;\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FormBuilder = exports.Form = exports.Formio = void 0;\nconst CDN_js_1 = __importDefault(__webpack_require__(/*! ./CDN.js */ \"./lib/cjs/CDN.js\"));\nclass Formio {\n static setLicense(license, norecurse = false) {\n _a.license = license;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setLicense(license);\n }\n }\n static setBaseUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setBaseUrl(url);\n }\n }\n static setApiUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setApiUrl(url);\n }\n }\n static setProjectUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setProjectUrl(url);\n }\n }\n static setAppUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setAppUrl(url);\n }\n }\n static setPathType(type, norecurse = false) {\n _a.pathType = type;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setPathType(type);\n }\n }\n static debug(...args) {\n if (_a.config.debug) {\n console.log(...args);\n }\n }\n static clearCache() {\n if (_a.FormioClass) {\n _a.FormioClass.clearCache();\n }\n }\n static global(prop, flag = '') {\n const globalValue = window[prop];\n if (flag && globalValue && !globalValue[flag]) {\n return null;\n }\n _a.debug(`Getting global ${prop}`, globalValue);\n return globalValue;\n }\n static use(module) {\n if (_a.FormioClass && _a.FormioClass.isRenderer) {\n _a.FormioClass.use(module);\n }\n else {\n _a.modules.push(module);\n }\n }\n static createElement(type, attrs, children) {\n const element = document.createElement(type);\n Object.keys(attrs).forEach(key => {\n element.setAttribute(key, attrs[key]);\n });\n (children || []).forEach(child => {\n element.appendChild(_a.createElement(child.tag, child.attrs, child.children));\n });\n return element;\n }\n static addScript(wrapper_1, src_1, name_1) {\n return __awaiter(this, arguments, void 0, function* (wrapper, src, name, flag = '') {\n if (!src) {\n return Promise.resolve();\n }\n if (typeof src !== 'string' && src.length) {\n return Promise.all(src.map(ref => _a.addScript(wrapper, ref)));\n }\n if (name && _a.global(name, flag)) {\n _a.debug(`${name} already loaded.`);\n return Promise.resolve(_a.global(name));\n }\n _a.debug('Adding Script', src);\n try {\n wrapper.appendChild(_a.createElement('script', {\n src\n }));\n }\n catch (err) {\n _a.debug(err);\n return Promise.resolve();\n }\n if (!name) {\n return Promise.resolve();\n }\n return new Promise((resolve) => {\n _a.debug(`Waiting to load ${name}`);\n const wait = setInterval(() => {\n if (_a.global(name, flag)) {\n clearInterval(wait);\n _a.debug(`${name} loaded.`);\n resolve(_a.global(name));\n }\n }, 100);\n });\n });\n }\n static addStyles(wrapper, href) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!href) {\n return;\n }\n if (typeof href !== 'string' && href.length) {\n href.forEach(ref => _a.addStyles(wrapper, ref));\n return;\n }\n _a.debug('Adding Styles', href);\n wrapper.appendChild(_a.createElement('link', {\n rel: 'stylesheet',\n href\n }));\n });\n }\n static submitDone(instance, submission) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.debug('Submision Complete', submission);\n const successMessage = (_a.config.success || '').toString();\n if (successMessage && successMessage.toLowerCase() !== 'false' && instance.element) {\n instance.element.innerHTML = `<div class=\"alert-success\" role=\"alert\">${successMessage}</div>`;\n }\n let returnUrl = _a.config.redirect;\n // Allow form based configuration for return url.\n if (!returnUrl &&\n (instance._form &&\n instance._form.settings &&\n (instance._form.settings.returnUrl ||\n instance._form.settings.redirect))) {\n _a.debug('Return url found in form configuration');\n returnUrl = instance._form.settings.returnUrl || instance._form.settings.redirect;\n }\n if (returnUrl) {\n const formSrc = instance.formio ? instance.formio.formUrl : '';\n const hasQuery = !!returnUrl.match(/\\?/);\n const isOrigin = returnUrl.indexOf(location.origin) === 0;\n returnUrl += hasQuery ? '&' : '?';\n returnUrl += `sub=${submission._id}`;\n if (!isOrigin && formSrc) {\n returnUrl += `&form=${encodeURIComponent(formSrc)}`;\n }\n _a.debug('Return URL', returnUrl);\n window.location.href = returnUrl;\n if (isOrigin) {\n window.location.reload();\n }\n }\n });\n }\n // Return the full script if the builder is being used.\n static formioScript(script, builder) {\n builder = builder || _a.config.includeBuilder;\n if (_a.fullAdded || builder) {\n _a.fullAdded = true;\n return script.replace('formio.form', 'formio.full');\n }\n return script;\n }\n static addLibrary(wrapper, lib, name) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!lib) {\n return;\n }\n if (lib.dependencies) {\n for (let i = 0; i < lib.dependencies.length; i++) {\n yield _a.addLibrary(wrapper, _a.cdn.libs[lib.dependencies[i]]);\n }\n }\n if (lib.css) {\n yield _a.addStyles(wrapper, lib.css);\n }\n if (lib.js) {\n const module = yield _a.addScript(wrapper, lib.js, lib.use ? name : false);\n if (lib.use) {\n _a.debug(`Using ${name}`);\n const options = lib.options || {};\n if (!options.license && _a.license) {\n options.license = _a.license;\n }\n _a.use((typeof lib.use === 'function' ? lib.use(module) : module), options);\n }\n }\n });\n }\n static addLoader(wrapper) {\n return __awaiter(this, void 0, void 0, function* () {\n wrapper.appendChild(_a.createElement('div', {\n 'class': 'formio-loader'\n }, [{\n tag: 'div',\n attrs: {\n class: 'loader-wrapper'\n },\n children: [{\n tag: 'div',\n attrs: {\n class: 'loader text-center'\n }\n }]\n }]));\n });\n }\n // eslint-disable-next-line max-statements\n static init(element_1) {\n return __awaiter(this, arguments, void 0, function* (element, options = {}, builder = false) {\n _a.cdn = new CDN_js_1.default(_a.config.cdn, _a.config.cdnUrls || {});\n _a.config.libs = _a.config.libs || {\n uswds: {\n dependencies: ['fontawesome'],\n js: `${_a.cdn.uswds}/uswds.min.js`,\n css: `${_a.cdn.uswds}/uswds.min.css`,\n use: true\n },\n fontawesome: {\n css: `${_a.cdn['font-awesome']}/css/font-awesome.min.css`\n },\n bootstrap4: {\n dependencies: ['fontawesome'],\n css: `${_a.cdn.bootstrap4}/css/bootstrap.min.css`\n },\n bootstrap: {\n dependencies: ['bootstrap-icons'],\n css: `${_a.cdn.bootstrap}/css/bootstrap.min.css`\n },\n 'bootstrap-icons': {\n css: `${_a.cdn['bootstrap-icons']}/css/bootstrap-icons.css`\n }\n };\n const id = _a.config.id || `formio-${Math.random().toString(36).substring(7)}`;\n // Create a new wrapper and add the element inside of a new wrapper.\n let wrapper = _a.createElement('div', {\n 'id': `${id}-wrapper`\n });\n element.parentNode.insertBefore(wrapper, element);\n // If we include the libraries, then we will attempt to run this in shadow dom.\n const useShadowDom = _a.config.includeLibs && (typeof wrapper.attachShadow === 'function');\n if (useShadowDom) {\n wrapper = wrapper.attachShadow({\n mode: 'open'\n });\n options.shadowRoot = wrapper;\n }\n element.parentNode.removeChild(element);\n wrapper.appendChild(element);\n // If this is inside of shadow dom, then we need to add the styles and scripts to the shadow dom.\n const libWrapper = useShadowDom ? wrapper : document.body;\n // Load the renderer styles.\n yield _a.addStyles(libWrapper, _a.config.embedCSS || `${_a.cdn.js}/formio.embed.css`);\n // Add a loader.\n _a.addLoader(wrapper);\n const formioSrc = _a.config.full ? 'formio.full' : 'formio.form';\n const renderer = _a.config.debug ? formioSrc : `${formioSrc}.min`;\n _a.FormioClass = yield _a.addScript(libWrapper, _a.formioScript(_a.config.script || `${_a.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');\n _a.FormioClass.cdn = _a.cdn;\n _a.FormioClass.setBaseUrl(options.baseUrl || _a.baseUrl || _a.config.base);\n _a.FormioClass.setProjectUrl(options.projectUrl || _a.projectUrl || _a.config.project);\n _a.FormioClass.language = _a.language;\n _a.setLicense(_a.license || _a.config.license || false);\n _a.modules.forEach((module) => {\n _a.FormioClass.use(module);\n });\n if (_a.icons) {\n _a.FormioClass.icons = _a.icons;\n }\n if (_a.pathType) {\n _a.FormioClass.setPathType(_a.pathType);\n }\n // Add libraries if they wish to include the libs.\n if (_a.config.template && _a.config.includeLibs) {\n yield _a.addLibrary(libWrapper, _a.config.libs[_a.config.template], _a.config.template);\n }\n // Add the premium modules.\n if (_a.config.premium) {\n _a.config.modules.premium = _a.config.premium;\n }\n // Allow adding dynamic modules.\n if (_a.config.modules) {\n for (const name in _a.config.modules) {\n const lib = _a.config.modules[name];\n lib.use = lib.use || true;\n yield _a.addLibrary(libWrapper, lib, name);\n }\n }\n yield _a.addStyles(libWrapper, _a.formioScript(_a.config.style || `${_a.cdn.js}/${renderer}.css`, builder));\n if (_a.config.before) {\n yield _a.config.before(_a.FormioClass, element, _a.config);\n }\n _a.FormioClass.license = true;\n _a._formioReady(_a.FormioClass);\n return wrapper;\n });\n }\n // Called after an instance has been created.\n static afterCreate(instance, wrapper, readyEvent) {\n return __awaiter(this, void 0, void 0, function* () {\n const loader = wrapper.querySelector('.formio-loader');\n if (loader) {\n wrapper.removeChild(loader);\n }\n _a.FormioClass.events.emit(readyEvent, instance);\n if (_a.config.after) {\n _a.debug('Calling ready callback');\n _a.config.after(instance, _a.config);\n }\n return instance;\n });\n }\n // Create a new form.\n static createForm(element_1, form_1) {\n return __awaiter(this, arguments, void 0, function* (element, form, options = {}) {\n if (_a.FormioClass) {\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true }));\n }\n const wrapper = yield _a.init(element, options);\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {\n // Set the default submission data.\n if (_a.config.submission) {\n _a.debug('Setting submission', _a.config.submission);\n instance.submission = _a.config.submission;\n }\n // Call the after create method.\n _a.afterCreate(instance, wrapper, 'formEmbedded');\n return instance;\n });\n });\n }\n // Create a form builder.\n static builder(element_1, form_1) {\n return __awaiter(this, arguments, void 0, function* (element, form, options = {}) {\n var _a;\n if ((_a = _a.FormioClass) === null || _a === void 0 ? void 0 : _a.builder) {\n return _a.FormioClass.builder(element, form, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.builder(element, form, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'builderEmbedded');\n return instance;\n });\n });\n }\n}\nexports.Formio = Formio;\n_a = Formio;\nFormio.FormioClass = null;\nFormio.config = {};\nFormio.modules = [];\nFormio.icons = '';\nFormio.license = '';\nFormio.formioReady = new Promise((ready, reject) => {\n _a._formioReady = ready;\n _a._formioReadyReject = reject;\n});\nFormio.version = '5.0.0-rc.40';\n// Create a report.\nFormio.Report = {\n create: (element_1, submission_1, ...args_1) => __awaiter(void 0, [element_1, submission_1, ...args_1], void 0, function* (element, submission, options = {}) {\n var _b;\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.Report) {\n return _a.FormioClass.Report.create(element, submission, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.Report.create(element, submission, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'reportEmbedded');\n return instance;\n });\n })\n};\nCDN_js_1.default.defaultCDN = Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';\nclass Form {\n constructor(element, form, options) {\n this.form = form;\n this.element = element;\n this.options = options || {};\n this.init();\n this.instance = {\n proxy: true,\n ready: this.ready,\n destroy: () => { }\n };\n }\n init() {\n if (this.instance && !this.instance.proxy) {\n this.instance.destroy();\n }\n this.element.innerHTML = '';\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.form = instance.form;\n return instance;\n });\n }\n create() {\n return Formio.createForm(this.element, this.form, this.options);\n }\n setForm(form) {\n this.form = form;\n if (this.instance) {\n this.instance.setForm(form);\n }\n }\n setDisplay(display) {\n if (this.instance.proxy) {\n return this.ready;\n }\n this.form.display = display;\n this.instance.destroy();\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.setForm(this.form);\n });\n return this.ready;\n }\n}\nexports.Form = Form;\nclass FormBuilder extends Form {\n create() {\n return Formio.builder(this.element, this.form, this.options);\n }\n}\nexports.FormBuilder = FormBuilder;\nFormio.Form = Form;\nFormio.FormBuilder = FormBuilder;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Embed.js?");
|
10417
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar _a;\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FormBuilder = exports.Form = exports.Formio = void 0;\nconst CDN_js_1 = __importDefault(__webpack_require__(/*! ./CDN.js */ \"./lib/cjs/CDN.js\"));\nclass Formio {\n static setLicense(license, norecurse = false) {\n _a.license = license;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setLicense(license);\n }\n }\n static setBaseUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setBaseUrl(url);\n }\n }\n static setApiUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setApiUrl(url);\n }\n }\n static setProjectUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setProjectUrl(url);\n }\n }\n static setAppUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setAppUrl(url);\n }\n }\n static setPathType(type, norecurse = false) {\n _a.pathType = type;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setPathType(type);\n }\n }\n static debug(...args) {\n if (_a.config.debug) {\n console.log(...args);\n }\n }\n static clearCache() {\n if (_a.FormioClass) {\n _a.FormioClass.clearCache();\n }\n }\n static global(prop, flag = '') {\n const globalValue = window[prop];\n if (flag && globalValue && !globalValue[flag]) {\n return null;\n }\n _a.debug(`Getting global ${prop}`, globalValue);\n return globalValue;\n }\n static use(module) {\n if (_a.FormioClass && _a.FormioClass.isRenderer) {\n _a.FormioClass.use(module);\n }\n else {\n _a.modules.push(module);\n }\n }\n static createElement(type, attrs, children) {\n const element = document.createElement(type);\n Object.keys(attrs).forEach(key => {\n element.setAttribute(key, attrs[key]);\n });\n (children || []).forEach(child => {\n element.appendChild(_a.createElement(child.tag, child.attrs, child.children));\n });\n return element;\n }\n static addScript(wrapper, src, name, flag = '') {\n return __awaiter(this, void 0, void 0, function* () {\n if (!src) {\n return Promise.resolve();\n }\n if (typeof src !== 'string' && src.length) {\n return Promise.all(src.map(ref => _a.addScript(wrapper, ref)));\n }\n if (name && _a.global(name, flag)) {\n _a.debug(`${name} already loaded.`);\n return Promise.resolve(_a.global(name));\n }\n _a.debug('Adding Script', src);\n try {\n wrapper.appendChild(_a.createElement('script', {\n src\n }));\n }\n catch (err) {\n _a.debug(err);\n return Promise.resolve();\n }\n if (!name) {\n return Promise.resolve();\n }\n return new Promise((resolve) => {\n _a.debug(`Waiting to load ${name}`);\n const wait = setInterval(() => {\n if (_a.global(name, flag)) {\n clearInterval(wait);\n _a.debug(`${name} loaded.`);\n resolve(_a.global(name));\n }\n }, 100);\n });\n });\n }\n static addStyles(wrapper, href) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!href) {\n return;\n }\n if (typeof href !== 'string' && href.length) {\n href.forEach(ref => _a.addStyles(wrapper, ref));\n return;\n }\n _a.debug('Adding Styles', href);\n wrapper.appendChild(_a.createElement('link', {\n rel: 'stylesheet',\n href\n }));\n });\n }\n static submitDone(instance, submission) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.debug('Submision Complete', submission);\n const successMessage = (_a.config.success || '').toString();\n if (successMessage && successMessage.toLowerCase() !== 'false' && instance.element) {\n instance.element.innerHTML = `<div class=\"alert-success\" role=\"alert\">${successMessage}</div>`;\n }\n let returnUrl = _a.config.redirect;\n // Allow form based configuration for return url.\n if (!returnUrl &&\n (instance._form &&\n instance._form.settings &&\n (instance._form.settings.returnUrl ||\n instance._form.settings.redirect))) {\n _a.debug('Return url found in form configuration');\n returnUrl = instance._form.settings.returnUrl || instance._form.settings.redirect;\n }\n if (returnUrl) {\n const formSrc = instance.formio ? instance.formio.formUrl : '';\n const hasQuery = !!returnUrl.match(/\\?/);\n const isOrigin = returnUrl.indexOf(location.origin) === 0;\n returnUrl += hasQuery ? '&' : '?';\n returnUrl += `sub=${submission._id}`;\n if (!isOrigin && formSrc) {\n returnUrl += `&form=${encodeURIComponent(formSrc)}`;\n }\n _a.debug('Return URL', returnUrl);\n window.location.href = returnUrl;\n if (isOrigin) {\n window.location.reload();\n }\n }\n });\n }\n // Return the full script if the builder is being used.\n static formioScript(script, builder) {\n builder = builder || _a.config.includeBuilder;\n if (_a.fullAdded || builder) {\n _a.fullAdded = true;\n return script.replace('formio.form', 'formio.full');\n }\n return script;\n }\n static addLibrary(wrapper, lib, name) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!lib) {\n return;\n }\n if (lib.dependencies) {\n for (let i = 0; i < lib.dependencies.length; i++) {\n yield _a.addLibrary(wrapper, _a.cdn.libs[lib.dependencies[i]]);\n }\n }\n if (lib.css) {\n yield _a.addStyles(wrapper, lib.css);\n }\n if (lib.js) {\n const module = yield _a.addScript(wrapper, lib.js, lib.use ? name : false);\n if (lib.use) {\n _a.debug(`Using ${name}`);\n const options = lib.options || {};\n if (!options.license && _a.license) {\n options.license = _a.license;\n }\n _a.use((typeof lib.use === 'function' ? lib.use(module) : module), options);\n }\n }\n });\n }\n static addLoader(wrapper) {\n return __awaiter(this, void 0, void 0, function* () {\n wrapper.appendChild(_a.createElement('div', {\n 'class': 'formio-loader'\n }, [{\n tag: 'div',\n attrs: {\n class: 'loader-wrapper'\n },\n children: [{\n tag: 'div',\n attrs: {\n class: 'loader text-center'\n }\n }]\n }]));\n });\n }\n // eslint-disable-next-line max-statements\n static init(element, options = {}, builder = false) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.cdn = new CDN_js_1.default(_a.config.cdn, _a.config.cdnUrls || {});\n _a.config.libs = _a.config.libs || {\n uswds: {\n dependencies: ['fontawesome'],\n js: `${_a.cdn.uswds}/uswds.min.js`,\n css: `${_a.cdn.uswds}/uswds.min.css`,\n use: true\n },\n fontawesome: {\n css: `${_a.cdn['font-awesome']}/css/font-awesome.min.css`\n },\n bootstrap4: {\n dependencies: ['fontawesome'],\n css: `${_a.cdn.bootstrap4}/css/bootstrap.min.css`\n },\n bootstrap: {\n dependencies: ['bootstrap-icons'],\n css: `${_a.cdn.bootstrap}/css/bootstrap.min.css`\n },\n 'bootstrap-icons': {\n css: `${_a.cdn['bootstrap-icons']}/css/bootstrap-icons.css`\n }\n };\n const id = _a.config.id || `formio-${Math.random().toString(36).substring(7)}`;\n // Create a new wrapper and add the element inside of a new wrapper.\n let wrapper = _a.createElement('div', {\n 'id': `${id}-wrapper`\n });\n element.parentNode.insertBefore(wrapper, element);\n // If we include the libraries, then we will attempt to run this in shadow dom.\n const useShadowDom = _a.config.includeLibs && (typeof wrapper.attachShadow === 'function');\n if (useShadowDom) {\n wrapper = wrapper.attachShadow({\n mode: 'open'\n });\n options.shadowRoot = wrapper;\n }\n element.parentNode.removeChild(element);\n wrapper.appendChild(element);\n // If this is inside of shadow dom, then we need to add the styles and scripts to the shadow dom.\n const libWrapper = useShadowDom ? wrapper : document.body;\n // Load the renderer styles.\n yield _a.addStyles(libWrapper, _a.config.embedCSS || `${_a.cdn.js}/formio.embed.css`);\n // Add a loader.\n _a.addLoader(wrapper);\n const formioSrc = _a.config.full ? 'formio.full' : 'formio.form';\n const renderer = _a.config.debug ? formioSrc : `${formioSrc}.min`;\n _a.FormioClass = yield _a.addScript(libWrapper, _a.formioScript(_a.config.script || `${_a.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');\n _a.FormioClass.cdn = _a.cdn;\n _a.FormioClass.setBaseUrl(options.baseUrl || _a.baseUrl || _a.config.base);\n _a.FormioClass.setProjectUrl(options.projectUrl || _a.projectUrl || _a.config.project);\n _a.FormioClass.language = _a.language;\n _a.setLicense(_a.license || _a.config.license || false);\n _a.modules.forEach((module) => {\n _a.FormioClass.use(module);\n });\n if (_a.icons) {\n _a.FormioClass.icons = _a.icons;\n }\n if (_a.pathType) {\n _a.FormioClass.setPathType(_a.pathType);\n }\n // Add libraries if they wish to include the libs.\n if (_a.config.template && _a.config.includeLibs) {\n yield _a.addLibrary(libWrapper, _a.config.libs[_a.config.template], _a.config.template);\n }\n // Add the premium modules.\n if (_a.config.premium) {\n _a.config.modules.premium = _a.config.premium;\n }\n // Allow adding dynamic modules.\n if (_a.config.modules) {\n for (const name in _a.config.modules) {\n const lib = _a.config.modules[name];\n lib.use = lib.use || true;\n yield _a.addLibrary(libWrapper, lib, name);\n }\n }\n yield _a.addStyles(libWrapper, _a.formioScript(_a.config.style || `${_a.cdn.js}/${renderer}.css`, builder));\n if (_a.config.before) {\n yield _a.config.before(_a.FormioClass, element, _a.config);\n }\n _a.FormioClass.license = true;\n _a._formioReady(_a.FormioClass);\n return wrapper;\n });\n }\n // Called after an instance has been created.\n static afterCreate(instance, wrapper, readyEvent) {\n return __awaiter(this, void 0, void 0, function* () {\n const loader = wrapper.querySelector('.formio-loader');\n if (loader) {\n wrapper.removeChild(loader);\n }\n _a.FormioClass.events.emit(readyEvent, instance);\n if (_a.config.after) {\n _a.debug('Calling ready callback');\n _a.config.after(instance, _a.config);\n }\n return instance;\n });\n }\n // Create a new form.\n static createForm(element, form, options = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n if (_a.FormioClass) {\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true }));\n }\n const wrapper = yield _a.init(element, options);\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {\n // Set the default submission data.\n if (_a.config.submission) {\n _a.debug('Setting submission', _a.config.submission);\n instance.submission = _a.config.submission;\n }\n // Call the after create method.\n _a.afterCreate(instance, wrapper, 'formEmbedded');\n return instance;\n });\n });\n }\n // Create a form builder.\n static builder(element, form, options = {}) {\n var _b;\n return __awaiter(this, void 0, void 0, function* () {\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.builder) {\n return _a.FormioClass.builder(element, form, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.builder(element, form, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'builderEmbedded');\n return instance;\n });\n });\n }\n}\nexports.Formio = Formio;\n_a = Formio;\nFormio.FormioClass = null;\nFormio.config = {};\nFormio.modules = [];\nFormio.icons = '';\nFormio.license = '';\nFormio.formioReady = new Promise((ready, reject) => {\n _a._formioReady = ready;\n _a._formioReadyReject = reject;\n});\nFormio.version = '5.0.0-rc.42';\n// Create a report.\nFormio.Report = {\n create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {\n var _b;\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.Report) {\n return _a.FormioClass.Report.create(element, submission, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.Report.create(element, submission, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'reportEmbedded');\n return instance;\n });\n })\n};\nCDN_js_1.default.defaultCDN = Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';\nclass Form {\n constructor(element, form, options) {\n this.form = form;\n this.element = element;\n this.options = options || {};\n this.init();\n this.instance = {\n proxy: true,\n ready: this.ready,\n destroy: () => { }\n };\n }\n init() {\n if (this.instance && !this.instance.proxy) {\n this.instance.destroy();\n }\n this.element.innerHTML = '';\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.form = instance.form;\n return instance;\n });\n }\n create() {\n return Formio.createForm(this.element, this.form, this.options);\n }\n setForm(form) {\n this.form = form;\n if (this.instance) {\n this.instance.setForm(form);\n }\n }\n setDisplay(display) {\n if (this.instance.proxy) {\n return this.ready;\n }\n this.form.display = display;\n this.instance.destroy();\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.setForm(this.form);\n });\n return this.ready;\n }\n}\nexports.Form = Form;\nclass FormBuilder extends Form {\n create() {\n return Formio.builder(this.element, this.form, this.options);\n }\n}\nexports.FormBuilder = FormBuilder;\nFormio.Form = Form;\nFormio.FormBuilder = FormBuilder;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Embed.js?");
|
10385
10418
|
|
10386
10419
|
/***/ }),
|
10387
10420
|
|
@@ -10392,7 +10425,51 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
10392
10425
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
10393
10426
|
|
10394
10427
|
"use strict";
|
10395
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = void 0;\nconst sdk_1 = __webpack_require__(/*! @formio/core/sdk */ \"../core/lib/sdk/index.js\");\nObject.defineProperty(exports, \"Formio\", ({ enumerable: true, get: function () { return sdk_1.Formio; } }));\nconst Embed_1 = __webpack_require__(/*! ./Embed */ \"./lib/cjs/Embed.js\");\nconst CDN_1 = __importDefault(__webpack_require__(/*! ./CDN */ \"./lib/cjs/CDN.js\"));\nconst providers_1 = __importDefault(__webpack_require__(/*! ./providers */ \"./lib/cjs/providers/index.js\"));\nsdk_1.Formio.cdn = new CDN_1.default();\nsdk_1.Formio.Providers = providers_1.default;\nsdk_1.Formio.version = '5.0.0-rc.
|
10428
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = void 0;\nconst sdk_1 = __webpack_require__(/*! @formio/core/sdk */ \"../core/lib/sdk/index.js\");\nObject.defineProperty(exports, \"Formio\", ({ enumerable: true, get: function () { return sdk_1.Formio; } }));\nconst Embed_1 = __webpack_require__(/*! ./Embed */ \"./lib/cjs/Embed.js\");\nconst CDN_1 = __importDefault(__webpack_require__(/*! ./CDN */ \"./lib/cjs/CDN.js\"));\nconst providers_1 = __importDefault(__webpack_require__(/*! ./providers */ \"./lib/cjs/providers/index.js\"));\nsdk_1.Formio.cdn = new CDN_1.default();\nsdk_1.Formio.Providers = providers_1.default;\nsdk_1.Formio.version = '5.0.0-rc.42';\nCDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';\nconst isNil = (val) => val === null || val === undefined;\nsdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {\n const requestArgs = {\n provider: storage,\n method: 'upload',\n file: file,\n fileName: fileName,\n dir: dir\n };\n fileKey = fileKey || 'file';\n const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)\n .then(() => {\n return sdk_1.Formio.pluginGet('fileRequest', requestArgs)\n .then((result) => {\n if (storage && isNil(result)) {\n const Provider = providers_1.default.getProvider('storage', storage);\n if (Provider) {\n const provider = new Provider(this);\n if (uploadStartCallback) {\n uploadStartCallback();\n }\n return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions);\n }\n else {\n throw ('Storage provider not found');\n }\n }\n return result || { url: '' };\n });\n });\n return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n};\nsdk_1.Formio.prototype.downloadFile = function (file, options) {\n const requestArgs = {\n method: 'download',\n file: file\n };\n const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)\n .then(() => {\n return sdk_1.Formio.pluginGet('fileRequest', requestArgs)\n .then((result) => {\n if (file.storage && isNil(result)) {\n const Provider = providers_1.default.getProvider('storage', file.storage);\n if (Provider) {\n const provider = new Provider(this);\n return provider.downloadFile(file, options);\n }\n else {\n throw ('Storage provider not found');\n }\n }\n return result || { url: '' };\n });\n });\n return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n};\nsdk_1.Formio.prototype.deleteFile = function (file, options) {\n const requestArgs = {\n method: 'delete',\n file: file\n };\n const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)\n .then(() => {\n return sdk_1.Formio.pluginGet('fileRequest', requestArgs)\n .then((result) => {\n if (file.storage && isNil(result)) {\n const Provider = providers_1.default.getProvider('storage', file.storage);\n if (Provider) {\n const provider = new Provider(this);\n return provider.deleteFile(file, options);\n }\n else {\n throw ('Storage provider not found');\n }\n }\n return result || { url: '' };\n });\n });\n return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n};\n// Esnure we proxy the following methods to the FormioEmbed class.\n['setBaseUrl', 'setApiUrl', 'setAppUrl', 'setProjectUrl', 'setPathType', 'setLicense'].forEach((fn) => {\n const baseFn = sdk_1.Formio[fn];\n sdk_1.Formio[fn] = function (arg) {\n const retVal = Embed_1.Formio[fn](arg, true);\n return baseFn ? baseFn.call(this, arg) : retVal;\n };\n});\n// For reverse compatability.\nsdk_1.Formio.Promise = Promise;\nsdk_1.Formio.formioReady = Embed_1.Formio.formioReady;\nsdk_1.Formio.config = Embed_1.Formio.config;\nsdk_1.Formio.builder = Embed_1.Formio.builder;\nsdk_1.Formio.Report = Embed_1.Formio.Report;\nsdk_1.Formio.Form = Embed_1.Formio.Form;\nsdk_1.Formio.FormBuilder = Embed_1.Formio.FormBuilder;\nsdk_1.Formio.use = Embed_1.Formio.use;\nsdk_1.Formio.createForm = Embed_1.Formio.createForm;\nsdk_1.Formio.submitDone = Embed_1.Formio.submitDone;\nsdk_1.Formio.addLibrary = Embed_1.Formio.addLibrary;\nsdk_1.Formio.addLoader = Embed_1.Formio.addLoader;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Formio.js?");
|
10429
|
+
|
10430
|
+
/***/ }),
|
10431
|
+
|
10432
|
+
/***/ "../core/node_modules/fast-json-patch/index.mjs":
|
10433
|
+
/*!******************************************************!*\
|
10434
|
+
!*** ../core/node_modules/fast-json-patch/index.mjs ***!
|
10435
|
+
\******************************************************/
|
10436
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
10437
|
+
|
10438
|
+
"use strict";
|
10439
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ JsonPatchError: function() { return /* reexport safe */ _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__.PatchError; },\n/* harmony export */ _areEquals: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__._areEquals; },\n/* harmony export */ applyOperation: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__.applyOperation; },\n/* harmony export */ applyPatch: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__.applyPatch; },\n/* harmony export */ applyReducer: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__.applyReducer; },\n/* harmony export */ compare: function() { return /* reexport safe */ _module_duplex_mjs__WEBPACK_IMPORTED_MODULE_1__.compare; },\n/* harmony export */ deepClone: function() { return /* reexport safe */ _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__._deepClone; },\n/* harmony export */ \"default\": function() { return __WEBPACK_DEFAULT_EXPORT__; },\n/* harmony export */ escapePathComponent: function() { return /* reexport safe */ _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__.escapePathComponent; },\n/* harmony export */ generate: function() { return /* reexport safe */ _module_duplex_mjs__WEBPACK_IMPORTED_MODULE_1__.generate; },\n/* harmony export */ getValueByPointer: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__.getValueByPointer; },\n/* harmony export */ observe: function() { return /* reexport safe */ _module_duplex_mjs__WEBPACK_IMPORTED_MODULE_1__.observe; },\n/* harmony export */ unescapePathComponent: function() { return /* reexport safe */ _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__.unescapePathComponent; },\n/* harmony export */ unobserve: function() { return /* reexport safe */ _module_duplex_mjs__WEBPACK_IMPORTED_MODULE_1__.unobserve; },\n/* harmony export */ validate: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__.validate; },\n/* harmony export */ validator: function() { return /* reexport safe */ _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__.validator; }\n/* harmony export */ });\n/* harmony import */ var _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./module/core.mjs */ \"../core/node_modules/fast-json-patch/module/core.mjs\");\n/* harmony import */ var _module_duplex_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./module/duplex.mjs */ \"../core/node_modules/fast-json-patch/module/duplex.mjs\");\n/* harmony import */ var _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./module/helpers.mjs */ \"../core/node_modules/fast-json-patch/module/helpers.mjs\");\n\n\n\n\n\n/**\n * Default export for backwards compat\n */\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Object.assign({}, _module_core_mjs__WEBPACK_IMPORTED_MODULE_0__, _module_duplex_mjs__WEBPACK_IMPORTED_MODULE_1__, {\n JsonPatchError: _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__.PatchError,\n deepClone: _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__._deepClone,\n escapePathComponent: _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__.escapePathComponent,\n unescapePathComponent: _module_helpers_mjs__WEBPACK_IMPORTED_MODULE_2__.unescapePathComponent\n}));\n\n//# sourceURL=webpack://Formio/../core/node_modules/fast-json-patch/index.mjs?");
|
10440
|
+
|
10441
|
+
/***/ }),
|
10442
|
+
|
10443
|
+
/***/ "../core/node_modules/fast-json-patch/module/core.mjs":
|
10444
|
+
/*!************************************************************!*\
|
10445
|
+
!*** ../core/node_modules/fast-json-patch/module/core.mjs ***!
|
10446
|
+
\************************************************************/
|
10447
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
10448
|
+
|
10449
|
+
"use strict";
|
10450
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ JsonPatchError: function() { return /* binding */ JsonPatchError; },\n/* harmony export */ _areEquals: function() { return /* binding */ _areEquals; },\n/* harmony export */ applyOperation: function() { return /* binding */ applyOperation; },\n/* harmony export */ applyPatch: function() { return /* binding */ applyPatch; },\n/* harmony export */ applyReducer: function() { return /* binding */ applyReducer; },\n/* harmony export */ deepClone: function() { return /* binding */ deepClone; },\n/* harmony export */ getValueByPointer: function() { return /* binding */ getValueByPointer; },\n/* harmony export */ validate: function() { return /* binding */ validate; },\n/* harmony export */ validator: function() { return /* binding */ validator; }\n/* harmony export */ });\n/* harmony import */ var _helpers_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers.mjs */ \"../core/node_modules/fast-json-patch/module/helpers.mjs\");\n\nvar JsonPatchError = _helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.PatchError;\nvar deepClone = _helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone;\n/* We use a Javascript hash to store each\n function. Each hash entry (property) uses\n the operation identifiers specified in rfc6902.\n In this way, we can map each patch operation\n to its dedicated function in efficient way.\n */\n/* The operations applicable to an object */\nvar objOps = {\n add: function (obj, key, document) {\n obj[key] = this.value;\n return { newDocument: document };\n },\n remove: function (obj, key, document) {\n var removed = obj[key];\n delete obj[key];\n return { newDocument: document, removed: removed };\n },\n replace: function (obj, key, document) {\n var removed = obj[key];\n obj[key] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: function (obj, key, document) {\n /* in case move target overwrites an existing value,\n return the removed value, this can be taxing performance-wise,\n and is potentially unneeded */\n var removed = getValueByPointer(document, this.path);\n if (removed) {\n removed = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(removed);\n }\n var originalValue = applyOperation(document, { op: \"remove\", path: this.from }).removed;\n applyOperation(document, { op: \"add\", path: this.path, value: originalValue });\n return { newDocument: document, removed: removed };\n },\n copy: function (obj, key, document) {\n var valueToCopy = getValueByPointer(document, this.from);\n // enforce copy by value so further operations don't affect source (see issue #177)\n applyOperation(document, { op: \"add\", path: this.path, value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(valueToCopy) });\n return { newDocument: document };\n },\n test: function (obj, key, document) {\n return { newDocument: document, test: _areEquals(obj[key], this.value) };\n },\n _get: function (obj, key, document) {\n this.value = obj[key];\n return { newDocument: document };\n }\n};\n/* The operations applicable to an array. Many are the same as for the object */\nvar arrOps = {\n add: function (arr, i, document) {\n if ((0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.isInteger)(i)) {\n arr.splice(i, 0, this.value);\n }\n else { // array props\n arr[i] = this.value;\n }\n // this may be needed when using '-' in an array\n return { newDocument: document, index: i };\n },\n remove: function (arr, i, document) {\n var removedList = arr.splice(i, 1);\n return { newDocument: document, removed: removedList[0] };\n },\n replace: function (arr, i, document) {\n var removed = arr[i];\n arr[i] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: objOps.move,\n copy: objOps.copy,\n test: objOps.test,\n _get: objOps._get\n};\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nfunction getValueByPointer(document, pointer) {\n if (pointer == '') {\n return document;\n }\n var getOriginalDestination = { op: \"_get\", path: pointer };\n applyOperation(document, getOriginalDestination);\n return getOriginalDestination.value;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nfunction applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {\n if (validateOperation === void 0) { validateOperation = false; }\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (index === void 0) { index = 0; }\n if (validateOperation) {\n if (typeof validateOperation == 'function') {\n validateOperation(operation, 0, document, operation.path);\n }\n else {\n validator(operation, 0);\n }\n }\n /* ROOT OPERATIONS */\n if (operation.path === \"\") {\n var returnValue = { newDocument: document };\n if (operation.op === 'add') {\n returnValue.newDocument = operation.value;\n return returnValue;\n }\n else if (operation.op === 'replace') {\n returnValue.newDocument = operation.value;\n returnValue.removed = document; //document we removed\n return returnValue;\n }\n else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root\n returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field\n if (operation.op === 'move') { // report removed item\n returnValue.removed = document;\n }\n return returnValue;\n }\n else if (operation.op === 'test') {\n returnValue.test = _areEquals(document, operation.value);\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n returnValue.newDocument = document;\n return returnValue;\n }\n else if (operation.op === 'remove') { // a remove on root\n returnValue.removed = document;\n returnValue.newDocument = null;\n return returnValue;\n }\n else if (operation.op === '_get') {\n operation.value = document;\n return returnValue;\n }\n else { /* bad operation */\n if (validateOperation) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else {\n return returnValue;\n }\n }\n } /* END ROOT OPERATIONS */\n else {\n if (!mutateDocument) {\n document = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(document);\n }\n var path = operation.path || \"\";\n var keys = path.split('/');\n var obj = document;\n var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n var len = keys.length;\n var existingPathFragment = undefined;\n var key = void 0;\n var validateFunction = void 0;\n if (typeof validateOperation == 'function') {\n validateFunction = validateOperation;\n }\n else {\n validateFunction = validator;\n }\n while (true) {\n key = keys[t];\n if (key && key.indexOf('~') != -1) {\n key = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.unescapePathComponent)(key);\n }\n if (banPrototypeModifications &&\n (key == '__proto__' ||\n (key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {\n throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');\n }\n if (validateOperation) {\n if (existingPathFragment === undefined) {\n if (obj[key] === undefined) {\n existingPathFragment = keys.slice(0, t).join('/');\n }\n else if (t == len - 1) {\n existingPathFragment = operation.path;\n }\n if (existingPathFragment !== undefined) {\n validateFunction(operation, 0, document, existingPathFragment);\n }\n }\n }\n t++;\n if (Array.isArray(obj)) {\n if (key === '-') {\n key = obj.length;\n }\n else {\n if (validateOperation && !(0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.isInteger)(key)) {\n throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", index, operation, document);\n } // only parse key when it's an integer for `arr.prop` to work\n else if ((0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.isInteger)(key)) {\n key = ~~key;\n }\n }\n if (t >= len) {\n if (validateOperation && operation.op === \"add\" && key > obj.length) {\n throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", index, operation, document);\n }\n var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n else {\n if (t >= len) {\n var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n obj = obj[key];\n // If we have more keys in the path, but the next value isn't a non-null object,\n // throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.\n if (validateOperation && t < len && (!obj || typeof obj !== \"object\")) {\n throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nfunction applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (validateOperation) {\n if (!Array.isArray(patch)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n }\n if (!mutateDocument) {\n document = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(document);\n }\n var results = new Array(patch.length);\n for (var i = 0, length_1 = patch.length; i < length_1; i++) {\n // we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`\n results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);\n document = results[i].newDocument; // in case root was replaced\n }\n results.newDocument = document;\n return results;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nfunction applyReducer(document, operation, index) {\n var operationResult = applyOperation(document, operation);\n if (operationResult.test === false) { // failed test\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return operationResult.newDocument;\n}\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nfunction validator(operation, index, document, existingPathFragment) {\n if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {\n throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);\n }\n else if (!objOps[operation.op]) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else if (typeof operation.path !== 'string') {\n throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {\n // paths that aren't empty string should start with \"/\"\n throw new JsonPatchError('Operation `path` property must start with \"/\"', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {\n throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.hasUndefined)(operation.value)) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);\n }\n else if (document) {\n if (operation.op == \"add\") {\n var pathLen = operation.path.split(\"/\").length;\n var existingPathLen = existingPathFragment.split(\"/\").length;\n if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {\n throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);\n }\n }\n else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {\n if (operation.path !== existingPathFragment) {\n throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n else if (operation.op === 'move' || operation.op === 'copy') {\n var existingValue = { op: \"_get\", path: operation.from, value: undefined };\n var error = validate([existingValue], document);\n if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {\n throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nfunction validate(sequence, document, externalValidator) {\n try {\n if (!Array.isArray(sequence)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n if (document) {\n //clone document and sequence so that we can safely try applying operations\n applyPatch((0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(document), (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(sequence), externalValidator || true);\n }\n else {\n externalValidator = externalValidator || validator;\n for (var i = 0; i < sequence.length; i++) {\n externalValidator(sequence[i], i, document, undefined);\n }\n }\n }\n catch (e) {\n if (e instanceof JsonPatchError) {\n return e;\n }\n else {\n throw e;\n }\n }\n}\n// based on https://github.com/epoberezkin/fast-deep-equal\n// MIT License\n// Copyright (c) 2017 Evgeny Poberezkin\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\nfunction _areEquals(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;\n if (arrA && arrB) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!_areEquals(a[i], b[i]))\n return false;\n return true;\n }\n if (arrA != arrB)\n return false;\n var keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!b.hasOwnProperty(keys[i]))\n return false;\n for (i = length; i-- !== 0;) {\n key = keys[i];\n if (!_areEquals(a[key], b[key]))\n return false;\n }\n return true;\n }\n return a !== a && b !== b;\n}\n;\n\n\n//# sourceURL=webpack://Formio/../core/node_modules/fast-json-patch/module/core.mjs?");
|
10451
|
+
|
10452
|
+
/***/ }),
|
10453
|
+
|
10454
|
+
/***/ "../core/node_modules/fast-json-patch/module/duplex.mjs":
|
10455
|
+
/*!**************************************************************!*\
|
10456
|
+
!*** ../core/node_modules/fast-json-patch/module/duplex.mjs ***!
|
10457
|
+
\**************************************************************/
|
10458
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
10459
|
+
|
10460
|
+
"use strict";
|
10461
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: function() { return /* binding */ compare; },\n/* harmony export */ generate: function() { return /* binding */ generate; },\n/* harmony export */ observe: function() { return /* binding */ observe; },\n/* harmony export */ unobserve: function() { return /* binding */ unobserve; }\n/* harmony export */ });\n/* harmony import */ var _helpers_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers.mjs */ \"../core/node_modules/fast-json-patch/module/helpers.mjs\");\n/* harmony import */ var _core_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core.mjs */ \"../core/node_modules/fast-json-patch/module/core.mjs\");\n/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2021 Joachim Wester\n * MIT license\n */\n\n\nvar beforeDict = new WeakMap();\nvar Mirror = /** @class */ (function () {\n function Mirror(obj) {\n this.observers = new Map();\n this.obj = obj;\n }\n return Mirror;\n}());\nvar ObserverInfo = /** @class */ (function () {\n function ObserverInfo(callback, observer) {\n this.callback = callback;\n this.observer = observer;\n }\n return ObserverInfo;\n}());\nfunction getMirror(obj) {\n return beforeDict.get(obj);\n}\nfunction getObserverFromMirror(mirror, callback) {\n return mirror.observers.get(callback);\n}\nfunction removeObserverFromMirror(mirror, observer) {\n mirror.observers.delete(observer.callback);\n}\n/**\n * Detach an observer from an object\n */\nfunction unobserve(root, observer) {\n observer.unobserve();\n}\n/**\n * Observes changes made to an object, which can then be retrieved using generate\n */\nfunction observe(obj, callback) {\n var patches = [];\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.set(obj, mirror);\n }\n else {\n var observerInfo = getObserverFromMirror(mirror, callback);\n observer = observerInfo && observerInfo.observer;\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') { //not Node\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n window.removeEventListener('change', fastCheck);\n }\n };\n mirror.observers.set(callback, new ObserverInfo(callback, observer));\n return observer;\n}\n/**\n * Generate an array of patches from an observer\n */\nfunction generate(observer, invertible) {\n if (invertible === void 0) { invertible = false; }\n var mirror = beforeDict.get(observer.object);\n _generate(mirror.value, observer.object, observer.patches, \"\", invertible);\n if (observer.patches.length) {\n (0,_core_mjs__WEBPACK_IMPORTED_MODULE_1__.applyPatch)(mirror.value, observer.patches);\n }\n var temp = observer.patches;\n if (temp.length > 0) {\n observer.patches = [];\n if (observer.callback) {\n observer.callback(temp);\n }\n }\n return temp;\n}\n// Dirty check if obj is different from mirror, generate patches and update mirror\nfunction _generate(mirror, obj, patches, path, invertible) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._objectKeys)(obj);\n var oldKeys = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._objectKeys)(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if ((0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.hasOwnProperty)(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {\n _generate(oldVal, newVal, patches, path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), invertible);\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(oldVal) });\n }\n patches.push({ op: \"replace\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(newVal) });\n }\n }\n }\n else if (Array.isArray(mirror) === Array.isArray(obj)) {\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(oldVal) });\n }\n patches.push({ op: \"remove\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key) });\n deleted = true; // property has been deleted\n }\n else {\n if (invertible) {\n patches.push({ op: \"test\", path: path, value: mirror });\n }\n patches.push({ op: \"replace\", path: path, value: obj });\n changed = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!(0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.hasOwnProperty)(mirror, key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(obj[key]) });\n }\n }\n}\n/**\n * Create an array of patches from the differences in two objects\n */\nfunction compare(tree1, tree2, invertible) {\n if (invertible === void 0) { invertible = false; }\n var patches = [];\n _generate(tree1, tree2, patches, '', invertible);\n return patches;\n}\n\n\n//# sourceURL=webpack://Formio/../core/node_modules/fast-json-patch/module/duplex.mjs?");
|
10462
|
+
|
10463
|
+
/***/ }),
|
10464
|
+
|
10465
|
+
/***/ "../core/node_modules/fast-json-patch/module/helpers.mjs":
|
10466
|
+
/*!***************************************************************!*\
|
10467
|
+
!*** ../core/node_modules/fast-json-patch/module/helpers.mjs ***!
|
10468
|
+
\***************************************************************/
|
10469
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
10470
|
+
|
10471
|
+
"use strict";
|
10472
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PatchError: function() { return /* binding */ PatchError; },\n/* harmony export */ _deepClone: function() { return /* binding */ _deepClone; },\n/* harmony export */ _getPathRecursive: function() { return /* binding */ _getPathRecursive; },\n/* harmony export */ _objectKeys: function() { return /* binding */ _objectKeys; },\n/* harmony export */ escapePathComponent: function() { return /* binding */ escapePathComponent; },\n/* harmony export */ getPath: function() { return /* binding */ getPath; },\n/* harmony export */ hasOwnProperty: function() { return /* binding */ hasOwnProperty; },\n/* harmony export */ hasUndefined: function() { return /* binding */ hasUndefined; },\n/* harmony export */ isInteger: function() { return /* binding */ isInteger; },\n/* harmony export */ unescapePathComponent: function() { return /* binding */ unescapePathComponent; }\n/* harmony export */ });\n/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2022 Joachim Wester\n * MIT licensed\n */\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction hasOwnProperty(obj, key) {\n return _hasOwnProperty.call(obj, key);\n}\nfunction _objectKeys(obj) {\n if (Array.isArray(obj)) {\n var keys_1 = new Array(obj.length);\n for (var k = 0; k < keys_1.length; k++) {\n keys_1[k] = \"\" + k;\n }\n return keys_1;\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keys = [];\n for (var i in obj) {\n if (hasOwnProperty(obj, i)) {\n keys.push(i);\n }\n }\n return keys;\n}\n;\n/**\n* Deeply clone the object.\n* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)\n* @param {any} obj value to clone\n* @return {any} cloned obj\n*/\nfunction _deepClone(obj) {\n switch (typeof obj) {\n case \"object\":\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case \"undefined\":\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n}\n//3x faster than cached /^\\d+$/.test(str)\nfunction isInteger(str) {\n var i = 0;\n var len = str.length;\n var charCode;\n while (i < len) {\n charCode = str.charCodeAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n}\n/**\n* Escapes a json pointer path\n* @param path The raw pointer\n* @return the Escaped path\n*/\nfunction escapePathComponent(path) {\n if (path.indexOf('/') === -1 && path.indexOf('~') === -1)\n return path;\n return path.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n/**\n * Unescapes a json pointer path\n * @param path The escaped pointer\n * @return The unescaped path\n */\nfunction unescapePathComponent(path) {\n return path.replace(/~1/g, '/').replace(/~0/g, '~');\n}\nfunction _getPathRecursive(root, obj) {\n var found;\n for (var key in root) {\n if (hasOwnProperty(root, key)) {\n if (root[key] === obj) {\n return escapePathComponent(key) + '/';\n }\n else if (typeof root[key] === 'object') {\n found = _getPathRecursive(root[key], obj);\n if (found != '') {\n return escapePathComponent(key) + '/' + found;\n }\n }\n }\n }\n return '';\n}\nfunction getPath(root, obj) {\n if (root === obj) {\n return '/';\n }\n var path = _getPathRecursive(root, obj);\n if (path === '') {\n throw new Error(\"Object not found in root\");\n }\n return \"/\" + path;\n}\n/**\n* Recursively checks whether an object has any undefined values inside.\n*/\nfunction hasUndefined(obj) {\n if (obj === undefined) {\n return true;\n }\n if (obj) {\n if (Array.isArray(obj)) {\n for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {\n if (hasUndefined(obj[i_1])) {\n return true;\n }\n }\n }\n else if (typeof obj === \"object\") {\n var objKeys = _objectKeys(obj);\n var objKeysLength = objKeys.length;\n for (var i = 0; i < objKeysLength; i++) {\n if (hasUndefined(obj[objKeys[i]])) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction patchErrorMessageFormatter(message, args) {\n var messageParts = [message];\n for (var key in args) {\n var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print\n if (typeof value !== 'undefined') {\n messageParts.push(key + \": \" + value);\n }\n }\n return messageParts.join('\\n');\n}\nvar PatchError = /** @class */ (function (_super) {\n __extends(PatchError, _super);\n function PatchError(message, name, index, operation, tree) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;\n _this.name = name;\n _this.index = index;\n _this.operation = operation;\n _this.tree = tree;\n Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359\n _this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });\n return _this;\n }\n return PatchError;\n}(Error));\n\n\n\n//# sourceURL=webpack://Formio/../core/node_modules/fast-json-patch/module/helpers.mjs?");
|
10396
10473
|
|
10397
10474
|
/***/ }),
|
10398
10475
|
|