@abgov/jsonforms-components 0.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/index.esm.d.ts +1 -0
  2. package/index.esm.js +4752 -0
  3. package/package.json +5 -2
  4. package/src/index.d.ts +5 -0
  5. package/src/lib/Additional/HelpContent.d.ts +21 -0
  6. package/src/lib/Additional/styled-components.d.ts +1 -0
  7. package/src/lib/Cells/DateCell.d.ts +6 -0
  8. package/src/lib/Cells/IntegerCell.d.ts +6 -0
  9. package/src/lib/Cells/NumberCell.d.ts +6 -0
  10. package/src/lib/Cells/TextCell.d.ts +6 -0
  11. package/src/lib/Cells/TimeCell.d.ts +6 -0
  12. package/src/lib/Cells/index.d.ts +2 -0
  13. package/src/lib/Context/index.d.ts +39 -0
  14. package/src/lib/Controls/FileUploader/ContextMenu.d.ts +18 -0
  15. package/src/lib/Controls/FileUploader/FileUploaderControl.d.ts +4 -0
  16. package/src/lib/Controls/FileUploader/FileUploaderTester.d.ts +2 -0
  17. package/src/lib/Controls/FileUploader/styled-components.d.ts +1 -0
  18. package/src/lib/Controls/FormStepper/FormStepperControl.d.ts +10 -0
  19. package/src/lib/Controls/FormStepper/FormStepperTester.d.ts +2 -0
  20. package/src/lib/Controls/FormStepper/styled-components.d.ts +3 -0
  21. package/src/lib/Controls/Inputs/InputBaseControl.d.ts +7 -0
  22. package/src/lib/Controls/Inputs/InputBooleanControl.d.ts +6 -0
  23. package/src/lib/Controls/Inputs/InputBooleanRadioControl.d.ts +6 -0
  24. package/src/lib/Controls/Inputs/InputDateControl.d.ts +9 -0
  25. package/src/lib/Controls/Inputs/InputDateTimeControl.d.ts +9 -0
  26. package/src/lib/Controls/Inputs/InputEnum.d.ts +12 -0
  27. package/src/lib/Controls/Inputs/InputEnumAutoComplete.d.ts +10 -0
  28. package/src/lib/Controls/Inputs/InputEnumRadios.d.ts +12 -0
  29. package/src/lib/Controls/Inputs/InputIntegerControl.d.ts +9 -0
  30. package/src/lib/Controls/Inputs/InputMultiLineTextControl.d.ts +9 -0
  31. package/src/lib/Controls/Inputs/InputNumberControl.d.ts +9 -0
  32. package/src/lib/Controls/Inputs/InputTextControl.d.ts +9 -0
  33. package/src/lib/Controls/Inputs/InputTimeControl.d.ts +9 -0
  34. package/src/lib/Controls/Inputs/{type.ts → type.d.ts} +1 -1
  35. package/src/lib/Controls/ObjectArray/DeleteDialog.d.ts +12 -0
  36. package/src/lib/Controls/ObjectArray/ObjectArray.d.ts +6 -0
  37. package/src/lib/Controls/ObjectArray/ObjectArrayToolBar.d.ts +16 -0
  38. package/src/lib/Controls/ObjectArray/ObjectListControl.d.ts +24 -0
  39. package/src/lib/Controls/ObjectArray/styled-components.d.ts +3 -0
  40. package/src/lib/ErrorHandling/GoAErrorControl.d.ts +15 -0
  41. package/src/lib/ErrorHandling/{MessageControl.tsx → MessageControl.d.ts} +1 -8
  42. package/src/lib/ErrorHandling/errorCheck.d.ts +14 -0
  43. package/src/lib/ErrorHandling/schemaValidation.d.ts +11 -0
  44. package/src/lib/common/Grid.d.ts +11 -0
  45. package/src/lib/jsonforms-components.d.ts +4 -0
  46. package/src/lib/layouts/GroupControl.d.ts +5 -0
  47. package/src/lib/layouts/HorizontalLayoutControl.d.ts +5 -0
  48. package/src/lib/layouts/VerticalLayoutControl.d.ts +4 -0
  49. package/src/lib/util/layout.d.ts +8 -0
  50. package/src/lib/util/schemaUtils.d.ts +1 -0
  51. package/src/lib/util/stringUtils.d.ts +33 -0
  52. package/src/lib/util/style-component.d.ts +1 -0
  53. package/.babelrc +0 -12
  54. package/.eslintrc.json +0 -36
  55. package/.releaserc.json +0 -25
  56. package/jest.config.ts +0 -11
  57. package/project.json +0 -55
  58. package/rollup.config.js +0 -14
  59. package/src/index.ts +0 -166
  60. package/src/lib/Additional/HelpContent.tsx +0 -95
  61. package/src/lib/Additional/styled-components.ts +0 -27
  62. package/src/lib/Cells/DateCell.tsx +0 -10
  63. package/src/lib/Cells/IntegerCell.tsx +0 -10
  64. package/src/lib/Cells/NumberCell.tsx +0 -10
  65. package/src/lib/Cells/TextCell.tsx +0 -10
  66. package/src/lib/Cells/TimeCell.tsx +0 -10
  67. package/src/lib/Cells/index.tsx +0 -14
  68. package/src/lib/Context/index.tsx +0 -172
  69. package/src/lib/Controls/FileUploader/ContextMenu.tsx +0 -50
  70. package/src/lib/Controls/FileUploader/FileUploaderControl.tsx +0 -131
  71. package/src/lib/Controls/FileUploader/FileUploaderTester.tsx +0 -3
  72. package/src/lib/Controls/FileUploader/styled-components.tsx +0 -10
  73. package/src/lib/Controls/FormStepper/FormStepperControl.tsx +0 -269
  74. package/src/lib/Controls/FormStepper/FormStepperTester.tsx +0 -22
  75. package/src/lib/Controls/FormStepper/styled-components.tsx +0 -17
  76. package/src/lib/Controls/Inputs/InputBaseControl.tsx +0 -52
  77. package/src/lib/Controls/Inputs/InputBooleanControl.tsx +0 -67
  78. package/src/lib/Controls/Inputs/InputBooleanRadioControl.tsx +0 -74
  79. package/src/lib/Controls/Inputs/InputDateControl.tsx +0 -90
  80. package/src/lib/Controls/Inputs/InputDateTimeControl.tsx +0 -46
  81. package/src/lib/Controls/Inputs/InputEnum.tsx +0 -74
  82. package/src/lib/Controls/Inputs/InputEnumAutoComplete.tsx +0 -73
  83. package/src/lib/Controls/Inputs/InputEnumRadios.tsx +0 -43
  84. package/src/lib/Controls/Inputs/InputIntegerControl.tsx +0 -63
  85. package/src/lib/Controls/Inputs/InputMultiLineTextControl.tsx +0 -63
  86. package/src/lib/Controls/Inputs/InputNumberControl.tsx +0 -63
  87. package/src/lib/Controls/Inputs/InputTextControl.tsx +0 -62
  88. package/src/lib/Controls/Inputs/InputTimeControl.tsx +0 -46
  89. package/src/lib/Controls/Inputs/inputControl.spec.ts +0 -84
  90. package/src/lib/Controls/ObjectArray/DeleteDialog.tsx +0 -49
  91. package/src/lib/Controls/ObjectArray/ObjectArray.tsx +0 -59
  92. package/src/lib/Controls/ObjectArray/ObjectArrayToolBar.tsx +0 -51
  93. package/src/lib/Controls/ObjectArray/ObjectListControl.tsx +0 -368
  94. package/src/lib/Controls/ObjectArray/styled-components.tsx +0 -13
  95. package/src/lib/ErrorHandling/GoAErrorControl.tsx +0 -53
  96. package/src/lib/ErrorHandling/categorizationValidation.spec.ts +0 -98
  97. package/src/lib/ErrorHandling/controlValildation.spec.ts +0 -57
  98. package/src/lib/ErrorHandling/errorCheck.spec.ts +0 -185
  99. package/src/lib/ErrorHandling/errorCheck.tsx +0 -86
  100. package/src/lib/ErrorHandling/layoutValildation.spec.ts +0 -47
  101. package/src/lib/ErrorHandling/otherValildation.spec.ts +0 -74
  102. package/src/lib/ErrorHandling/schemaValidation.ts +0 -115
  103. package/src/lib/common/Grid.tsx +0 -55
  104. package/src/lib/jsonforms-components.module.scss +0 -7
  105. package/src/lib/jsonforms-components.spec.tsx +0 -10
  106. package/src/lib/jsonforms-components.tsx +0 -14
  107. package/src/lib/layouts/GroupControl.tsx +0 -25
  108. package/src/lib/layouts/HorizontalLayoutControl.tsx +0 -30
  109. package/src/lib/layouts/VerticalLayoutControl.tsx +0 -28
  110. package/src/lib/util/layout.tsx +0 -68
  111. package/src/lib/util/schemaUtils.ts +0 -9
  112. package/src/lib/util/stringUtils.ts +0 -98
  113. package/src/lib/util/style-component.ts +0 -8
  114. package/tsconfig.json +0 -20
  115. package/tsconfig.lib.json +0 -19
  116. package/tsconfig.spec.json +0 -20
  117. /package/src/lib/Additional/{index.ts → index.d.ts} +0 -0
  118. /package/src/lib/Controls/FileUploader/{index.tsx → index.d.ts} +0 -0
  119. /package/src/lib/Controls/FormStepper/{index.tsx → index.d.ts} +0 -0
  120. /package/src/lib/Controls/Inputs/{index.tsx → index.d.ts} +0 -0
  121. /package/src/lib/Controls/ObjectArray/{index.tsx → index.d.ts} +0 -0
  122. /package/src/lib/Controls/{index.tsx → index.d.ts} +0 -0
  123. /package/src/lib/layouts/{index.ts → index.d.ts} +0 -0
package/index.esm.js ADDED
@@ -0,0 +1,4752 @@
1
+ import { withAjvProps, materialSliderControlTester, MaterialSliderControl, materialObjectControlTester, MaterialObjectRenderer, materialAllOfControlTester, MaterialAllOfRenderer, materialAnyOfControlTester, MaterialAnyOfRenderer, materialOneOfControlTester, MaterialOneOfRenderer, materialOneOfRadioGroupControlTester, MaterialOneOfRadioGroupControl, materialOneOfEnumControlTester, MaterialOneOfEnumControl, materialHorizontalLayoutTester, materialVerticalLayoutTester, materialArrayLayoutTester, MaterialArrayLayout, materialAnyOfStringOrEnumControlTester, MaterialAnyOfStringOrEnumControl, materialEnumArrayRendererTester, MaterialEnumArrayRenderer, materialBooleanCellTester, MaterialBooleanCell, materialBooleanToggleCellTester, MaterialBooleanToggleCell, materialEnumCellTester, MaterialEnumCell, materialOneOfEnumCellTester, MaterialOneOfEnumCell } from '@jsonforms/material-renderers';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAIconButton, GoAFileUploadInput, GoAModal, GoACircularProgress, GoAGrid, GoAContainer, GoAButtonGroup, GoADetails } from '@abgov/react-components';
4
+ import { Hidden, Typography, FormHelperText } from '@mui/material';
5
+ import { rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, isVisible, isEnabled, deriveLabelForUISchemaElement, uiTypeIs, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
6
+ import { withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, withJsonFormsLayoutProps, JsonFormsDispatch, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
7
+ import React, { createContext, useEffect, useState, useMemo, useContext, useCallback } from 'react';
8
+ import merge from 'lodash/merge';
9
+ import axios from 'axios';
10
+ import TextField from '@mui/material/TextField';
11
+ import Autocomplete from '@mui/material/Autocomplete';
12
+ import styled from 'styled-components';
13
+ import isEmpty from 'lodash/isEmpty';
14
+ import range from 'lodash/range';
15
+
16
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
17
+
18
+ var fails$h = function (exec) {
19
+ try {
20
+ return !!exec();
21
+ } catch (error) {
22
+ return true;
23
+ }
24
+ };
25
+
26
+ var fails$g = fails$h;
27
+
28
+ var functionBindNative = !fails$g(function () {
29
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
30
+ var test = (function () { /* empty */ }).bind();
31
+ // eslint-disable-next-line no-prototype-builtins -- safe
32
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
33
+ });
34
+
35
+ var NATIVE_BIND$2 = functionBindNative;
36
+
37
+ var FunctionPrototype$2 = Function.prototype;
38
+ var call$b = FunctionPrototype$2.call;
39
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$b, call$b);
40
+
41
+ var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
42
+ return function () {
43
+ return call$b.apply(fn, arguments);
44
+ };
45
+ };
46
+
47
+ var uncurryThis$g = functionUncurryThis;
48
+
49
+ var toString$7 = uncurryThis$g({}.toString);
50
+ var stringSlice$6 = uncurryThis$g(''.slice);
51
+
52
+ var classofRaw$1 = function (it) {
53
+ return stringSlice$6(toString$7(it), 8, -1);
54
+ };
55
+
56
+ var uncurryThis$f = functionUncurryThis;
57
+ var fails$f = fails$h;
58
+ var classof$4 = classofRaw$1;
59
+
60
+ var $Object$4 = Object;
61
+ var split = uncurryThis$f(''.split);
62
+
63
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
64
+ var indexedObject = fails$f(function () {
65
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
66
+ // eslint-disable-next-line no-prototype-builtins -- safe
67
+ return !$Object$4('z').propertyIsEnumerable(0);
68
+ }) ? function (it) {
69
+ return classof$4(it) === 'String' ? split(it, '') : $Object$4(it);
70
+ } : $Object$4;
71
+
72
+ // we can't use just `it == null` since of `document.all` special case
73
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
74
+ var isNullOrUndefined$3 = function (it) {
75
+ return it === null || it === undefined;
76
+ };
77
+
78
+ var isNullOrUndefined$2 = isNullOrUndefined$3;
79
+
80
+ var $TypeError$8 = TypeError;
81
+
82
+ // `RequireObjectCoercible` abstract operation
83
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
84
+ var requireObjectCoercible$5 = function (it) {
85
+ if (isNullOrUndefined$2(it)) throw new $TypeError$8("Can't call method on " + it);
86
+ return it;
87
+ };
88
+
89
+ // toObject with fallback for non-array-like ES3 strings
90
+ var IndexedObject$1 = indexedObject;
91
+ var requireObjectCoercible$4 = requireObjectCoercible$5;
92
+
93
+ var toIndexedObject$5 = function (it) {
94
+ return IndexedObject$1(requireObjectCoercible$4(it));
95
+ };
96
+
97
+ var check = function (it) {
98
+ return it && it.Math === Math && it;
99
+ };
100
+
101
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
102
+ var global$f =
103
+ // eslint-disable-next-line es/no-global-this -- safe
104
+ check(typeof globalThis == 'object' && globalThis) ||
105
+ check(typeof window == 'object' && window) ||
106
+ // eslint-disable-next-line no-restricted-globals -- safe
107
+ check(typeof self == 'object' && self) ||
108
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
109
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
110
+ // eslint-disable-next-line no-new-func -- fallback
111
+ (function () { return this; })() || Function('return this')();
112
+
113
+ var sharedStore = {exports: {}};
114
+
115
+ var global$e = global$f;
116
+
117
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
118
+ var defineProperty$6 = Object.defineProperty;
119
+
120
+ var defineGlobalProperty$3 = function (key, value) {
121
+ try {
122
+ defineProperty$6(global$e, key, { value: value, configurable: true, writable: true });
123
+ } catch (error) {
124
+ global$e[key] = value;
125
+ } return value;
126
+ };
127
+
128
+ var globalThis$1 = global$f;
129
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
130
+
131
+ var SHARED = '__core-js_shared__';
132
+ var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
133
+
134
+ (store$3.versions || (store$3.versions = [])).push({
135
+ version: '3.36.0',
136
+ mode: 'global',
137
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
138
+ license: 'https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE',
139
+ source: 'https://github.com/zloirock/core-js'
140
+ });
141
+
142
+ var store$2 = sharedStore.exports;
143
+
144
+ var shared$4 = function (key, value) {
145
+ return store$2[key] || (store$2[key] = value || {});
146
+ };
147
+
148
+ var requireObjectCoercible$3 = requireObjectCoercible$5;
149
+
150
+ var $Object$3 = Object;
151
+
152
+ // `ToObject` abstract operation
153
+ // https://tc39.es/ecma262/#sec-toobject
154
+ var toObject$4 = function (argument) {
155
+ return $Object$3(requireObjectCoercible$3(argument));
156
+ };
157
+
158
+ var uncurryThis$e = functionUncurryThis;
159
+ var toObject$3 = toObject$4;
160
+
161
+ var hasOwnProperty = uncurryThis$e({}.hasOwnProperty);
162
+
163
+ // `HasOwnProperty` abstract operation
164
+ // https://tc39.es/ecma262/#sec-hasownproperty
165
+ // eslint-disable-next-line es/no-object-hasown -- safe
166
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
167
+ return hasOwnProperty(toObject$3(it), key);
168
+ };
169
+
170
+ var uncurryThis$d = functionUncurryThis;
171
+
172
+ var id = 0;
173
+ var postfix = Math.random();
174
+ var toString$6 = uncurryThis$d(1.0.toString);
175
+
176
+ var uid$2 = function (key) {
177
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36);
178
+ };
179
+
180
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
181
+
182
+ var global$d = global$f;
183
+ var userAgent = engineUserAgent;
184
+
185
+ var process = global$d.process;
186
+ var Deno = global$d.Deno;
187
+ var versions = process && process.versions || Deno && Deno.version;
188
+ var v8 = versions && versions.v8;
189
+ var match, version;
190
+
191
+ if (v8) {
192
+ match = v8.split('.');
193
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
194
+ // but their correct versions are not interesting for us
195
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
196
+ }
197
+
198
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
199
+ // so check `userAgent` even if `.v8` exists, but 0
200
+ if (!version && userAgent) {
201
+ match = userAgent.match(/Edge\/(\d+)/);
202
+ if (!match || match[1] >= 74) {
203
+ match = userAgent.match(/Chrome\/(\d+)/);
204
+ if (match) version = +match[1];
205
+ }
206
+ }
207
+
208
+ var engineV8Version = version;
209
+
210
+ /* eslint-disable es/no-symbol -- required for testing */
211
+ var V8_VERSION = engineV8Version;
212
+ var fails$e = fails$h;
213
+ var global$c = global$f;
214
+
215
+ var $String$5 = global$c.String;
216
+
217
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
218
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(function () {
219
+ var symbol = Symbol('symbol detection');
220
+ // Chrome 38 Symbol has incorrect toString conversion
221
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
222
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
223
+ // of course, fail.
224
+ return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
225
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
226
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
227
+ });
228
+
229
+ /* eslint-disable es/no-symbol -- required for testing */
230
+ var NATIVE_SYMBOL$2 = symbolConstructorDetection;
231
+
232
+ var useSymbolAsUid = NATIVE_SYMBOL$2
233
+ && !Symbol.sham
234
+ && typeof Symbol.iterator == 'symbol';
235
+
236
+ var global$b = global$f;
237
+ var shared$3 = shared$4;
238
+ var hasOwn$9 = hasOwnProperty_1;
239
+ var uid$1 = uid$2;
240
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
241
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
242
+
243
+ var Symbol$1 = global$b.Symbol;
244
+ var WellKnownSymbolsStore = shared$3('wks');
245
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
246
+
247
+ var wellKnownSymbol$c = function (name) {
248
+ if (!hasOwn$9(WellKnownSymbolsStore, name)) {
249
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL$1 && hasOwn$9(Symbol$1, name)
250
+ ? Symbol$1[name]
251
+ : createWellKnownSymbol('Symbol.' + name);
252
+ } return WellKnownSymbolsStore[name];
253
+ };
254
+
255
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
256
+ var documentAll = typeof document == 'object' && document.all;
257
+
258
+ // `IsCallable` abstract operation
259
+ // https://tc39.es/ecma262/#sec-iscallable
260
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
261
+ var isCallable$h = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
262
+ return typeof argument == 'function' || argument === documentAll;
263
+ } : function (argument) {
264
+ return typeof argument == 'function';
265
+ };
266
+
267
+ var isCallable$g = isCallable$h;
268
+
269
+ var isObject$8 = function (it) {
270
+ return typeof it == 'object' ? it !== null : isCallable$g(it);
271
+ };
272
+
273
+ var isObject$7 = isObject$8;
274
+
275
+ var $String$4 = String;
276
+ var $TypeError$7 = TypeError;
277
+
278
+ // `Assert: Type(argument) is Object`
279
+ var anObject$8 = function (argument) {
280
+ if (isObject$7(argument)) return argument;
281
+ throw new $TypeError$7($String$4(argument) + ' is not an object');
282
+ };
283
+
284
+ var objectDefineProperties = {};
285
+
286
+ var fails$d = fails$h;
287
+
288
+ // Detect IE8's incomplete defineProperty implementation
289
+ var descriptors = !fails$d(function () {
290
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
291
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
292
+ });
293
+
294
+ var DESCRIPTORS$a = descriptors;
295
+ var fails$c = fails$h;
296
+
297
+ // V8 ~ Chrome 36-
298
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
299
+ var v8PrototypeDefineBug = DESCRIPTORS$a && fails$c(function () {
300
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
301
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
302
+ value: 42,
303
+ writable: false
304
+ }).prototype !== 42;
305
+ });
306
+
307
+ var objectDefineProperty = {};
308
+
309
+ var global$a = global$f;
310
+ var isObject$6 = isObject$8;
311
+
312
+ var document$1 = global$a.document;
313
+ // typeof document.createElement is 'object' in old IE
314
+ var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement);
315
+
316
+ var documentCreateElement$2 = function (it) {
317
+ return EXISTS$1 ? document$1.createElement(it) : {};
318
+ };
319
+
320
+ var DESCRIPTORS$9 = descriptors;
321
+ var fails$b = fails$h;
322
+ var createElement = documentCreateElement$2;
323
+
324
+ // Thanks to IE8 for its funny defineProperty
325
+ var ie8DomDefine = !DESCRIPTORS$9 && !fails$b(function () {
326
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
327
+ return Object.defineProperty(createElement('div'), 'a', {
328
+ get: function () { return 7; }
329
+ }).a !== 7;
330
+ });
331
+
332
+ var NATIVE_BIND$1 = functionBindNative;
333
+
334
+ var call$a = Function.prototype.call;
335
+
336
+ var functionCall = NATIVE_BIND$1 ? call$a.bind(call$a) : function () {
337
+ return call$a.apply(call$a, arguments);
338
+ };
339
+
340
+ var global$9 = global$f;
341
+ var isCallable$f = isCallable$h;
342
+
343
+ var aFunction = function (argument) {
344
+ return isCallable$f(argument) ? argument : undefined;
345
+ };
346
+
347
+ var getBuiltIn$3 = function (namespace, method) {
348
+ return arguments.length < 2 ? aFunction(global$9[namespace]) : global$9[namespace] && global$9[namespace][method];
349
+ };
350
+
351
+ var uncurryThis$c = functionUncurryThis;
352
+
353
+ var objectIsPrototypeOf = uncurryThis$c({}.isPrototypeOf);
354
+
355
+ var getBuiltIn$2 = getBuiltIn$3;
356
+ var isCallable$e = isCallable$h;
357
+ var isPrototypeOf$1 = objectIsPrototypeOf;
358
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
359
+
360
+ var $Object$2 = Object;
361
+
362
+ var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
363
+ return typeof it == 'symbol';
364
+ } : function (it) {
365
+ var $Symbol = getBuiltIn$2('Symbol');
366
+ return isCallable$e($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
367
+ };
368
+
369
+ var $String$3 = String;
370
+
371
+ var tryToString$1 = function (argument) {
372
+ try {
373
+ return $String$3(argument);
374
+ } catch (error) {
375
+ return 'Object';
376
+ }
377
+ };
378
+
379
+ var isCallable$d = isCallable$h;
380
+ var tryToString = tryToString$1;
381
+
382
+ var $TypeError$6 = TypeError;
383
+
384
+ // `Assert: IsCallable(argument) is true`
385
+ var aCallable$2 = function (argument) {
386
+ if (isCallable$d(argument)) return argument;
387
+ throw new $TypeError$6(tryToString(argument) + ' is not a function');
388
+ };
389
+
390
+ var aCallable$1 = aCallable$2;
391
+ var isNullOrUndefined$1 = isNullOrUndefined$3;
392
+
393
+ // `GetMethod` abstract operation
394
+ // https://tc39.es/ecma262/#sec-getmethod
395
+ var getMethod$2 = function (V, P) {
396
+ var func = V[P];
397
+ return isNullOrUndefined$1(func) ? undefined : aCallable$1(func);
398
+ };
399
+
400
+ var call$9 = functionCall;
401
+ var isCallable$c = isCallable$h;
402
+ var isObject$5 = isObject$8;
403
+
404
+ var $TypeError$5 = TypeError;
405
+
406
+ // `OrdinaryToPrimitive` abstract operation
407
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
408
+ var ordinaryToPrimitive$1 = function (input, pref) {
409
+ var fn, val;
410
+ if (pref === 'string' && isCallable$c(fn = input.toString) && !isObject$5(val = call$9(fn, input))) return val;
411
+ if (isCallable$c(fn = input.valueOf) && !isObject$5(val = call$9(fn, input))) return val;
412
+ if (pref !== 'string' && isCallable$c(fn = input.toString) && !isObject$5(val = call$9(fn, input))) return val;
413
+ throw new $TypeError$5("Can't convert object to primitive value");
414
+ };
415
+
416
+ var call$8 = functionCall;
417
+ var isObject$4 = isObject$8;
418
+ var isSymbol$1 = isSymbol$2;
419
+ var getMethod$1 = getMethod$2;
420
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
421
+ var wellKnownSymbol$b = wellKnownSymbol$c;
422
+
423
+ var $TypeError$4 = TypeError;
424
+ var TO_PRIMITIVE = wellKnownSymbol$b('toPrimitive');
425
+
426
+ // `ToPrimitive` abstract operation
427
+ // https://tc39.es/ecma262/#sec-toprimitive
428
+ var toPrimitive$1 = function (input, pref) {
429
+ if (!isObject$4(input) || isSymbol$1(input)) return input;
430
+ var exoticToPrim = getMethod$1(input, TO_PRIMITIVE);
431
+ var result;
432
+ if (exoticToPrim) {
433
+ if (pref === undefined) pref = 'default';
434
+ result = call$8(exoticToPrim, input, pref);
435
+ if (!isObject$4(result) || isSymbol$1(result)) return result;
436
+ throw new $TypeError$4("Can't convert object to primitive value");
437
+ }
438
+ if (pref === undefined) pref = 'number';
439
+ return ordinaryToPrimitive(input, pref);
440
+ };
441
+
442
+ var toPrimitive = toPrimitive$1;
443
+ var isSymbol = isSymbol$2;
444
+
445
+ // `ToPropertyKey` abstract operation
446
+ // https://tc39.es/ecma262/#sec-topropertykey
447
+ var toPropertyKey$2 = function (argument) {
448
+ var key = toPrimitive(argument, 'string');
449
+ return isSymbol(key) ? key : key + '';
450
+ };
451
+
452
+ var DESCRIPTORS$8 = descriptors;
453
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
454
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
455
+ var anObject$7 = anObject$8;
456
+ var toPropertyKey$1 = toPropertyKey$2;
457
+
458
+ var $TypeError$3 = TypeError;
459
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
460
+ var $defineProperty = Object.defineProperty;
461
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
462
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
463
+ var ENUMERABLE = 'enumerable';
464
+ var CONFIGURABLE$1 = 'configurable';
465
+ var WRITABLE = 'writable';
466
+
467
+ // `Object.defineProperty` method
468
+ // https://tc39.es/ecma262/#sec-object.defineproperty
469
+ objectDefineProperty.f = DESCRIPTORS$8 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
470
+ anObject$7(O);
471
+ P = toPropertyKey$1(P);
472
+ anObject$7(Attributes);
473
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
474
+ var current = $getOwnPropertyDescriptor$1(O, P);
475
+ if (current && current[WRITABLE]) {
476
+ O[P] = Attributes.value;
477
+ Attributes = {
478
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
479
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
480
+ writable: false
481
+ };
482
+ }
483
+ } return $defineProperty(O, P, Attributes);
484
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
485
+ anObject$7(O);
486
+ P = toPropertyKey$1(P);
487
+ anObject$7(Attributes);
488
+ if (IE8_DOM_DEFINE$1) try {
489
+ return $defineProperty(O, P, Attributes);
490
+ } catch (error) { /* empty */ }
491
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$3('Accessors not supported');
492
+ if ('value' in Attributes) O[P] = Attributes.value;
493
+ return O;
494
+ };
495
+
496
+ var ceil = Math.ceil;
497
+ var floor$1 = Math.floor;
498
+
499
+ // `Math.trunc` method
500
+ // https://tc39.es/ecma262/#sec-math.trunc
501
+ // eslint-disable-next-line es/no-math-trunc -- safe
502
+ var mathTrunc = Math.trunc || function trunc(x) {
503
+ var n = +x;
504
+ return (n > 0 ? floor$1 : ceil)(n);
505
+ };
506
+
507
+ var trunc = mathTrunc;
508
+
509
+ // `ToIntegerOrInfinity` abstract operation
510
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
511
+ var toIntegerOrInfinity$4 = function (argument) {
512
+ var number = +argument;
513
+ // eslint-disable-next-line no-self-compare -- NaN check
514
+ return number !== number || number === 0 ? 0 : trunc(number);
515
+ };
516
+
517
+ var toIntegerOrInfinity$3 = toIntegerOrInfinity$4;
518
+
519
+ var max$1 = Math.max;
520
+ var min$2 = Math.min;
521
+
522
+ // Helper for a popular repeating case of the spec:
523
+ // Let integer be ? ToInteger(index).
524
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
525
+ var toAbsoluteIndex$1 = function (index, length) {
526
+ var integer = toIntegerOrInfinity$3(index);
527
+ return integer < 0 ? max$1(integer + length, 0) : min$2(integer, length);
528
+ };
529
+
530
+ var toIntegerOrInfinity$2 = toIntegerOrInfinity$4;
531
+
532
+ var min$1 = Math.min;
533
+
534
+ // `ToLength` abstract operation
535
+ // https://tc39.es/ecma262/#sec-tolength
536
+ var toLength$2 = function (argument) {
537
+ var len = toIntegerOrInfinity$2(argument);
538
+ return len > 0 ? min$1(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
539
+ };
540
+
541
+ var toLength$1 = toLength$2;
542
+
543
+ // `LengthOfArrayLike` abstract operation
544
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
545
+ var lengthOfArrayLike$1 = function (obj) {
546
+ return toLength$1(obj.length);
547
+ };
548
+
549
+ var toIndexedObject$4 = toIndexedObject$5;
550
+ var toAbsoluteIndex = toAbsoluteIndex$1;
551
+ var lengthOfArrayLike = lengthOfArrayLike$1;
552
+
553
+ // `Array.prototype.{ indexOf, includes }` methods implementation
554
+ var createMethod$1 = function (IS_INCLUDES) {
555
+ return function ($this, el, fromIndex) {
556
+ var O = toIndexedObject$4($this);
557
+ var length = lengthOfArrayLike(O);
558
+ if (length === 0) return !IS_INCLUDES && -1;
559
+ var index = toAbsoluteIndex(fromIndex, length);
560
+ var value;
561
+ // Array#includes uses SameValueZero equality algorithm
562
+ // eslint-disable-next-line no-self-compare -- NaN check
563
+ if (IS_INCLUDES && el !== el) while (length > index) {
564
+ value = O[index++];
565
+ // eslint-disable-next-line no-self-compare -- NaN check
566
+ if (value !== value) return true;
567
+ // Array#indexOf ignores holes, Array#includes - not
568
+ } else for (;length > index; index++) {
569
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
570
+ } return !IS_INCLUDES && -1;
571
+ };
572
+ };
573
+
574
+ var arrayIncludes = {
575
+ // `Array.prototype.includes` method
576
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
577
+ includes: createMethod$1(true),
578
+ // `Array.prototype.indexOf` method
579
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
580
+ indexOf: createMethod$1(false)
581
+ };
582
+
583
+ var hiddenKeys$4 = {};
584
+
585
+ var uncurryThis$b = functionUncurryThis;
586
+ var hasOwn$8 = hasOwnProperty_1;
587
+ var toIndexedObject$3 = toIndexedObject$5;
588
+ var indexOf$1 = arrayIncludes.indexOf;
589
+ var hiddenKeys$3 = hiddenKeys$4;
590
+
591
+ var push$1 = uncurryThis$b([].push);
592
+
593
+ var objectKeysInternal = function (object, names) {
594
+ var O = toIndexedObject$3(object);
595
+ var i = 0;
596
+ var result = [];
597
+ var key;
598
+ for (key in O) !hasOwn$8(hiddenKeys$3, key) && hasOwn$8(O, key) && push$1(result, key);
599
+ // Don't enum bug & hidden keys
600
+ while (names.length > i) if (hasOwn$8(O, key = names[i++])) {
601
+ ~indexOf$1(result, key) || push$1(result, key);
602
+ }
603
+ return result;
604
+ };
605
+
606
+ // IE8- don't enum bug keys
607
+ var enumBugKeys$3 = [
608
+ 'constructor',
609
+ 'hasOwnProperty',
610
+ 'isPrototypeOf',
611
+ 'propertyIsEnumerable',
612
+ 'toLocaleString',
613
+ 'toString',
614
+ 'valueOf'
615
+ ];
616
+
617
+ var internalObjectKeys$1 = objectKeysInternal;
618
+ var enumBugKeys$2 = enumBugKeys$3;
619
+
620
+ // `Object.keys` method
621
+ // https://tc39.es/ecma262/#sec-object.keys
622
+ // eslint-disable-next-line es/no-object-keys -- safe
623
+ var objectKeys$2 = Object.keys || function keys(O) {
624
+ return internalObjectKeys$1(O, enumBugKeys$2);
625
+ };
626
+
627
+ var DESCRIPTORS$7 = descriptors;
628
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
629
+ var definePropertyModule$3 = objectDefineProperty;
630
+ var anObject$6 = anObject$8;
631
+ var toIndexedObject$2 = toIndexedObject$5;
632
+ var objectKeys$1 = objectKeys$2;
633
+
634
+ // `Object.defineProperties` method
635
+ // https://tc39.es/ecma262/#sec-object.defineproperties
636
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
637
+ objectDefineProperties.f = DESCRIPTORS$7 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
638
+ anObject$6(O);
639
+ var props = toIndexedObject$2(Properties);
640
+ var keys = objectKeys$1(Properties);
641
+ var length = keys.length;
642
+ var index = 0;
643
+ var key;
644
+ while (length > index) definePropertyModule$3.f(O, key = keys[index++], props[key]);
645
+ return O;
646
+ };
647
+
648
+ var getBuiltIn$1 = getBuiltIn$3;
649
+
650
+ var html$1 = getBuiltIn$1('document', 'documentElement');
651
+
652
+ var shared$2 = shared$4;
653
+ var uid = uid$2;
654
+
655
+ var keys = shared$2('keys');
656
+
657
+ var sharedKey$3 = function (key) {
658
+ return keys[key] || (keys[key] = uid(key));
659
+ };
660
+
661
+ /* global ActiveXObject -- old IE, WSH */
662
+ var anObject$5 = anObject$8;
663
+ var definePropertiesModule = objectDefineProperties;
664
+ var enumBugKeys$1 = enumBugKeys$3;
665
+ var hiddenKeys$2 = hiddenKeys$4;
666
+ var html = html$1;
667
+ var documentCreateElement$1 = documentCreateElement$2;
668
+ var sharedKey$2 = sharedKey$3;
669
+
670
+ var GT = '>';
671
+ var LT = '<';
672
+ var PROTOTYPE = 'prototype';
673
+ var SCRIPT = 'script';
674
+ var IE_PROTO$1 = sharedKey$2('IE_PROTO');
675
+
676
+ var EmptyConstructor = function () { /* empty */ };
677
+
678
+ var scriptTag = function (content) {
679
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
680
+ };
681
+
682
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
683
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
684
+ activeXDocument.write(scriptTag(''));
685
+ activeXDocument.close();
686
+ var temp = activeXDocument.parentWindow.Object;
687
+ activeXDocument = null; // avoid memory leak
688
+ return temp;
689
+ };
690
+
691
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
692
+ var NullProtoObjectViaIFrame = function () {
693
+ // Thrash, waste and sodomy: IE GC bug
694
+ var iframe = documentCreateElement$1('iframe');
695
+ var JS = 'java' + SCRIPT + ':';
696
+ var iframeDocument;
697
+ iframe.style.display = 'none';
698
+ html.appendChild(iframe);
699
+ // https://github.com/zloirock/core-js/issues/475
700
+ iframe.src = String(JS);
701
+ iframeDocument = iframe.contentWindow.document;
702
+ iframeDocument.open();
703
+ iframeDocument.write(scriptTag('document.F=Object'));
704
+ iframeDocument.close();
705
+ return iframeDocument.F;
706
+ };
707
+
708
+ // Check for document.domain and active x support
709
+ // No need to use active x approach when document.domain is not set
710
+ // see https://github.com/es-shims/es5-shim/issues/150
711
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
712
+ // avoid IE GC bug
713
+ var activeXDocument;
714
+ var NullProtoObject = function () {
715
+ try {
716
+ activeXDocument = new ActiveXObject('htmlfile');
717
+ } catch (error) { /* ignore */ }
718
+ NullProtoObject = typeof document != 'undefined'
719
+ ? document.domain && activeXDocument
720
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
721
+ : NullProtoObjectViaIFrame()
722
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
723
+ var length = enumBugKeys$1.length;
724
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys$1[length]];
725
+ return NullProtoObject();
726
+ };
727
+
728
+ hiddenKeys$2[IE_PROTO$1] = true;
729
+
730
+ // `Object.create` method
731
+ // https://tc39.es/ecma262/#sec-object.create
732
+ // eslint-disable-next-line es/no-object-create -- safe
733
+ var objectCreate = Object.create || function create(O, Properties) {
734
+ var result;
735
+ if (O !== null) {
736
+ EmptyConstructor[PROTOTYPE] = anObject$5(O);
737
+ result = new EmptyConstructor();
738
+ EmptyConstructor[PROTOTYPE] = null;
739
+ // add "__proto__" for Object.getPrototypeOf polyfill
740
+ result[IE_PROTO$1] = O;
741
+ } else result = NullProtoObject();
742
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
743
+ };
744
+
745
+ var wellKnownSymbol$a = wellKnownSymbol$c;
746
+ var create$2 = objectCreate;
747
+ var defineProperty$5 = objectDefineProperty.f;
748
+
749
+ var UNSCOPABLES = wellKnownSymbol$a('unscopables');
750
+ var ArrayPrototype = Array.prototype;
751
+
752
+ // Array.prototype[@@unscopables]
753
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
754
+ if (ArrayPrototype[UNSCOPABLES] === undefined) {
755
+ defineProperty$5(ArrayPrototype, UNSCOPABLES, {
756
+ configurable: true,
757
+ value: create$2(null)
758
+ });
759
+ }
760
+
761
+ // add a key to Array.prototype[@@unscopables]
762
+ var addToUnscopables$2 = function (key) {
763
+ ArrayPrototype[UNSCOPABLES][key] = true;
764
+ };
765
+
766
+ var iterators = {};
767
+
768
+ var global$8 = global$f;
769
+ var isCallable$b = isCallable$h;
770
+
771
+ var WeakMap$1 = global$8.WeakMap;
772
+
773
+ var weakMapBasicDetection = isCallable$b(WeakMap$1) && /native code/.test(String(WeakMap$1));
774
+
775
+ var createPropertyDescriptor$3 = function (bitmap, value) {
776
+ return {
777
+ enumerable: !(bitmap & 1),
778
+ configurable: !(bitmap & 2),
779
+ writable: !(bitmap & 4),
780
+ value: value
781
+ };
782
+ };
783
+
784
+ var DESCRIPTORS$6 = descriptors;
785
+ var definePropertyModule$2 = objectDefineProperty;
786
+ var createPropertyDescriptor$2 = createPropertyDescriptor$3;
787
+
788
+ var createNonEnumerableProperty$5 = DESCRIPTORS$6 ? function (object, key, value) {
789
+ return definePropertyModule$2.f(object, key, createPropertyDescriptor$2(1, value));
790
+ } : function (object, key, value) {
791
+ object[key] = value;
792
+ return object;
793
+ };
794
+
795
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
796
+ var global$7 = global$f;
797
+ var isObject$3 = isObject$8;
798
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
799
+ var hasOwn$7 = hasOwnProperty_1;
800
+ var shared$1 = sharedStore.exports;
801
+ var sharedKey$1 = sharedKey$3;
802
+ var hiddenKeys$1 = hiddenKeys$4;
803
+
804
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
805
+ var TypeError$1 = global$7.TypeError;
806
+ var WeakMap = global$7.WeakMap;
807
+ var set, get, has;
808
+
809
+ var enforce = function (it) {
810
+ return has(it) ? get(it) : set(it, {});
811
+ };
812
+
813
+ var getterFor = function (TYPE) {
814
+ return function (it) {
815
+ var state;
816
+ if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
817
+ throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
818
+ } return state;
819
+ };
820
+ };
821
+
822
+ if (NATIVE_WEAK_MAP || shared$1.state) {
823
+ var store$1 = shared$1.state || (shared$1.state = new WeakMap());
824
+ /* eslint-disable no-self-assign -- prototype methods protection */
825
+ store$1.get = store$1.get;
826
+ store$1.has = store$1.has;
827
+ store$1.set = store$1.set;
828
+ /* eslint-enable no-self-assign -- prototype methods protection */
829
+ set = function (it, metadata) {
830
+ if (store$1.has(it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
831
+ metadata.facade = it;
832
+ store$1.set(it, metadata);
833
+ return metadata;
834
+ };
835
+ get = function (it) {
836
+ return store$1.get(it) || {};
837
+ };
838
+ has = function (it) {
839
+ return store$1.has(it);
840
+ };
841
+ } else {
842
+ var STATE = sharedKey$1('state');
843
+ hiddenKeys$1[STATE] = true;
844
+ set = function (it, metadata) {
845
+ if (hasOwn$7(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
846
+ metadata.facade = it;
847
+ createNonEnumerableProperty$4(it, STATE, metadata);
848
+ return metadata;
849
+ };
850
+ get = function (it) {
851
+ return hasOwn$7(it, STATE) ? it[STATE] : {};
852
+ };
853
+ has = function (it) {
854
+ return hasOwn$7(it, STATE);
855
+ };
856
+ }
857
+
858
+ var internalState = {
859
+ set: set,
860
+ get: get,
861
+ has: has,
862
+ enforce: enforce,
863
+ getterFor: getterFor
864
+ };
865
+
866
+ var objectGetOwnPropertyDescriptor = {};
867
+
868
+ var objectPropertyIsEnumerable = {};
869
+
870
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
871
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
872
+ var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
873
+
874
+ // Nashorn ~ JDK8 bug
875
+ var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
876
+
877
+ // `Object.prototype.propertyIsEnumerable` method implementation
878
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
879
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
880
+ var descriptor = getOwnPropertyDescriptor$1(this, V);
881
+ return !!descriptor && descriptor.enumerable;
882
+ } : $propertyIsEnumerable;
883
+
884
+ var DESCRIPTORS$5 = descriptors;
885
+ var call$7 = functionCall;
886
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
887
+ var createPropertyDescriptor$1 = createPropertyDescriptor$3;
888
+ var toIndexedObject$1 = toIndexedObject$5;
889
+ var toPropertyKey = toPropertyKey$2;
890
+ var hasOwn$6 = hasOwnProperty_1;
891
+ var IE8_DOM_DEFINE = ie8DomDefine;
892
+
893
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
894
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
895
+
896
+ // `Object.getOwnPropertyDescriptor` method
897
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
898
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
899
+ O = toIndexedObject$1(O);
900
+ P = toPropertyKey(P);
901
+ if (IE8_DOM_DEFINE) try {
902
+ return $getOwnPropertyDescriptor(O, P);
903
+ } catch (error) { /* empty */ }
904
+ if (hasOwn$6(O, P)) return createPropertyDescriptor$1(!call$7(propertyIsEnumerableModule$1.f, O, P), O[P]);
905
+ };
906
+
907
+ var makeBuiltIn$3 = {exports: {}};
908
+
909
+ var DESCRIPTORS$4 = descriptors;
910
+ var hasOwn$5 = hasOwnProperty_1;
911
+
912
+ var FunctionPrototype$1 = Function.prototype;
913
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
914
+ var getDescriptor = DESCRIPTORS$4 && Object.getOwnPropertyDescriptor;
915
+
916
+ var EXISTS = hasOwn$5(FunctionPrototype$1, 'name');
917
+ // additional protection from minified / mangled / dropped function names
918
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
919
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$4 || (DESCRIPTORS$4 && getDescriptor(FunctionPrototype$1, 'name').configurable));
920
+
921
+ var functionName = {
922
+ EXISTS: EXISTS,
923
+ PROPER: PROPER,
924
+ CONFIGURABLE: CONFIGURABLE
925
+ };
926
+
927
+ var uncurryThis$a = functionUncurryThis;
928
+ var isCallable$a = isCallable$h;
929
+ var store = sharedStore.exports;
930
+
931
+ var functionToString = uncurryThis$a(Function.toString);
932
+
933
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
934
+ if (!isCallable$a(store.inspectSource)) {
935
+ store.inspectSource = function (it) {
936
+ return functionToString(it);
937
+ };
938
+ }
939
+
940
+ var inspectSource$1 = store.inspectSource;
941
+
942
+ var uncurryThis$9 = functionUncurryThis;
943
+ var fails$a = fails$h;
944
+ var isCallable$9 = isCallable$h;
945
+ var hasOwn$4 = hasOwnProperty_1;
946
+ var DESCRIPTORS$3 = descriptors;
947
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
948
+ var inspectSource = inspectSource$1;
949
+ var InternalStateModule$1 = internalState;
950
+
951
+ var enforceInternalState = InternalStateModule$1.enforce;
952
+ var getInternalState$2 = InternalStateModule$1.get;
953
+ var $String$2 = String;
954
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
955
+ var defineProperty$4 = Object.defineProperty;
956
+ var stringSlice$5 = uncurryThis$9(''.slice);
957
+ var replace$3 = uncurryThis$9(''.replace);
958
+ var join = uncurryThis$9([].join);
959
+
960
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$3 && !fails$a(function () {
961
+ return defineProperty$4(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
962
+ });
963
+
964
+ var TEMPLATE = String(String).split('String');
965
+
966
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
967
+ if (stringSlice$5($String$2(name), 0, 7) === 'Symbol(') {
968
+ name = '[' + replace$3($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
969
+ }
970
+ if (options && options.getter) name = 'get ' + name;
971
+ if (options && options.setter) name = 'set ' + name;
972
+ if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
973
+ if (DESCRIPTORS$3) defineProperty$4(value, 'name', { value: name, configurable: true });
974
+ else value.name = name;
975
+ }
976
+ if (CONFIGURABLE_LENGTH && options && hasOwn$4(options, 'arity') && value.length !== options.arity) {
977
+ defineProperty$4(value, 'length', { value: options.arity });
978
+ }
979
+ try {
980
+ if (options && hasOwn$4(options, 'constructor') && options.constructor) {
981
+ if (DESCRIPTORS$3) defineProperty$4(value, 'prototype', { writable: false });
982
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
983
+ } else if (value.prototype) value.prototype = undefined;
984
+ } catch (error) { /* empty */ }
985
+ var state = enforceInternalState(value);
986
+ if (!hasOwn$4(state, 'source')) {
987
+ state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
988
+ } return value;
989
+ };
990
+
991
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
992
+ // eslint-disable-next-line no-extend-native -- required
993
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
994
+ return isCallable$9(this) && getInternalState$2(this).source || inspectSource(this);
995
+ }, 'toString');
996
+
997
+ var isCallable$8 = isCallable$h;
998
+ var definePropertyModule$1 = objectDefineProperty;
999
+ var makeBuiltIn$1 = makeBuiltIn$3.exports;
1000
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
1001
+
1002
+ var defineBuiltIn$4 = function (O, key, value, options) {
1003
+ if (!options) options = {};
1004
+ var simple = options.enumerable;
1005
+ var name = options.name !== undefined ? options.name : key;
1006
+ if (isCallable$8(value)) makeBuiltIn$1(value, name, options);
1007
+ if (options.global) {
1008
+ if (simple) O[key] = value;
1009
+ else defineGlobalProperty$1(key, value);
1010
+ } else {
1011
+ try {
1012
+ if (!options.unsafe) delete O[key];
1013
+ else if (O[key]) simple = true;
1014
+ } catch (error) { /* empty */ }
1015
+ if (simple) O[key] = value;
1016
+ else definePropertyModule$1.f(O, key, {
1017
+ value: value,
1018
+ enumerable: false,
1019
+ configurable: !options.nonConfigurable,
1020
+ writable: !options.nonWritable
1021
+ });
1022
+ } return O;
1023
+ };
1024
+
1025
+ var objectGetOwnPropertyNames = {};
1026
+
1027
+ var internalObjectKeys = objectKeysInternal;
1028
+ var enumBugKeys = enumBugKeys$3;
1029
+
1030
+ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
1031
+
1032
+ // `Object.getOwnPropertyNames` method
1033
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
1034
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1035
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1036
+ return internalObjectKeys(O, hiddenKeys);
1037
+ };
1038
+
1039
+ var objectGetOwnPropertySymbols = {};
1040
+
1041
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1042
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1043
+
1044
+ var getBuiltIn = getBuiltIn$3;
1045
+ var uncurryThis$8 = functionUncurryThis;
1046
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1047
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
1048
+ var anObject$4 = anObject$8;
1049
+
1050
+ var concat$2 = uncurryThis$8([].concat);
1051
+
1052
+ // all object keys, includes non-enumerable and symbols
1053
+ var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
1054
+ var keys = getOwnPropertyNamesModule.f(anObject$4(it));
1055
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1056
+ return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
1057
+ };
1058
+
1059
+ var hasOwn$3 = hasOwnProperty_1;
1060
+ var ownKeys = ownKeys$1;
1061
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1062
+ var definePropertyModule = objectDefineProperty;
1063
+
1064
+ var copyConstructorProperties$2 = function (target, source, exceptions) {
1065
+ var keys = ownKeys(source);
1066
+ var defineProperty = definePropertyModule.f;
1067
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1068
+ for (var i = 0; i < keys.length; i++) {
1069
+ var key = keys[i];
1070
+ if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
1071
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1072
+ }
1073
+ }
1074
+ };
1075
+
1076
+ var fails$9 = fails$h;
1077
+ var isCallable$7 = isCallable$h;
1078
+
1079
+ var replacement = /#|\.prototype\./;
1080
+
1081
+ var isForced$1 = function (feature, detection) {
1082
+ var value = data[normalize(feature)];
1083
+ return value === POLYFILL ? true
1084
+ : value === NATIVE ? false
1085
+ : isCallable$7(detection) ? fails$9(detection)
1086
+ : !!detection;
1087
+ };
1088
+
1089
+ var normalize = isForced$1.normalize = function (string) {
1090
+ return String(string).replace(replacement, '.').toLowerCase();
1091
+ };
1092
+
1093
+ var data = isForced$1.data = {};
1094
+ var NATIVE = isForced$1.NATIVE = 'N';
1095
+ var POLYFILL = isForced$1.POLYFILL = 'P';
1096
+
1097
+ var isForced_1 = isForced$1;
1098
+
1099
+ var global$6 = global$f;
1100
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1101
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
1102
+ var defineBuiltIn$3 = defineBuiltIn$4;
1103
+ var defineGlobalProperty = defineGlobalProperty$3;
1104
+ var copyConstructorProperties$1 = copyConstructorProperties$2;
1105
+ var isForced = isForced_1;
1106
+
1107
+ /*
1108
+ options.target - name of the target object
1109
+ options.global - target is the global object
1110
+ options.stat - export as static methods of target
1111
+ options.proto - export as prototype methods of target
1112
+ options.real - real prototype method for the `pure` version
1113
+ options.forced - export even if the native feature is available
1114
+ options.bind - bind methods to the target, required for the `pure` version
1115
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1116
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1117
+ options.sham - add a flag to not completely full polyfills
1118
+ options.enumerable - export as enumerable property
1119
+ options.dontCallGetSet - prevent calling a getter on target
1120
+ options.name - the .name of the function if it does not match the key
1121
+ */
1122
+ var _export = function (options, source) {
1123
+ var TARGET = options.target;
1124
+ var GLOBAL = options.global;
1125
+ var STATIC = options.stat;
1126
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1127
+ if (GLOBAL) {
1128
+ target = global$6;
1129
+ } else if (STATIC) {
1130
+ target = global$6[TARGET] || defineGlobalProperty(TARGET, {});
1131
+ } else {
1132
+ target = global$6[TARGET] && global$6[TARGET].prototype;
1133
+ }
1134
+ if (target) for (key in source) {
1135
+ sourceProperty = source[key];
1136
+ if (options.dontCallGetSet) {
1137
+ descriptor = getOwnPropertyDescriptor(target, key);
1138
+ targetProperty = descriptor && descriptor.value;
1139
+ } else targetProperty = target[key];
1140
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1141
+ // contained in target
1142
+ if (!FORCED && targetProperty !== undefined) {
1143
+ if (typeof sourceProperty == typeof targetProperty) continue;
1144
+ copyConstructorProperties$1(sourceProperty, targetProperty);
1145
+ }
1146
+ // add a flag to not completely full polyfills
1147
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1148
+ createNonEnumerableProperty$3(sourceProperty, 'sham', true);
1149
+ }
1150
+ defineBuiltIn$3(target, key, sourceProperty, options);
1151
+ }
1152
+ };
1153
+
1154
+ var fails$8 = fails$h;
1155
+
1156
+ var correctPrototypeGetter = !fails$8(function () {
1157
+ function F() { /* empty */ }
1158
+ F.prototype.constructor = null;
1159
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1160
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1161
+ });
1162
+
1163
+ var hasOwn$2 = hasOwnProperty_1;
1164
+ var isCallable$6 = isCallable$h;
1165
+ var toObject$2 = toObject$4;
1166
+ var sharedKey = sharedKey$3;
1167
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1168
+
1169
+ var IE_PROTO = sharedKey('IE_PROTO');
1170
+ var $Object$1 = Object;
1171
+ var ObjectPrototype = $Object$1.prototype;
1172
+
1173
+ // `Object.getPrototypeOf` method
1174
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1175
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
1176
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1177
+ var object = toObject$2(O);
1178
+ if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1179
+ var constructor = object.constructor;
1180
+ if (isCallable$6(constructor) && object instanceof constructor) {
1181
+ return constructor.prototype;
1182
+ } return object instanceof $Object$1 ? ObjectPrototype : null;
1183
+ };
1184
+
1185
+ var fails$7 = fails$h;
1186
+ var isCallable$5 = isCallable$h;
1187
+ var isObject$2 = isObject$8;
1188
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1189
+ var defineBuiltIn$2 = defineBuiltIn$4;
1190
+ var wellKnownSymbol$9 = wellKnownSymbol$c;
1191
+
1192
+ var ITERATOR$2 = wellKnownSymbol$9('iterator');
1193
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1194
+
1195
+ // `%IteratorPrototype%` object
1196
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1197
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1198
+
1199
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1200
+ if ([].keys) {
1201
+ arrayIterator = [].keys();
1202
+ // Safari 8 has buggy iterators w/o `next`
1203
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1204
+ else {
1205
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1206
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1207
+ }
1208
+ }
1209
+
1210
+ var NEW_ITERATOR_PROTOTYPE = !isObject$2(IteratorPrototype$2) || fails$7(function () {
1211
+ var test = {};
1212
+ // FF44- legacy iterators case
1213
+ return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
1214
+ });
1215
+
1216
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1217
+
1218
+ // `%IteratorPrototype%[@@iterator]()` method
1219
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1220
+ if (!isCallable$5(IteratorPrototype$2[ITERATOR$2])) {
1221
+ defineBuiltIn$2(IteratorPrototype$2, ITERATOR$2, function () {
1222
+ return this;
1223
+ });
1224
+ }
1225
+
1226
+ var iteratorsCore = {
1227
+ IteratorPrototype: IteratorPrototype$2,
1228
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1229
+ };
1230
+
1231
+ var defineProperty$3 = objectDefineProperty.f;
1232
+ var hasOwn$1 = hasOwnProperty_1;
1233
+ var wellKnownSymbol$8 = wellKnownSymbol$c;
1234
+
1235
+ var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
1236
+
1237
+ var setToStringTag$3 = function (target, TAG, STATIC) {
1238
+ if (target && !STATIC) target = target.prototype;
1239
+ if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
1240
+ defineProperty$3(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1241
+ }
1242
+ };
1243
+
1244
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1245
+ var create$1 = objectCreate;
1246
+ var createPropertyDescriptor = createPropertyDescriptor$3;
1247
+ var setToStringTag$2 = setToStringTag$3;
1248
+ var Iterators$2 = iterators;
1249
+
1250
+ var returnThis$1 = function () { return this; };
1251
+
1252
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1253
+ var TO_STRING_TAG = NAME + ' Iterator';
1254
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
1255
+ setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
1256
+ Iterators$2[TO_STRING_TAG] = returnThis$1;
1257
+ return IteratorConstructor;
1258
+ };
1259
+
1260
+ var uncurryThis$7 = functionUncurryThis;
1261
+ var aCallable = aCallable$2;
1262
+
1263
+ var functionUncurryThisAccessor = function (object, key, method) {
1264
+ try {
1265
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1266
+ return uncurryThis$7(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
1267
+ } catch (error) { /* empty */ }
1268
+ };
1269
+
1270
+ var isObject$1 = isObject$8;
1271
+
1272
+ var isPossiblePrototype$1 = function (argument) {
1273
+ return isObject$1(argument) || argument === null;
1274
+ };
1275
+
1276
+ var isPossiblePrototype = isPossiblePrototype$1;
1277
+
1278
+ var $String$1 = String;
1279
+ var $TypeError$2 = TypeError;
1280
+
1281
+ var aPossiblePrototype$1 = function (argument) {
1282
+ if (isPossiblePrototype(argument)) return argument;
1283
+ throw new $TypeError$2("Can't set " + $String$1(argument) + ' as a prototype');
1284
+ };
1285
+
1286
+ /* eslint-disable no-proto -- safe */
1287
+ var uncurryThisAccessor = functionUncurryThisAccessor;
1288
+ var anObject$3 = anObject$8;
1289
+ var aPossiblePrototype = aPossiblePrototype$1;
1290
+
1291
+ // `Object.setPrototypeOf` method
1292
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1293
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1294
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1295
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1296
+ var CORRECT_SETTER = false;
1297
+ var test = {};
1298
+ var setter;
1299
+ try {
1300
+ setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1301
+ setter(test, []);
1302
+ CORRECT_SETTER = test instanceof Array;
1303
+ } catch (error) { /* empty */ }
1304
+ return function setPrototypeOf(O, proto) {
1305
+ anObject$3(O);
1306
+ aPossiblePrototype(proto);
1307
+ if (CORRECT_SETTER) setter(O, proto);
1308
+ else O.__proto__ = proto;
1309
+ return O;
1310
+ };
1311
+ }() : undefined);
1312
+
1313
+ var $$5 = _export;
1314
+ var call$6 = functionCall;
1315
+ var FunctionName = functionName;
1316
+ var isCallable$4 = isCallable$h;
1317
+ var createIteratorConstructor = iteratorCreateConstructor;
1318
+ var getPrototypeOf = objectGetPrototypeOf;
1319
+ var setPrototypeOf = objectSetPrototypeOf;
1320
+ var setToStringTag$1 = setToStringTag$3;
1321
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
1322
+ var defineBuiltIn$1 = defineBuiltIn$4;
1323
+ var wellKnownSymbol$7 = wellKnownSymbol$c;
1324
+ var Iterators$1 = iterators;
1325
+ var IteratorsCore = iteratorsCore;
1326
+
1327
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1328
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1329
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1330
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1331
+ var ITERATOR$1 = wellKnownSymbol$7('iterator');
1332
+ var KEYS = 'keys';
1333
+ var VALUES = 'values';
1334
+ var ENTRIES = 'entries';
1335
+
1336
+ var returnThis = function () { return this; };
1337
+
1338
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1339
+ createIteratorConstructor(IteratorConstructor, NAME, next);
1340
+
1341
+ var getIterationMethod = function (KIND) {
1342
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1343
+ if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1344
+
1345
+ switch (KIND) {
1346
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1347
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1348
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1349
+ }
1350
+
1351
+ return function () { return new IteratorConstructor(this); };
1352
+ };
1353
+
1354
+ var TO_STRING_TAG = NAME + ' Iterator';
1355
+ var INCORRECT_VALUES_NAME = false;
1356
+ var IterablePrototype = Iterable.prototype;
1357
+ var nativeIterator = IterablePrototype[ITERATOR$1]
1358
+ || IterablePrototype['@@iterator']
1359
+ || DEFAULT && IterablePrototype[DEFAULT];
1360
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1361
+ var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1362
+ var CurrentIteratorPrototype, methods, KEY;
1363
+
1364
+ // fix native
1365
+ if (anyNativeIterator) {
1366
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1367
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1368
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1369
+ if (setPrototypeOf) {
1370
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1371
+ } else if (!isCallable$4(CurrentIteratorPrototype[ITERATOR$1])) {
1372
+ defineBuiltIn$1(CurrentIteratorPrototype, ITERATOR$1, returnThis);
1373
+ }
1374
+ }
1375
+ // Set @@toStringTag to native iterators
1376
+ setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true);
1377
+ }
1378
+ }
1379
+
1380
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1381
+ if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1382
+ if (CONFIGURABLE_FUNCTION_NAME) {
1383
+ createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
1384
+ } else {
1385
+ INCORRECT_VALUES_NAME = true;
1386
+ defaultIterator = function values() { return call$6(nativeIterator, this); };
1387
+ }
1388
+ }
1389
+
1390
+ // export additional methods
1391
+ if (DEFAULT) {
1392
+ methods = {
1393
+ values: getIterationMethod(VALUES),
1394
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1395
+ entries: getIterationMethod(ENTRIES)
1396
+ };
1397
+ if (FORCED) for (KEY in methods) {
1398
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1399
+ defineBuiltIn$1(IterablePrototype, KEY, methods[KEY]);
1400
+ }
1401
+ } else $$5({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1402
+ }
1403
+
1404
+ // define iterator
1405
+ if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
1406
+ defineBuiltIn$1(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
1407
+ }
1408
+ Iterators$1[NAME] = defaultIterator;
1409
+
1410
+ return methods;
1411
+ };
1412
+
1413
+ // `CreateIterResultObject` abstract operation
1414
+ // https://tc39.es/ecma262/#sec-createiterresultobject
1415
+ var createIterResultObject$1 = function (value, done) {
1416
+ return { value: value, done: done };
1417
+ };
1418
+
1419
+ var toIndexedObject = toIndexedObject$5;
1420
+ var addToUnscopables$1 = addToUnscopables$2;
1421
+ var Iterators = iterators;
1422
+ var InternalStateModule = internalState;
1423
+ var defineProperty$2 = objectDefineProperty.f;
1424
+ var defineIterator = iteratorDefine;
1425
+ var createIterResultObject = createIterResultObject$1;
1426
+ var DESCRIPTORS$2 = descriptors;
1427
+
1428
+ var ARRAY_ITERATOR = 'Array Iterator';
1429
+ var setInternalState = InternalStateModule.set;
1430
+ var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
1431
+
1432
+ // `Array.prototype.entries` method
1433
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1434
+ // `Array.prototype.keys` method
1435
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1436
+ // `Array.prototype.values` method
1437
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1438
+ // `Array.prototype[@@iterator]` method
1439
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1440
+ // `CreateArrayIterator` internal method
1441
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1442
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1443
+ setInternalState(this, {
1444
+ type: ARRAY_ITERATOR,
1445
+ target: toIndexedObject(iterated), // target
1446
+ index: 0, // next index
1447
+ kind: kind // kind
1448
+ });
1449
+ // `%ArrayIteratorPrototype%.next` method
1450
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1451
+ }, function () {
1452
+ var state = getInternalState$1(this);
1453
+ var target = state.target;
1454
+ var index = state.index++;
1455
+ if (!target || index >= target.length) {
1456
+ state.target = undefined;
1457
+ return createIterResultObject(undefined, true);
1458
+ }
1459
+ switch (state.kind) {
1460
+ case 'keys': return createIterResultObject(index, false);
1461
+ case 'values': return createIterResultObject(target[index], false);
1462
+ } return createIterResultObject([index, target[index]], false);
1463
+ }, 'values');
1464
+
1465
+ // argumentsList[@@iterator] is %ArrayProto_values%
1466
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1467
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1468
+ var values = Iterators.Arguments = Iterators.Array;
1469
+
1470
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1471
+ addToUnscopables$1('keys');
1472
+ addToUnscopables$1('values');
1473
+ addToUnscopables$1('entries');
1474
+
1475
+ // V8 ~ Chrome 45- bug
1476
+ if (DESCRIPTORS$2 && values.name !== 'values') try {
1477
+ defineProperty$2(values, 'name', { value: 'values' });
1478
+ } catch (error) { /* empty */ }
1479
+
1480
+ // iterable DOM collections
1481
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1482
+ var domIterables = {
1483
+ CSSRuleList: 0,
1484
+ CSSStyleDeclaration: 0,
1485
+ CSSValueList: 0,
1486
+ ClientRectList: 0,
1487
+ DOMRectList: 0,
1488
+ DOMStringList: 0,
1489
+ DOMTokenList: 1,
1490
+ DataTransferItemList: 0,
1491
+ FileList: 0,
1492
+ HTMLAllCollection: 0,
1493
+ HTMLCollection: 0,
1494
+ HTMLFormElement: 0,
1495
+ HTMLSelectElement: 0,
1496
+ MediaList: 0,
1497
+ MimeTypeArray: 0,
1498
+ NamedNodeMap: 0,
1499
+ NodeList: 1,
1500
+ PaintRequestList: 0,
1501
+ Plugin: 0,
1502
+ PluginArray: 0,
1503
+ SVGLengthList: 0,
1504
+ SVGNumberList: 0,
1505
+ SVGPathSegList: 0,
1506
+ SVGPointList: 0,
1507
+ SVGStringList: 0,
1508
+ SVGTransformList: 0,
1509
+ SourceBufferList: 0,
1510
+ StyleSheetList: 0,
1511
+ TextTrackCueList: 0,
1512
+ TextTrackList: 0,
1513
+ TouchList: 0
1514
+ };
1515
+
1516
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1517
+ var documentCreateElement = documentCreateElement$2;
1518
+
1519
+ var classList = documentCreateElement('span').classList;
1520
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1521
+
1522
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1523
+
1524
+ var global$5 = global$f;
1525
+ var DOMIterables = domIterables;
1526
+ var DOMTokenListPrototype = domTokenListPrototype;
1527
+ var ArrayIteratorMethods = es_array_iterator;
1528
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
1529
+ var setToStringTag = setToStringTag$3;
1530
+ var wellKnownSymbol$6 = wellKnownSymbol$c;
1531
+
1532
+ var ITERATOR = wellKnownSymbol$6('iterator');
1533
+ var ArrayValues = ArrayIteratorMethods.values;
1534
+
1535
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1536
+ if (CollectionPrototype) {
1537
+ // some Chrome versions have non-configurable methods on DOMTokenList
1538
+ if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
1539
+ createNonEnumerableProperty$1(CollectionPrototype, ITERATOR, ArrayValues);
1540
+ } catch (error) {
1541
+ CollectionPrototype[ITERATOR] = ArrayValues;
1542
+ }
1543
+ setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
1544
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1545
+ // some Chrome versions have non-configurable methods on DOMTokenList
1546
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1547
+ createNonEnumerableProperty$1(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1548
+ } catch (error) {
1549
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1550
+ }
1551
+ }
1552
+ }
1553
+ };
1554
+
1555
+ for (var COLLECTION_NAME in DOMIterables) {
1556
+ handlePrototype(global$5[COLLECTION_NAME] && global$5[COLLECTION_NAME].prototype, COLLECTION_NAME);
1557
+ }
1558
+
1559
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1560
+
1561
+ var wellKnownSymbol$5 = wellKnownSymbol$c;
1562
+
1563
+ var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1564
+ var test = {};
1565
+
1566
+ test[TO_STRING_TAG$1] = 'z';
1567
+
1568
+ var toStringTagSupport = String(test) === '[object z]';
1569
+
1570
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1571
+ var isCallable$3 = isCallable$h;
1572
+ var classofRaw = classofRaw$1;
1573
+ var wellKnownSymbol$4 = wellKnownSymbol$c;
1574
+
1575
+ var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1576
+ var $Object = Object;
1577
+
1578
+ // ES3 wrong here
1579
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1580
+
1581
+ // fallback for IE11 Script Access Denied error
1582
+ var tryGet = function (it, key) {
1583
+ try {
1584
+ return it[key];
1585
+ } catch (error) { /* empty */ }
1586
+ };
1587
+
1588
+ // getting tag from ES6+ `Object.prototype.toString`
1589
+ var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1590
+ var O, tag, result;
1591
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1592
+ // @@toStringTag case
1593
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1594
+ // builtinTag case
1595
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1596
+ // ES3 arguments fallback
1597
+ : (result = classofRaw(O)) === 'Object' && isCallable$3(O.callee) ? 'Arguments' : result;
1598
+ };
1599
+
1600
+ var classof$2 = classof$3;
1601
+
1602
+ var $String = String;
1603
+
1604
+ var toString$5 = function (argument) {
1605
+ if (classof$2(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1606
+ return $String(argument);
1607
+ };
1608
+
1609
+ var makeBuiltIn = makeBuiltIn$3.exports;
1610
+ var defineProperty$1 = objectDefineProperty;
1611
+
1612
+ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1613
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1614
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1615
+ return defineProperty$1.f(target, name, descriptor);
1616
+ };
1617
+
1618
+ var $$4 = _export;
1619
+ var DESCRIPTORS$1 = descriptors;
1620
+ var global$4 = global$f;
1621
+ var uncurryThis$6 = functionUncurryThis;
1622
+ var hasOwn = hasOwnProperty_1;
1623
+ var isCallable$2 = isCallable$h;
1624
+ var isPrototypeOf = objectIsPrototypeOf;
1625
+ var toString$4 = toString$5;
1626
+ var defineBuiltInAccessor = defineBuiltInAccessor$1;
1627
+ var copyConstructorProperties = copyConstructorProperties$2;
1628
+
1629
+ var NativeSymbol = global$4.Symbol;
1630
+ var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
1631
+
1632
+ if (DESCRIPTORS$1 && isCallable$2(NativeSymbol) && (!('description' in SymbolPrototype) ||
1633
+ // Safari 12 bug
1634
+ NativeSymbol().description !== undefined
1635
+ )) {
1636
+ var EmptyStringDescriptionStore = {};
1637
+ // wrap Symbol constructor for correct work with undefined description
1638
+ var SymbolWrapper = function Symbol() {
1639
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$4(arguments[0]);
1640
+ var result = isPrototypeOf(SymbolPrototype, this)
1641
+ ? new NativeSymbol(description)
1642
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1643
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
1644
+ if (description === '') EmptyStringDescriptionStore[result] = true;
1645
+ return result;
1646
+ };
1647
+
1648
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
1649
+ SymbolWrapper.prototype = SymbolPrototype;
1650
+ SymbolPrototype.constructor = SymbolWrapper;
1651
+
1652
+ var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
1653
+ var thisSymbolValue = uncurryThis$6(SymbolPrototype.valueOf);
1654
+ var symbolDescriptiveString = uncurryThis$6(SymbolPrototype.toString);
1655
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
1656
+ var replace$2 = uncurryThis$6(''.replace);
1657
+ var stringSlice$4 = uncurryThis$6(''.slice);
1658
+
1659
+ defineBuiltInAccessor(SymbolPrototype, 'description', {
1660
+ configurable: true,
1661
+ get: function description() {
1662
+ var symbol = thisSymbolValue(this);
1663
+ if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
1664
+ var string = symbolDescriptiveString(symbol);
1665
+ var desc = NATIVE_SYMBOL ? stringSlice$4(string, 7, -1) : replace$2(string, regexp, '$1');
1666
+ return desc === '' ? undefined : desc;
1667
+ }
1668
+ });
1669
+
1670
+ $$4({ global: true, constructor: true, forced: true }, {
1671
+ Symbol: SymbolWrapper
1672
+ });
1673
+ }
1674
+
1675
+ var DESCRIPTORS = descriptors;
1676
+ var uncurryThis$5 = functionUncurryThis;
1677
+ var call$5 = functionCall;
1678
+ var fails$6 = fails$h;
1679
+ var objectKeys = objectKeys$2;
1680
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1681
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1682
+ var toObject$1 = toObject$4;
1683
+ var IndexedObject = indexedObject;
1684
+
1685
+ // eslint-disable-next-line es/no-object-assign -- safe
1686
+ var $assign = Object.assign;
1687
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1688
+ var defineProperty = Object.defineProperty;
1689
+ var concat$1 = uncurryThis$5([].concat);
1690
+
1691
+ // `Object.assign` method
1692
+ // https://tc39.es/ecma262/#sec-object.assign
1693
+ var objectAssign = !$assign || fails$6(function () {
1694
+ // should have correct order of operations (Edge bug)
1695
+ if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
1696
+ enumerable: true,
1697
+ get: function () {
1698
+ defineProperty(this, 'b', {
1699
+ value: 3,
1700
+ enumerable: false
1701
+ });
1702
+ }
1703
+ }), { b: 2 })).b !== 1) return true;
1704
+ // should work with symbols and should have deterministic property order (V8 bug)
1705
+ var A = {};
1706
+ var B = {};
1707
+ // eslint-disable-next-line es/no-symbol -- safe
1708
+ var symbol = Symbol('assign detection');
1709
+ var alphabet = 'abcdefghijklmnopqrst';
1710
+ A[symbol] = 7;
1711
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1712
+ return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
1713
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1714
+ var T = toObject$1(target);
1715
+ var argumentsLength = arguments.length;
1716
+ var index = 1;
1717
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1718
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
1719
+ while (argumentsLength > index) {
1720
+ var S = IndexedObject(arguments[index++]);
1721
+ var keys = getOwnPropertySymbols ? concat$1(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1722
+ var length = keys.length;
1723
+ var j = 0;
1724
+ var key;
1725
+ while (length > j) {
1726
+ key = keys[j++];
1727
+ if (!DESCRIPTORS || call$5(propertyIsEnumerable, S, key)) T[key] = S[key];
1728
+ }
1729
+ } return T;
1730
+ } : $assign;
1731
+
1732
+ var $$3 = _export;
1733
+ var assign = objectAssign;
1734
+
1735
+ // `Object.assign` method
1736
+ // https://tc39.es/ecma262/#sec-object.assign
1737
+ // eslint-disable-next-line es/no-object-assign -- required for testing
1738
+ $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1739
+ assign: assign
1740
+ });
1741
+
1742
+ var anObject$2 = anObject$8;
1743
+
1744
+ // `RegExp.prototype.flags` getter implementation
1745
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1746
+ var regexpFlags$1 = function () {
1747
+ var that = anObject$2(this);
1748
+ var result = '';
1749
+ if (that.hasIndices) result += 'd';
1750
+ if (that.global) result += 'g';
1751
+ if (that.ignoreCase) result += 'i';
1752
+ if (that.multiline) result += 'm';
1753
+ if (that.dotAll) result += 's';
1754
+ if (that.unicode) result += 'u';
1755
+ if (that.unicodeSets) result += 'v';
1756
+ if (that.sticky) result += 'y';
1757
+ return result;
1758
+ };
1759
+
1760
+ var fails$5 = fails$h;
1761
+ var global$3 = global$f;
1762
+
1763
+ // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1764
+ var $RegExp$2 = global$3.RegExp;
1765
+
1766
+ var UNSUPPORTED_Y$1 = fails$5(function () {
1767
+ var re = $RegExp$2('a', 'y');
1768
+ re.lastIndex = 2;
1769
+ return re.exec('abcd') !== null;
1770
+ });
1771
+
1772
+ // UC Browser bug
1773
+ // https://github.com/zloirock/core-js/issues/1008
1774
+ var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$5(function () {
1775
+ return !$RegExp$2('a', 'y').sticky;
1776
+ });
1777
+
1778
+ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$5(function () {
1779
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1780
+ var re = $RegExp$2('^r', 'gy');
1781
+ re.lastIndex = 2;
1782
+ return re.exec('str') !== null;
1783
+ });
1784
+
1785
+ var regexpStickyHelpers = {
1786
+ BROKEN_CARET: BROKEN_CARET,
1787
+ MISSED_STICKY: MISSED_STICKY,
1788
+ UNSUPPORTED_Y: UNSUPPORTED_Y$1
1789
+ };
1790
+
1791
+ var fails$4 = fails$h;
1792
+ var global$2 = global$f;
1793
+
1794
+ // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1795
+ var $RegExp$1 = global$2.RegExp;
1796
+
1797
+ var regexpUnsupportedDotAll = fails$4(function () {
1798
+ var re = $RegExp$1('.', 's');
1799
+ return !(re.dotAll && re.test('\n') && re.flags === 's');
1800
+ });
1801
+
1802
+ var fails$3 = fails$h;
1803
+ var global$1 = global$f;
1804
+
1805
+ // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
1806
+ var $RegExp = global$1.RegExp;
1807
+
1808
+ var regexpUnsupportedNcg = fails$3(function () {
1809
+ var re = $RegExp('(?<a>b)', 'g');
1810
+ return re.exec('b').groups.a !== 'b' ||
1811
+ 'b'.replace(re, '$<a>c') !== 'bc';
1812
+ });
1813
+
1814
+ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1815
+ /* eslint-disable regexp/no-useless-quantifier -- testing */
1816
+ var call$4 = functionCall;
1817
+ var uncurryThis$4 = functionUncurryThis;
1818
+ var toString$3 = toString$5;
1819
+ var regexpFlags = regexpFlags$1;
1820
+ var stickyHelpers = regexpStickyHelpers;
1821
+ var shared = shared$4;
1822
+ var create = objectCreate;
1823
+ var getInternalState = internalState.get;
1824
+ var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
1825
+ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
1826
+
1827
+ var nativeReplace = shared('native-string-replace', String.prototype.replace);
1828
+ var nativeExec = RegExp.prototype.exec;
1829
+ var patchedExec = nativeExec;
1830
+ var charAt$3 = uncurryThis$4(''.charAt);
1831
+ var indexOf = uncurryThis$4(''.indexOf);
1832
+ var replace$1 = uncurryThis$4(''.replace);
1833
+ var stringSlice$3 = uncurryThis$4(''.slice);
1834
+
1835
+ var UPDATES_LAST_INDEX_WRONG = (function () {
1836
+ var re1 = /a/;
1837
+ var re2 = /b*/g;
1838
+ call$4(nativeExec, re1, 'a');
1839
+ call$4(nativeExec, re2, 'a');
1840
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1841
+ })();
1842
+
1843
+ var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
1844
+
1845
+ // nonparticipating capturing group, copied from es5-shim's String#split patch.
1846
+ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1847
+
1848
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
1849
+
1850
+ if (PATCH) {
1851
+ patchedExec = function exec(string) {
1852
+ var re = this;
1853
+ var state = getInternalState(re);
1854
+ var str = toString$3(string);
1855
+ var raw = state.raw;
1856
+ var result, reCopy, lastIndex, match, i, object, group;
1857
+
1858
+ if (raw) {
1859
+ raw.lastIndex = re.lastIndex;
1860
+ result = call$4(patchedExec, raw, str);
1861
+ re.lastIndex = raw.lastIndex;
1862
+ return result;
1863
+ }
1864
+
1865
+ var groups = state.groups;
1866
+ var sticky = UNSUPPORTED_Y && re.sticky;
1867
+ var flags = call$4(regexpFlags, re);
1868
+ var source = re.source;
1869
+ var charsAdded = 0;
1870
+ var strCopy = str;
1871
+
1872
+ if (sticky) {
1873
+ flags = replace$1(flags, 'y', '');
1874
+ if (indexOf(flags, 'g') === -1) {
1875
+ flags += 'g';
1876
+ }
1877
+
1878
+ strCopy = stringSlice$3(str, re.lastIndex);
1879
+ // Support anchored sticky behavior.
1880
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
1881
+ source = '(?: ' + source + ')';
1882
+ strCopy = ' ' + strCopy;
1883
+ charsAdded++;
1884
+ }
1885
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
1886
+ // simulate the 'y' flag.
1887
+ reCopy = new RegExp('^(?:' + source + ')', flags);
1888
+ }
1889
+
1890
+ if (NPCG_INCLUDED) {
1891
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1892
+ }
1893
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1894
+
1895
+ match = call$4(nativeExec, sticky ? reCopy : re, strCopy);
1896
+
1897
+ if (sticky) {
1898
+ if (match) {
1899
+ match.input = stringSlice$3(match.input, charsAdded);
1900
+ match[0] = stringSlice$3(match[0], charsAdded);
1901
+ match.index = re.lastIndex;
1902
+ re.lastIndex += match[0].length;
1903
+ } else re.lastIndex = 0;
1904
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
1905
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1906
+ }
1907
+ if (NPCG_INCLUDED && match && match.length > 1) {
1908
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
1909
+ // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
1910
+ call$4(nativeReplace, match[0], reCopy, function () {
1911
+ for (i = 1; i < arguments.length - 2; i++) {
1912
+ if (arguments[i] === undefined) match[i] = undefined;
1913
+ }
1914
+ });
1915
+ }
1916
+
1917
+ if (match && groups) {
1918
+ match.groups = object = create(null);
1919
+ for (i = 0; i < groups.length; i++) {
1920
+ group = groups[i];
1921
+ object[group[0]] = match[group[1]];
1922
+ }
1923
+ }
1924
+
1925
+ return match;
1926
+ };
1927
+ }
1928
+
1929
+ var regexpExec$2 = patchedExec;
1930
+
1931
+ var $$2 = _export;
1932
+ var exec = regexpExec$2;
1933
+
1934
+ // `RegExp.prototype.exec` method
1935
+ // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1936
+ $$2({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
1937
+ exec: exec
1938
+ });
1939
+
1940
+ var NATIVE_BIND = functionBindNative;
1941
+
1942
+ var FunctionPrototype = Function.prototype;
1943
+ var apply$1 = FunctionPrototype.apply;
1944
+ var call$3 = FunctionPrototype.call;
1945
+
1946
+ // eslint-disable-next-line es/no-reflect -- safe
1947
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$3.bind(apply$1) : function () {
1948
+ return call$3.apply(apply$1, arguments);
1949
+ });
1950
+
1951
+ // TODO: Remove from `core-js@4` since it's moved to entry points
1952
+
1953
+ var call$2 = functionCall;
1954
+ var defineBuiltIn = defineBuiltIn$4;
1955
+ var regexpExec$1 = regexpExec$2;
1956
+ var fails$2 = fails$h;
1957
+ var wellKnownSymbol$3 = wellKnownSymbol$c;
1958
+ var createNonEnumerableProperty = createNonEnumerableProperty$5;
1959
+
1960
+ var SPECIES = wellKnownSymbol$3('species');
1961
+ var RegExpPrototype = RegExp.prototype;
1962
+
1963
+ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
1964
+ var SYMBOL = wellKnownSymbol$3(KEY);
1965
+
1966
+ var DELEGATES_TO_SYMBOL = !fails$2(function () {
1967
+ // String methods call symbol-named RegExp methods
1968
+ var O = {};
1969
+ O[SYMBOL] = function () { return 7; };
1970
+ return ''[KEY](O) !== 7;
1971
+ });
1972
+
1973
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$2(function () {
1974
+ // Symbol-named RegExp methods call .exec
1975
+ var execCalled = false;
1976
+ var re = /a/;
1977
+
1978
+ if (KEY === 'split') {
1979
+ // We can't use real regex here since it causes deoptimization
1980
+ // and serious performance degradation in V8
1981
+ // https://github.com/zloirock/core-js/issues/306
1982
+ re = {};
1983
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
1984
+ // a new one. We need to return the patched regex when creating the new one.
1985
+ re.constructor = {};
1986
+ re.constructor[SPECIES] = function () { return re; };
1987
+ re.flags = '';
1988
+ re[SYMBOL] = /./[SYMBOL];
1989
+ }
1990
+
1991
+ re.exec = function () {
1992
+ execCalled = true;
1993
+ return null;
1994
+ };
1995
+
1996
+ re[SYMBOL]('');
1997
+ return !execCalled;
1998
+ });
1999
+
2000
+ if (
2001
+ !DELEGATES_TO_SYMBOL ||
2002
+ !DELEGATES_TO_EXEC ||
2003
+ FORCED
2004
+ ) {
2005
+ var nativeRegExpMethod = /./[SYMBOL];
2006
+ var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
2007
+ var $exec = regexp.exec;
2008
+ if ($exec === regexpExec$1 || $exec === RegExpPrototype.exec) {
2009
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
2010
+ // The native String method already delegates to @@method (this
2011
+ // polyfilled function), leasing to infinite recursion.
2012
+ // We avoid it by directly calling the native @@method method.
2013
+ return { done: true, value: call$2(nativeRegExpMethod, regexp, str, arg2) };
2014
+ }
2015
+ return { done: true, value: call$2(nativeMethod, str, regexp, arg2) };
2016
+ }
2017
+ return { done: false };
2018
+ });
2019
+
2020
+ defineBuiltIn(String.prototype, KEY, methods[0]);
2021
+ defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
2022
+ }
2023
+
2024
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
2025
+ };
2026
+
2027
+ var uncurryThis$3 = functionUncurryThis;
2028
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
2029
+ var toString$2 = toString$5;
2030
+ var requireObjectCoercible$2 = requireObjectCoercible$5;
2031
+
2032
+ var charAt$2 = uncurryThis$3(''.charAt);
2033
+ var charCodeAt = uncurryThis$3(''.charCodeAt);
2034
+ var stringSlice$2 = uncurryThis$3(''.slice);
2035
+
2036
+ var createMethod = function (CONVERT_TO_STRING) {
2037
+ return function ($this, pos) {
2038
+ var S = toString$2(requireObjectCoercible$2($this));
2039
+ var position = toIntegerOrInfinity$1(pos);
2040
+ var size = S.length;
2041
+ var first, second;
2042
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
2043
+ first = charCodeAt(S, position);
2044
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size
2045
+ || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
2046
+ ? CONVERT_TO_STRING
2047
+ ? charAt$2(S, position)
2048
+ : first
2049
+ : CONVERT_TO_STRING
2050
+ ? stringSlice$2(S, position, position + 2)
2051
+ : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
2052
+ };
2053
+ };
2054
+
2055
+ var stringMultibyte = {
2056
+ // `String.prototype.codePointAt` method
2057
+ // https://tc39.es/ecma262/#sec-string.prototype.codepointat
2058
+ codeAt: createMethod(false),
2059
+ // `String.prototype.at` method
2060
+ // https://github.com/mathiasbynens/String.prototype.at
2061
+ charAt: createMethod(true)
2062
+ };
2063
+
2064
+ var charAt$1 = stringMultibyte.charAt;
2065
+
2066
+ // `AdvanceStringIndex` abstract operation
2067
+ // https://tc39.es/ecma262/#sec-advancestringindex
2068
+ var advanceStringIndex$1 = function (S, index, unicode) {
2069
+ return index + (unicode ? charAt$1(S, index).length : 1);
2070
+ };
2071
+
2072
+ var uncurryThis$2 = functionUncurryThis;
2073
+ var toObject = toObject$4;
2074
+
2075
+ var floor = Math.floor;
2076
+ var charAt = uncurryThis$2(''.charAt);
2077
+ var replace = uncurryThis$2(''.replace);
2078
+ var stringSlice$1 = uncurryThis$2(''.slice);
2079
+ // eslint-disable-next-line redos/no-vulnerable -- safe
2080
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
2081
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
2082
+
2083
+ // `GetSubstitution` abstract operation
2084
+ // https://tc39.es/ecma262/#sec-getsubstitution
2085
+ var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
2086
+ var tailPos = position + matched.length;
2087
+ var m = captures.length;
2088
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2089
+ if (namedCaptures !== undefined) {
2090
+ namedCaptures = toObject(namedCaptures);
2091
+ symbols = SUBSTITUTION_SYMBOLS;
2092
+ }
2093
+ return replace(replacement, symbols, function (match, ch) {
2094
+ var capture;
2095
+ switch (charAt(ch, 0)) {
2096
+ case '$': return '$';
2097
+ case '&': return matched;
2098
+ case '`': return stringSlice$1(str, 0, position);
2099
+ case "'": return stringSlice$1(str, tailPos);
2100
+ case '<':
2101
+ capture = namedCaptures[stringSlice$1(ch, 1, -1)];
2102
+ break;
2103
+ default: // \d\d?
2104
+ var n = +ch;
2105
+ if (n === 0) return match;
2106
+ if (n > m) {
2107
+ var f = floor(n / 10);
2108
+ if (f === 0) return match;
2109
+ if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
2110
+ return match;
2111
+ }
2112
+ capture = captures[n - 1];
2113
+ }
2114
+ return capture === undefined ? '' : capture;
2115
+ });
2116
+ };
2117
+
2118
+ var call$1 = functionCall;
2119
+ var anObject$1 = anObject$8;
2120
+ var isCallable$1 = isCallable$h;
2121
+ var classof$1 = classofRaw$1;
2122
+ var regexpExec = regexpExec$2;
2123
+
2124
+ var $TypeError$1 = TypeError;
2125
+
2126
+ // `RegExpExec` abstract operation
2127
+ // https://tc39.es/ecma262/#sec-regexpexec
2128
+ var regexpExecAbstract = function (R, S) {
2129
+ var exec = R.exec;
2130
+ if (isCallable$1(exec)) {
2131
+ var result = call$1(exec, R, S);
2132
+ if (result !== null) anObject$1(result);
2133
+ return result;
2134
+ }
2135
+ if (classof$1(R) === 'RegExp') return call$1(regexpExec, R, S);
2136
+ throw new $TypeError$1('RegExp#exec called on incompatible receiver');
2137
+ };
2138
+
2139
+ var apply = functionApply;
2140
+ var call = functionCall;
2141
+ var uncurryThis$1 = functionUncurryThis;
2142
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
2143
+ var fails$1 = fails$h;
2144
+ var anObject = anObject$8;
2145
+ var isCallable = isCallable$h;
2146
+ var isNullOrUndefined = isNullOrUndefined$3;
2147
+ var toIntegerOrInfinity = toIntegerOrInfinity$4;
2148
+ var toLength = toLength$2;
2149
+ var toString$1 = toString$5;
2150
+ var requireObjectCoercible$1 = requireObjectCoercible$5;
2151
+ var advanceStringIndex = advanceStringIndex$1;
2152
+ var getMethod = getMethod$2;
2153
+ var getSubstitution = getSubstitution$1;
2154
+ var regExpExec = regexpExecAbstract;
2155
+ var wellKnownSymbol$2 = wellKnownSymbol$c;
2156
+
2157
+ var REPLACE = wellKnownSymbol$2('replace');
2158
+ var max = Math.max;
2159
+ var min = Math.min;
2160
+ var concat = uncurryThis$1([].concat);
2161
+ var push = uncurryThis$1([].push);
2162
+ var stringIndexOf$1 = uncurryThis$1(''.indexOf);
2163
+ var stringSlice = uncurryThis$1(''.slice);
2164
+
2165
+ var maybeToString = function (it) {
2166
+ return it === undefined ? it : String(it);
2167
+ };
2168
+
2169
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
2170
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
2171
+ var REPLACE_KEEPS_$0 = (function () {
2172
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
2173
+ return 'a'.replace(/./, '$0') === '$0';
2174
+ })();
2175
+
2176
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
2177
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
2178
+ if (/./[REPLACE]) {
2179
+ return /./[REPLACE]('a', '$0') === '';
2180
+ }
2181
+ return false;
2182
+ })();
2183
+
2184
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$1(function () {
2185
+ var re = /./;
2186
+ re.exec = function () {
2187
+ var result = [];
2188
+ result.groups = { a: '7' };
2189
+ return result;
2190
+ };
2191
+ // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
2192
+ return ''.replace(re, '$<a>') !== '7';
2193
+ });
2194
+
2195
+ // @@replace logic
2196
+ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
2197
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
2198
+
2199
+ return [
2200
+ // `String.prototype.replace` method
2201
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
2202
+ function replace(searchValue, replaceValue) {
2203
+ var O = requireObjectCoercible$1(this);
2204
+ var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
2205
+ return replacer
2206
+ ? call(replacer, searchValue, O, replaceValue)
2207
+ : call(nativeReplace, toString$1(O), searchValue, replaceValue);
2208
+ },
2209
+ // `RegExp.prototype[@@replace]` method
2210
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
2211
+ function (string, replaceValue) {
2212
+ var rx = anObject(this);
2213
+ var S = toString$1(string);
2214
+
2215
+ if (
2216
+ typeof replaceValue == 'string' &&
2217
+ stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
2218
+ stringIndexOf$1(replaceValue, '$<') === -1
2219
+ ) {
2220
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
2221
+ if (res.done) return res.value;
2222
+ }
2223
+
2224
+ var functionalReplace = isCallable(replaceValue);
2225
+ if (!functionalReplace) replaceValue = toString$1(replaceValue);
2226
+
2227
+ var global = rx.global;
2228
+ var fullUnicode;
2229
+ if (global) {
2230
+ fullUnicode = rx.unicode;
2231
+ rx.lastIndex = 0;
2232
+ }
2233
+
2234
+ var results = [];
2235
+ var result;
2236
+ while (true) {
2237
+ result = regExpExec(rx, S);
2238
+ if (result === null) break;
2239
+
2240
+ push(results, result);
2241
+ if (!global) break;
2242
+
2243
+ var matchStr = toString$1(result[0]);
2244
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2245
+ }
2246
+
2247
+ var accumulatedResult = '';
2248
+ var nextSourcePosition = 0;
2249
+ for (var i = 0; i < results.length; i++) {
2250
+ result = results[i];
2251
+
2252
+ var matched = toString$1(result[0]);
2253
+ var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
2254
+ var captures = [];
2255
+ var replacement;
2256
+ // NOTE: This is equivalent to
2257
+ // captures = result.slice(1).map(maybeToString)
2258
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2259
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2260
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2261
+ for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
2262
+ var namedCaptures = result.groups;
2263
+ if (functionalReplace) {
2264
+ var replacerArgs = concat([matched], captures, position, S);
2265
+ if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
2266
+ replacement = toString$1(apply(replaceValue, undefined, replacerArgs));
2267
+ } else {
2268
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2269
+ }
2270
+ if (position >= nextSourcePosition) {
2271
+ accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
2272
+ nextSourcePosition = position + matched.length;
2273
+ }
2274
+ }
2275
+
2276
+ return accumulatedResult + stringSlice(S, nextSourcePosition);
2277
+ }
2278
+ ];
2279
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
2280
+
2281
+ /**
2282
+ * Sets the first word to be capitalized so that it is sentence cased.
2283
+ * @param words
2284
+ * @returns sentence word string.
2285
+ */
2286
+ const capitalizeFirstLetter = words => {
2287
+ const value = words.charAt(0).toUpperCase() + words.slice(1).toLowerCase();
2288
+ return value;
2289
+ };
2290
+ /**
2291
+ * Compares the scope name and the label to determine if it matches so that it can be sentence case.
2292
+ * @param scope - format eg: '#/properties/firstName'
2293
+ * @param label - The label text
2294
+ * @returns true if the scope and label matches, otherwise false
2295
+ */
2296
+ const controlScopeMatchesLabel = (scope, label) => {
2297
+ var _a, _b, _c;
2298
+ // Get the property name in the string from the scope
2299
+ const splitIdName = (_c = (_b = (_a = scope.replace(' ', '').split('/')) === null || _a === void 0 ? void 0 : _a.at(-1)) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : '';
2300
+ const labelWithNoSpaces = label.replace(' ', '').toLowerCase();
2301
+ if (splitIdName === labelWithNoSpaces) {
2302
+ return true;
2303
+ }
2304
+ return false;
2305
+ };
2306
+ /**
2307
+ * Gets the label text in sentence case
2308
+ * @param scope
2309
+ * @param label
2310
+ * @returns
2311
+ */
2312
+ const getLabelText = (scope, label) => {
2313
+ let labelToUpdate = '';
2314
+ if (controlScopeMatchesLabel(scope, label || '')) {
2315
+ labelToUpdate = capitalizeFirstLetter(label || '');
2316
+ } else {
2317
+ labelToUpdate = label || '';
2318
+ }
2319
+ return labelToUpdate;
2320
+ };
2321
+ const isEmptyBoolean = (schema, data) => {
2322
+ return schema.type !== undefined && schema.type === 'boolean' && (data === null || data === undefined);
2323
+ };
2324
+ const isEmptyNumber = (schema, data) => {
2325
+ return data === '' || data === undefined || data === null || (schema.type === 'number' || schema.type === 'integer') && isNaN(+data);
2326
+ };
2327
+ /**
2328
+ * Check if a required, defined input value is valid. Returns an appropriate
2329
+ * error message if not.
2330
+ * @param props
2331
+ * @returns error message
2332
+ */
2333
+ const checkFieldValidity = props => {
2334
+ const {
2335
+ data,
2336
+ errors: ajvErrors,
2337
+ required,
2338
+ label,
2339
+ uischema,
2340
+ schema
2341
+ } = props;
2342
+ const labelToUpdate = getLabelText(uischema.scope, label);
2343
+ if (required) {
2344
+ if (data === undefined) return '';
2345
+ if (schema) {
2346
+ if (isEmptyBoolean(schema, data)) {
2347
+ return `${labelToUpdate} is required`;
2348
+ }
2349
+ if (isEmptyNumber(schema, data)) {
2350
+ return `${labelToUpdate} is required`;
2351
+ }
2352
+ }
2353
+ }
2354
+ return ajvErrors;
2355
+ };
2356
+ /**
2357
+ * Check if the date is a valid date/time
2358
+ */
2359
+ const isValidDate = function isValidDate(date) {
2360
+ if (date instanceof Date && isFinite(date.getTime())) {
2361
+ return true;
2362
+ } else if (typeof date === 'string' && date.length > 0) {
2363
+ return true;
2364
+ } else {
2365
+ return false;
2366
+ }
2367
+ };
2368
+
2369
+ const GoAInputBaseControl = props => {
2370
+ var _a, _b, _c;
2371
+ // eslint-disable-next-line
2372
+ const {
2373
+ id,
2374
+ description,
2375
+ errors,
2376
+ uischema,
2377
+ visible,
2378
+ config,
2379
+ label,
2380
+ input,
2381
+ required
2382
+ } = props;
2383
+ errors.length === 0;
2384
+ const InnerComponent = input;
2385
+ const labelToUpdate = getLabelText(uischema.scope, label || '');
2386
+ let modifiedErrors = checkFieldValidity(props);
2387
+ if (modifiedErrors === 'should be equal to one of the allowed values' && ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext)) {
2388
+ modifiedErrors = '';
2389
+ }
2390
+ return jsx(Hidden, {
2391
+ xsUp: !visible,
2392
+ children: jsx(GoAFormItem, {
2393
+ requirement: required ? 'required' : undefined,
2394
+ error: modifiedErrors,
2395
+ label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
2396
+ helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
2397
+ children: jsx(InnerComponent, Object.assign({}, props))
2398
+ })
2399
+ });
2400
+ };
2401
+
2402
+ const GoAInputText = props => {
2403
+ var _a, _b, _c, _d;
2404
+ // eslint-disable-next-line
2405
+ const {
2406
+ data,
2407
+ config,
2408
+ id,
2409
+ enabled,
2410
+ uischema,
2411
+ isValid,
2412
+ errors,
2413
+ path,
2414
+ handleChange,
2415
+ schema,
2416
+ label
2417
+ } = props;
2418
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2419
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2420
+ const errorsFormInput = checkFieldValidity(props);
2421
+ const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
2422
+ return jsx(GoAInput, Object.assign({
2423
+ error: errorsFormInput.length > 0,
2424
+ type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
2425
+ disabled: !enabled,
2426
+ value: data,
2427
+ width: '100%',
2428
+ placeholder: placeholder,
2429
+ // maxLength={appliedUiSchemaOptions?.maxLength}
2430
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2431
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2432
+ // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2433
+ // If you use it onChange along with keyPress event it will cause a
2434
+ // side effect that causes the validation to render when it shouldnt.
2435
+ onChange: (name, value) => {},
2436
+ onKeyPress: (name, value, key) => {
2437
+ if (!(key === 'Tab' || key === 'Shift')) {
2438
+ if (autoCapitalize === true) {
2439
+ handleChange(path, value.toUpperCase());
2440
+ } else {
2441
+ handleChange(path, value);
2442
+ }
2443
+ }
2444
+ },
2445
+ onBlur: (name, value) => {
2446
+ if (autoCapitalize === true) {
2447
+ handleChange(path, value.toUpperCase());
2448
+ } else {
2449
+ handleChange(path, value);
2450
+ }
2451
+ }
2452
+ }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2453
+ };
2454
+ const GoATextControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2455
+ input: GoAInputText
2456
+ }));
2457
+ const GoATextControlTester = rankWith(1, isStringControl);
2458
+ const GoAInputTextControl = withJsonFormsControlProps(GoATextControl);
2459
+
2460
+ const MultiLineText = props => {
2461
+ var _a, _b, _c, _d;
2462
+ // eslint-disable-next-line
2463
+ const {
2464
+ data,
2465
+ config,
2466
+ id,
2467
+ enabled,
2468
+ uischema,
2469
+ path,
2470
+ handleChange,
2471
+ schema,
2472
+ label
2473
+ } = props;
2474
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2475
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2476
+ const errorsFormInput = checkFieldValidity(props);
2477
+ const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
2478
+ return jsx(GoATextArea, Object.assign({
2479
+ error: errorsFormInput.length > 0,
2480
+ value: data,
2481
+ disabled: !enabled,
2482
+ placeholder: placeholder,
2483
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2484
+ name: `${label || path}-text-area`,
2485
+ width: '100%',
2486
+ // Note: Paul Jan-09-2023. The latest ui-component come with the maxCount. We need to uncomment the following line when the component is updated
2487
+ // maxCount={schema.maxLength || 256}
2488
+ onKeyPress: (name, value, key) => {
2489
+ if (!(key === 'Tab' || key === 'Shift')) {
2490
+ if (autoCapitalize === true) {
2491
+ handleChange(path, value.toUpperCase());
2492
+ } else {
2493
+ handleChange(path, value);
2494
+ }
2495
+ }
2496
+ },
2497
+ // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2498
+ // If you use it onChange along with keyPress event it will cause a
2499
+ // side effect that causes the validation to render when it shouldnt.
2500
+ onChange: () => {}
2501
+ }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2502
+ };
2503
+ const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2504
+ input: MultiLineText
2505
+ }));
2506
+ const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('multi', true)));
2507
+ const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
2508
+
2509
+ /**
2510
+ * Used internally by registered Controls, the MessageControl
2511
+ * is used to display an error message if a component cannot be rendered
2512
+ * due to input errors - typically from options.componentProps.
2513
+ *
2514
+ * NOTE: The component itself is not, and should not, be registered.
2515
+ *
2516
+ * @param message the message to be displayed
2517
+ *
2518
+ * @returns component for displaying the message in the correct style
2519
+ */
2520
+ // TODO: Add styling
2521
+ const MessageControl = message => {
2522
+ return jsx(GoACallout, {
2523
+ type: "emergency",
2524
+ children: message
2525
+ });
2526
+ };
2527
+
2528
+ const errMalformedDate = (scope, type) => {
2529
+ return `${type}-date for variable '${scope}' has an incorrect format.`;
2530
+ };
2531
+ const standardizeDate = date => {
2532
+ try {
2533
+ const stdDate = new Date(date).toISOString().substring(0, 10);
2534
+ return stdDate;
2535
+ } catch (e) {
2536
+ return undefined;
2537
+ }
2538
+ };
2539
+ const isValidDateFormat = date => {
2540
+ const standardized = standardizeDate(date);
2541
+ return standardized !== undefined;
2542
+ };
2543
+ const invalidDateFormat = (scope, type) => {
2544
+ return MessageControl(errMalformedDate(scope, type));
2545
+ };
2546
+ const reformatDateProps = props => {
2547
+ if (props) {
2548
+ if ('min' in props && typeof props.min === 'string') {
2549
+ props['min'] = standardizeDate(props.min);
2550
+ }
2551
+ if ('max' in props && typeof props.max === 'string') {
2552
+ props['max'] = standardizeDate(props.max);
2553
+ }
2554
+ }
2555
+ return props;
2556
+ };
2557
+ const GoADateInput = props => {
2558
+ var _a, _b, _c, _d, _e;
2559
+ const {
2560
+ data,
2561
+ config,
2562
+ id,
2563
+ enabled,
2564
+ uischema,
2565
+ path,
2566
+ handleChange,
2567
+ label
2568
+ } = props;
2569
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2570
+ const minDate = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.min;
2571
+ if (minDate && !isValidDateFormat(minDate)) {
2572
+ return invalidDateFormat(uischema.scope, 'Min');
2573
+ }
2574
+ const maxDate = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps) === null || _d === void 0 ? void 0 : _d.max;
2575
+ if (maxDate && !isValidDateFormat(maxDate)) {
2576
+ return invalidDateFormat(uischema.scope, 'Max');
2577
+ }
2578
+ return jsx(GoAInputDate, Object.assign({
2579
+ error: checkFieldValidity(props).length > 0,
2580
+ width: "100%",
2581
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2582
+ value: standardizeDate(data) || '',
2583
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2584
+ disabled: !enabled,
2585
+ // Don't use handleChange in the onChange event, use the keyPress or onBlur.
2586
+ // If you use it onChange along with keyPress event it will cause a
2587
+ // side effect that causes the validation to render when it shouldn't.
2588
+ onChange: (name, value) => {},
2589
+ onKeyPress: (name, value, key) => {
2590
+ if (!(key === 'Tab' || key === 'Shift')) {
2591
+ value = standardizeDate(value) || '';
2592
+ handleChange(path, value);
2593
+ }
2594
+ },
2595
+ onBlur: (name, value) => {
2596
+ value = standardizeDate(value) || '';
2597
+ handleChange(path, value);
2598
+ }
2599
+ }, reformatDateProps((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.componentProps)));
2600
+ };
2601
+ const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2602
+ input: GoADateInput
2603
+ }));
2604
+ const GoADateControlTester = rankWith(4, isDateControl);
2605
+ const GoAInputDateControl = withJsonFormsControlProps(GoADateControl);
2606
+
2607
+ const GoANumberInput = props => {
2608
+ var _a;
2609
+ // eslint-disable-next-line
2610
+ const {
2611
+ data,
2612
+ config,
2613
+ id,
2614
+ enabled,
2615
+ uischema,
2616
+ isValid,
2617
+ path,
2618
+ handleChange,
2619
+ schema,
2620
+ label
2621
+ } = props;
2622
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2623
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2624
+ const InputValue = data && data !== undefined ? data : '';
2625
+ const clonedSchema = JSON.parse(JSON.stringify(schema));
2626
+ const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0.01;
2627
+ const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
2628
+ const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
2629
+ const errorsFormInput = checkFieldValidity(props);
2630
+ return jsx(GoAInput, Object.assign({
2631
+ type: "number",
2632
+ error: errorsFormInput.length > 0,
2633
+ disabled: !enabled,
2634
+ value: InputValue,
2635
+ placeholder: placeholder,
2636
+ step: StepValue,
2637
+ min: MinValue,
2638
+ max: MaxValue,
2639
+ width: "100%",
2640
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2641
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2642
+ onKeyPress: (name, value, key) => {
2643
+ if (!(key === 'Tab' || key === 'Shift')) {
2644
+ let newValue = '';
2645
+ if (value !== '') {
2646
+ newValue = +value;
2647
+ }
2648
+ handleChange(path, newValue);
2649
+ }
2650
+ },
2651
+ onBlur: (name, value) => {
2652
+ let newValue = '';
2653
+ if (value !== '') {
2654
+ newValue = +value;
2655
+ }
2656
+ handleChange(path, newValue);
2657
+ },
2658
+ //Dont trigger the handleChange event on the onChange event as it will cause
2659
+ //issue with the error message from displaying, use keyPress or the onBlur event instead
2660
+ onChange: (name, value) => {}
2661
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
2662
+ };
2663
+ const GoANumberControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2664
+ input: GoANumberInput
2665
+ }));
2666
+ const GoANumberControlTester = rankWith(2, isNumberControl);
2667
+ const GoAInputNumberControl = withJsonFormsControlProps(GoANumberControl);
2668
+
2669
+ const GoAInputInteger = props => {
2670
+ var _a;
2671
+ // eslint-disable-next-line
2672
+ const {
2673
+ data,
2674
+ config,
2675
+ id,
2676
+ enabled,
2677
+ uischema,
2678
+ isValid,
2679
+ path,
2680
+ handleChange,
2681
+ schema,
2682
+ label
2683
+ } = props;
2684
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2685
+ const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2686
+ const InputValue = data && data !== undefined ? data : '';
2687
+ const clonedSchema = JSON.parse(JSON.stringify(schema));
2688
+ const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0;
2689
+ const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
2690
+ const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
2691
+ const errorsFormInput = checkFieldValidity(props);
2692
+ return jsx(GoAInput, Object.assign({
2693
+ type: "number",
2694
+ error: errorsFormInput.length > 0,
2695
+ width: "100%",
2696
+ disabled: !enabled,
2697
+ value: InputValue,
2698
+ step: StepValue,
2699
+ min: MinValue,
2700
+ max: MaxValue,
2701
+ placeholder: placeholder,
2702
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2703
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2704
+ onKeyPress: (name, value, key) => {
2705
+ if (!(key === 'Tab' || key === 'Shift')) {
2706
+ let newValue = '';
2707
+ if (value !== '') {
2708
+ newValue = +value;
2709
+ }
2710
+ handleChange(path, newValue);
2711
+ }
2712
+ },
2713
+ onBlur: (name, value) => {
2714
+ let newValue = '';
2715
+ if (value !== '') {
2716
+ newValue = +value;
2717
+ }
2718
+ handleChange(path, newValue);
2719
+ },
2720
+ //Dont trigger the handleChange event on the onChange event as it will cause
2721
+ //issue with the error message from displaying, use keyPress or the onBlur event instead
2722
+ onChange: (name, value) => {}
2723
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
2724
+ };
2725
+ const GoAIntegerControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2726
+ input: GoAInputInteger
2727
+ }));
2728
+ const GoAIntegerControlTester = rankWith(2, isIntegerControl);
2729
+ const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
2730
+
2731
+ const GoADateTimeInput = props => {
2732
+ var _a;
2733
+ // eslint-disable-next-line
2734
+ const {
2735
+ data,
2736
+ config,
2737
+ id,
2738
+ enabled,
2739
+ uischema,
2740
+ isValid,
2741
+ path,
2742
+ errors,
2743
+ handleChange,
2744
+ schema,
2745
+ label
2746
+ } = props;
2747
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2748
+ return jsx(GoAInputDateTime, Object.assign({
2749
+ error: checkFieldValidity(props).length > 0,
2750
+ width: "100%",
2751
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2752
+ value: data ? new Date(data).toISOString() : '',
2753
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2754
+ disabled: !enabled,
2755
+ // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2756
+ // If you use it onChange along with keyPress event it will cause a
2757
+ // side effect that causes the validation to render when it shouldnt.
2758
+ onChange: (name, value) => {},
2759
+ onKeyPress: (name, value, key) => {
2760
+ var _a;
2761
+ if (!(key === 'Tab' || key === 'Shift')) {
2762
+ value = isValidDate(value) ? (_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toISOString() : '';
2763
+ handleChange(path, value);
2764
+ }
2765
+ },
2766
+ onBlur: (name, value) => {
2767
+ value = isValidDate(value) ? new Date(value).toISOString() : '';
2768
+ handleChange(path, value);
2769
+ }
2770
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
2771
+ };
2772
+ const GoADateTimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2773
+ input: GoADateTimeInput
2774
+ }));
2775
+ const GoADateTimeControlTester = rankWith(2, isDateTimeControl);
2776
+ const GoAInputDateTimeControl = withJsonFormsControlProps(GoADateTimeControl);
2777
+
2778
+ const GoATimeInput = props => {
2779
+ var _a;
2780
+ // eslint-disable-next-line
2781
+ const {
2782
+ data,
2783
+ config,
2784
+ id,
2785
+ enabled,
2786
+ uischema,
2787
+ isValid,
2788
+ path,
2789
+ handleChange,
2790
+ schema,
2791
+ label
2792
+ } = props;
2793
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2794
+ (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2795
+ const errorsFormInput = checkFieldValidity(props);
2796
+ return jsx(GoAInputTime, Object.assign({
2797
+ error: errorsFormInput.length > 0,
2798
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2799
+ value: data,
2800
+ step: 1,
2801
+ width: "100%",
2802
+ disabled: !enabled,
2803
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2804
+ onBlur: (name, value) => {
2805
+ handleChange(path, value);
2806
+ },
2807
+ // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2808
+ // If you use it onChange along with keyPress event it will cause a
2809
+ // side effect that causes the validation to render when it shouldnt.
2810
+ onChange: (name, value) => {},
2811
+ onKeyPress: (name, value, key) => {
2812
+ if (!(key === 'Tab' || key === 'Shift')) {
2813
+ handleChange(path, value);
2814
+ }
2815
+ }
2816
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
2817
+ };
2818
+ const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2819
+ input: GoATimeInput
2820
+ }));
2821
+ const GoATimeControlTester = rankWith(4, isTimeControl);
2822
+ const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
2823
+
2824
+ var $$1 = _export;
2825
+ var $includes = arrayIncludes.includes;
2826
+ var fails = fails$h;
2827
+ var addToUnscopables = addToUnscopables$2;
2828
+
2829
+ // FF99+ bug
2830
+ var BROKEN_ON_SPARSE = fails(function () {
2831
+ // eslint-disable-next-line es/no-array-prototype-includes -- detection
2832
+ return !Array(1).includes();
2833
+ });
2834
+
2835
+ // `Array.prototype.includes` method
2836
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
2837
+ $$1({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
2838
+ includes: function includes(el /* , fromIndex = 0 */) {
2839
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2840
+ }
2841
+ });
2842
+
2843
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2844
+ addToUnscopables('includes');
2845
+
2846
+ var isObject = isObject$8;
2847
+ var classof = classofRaw$1;
2848
+ var wellKnownSymbol$1 = wellKnownSymbol$c;
2849
+
2850
+ var MATCH$1 = wellKnownSymbol$1('match');
2851
+
2852
+ // `IsRegExp` abstract operation
2853
+ // https://tc39.es/ecma262/#sec-isregexp
2854
+ var isRegexp = function (it) {
2855
+ var isRegExp;
2856
+ return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
2857
+ };
2858
+
2859
+ var isRegExp = isRegexp;
2860
+
2861
+ var $TypeError = TypeError;
2862
+
2863
+ var notARegexp = function (it) {
2864
+ if (isRegExp(it)) {
2865
+ throw new $TypeError("The method doesn't accept regular expressions");
2866
+ } return it;
2867
+ };
2868
+
2869
+ var wellKnownSymbol = wellKnownSymbol$c;
2870
+
2871
+ var MATCH = wellKnownSymbol('match');
2872
+
2873
+ var correctIsRegexpLogic = function (METHOD_NAME) {
2874
+ var regexp = /./;
2875
+ try {
2876
+ '/./'[METHOD_NAME](regexp);
2877
+ } catch (error1) {
2878
+ try {
2879
+ regexp[MATCH] = false;
2880
+ return '/./'[METHOD_NAME](regexp);
2881
+ } catch (error2) { /* empty */ }
2882
+ } return false;
2883
+ };
2884
+
2885
+ var $ = _export;
2886
+ var uncurryThis = functionUncurryThis;
2887
+ var notARegExp = notARegexp;
2888
+ var requireObjectCoercible = requireObjectCoercible$5;
2889
+ var toString = toString$5;
2890
+ var correctIsRegExpLogic = correctIsRegexpLogic;
2891
+
2892
+ var stringIndexOf = uncurryThis(''.indexOf);
2893
+
2894
+ // `String.prototype.includes` method
2895
+ // https://tc39.es/ecma262/#sec-string.prototype.includes
2896
+ $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
2897
+ includes: function includes(searchString /* , position = 0 */) {
2898
+ return !!~stringIndexOf(
2899
+ toString(requireObjectCoercible(this)),
2900
+ toString(notARegExp(searchString)),
2901
+ arguments.length > 1 ? arguments[1] : undefined
2902
+ );
2903
+ }
2904
+ });
2905
+
2906
+ const getAxiosInterceptorConfig = axios => {
2907
+ const requestId = axios.interceptors.request.use(req => {
2908
+ if (req.data === undefined) {
2909
+ throw new Error(`The URL: ${req.url} encountered a CORS error.`);
2910
+ }
2911
+ return req;
2912
+ });
2913
+ return [requestId, axios];
2914
+ };
2915
+ function addDataByUrl(key, url, processDataFunction, token) {
2916
+ let header = {};
2917
+ const [requestId, axiosWithConfig] = getAxiosInterceptorConfig(axios);
2918
+ if (token) {
2919
+ header = Object.assign(Object.assign({}, header), {
2920
+ Authorization: `Bearer ${token}`
2921
+ });
2922
+ }
2923
+ axiosWithConfig.get(url, header).then(response => {
2924
+ const processedData = processDataFunction(response.data);
2925
+ enumValues.set(key, () => processedData);
2926
+ }).catch(err => {
2927
+ if (err.message.includes('CORS')) {
2928
+ console.warn(err.message);
2929
+ } else {
2930
+ console.warn(`addDataByUrl: ${err.message}`);
2931
+ }
2932
+ });
2933
+ axiosWithConfig.interceptors.request.eject(requestId);
2934
+ }
2935
+ function addDataByOptions(key, url, location, type, values) {
2936
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2937
+ const dataFunction = data => {
2938
+ let dataLink = data;
2939
+ let returnData = [''];
2940
+ const locationArray = location && !Array.isArray(location) ? [location] : location;
2941
+ locationArray === null || locationArray === void 0 ? void 0 : locationArray.forEach(attribute => {
2942
+ dataLink = dataLink[attribute];
2943
+ });
2944
+ const valuesArray = Array.isArray(values) ? values : [values];
2945
+ if (type === 'keys') {
2946
+ returnData = Object.keys(dataLink);
2947
+ } else {
2948
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2949
+ returnData = dataLink.map(entry => {
2950
+ let parse = '';
2951
+ valuesArray.forEach((v, index) => {
2952
+ parse += `${entry[v]}`;
2953
+ if (index < valuesArray.length - 1) {
2954
+ parse += ' ';
2955
+ }
2956
+ });
2957
+ return parse;
2958
+ });
2959
+ }
2960
+ return returnData;
2961
+ };
2962
+ addDataByUrl(key, url, dataFunction);
2963
+ }
2964
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2965
+ const enumValues = new Map();
2966
+ const enumFunctions = new Map();
2967
+ const baseEnumerator = {
2968
+ data: enumValues,
2969
+ functions: enumFunctions
2970
+ };
2971
+ const JsonFormContext = /*#__PURE__*/createContext(baseEnumerator);
2972
+ function ContextProvider(props) {
2973
+ var _a;
2974
+ React.useContext(JsonFormContext);
2975
+ if (props.fileManagement) {
2976
+ const {
2977
+ fileList,
2978
+ uploadFile,
2979
+ downloadFile,
2980
+ deleteFile
2981
+ } = props.fileManagement;
2982
+ /* eslint-disable @typescript-eslint/no-empty-function */
2983
+ const uploadFileFunction = uploadFile ? uploadFile : () => {};
2984
+ const downloadFileFunction = downloadFile ? downloadFile : () => {};
2985
+ const deleteFileFunction = deleteFile ? deleteFile : () => {};
2986
+ enumValues.set('file-list', () => fileList);
2987
+ enumFunctions.set('upload-file', () => uploadFileFunction);
2988
+ enumFunctions.set('download-file', () => downloadFileFunction);
2989
+ enumFunctions.set('delete-file', () => deleteFileFunction);
2990
+ }
2991
+ if (props.data) {
2992
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2993
+ (_a = props.data) === null || _a === void 0 ? void 0 : _a.forEach(item => {
2994
+ enumValues.set(Object.keys(item)[0], () => item);
2995
+ });
2996
+ }
2997
+ if (!props.children) {
2998
+ return null;
2999
+ }
3000
+ return jsx(JsonFormContext.Provider, {
3001
+ value: baseEnumerator,
3002
+ children: props.children
3003
+ });
3004
+ }
3005
+ /**
3006
+ * Grabs data stored under a given key
3007
+ *
3008
+ */
3009
+ function getData(key) {
3010
+ const dataFunction = baseEnumerator.data.get(key);
3011
+ return dataFunction && dataFunction();
3012
+ }
3013
+ /**
3014
+ * Grabs all data
3015
+ *
3016
+ */
3017
+ function getAllData() {
3018
+ const allData = [];
3019
+ baseEnumerator.data.forEach((d, key) => {
3020
+ allData.push({
3021
+ [key]: d()
3022
+ });
3023
+ });
3024
+ return allData;
3025
+ }
3026
+ /**
3027
+ * Allows additional data to be added under a given key
3028
+ *
3029
+ * This data will then be available inside the context
3030
+ */
3031
+ function addData(key, data) {
3032
+ enumValues.set(key, () => data);
3033
+ }
3034
+
3035
+ const EnumSelect = props => {
3036
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3037
+ const {
3038
+ data,
3039
+ id,
3040
+ enabled,
3041
+ errors,
3042
+ schema,
3043
+ path,
3044
+ handleChange,
3045
+ options,
3046
+ config,
3047
+ label,
3048
+ uischema
3049
+ } = props;
3050
+ let enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
3051
+ const appliedUiSchemaOptions = merge({}, config, props.uischema.options, options);
3052
+ const dataKey = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext) === null || _b === void 0 ? void 0 : _b.key;
3053
+ const url = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.enumContext) === null || _d === void 0 ? void 0 : _d.url;
3054
+ const location = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.enumContext) === null || _f === void 0 ? void 0 : _f.location;
3055
+ const type = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.enumContext) === null || _h === void 0 ? void 0 : _h.type;
3056
+ const values = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.enumContext) === null || _k === void 0 ? void 0 : _k.values;
3057
+ const errorsFormInput = checkFieldValidity(props);
3058
+ useEffect(() => {
3059
+ if (dataKey && url) {
3060
+ addDataByOptions(dataKey, url, location, type, values);
3061
+ }
3062
+ }, [url, location, type, values, dataKey]);
3063
+ if (dataKey && getData(dataKey)) {
3064
+ const newData = getData(dataKey);
3065
+ enumData = newData;
3066
+ }
3067
+ return jsx(GoADropdown, Object.assign({
3068
+ error: errorsFormInput.length > 0,
3069
+ name: `${label}`,
3070
+ value: data,
3071
+ disabled: !enabled,
3072
+ relative: true,
3073
+ testId: `${id || label}-jsonform`
3074
+ }, appliedUiSchemaOptions, {
3075
+ onChange: (name, value) => {
3076
+ handleChange(path, value);
3077
+ }
3078
+ }, (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps, {
3079
+ children: enumData === null || enumData === void 0 ? void 0 : enumData.map(item => {
3080
+ return jsx(GoADropdownItem, {
3081
+ value: `${item}`,
3082
+ label: `${item}`
3083
+ }, `json-form-dropdown-${item}`);
3084
+ })
3085
+ }), `${id}-jsonform-key`);
3086
+ };
3087
+ const numControl = props => {
3088
+ return jsx(GoAInputBaseControl, Object.assign({}, props, {
3089
+ input: EnumSelect
3090
+ }));
3091
+ };
3092
+ const GoAEnumControlTester = rankWith(2, isEnumControl);
3093
+ // HOC order can be reversed with https://github.com/eclipsesource/jsonforms/issues/1987
3094
+ const GoAEnumControl = withJsonFormsEnumProps(withTranslateProps(numControl), true);
3095
+
3096
+ const EnumSelectAutoComplete = props => {
3097
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3098
+ const {
3099
+ data,
3100
+ schema,
3101
+ path,
3102
+ handleChange,
3103
+ uischema
3104
+ } = props;
3105
+ let enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
3106
+ const dataKey = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext) === null || _b === void 0 ? void 0 : _b.key;
3107
+ const url = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.enumContext) === null || _d === void 0 ? void 0 : _d.url;
3108
+ const location = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.enumContext) === null || _f === void 0 ? void 0 : _f.location;
3109
+ const type = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.enumContext) === null || _h === void 0 ? void 0 : _h.type;
3110
+ const values = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.enumContext) === null || _k === void 0 ? void 0 : _k.values;
3111
+ const defaultProps = {
3112
+ options: enumData,
3113
+ getOptionLabel: option => option
3114
+ };
3115
+ const [inputValue, setInputValue] = React.useState('');
3116
+ useEffect(() => {
3117
+ if (dataKey && url) {
3118
+ addDataByOptions(dataKey, url, location, type, values);
3119
+ }
3120
+ }, [url, location, type, values, dataKey]);
3121
+ if (dataKey && getData(dataKey)) {
3122
+ const newData = getData(dataKey);
3123
+ // eslint-disable-next-line
3124
+ enumData = newData;
3125
+ defaultProps.options = enumData;
3126
+ }
3127
+ return jsx(Autocomplete, Object.assign({}, defaultProps, {
3128
+ id: "autocomplete",
3129
+ getOptionLabel: option => option,
3130
+ isOptionEqualToValue: (option, value) => option.id === value.id,
3131
+ value: data || null,
3132
+ onChange: (name, value) => {
3133
+ handleChange(path, value);
3134
+ setInputValue(value);
3135
+ },
3136
+ renderInput: params => {
3137
+ return jsx(TextField, Object.assign({}, params, {
3138
+ variant: "outlined",
3139
+ size: "small",
3140
+ placeholder: schema === null || schema === void 0 ? void 0 : schema.description
3141
+ }));
3142
+ }
3143
+ }));
3144
+ };
3145
+ const numControlAutoComplete = props => {
3146
+ return jsx(GoAInputBaseControl, Object.assign({}, props, {
3147
+ input: EnumSelectAutoComplete
3148
+ }));
3149
+ };
3150
+ const GoAEnumControlAutoCompleteTester = rankWith(3, and(isEnumControl, optionIs('autocomplete', true)));
3151
+ const GoAEnumAutoCompleteControl = withJsonFormsEnumProps(withTranslateProps(numControlAutoComplete), true);
3152
+
3153
+ const RadioGroup = props => {
3154
+ var _a;
3155
+ const {
3156
+ data,
3157
+ className,
3158
+ id,
3159
+ enabled,
3160
+ schema,
3161
+ uischema,
3162
+ path,
3163
+ handleChange,
3164
+ options,
3165
+ config,
3166
+ label,
3167
+ t
3168
+ } = props;
3169
+ const enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
3170
+ const appliedUiSchemaOptions = merge({}, config, props.uischema.options, uischema, options);
3171
+ const errorsFormInput = checkFieldValidity(props);
3172
+ return jsx(GoARadioGroup, Object.assign({
3173
+ error: errorsFormInput.length > 0,
3174
+ name: `${options || appliedUiSchemaOptions.label}`,
3175
+ testId: `${id || label}-jsonform-dropdown`,
3176
+ value: data,
3177
+ disabled: !enabled
3178
+ }, appliedUiSchemaOptions, {
3179
+ onChange: (name, value) => handleChange(path, value)
3180
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
3181
+ children: enumData.map(value => {
3182
+ return jsx(GoARadioItem, Object.assign({
3183
+ name: value,
3184
+ value: `${value}`,
3185
+ label: value
3186
+ }, appliedUiSchemaOptions));
3187
+ })
3188
+ }));
3189
+ };
3190
+ const EnumRadioControl = props => {
3191
+ return jsx(GoAInputBaseControl, Object.assign({}, props, {
3192
+ input: RadioGroup
3193
+ }));
3194
+ };
3195
+ const GoAEnumRadioGroupControl = withJsonFormsEnumProps(withTranslateProps(EnumRadioControl), true);
3196
+ const GoARadioGroupControlTester = rankWith(20, and(isEnumControl, optionIs('format', 'radio')));
3197
+
3198
+ const BooleanComponent = ({
3199
+ data,
3200
+ visible,
3201
+ enabled,
3202
+ uischema,
3203
+ handleChange,
3204
+ path,
3205
+ config,
3206
+ label,
3207
+ required,
3208
+ errors,
3209
+ description
3210
+ }) => {
3211
+ var _a;
3212
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema.options);
3213
+ !isDescriptionHidden(visible, description, false, appliedUiSchemaOptions.showUnfocusedDescription);
3214
+ const errorsFormInput = checkFieldValidity({
3215
+ data,
3216
+ uischema,
3217
+ label,
3218
+ required,
3219
+ errors
3220
+ });
3221
+ let text = label + (required ? ' (required)' : '');
3222
+ if (label && description) {
3223
+ text = description;
3224
+ if (required) {
3225
+ text = `${description} ` + (required ? ' (required)' : '');
3226
+ }
3227
+ }
3228
+ return jsx(GoACheckbox, Object.assign({
3229
+ error: errorsFormInput.length > 0,
3230
+ testId: `${path}-checkbox-test-id`,
3231
+ disabled: !enabled,
3232
+ text: text,
3233
+ name: `${path}`,
3234
+ checked: data,
3235
+ onChange: (name, checked, value) => {
3236
+ handleChange(path, checked);
3237
+ }
3238
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
3239
+ };
3240
+ const BooleanControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3241
+ noLabel: true,
3242
+ input: BooleanComponent
3243
+ }));
3244
+ const GoABooleanControlTester = rankWith(2, isBooleanControl);
3245
+ const GoABooleanControl = withJsonFormsControlProps(BooleanControl);
3246
+
3247
+ const BooleanRadioComponent = ({
3248
+ data,
3249
+ visible,
3250
+ enabled,
3251
+ uischema,
3252
+ handleChange,
3253
+ path,
3254
+ config,
3255
+ label,
3256
+ required,
3257
+ errors,
3258
+ description
3259
+ }) => {
3260
+ var _a;
3261
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
3262
+ const TrueValue = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.textForTrue) || 'Yes';
3263
+ const FalseValue = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.textForFalse) || 'No';
3264
+ const EnableDescription = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.enableDescription) === true;
3265
+ const TrueDescription = description || (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.descriptionForTrue);
3266
+ const FalseDescription = description || (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.descriptionForFalse);
3267
+ const BaseTestId = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${path}-boolean-radio-jsonform`;
3268
+ const errorsFormInput = checkFieldValidity({
3269
+ data,
3270
+ uischema,
3271
+ label,
3272
+ required,
3273
+ errors
3274
+ });
3275
+ return jsx(Hidden, {
3276
+ xsUp: !visible,
3277
+ children: jsxs(GoARadioGroup, Object.assign({
3278
+ error: errorsFormInput.length > 0,
3279
+ name: `${label}`,
3280
+ value: data === true ? TrueValue : data === false ? FalseValue : null,
3281
+ disabled: !enabled,
3282
+ testId: BaseTestId,
3283
+ onChange: (_name, value) => {
3284
+ if (value === TrueValue) {
3285
+ handleChange(path, true);
3286
+ }
3287
+ if (value === FalseValue) {
3288
+ handleChange(path, false);
3289
+ }
3290
+ }
3291
+ }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
3292
+ children: [jsx(GoARadioItem, {
3293
+ value: TrueValue,
3294
+ testId: `${BaseTestId}-yes-option`,
3295
+ description: EnableDescription ? TrueDescription : null
3296
+ }), jsx(GoARadioItem, {
3297
+ value: FalseValue,
3298
+ testId: `${BaseTestId}-no-option`,
3299
+ description: EnableDescription ? FalseDescription : null
3300
+ })]
3301
+ }))
3302
+ });
3303
+ };
3304
+ const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3305
+ input: BooleanRadioComponent
3306
+ }));
3307
+ const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
3308
+ const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
3309
+
3310
+ let _$5 = t => t,
3311
+ _t$5,
3312
+ _t2$3;
3313
+ const Grid = styled.div(_t$5 || (_t$5 = _$5`
3314
+ display: flex;
3315
+ flex-direction: row;
3316
+ flex-wrap: wrap;
3317
+ justify-content: space-between;
3318
+ align-items: stretch;
3319
+ `));
3320
+ const GridItem = styled.div(_t2$3 || (_t2$3 = _$5`
3321
+ margin-bottom: ${0};
3322
+
3323
+ > .goa-card {
3324
+ height: 100% !important;
3325
+ width: 100% !important;
3326
+ }
3327
+
3328
+ > img {
3329
+ width: 100%;
3330
+ }
3331
+
3332
+ flex: 0 1
3333
+ ${0};
3334
+
3335
+ @media (min-width: 768px) {
3336
+ flex-basis: ${0};
3337
+ }
3338
+ @media (min-width: 1024px) {
3339
+ flex-basis: ${0};
3340
+ }
3341
+ @media (min-width: 1280px) {
3342
+ flex-basis: ${0};
3343
+ }
3344
+ `), props => {
3345
+ var _a;
3346
+ return `${(_a = props.vSpacing) !== null && _a !== void 0 ? _a : 0}rem`;
3347
+ }, props => {
3348
+ var _a, _b;
3349
+ return props.sm === 12 || props.sm === undefined ? '100%' : `calc(${100 * ((_a = props === null || props === void 0 ? void 0 : props.sm) !== null && _a !== void 0 ? _a : 12) / 12}% - ${(_b = props.hSpacing) !== null && _b !== void 0 ? _b : 0}rem)`;
3350
+ }, props => {
3351
+ var _a, _b, _c;
3352
+ return props.md === 12 ? '100%' : `calc(${100 * ((_b = (_a = props === null || props === void 0 ? void 0 : props.md) !== null && _a !== void 0 ? _a : props.sm) !== null && _b !== void 0 ? _b : 12) / 12}% - ${(_c = props.hSpacing) !== null && _c !== void 0 ? _c : 0}rem)`;
3353
+ }, props => {
3354
+ var _a, _b, _c, _d;
3355
+ return props.lg === 12 ? '100%' : `calc(${100 * ((_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.lg) !== null && _a !== void 0 ? _a : props === null || props === void 0 ? void 0 : props.md) !== null && _b !== void 0 ? _b : props.sm) !== null && _c !== void 0 ? _c : 12) / 12}% - ${(_d = props.hSpacing) !== null && _d !== void 0 ? _d : 0}rem)`;
3356
+ }, props => {
3357
+ var _a, _b, _c, _d;
3358
+ return props.xl === 12 ? '100%' : `calc(${100 * ((_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.xl) !== null && _a !== void 0 ? _a : props === null || props === void 0 ? void 0 : props.md) !== null && _b !== void 0 ? _b : props.sm) !== null && _c !== void 0 ? _c : 12) / 12}% - ${(_d = props.hSpacing) !== null && _d !== void 0 ? _d : 0}rem)`;
3359
+ });
3360
+
3361
+ let _$4 = t => t,
3362
+ _t$4,
3363
+ _t2$2,
3364
+ _t3$1;
3365
+ const ReviewItem = styled.div(_t$4 || (_t$4 = _$4`
3366
+ display: flex;
3367
+ border: var(--goa-border-width-s) solid grey;
3368
+ border-radius: var(--goa-border-radius-m);
3369
+ margin: var(--goa-space-2xs);
3370
+ padding: var(--goa-space-xs);
3371
+ `));
3372
+ const ReviewListItem = styled.div(_t2$2 || (_t2$2 = _$4`
3373
+ margin-left: var(--goa-space-m);
3374
+ `));
3375
+ const ReviewListWrapper = styled.div(_t3$1 || (_t3$1 = _$4`
3376
+ margin-bottom: var(--goa-space-m);
3377
+ `));
3378
+
3379
+ const FormStepper = ({
3380
+ uischema,
3381
+ data,
3382
+ schema,
3383
+ // eslint-disable-next-line
3384
+ ajv,
3385
+ path,
3386
+ cells,
3387
+ renderers,
3388
+ config,
3389
+ visible,
3390
+ enabled,
3391
+ t
3392
+ }) => {
3393
+ var _a;
3394
+ const categorization = uischema;
3395
+ const [step, setStep] = useState(0);
3396
+ const [isFormValid, setIsFormValid] = useState(false);
3397
+ const [showNextBtn, setShowNextBtn] = useState(true);
3398
+ const categories = useMemo(() => categorization.elements.filter(category => isVisible(category, data, '', ajv)), [categorization, data, ajv]);
3399
+ const disabledCategoryMap = categories.map(c => !isEnabled(c, data, '', ajv));
3400
+ const handleSubmit = () => {
3401
+ console.log('submitted', data);
3402
+ };
3403
+ const CategoryLabels = useMemo(() => {
3404
+ return categories.map(e => deriveLabelForUISchemaElement(e, t));
3405
+ }, [categories, t]);
3406
+ useEffect(() => {}, [categories.length]);
3407
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3408
+ const vslidateFormData = formData => {
3409
+ const validate = ajv.compile(schema);
3410
+ return validate(formData);
3411
+ };
3412
+ useEffect(() => {
3413
+ const valid = vslidateFormData(data);
3414
+ setIsFormValid(valid);
3415
+ }, [data, vslidateFormData]);
3416
+ if ((categories === null || categories === void 0 ? void 0 : categories.length) < 1) {
3417
+ // eslint-disable-next-line
3418
+ return jsx(Fragment, {});
3419
+ }
3420
+ function nextPage(page, disabled) {
3421
+ page++;
3422
+ while (page <= disabled.length && disabled[page - 1]) {
3423
+ page++;
3424
+ }
3425
+ setPage(page);
3426
+ }
3427
+ function prevPage(page, disabled) {
3428
+ page--;
3429
+ while (page >= 0 && disabled[page - 1]) {
3430
+ page--;
3431
+ }
3432
+ setPage(page);
3433
+ }
3434
+ function setPage(page) {
3435
+ setStep(page);
3436
+ if (page < 1 || page > categories.length + 1) return;
3437
+ if (categories.length + 1 === page) {
3438
+ setShowNextBtn(false);
3439
+ } else {
3440
+ setShowNextBtn(true);
3441
+ }
3442
+ }
3443
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3444
+ useEffect(() => {
3445
+ setStep(0);
3446
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3447
+ }, []);
3448
+ const renderStepElements = (category, indexOfCategory) => {
3449
+ return (
3450
+ /*
3451
+ [Mar-04-2024][Paul Li] the GoAPages internal state cannot handle the hidden/display well. We need extra hide/display control to it appropriately.
3452
+ */
3453
+ jsx(Hidden, {
3454
+ xsUp: indexOfCategory !== step - 1,
3455
+ children: category.elements.map((elementUiSchema, index) => {
3456
+ return jsx(JsonFormsDispatch, {
3457
+ schema: schema,
3458
+ uischema: elementUiSchema,
3459
+ renderers: renderers,
3460
+ cells: cells,
3461
+ path: path,
3462
+ visible: visible,
3463
+ enabled: enabled && !disabledCategoryMap[indexOfCategory]
3464
+ }, index);
3465
+ })
3466
+ })
3467
+ );
3468
+ };
3469
+ return jsx(Hidden, {
3470
+ xsUp: !visible,
3471
+ children: jsxs("div", {
3472
+ id: `${path || `goa`}-form-stepper`,
3473
+ className: "formStepper",
3474
+ children: [jsxs(GoAFormStepper, {
3475
+ testId: "form-stepper-test",
3476
+ step: step,
3477
+ onChange: step => {
3478
+ setPage(step);
3479
+ },
3480
+ children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
3481
+ return jsx(GoAFormStep, {
3482
+ text: `${CategoryLabels[index]}${disabledCategoryMap[index] ? ' (disabled)' : ''}`,
3483
+ status: 'incomplete'
3484
+ }, `${CategoryLabels[index]}-tab`);
3485
+ }), jsx(GoAFormStep, {
3486
+ text: "Review",
3487
+ status: "incomplete"
3488
+ })]
3489
+ }), jsxs(GoAPages, {
3490
+ current: step,
3491
+ mb: "xl",
3492
+ children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
3493
+ return jsx("div", {
3494
+ "data-testid": `step_${index}-content`,
3495
+ children: renderStepElements(category, index)
3496
+ }, `${CategoryLabels[index]}`);
3497
+ }), jsxs("div", {
3498
+ children: [jsx("h3", {
3499
+ style: {
3500
+ flex: 1
3501
+ },
3502
+ children: "Summary"
3503
+ }), jsx(ReviewItem, {
3504
+ children: jsx("div", {
3505
+ style: {
3506
+ width: '100%'
3507
+ },
3508
+ children: data && ((_a = Object.keys(data)) === null || _a === void 0 ? void 0 : _a.length) > 0 && jsx(Grid, {
3509
+ children: Object.keys(flattenObject(data)).map((key, ix) => {
3510
+ return jsxs(GridItem, {
3511
+ md: 6,
3512
+ vSpacing: 1,
3513
+ hSpacing: 0.5,
3514
+ children: [jsx("b", {
3515
+ children: key
3516
+ }), " : ", jsx(PreventControlElement, {
3517
+ value: flattenObject(data)[key]
3518
+ }, ix)]
3519
+ }, ix);
3520
+ })
3521
+ })
3522
+ })
3523
+ })]
3524
+ })]
3525
+ }), step && step !== 0 && jsxs("div", {
3526
+ style: {
3527
+ display: 'flex',
3528
+ justifyContent: 'space-between'
3529
+ },
3530
+ children: [step !== 1 ? jsx(GoAButton, {
3531
+ type: "secondary",
3532
+ disabled: disabledCategoryMap[step - 1] || !enabled,
3533
+ onClick: () => prevPage(step, disabledCategoryMap),
3534
+ children: "Previous"
3535
+ }) : jsx("div", {}), step !== null && showNextBtn && jsx(GoAButton, {
3536
+ type: "primary",
3537
+ disabled: disabledCategoryMap[step - 1] || !enabled,
3538
+ onClick: () => nextPage(step, disabledCategoryMap),
3539
+ children: "Next"
3540
+ }), !showNextBtn && jsx("div", {
3541
+ children: jsx(GoAButton, {
3542
+ type: "primary",
3543
+ onClick: handleSubmit,
3544
+ disabled: !isFormValid || !enabled,
3545
+ children: "Submit"
3546
+ })
3547
+ })]
3548
+ })]
3549
+ })
3550
+ });
3551
+ };
3552
+ const PreventControlElement = props => {
3553
+ if (typeof (props === null || props === void 0 ? void 0 : props.value) === 'string') return jsx("span", {
3554
+ children: props.value
3555
+ });
3556
+ if (Array.isArray(props === null || props === void 0 ? void 0 : props.value)) {
3557
+ return jsx("div", {
3558
+ children: props.value.map((item, index) => {
3559
+ return jsx(ReviewListWrapper, {
3560
+ children: item && Object.keys(item).map((key, innerIndex) => {
3561
+ if (typeof item[key] === 'string') {
3562
+ return jsxs(ReviewListItem, {
3563
+ children: [key, ": ", item[key]]
3564
+ }, innerIndex);
3565
+ }
3566
+ return jsxs(ReviewListItem, {
3567
+ children: [key, ": ", String(item[key])]
3568
+ }, innerIndex);
3569
+ })
3570
+ }, index);
3571
+ })
3572
+ });
3573
+ }
3574
+ // eslint-disable-next-line
3575
+ return jsx(Fragment, {});
3576
+ };
3577
+ const flattenObject = obj => {
3578
+ const flattened = {};
3579
+ Object.keys(obj || {}).forEach(key => {
3580
+ const value = obj[key];
3581
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
3582
+ Object.assign(flattened, flattenObject(value));
3583
+ } else {
3584
+ flattened[key] = value;
3585
+ }
3586
+ });
3587
+ return flattened;
3588
+ };
3589
+ const FormStepperControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepper)));
3590
+
3591
+ // Ensure that all children (Category) have valid elements or things tend
3592
+ // to blow up. If not, the the error control will report the problem.
3593
+ const categoriesAreValid = uischema => {
3594
+ let isValid = true;
3595
+ if ('type' in uischema && uischema.type === 'Categorization' && 'elements' in uischema) {
3596
+ uischema.elements.forEach(e => {
3597
+ if (e.type !== 'Category' || !('elements' in e)) {
3598
+ isValid = false;
3599
+ }
3600
+ });
3601
+ } else {
3602
+ return false;
3603
+ }
3604
+ return isValid;
3605
+ };
3606
+ const CategorizationRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, optionIs('variant', 'stepper')));
3607
+
3608
+ /******************************************************************************
3609
+ Copyright (c) Microsoft Corporation.
3610
+
3611
+ Permission to use, copy, modify, and/or distribute this software for any
3612
+ purpose with or without fee is hereby granted.
3613
+
3614
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3615
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3616
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3617
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3618
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3619
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3620
+ PERFORMANCE OF THIS SOFTWARE.
3621
+ ***************************************************************************** */
3622
+
3623
+ function __rest(s, e) {
3624
+ var t = {};
3625
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3626
+ t[p] = s[p];
3627
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3628
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3629
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3630
+ t[p[i]] = s[p[i]];
3631
+ }
3632
+ return t;
3633
+ }
3634
+
3635
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3636
+ var e = new Error(message);
3637
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3638
+ };
3639
+
3640
+ let _$3 = t => t,
3641
+ _t$3;
3642
+ const GoAContextMenuIcon = props => {
3643
+ return jsx(GoAIconButton, {
3644
+ icon: props.type,
3645
+ onClick: props.onClick,
3646
+ title: props.title,
3647
+ testId: props.testId,
3648
+ size: "small",
3649
+ disabled: props.disabled
3650
+ });
3651
+ };
3652
+ const GoAContextMenu = styled.div(_t$3 || (_t$3 = _$3`
3653
+ display: flex;
3654
+ align-items: center;
3655
+ background-color: #fff;
3656
+ gap: var(--goa-space-2xs);
3657
+
3658
+ > .goa-icon-button {
3659
+ cursor: pointer;
3660
+ border-radius: var(--goa-border-radius-m);
3661
+ padding: var(--goa-space-2xs);
3662
+ }
3663
+ > .goa-icon-button + .goa-icon-button {
3664
+ margin-left: var(--goa-space-none);
3665
+ }
3666
+ `));
3667
+
3668
+ let _$2 = t => t,
3669
+ _t$2,
3670
+ _t2$1;
3671
+ const FileUploader = _a => {
3672
+ var _b;
3673
+ var {
3674
+ data,
3675
+ path,
3676
+ handleChange,
3677
+ uischema
3678
+ } = _a,
3679
+ props = __rest(_a, ["data", "path", "handleChange", "uischema"]);
3680
+ const enumerators = useContext(JsonFormContext);
3681
+ const uploadTriggerFunction = enumerators.functions.get('upload-file');
3682
+ const uploadTrigger = uploadTriggerFunction && uploadTriggerFunction();
3683
+ const downloadTriggerFunction = enumerators.functions.get('download-file');
3684
+ const downloadTrigger = downloadTriggerFunction && downloadTriggerFunction();
3685
+ const deleteTriggerFunction = enumerators.functions.get('delete-file');
3686
+ const deleteTrigger = deleteTriggerFunction && deleteTriggerFunction();
3687
+ const fileListValue = enumerators.data.get('file-list');
3688
+ // eslint-disable-next-line
3689
+ const fileList = fileListValue && fileListValue();
3690
+ const {
3691
+ required,
3692
+ label,
3693
+ i18nKeyPrefix
3694
+ } = props;
3695
+ const propertyId = i18nKeyPrefix;
3696
+ const variant = ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.variant) || 'button';
3697
+ function uploadFile(file) {
3698
+ if (uploadTrigger) {
3699
+ handleChange(propertyId, ['Loading', Array.isArray(data) ? data[1] : data, file === null || file === void 0 ? void 0 : file.name]);
3700
+ uploadTrigger(file, propertyId);
3701
+ }
3702
+ }
3703
+ function downloadFile(file) {
3704
+ if (downloadTrigger) {
3705
+ downloadTrigger(file, propertyId);
3706
+ }
3707
+ }
3708
+ function deleteFile(file) {
3709
+ if (deleteTrigger) {
3710
+ deleteTrigger(file, propertyId);
3711
+ }
3712
+ }
3713
+ useEffect(() => {
3714
+ // UseEffect is required because not having it causes a react update error, but
3715
+ // it doesn't function correctly within jsonforms unless there is a minor delay here
3716
+ const delayedFunction = () => {
3717
+ var _a, _b;
3718
+ if (fileList && Array.isArray(data) && data[1] !== ((_a = fileList[propertyId]) === null || _a === void 0 ? void 0 : _a.urn)) {
3719
+ handleChange(propertyId, fileList && ((_b = fileList[propertyId]) === null || _b === void 0 ? void 0 : _b.urn));
3720
+ }
3721
+ };
3722
+ const timeoutId = setTimeout(delayedFunction, 1);
3723
+ return () => clearTimeout(timeoutId);
3724
+ }, [data, handleChange, fileList, propertyId]);
3725
+ return jsxs(FileUploaderStyle, {
3726
+ id: "file-upload",
3727
+ className: "FileUploader",
3728
+ children: [required ? jsx(GoAFormItem, {
3729
+ label: label,
3730
+ requirement: "required"
3731
+ }) : jsx("div", {
3732
+ className: "label",
3733
+ children: props.label
3734
+ }), jsx("div", {
3735
+ className: "file-upload",
3736
+ children: jsx(GoAFileUploadInput, {
3737
+ variant: variant,
3738
+ onSelectFile: uploadFile
3739
+ })
3740
+ }), jsx("div", {
3741
+ children: Array.isArray(data) && data[0] === 'Loading' ? jsx(GoAModal, {
3742
+ open: Array.isArray(data) && data[0] === 'Loading',
3743
+ children: jsx("div", {
3744
+ className: "align-center",
3745
+ children: jsx(GoACircularProgress, {
3746
+ visible: true,
3747
+ message: `Uploading ${data[2]}`,
3748
+ size: "large"
3749
+ })
3750
+ })
3751
+ }) : jsx("div", {
3752
+ children: fileList && fileList[props.i18nKeyPrefix] && jsxs(AttachmentBorder, {
3753
+ children: [jsx("div", {
3754
+ children: fileList && fileList[props.i18nKeyPrefix].filename
3755
+ }), jsxs(GoAContextMenu, {
3756
+ children: [jsx(GoAContextMenuIcon, {
3757
+ testId: "download-icon",
3758
+ title: "Download",
3759
+ type: "download",
3760
+ onClick: () => downloadFile(fileList && fileList[props.i18nKeyPrefix])
3761
+ }), jsx(GoAContextMenuIcon, {
3762
+ "data-testid": "delete-icon",
3763
+ title: "Delete",
3764
+ type: "trash",
3765
+ onClick: () => deleteFile(fileList && fileList[props.i18nKeyPrefix])
3766
+ })]
3767
+ })]
3768
+ })
3769
+ })
3770
+ })]
3771
+ });
3772
+ };
3773
+ const AttachmentBorder = styled.div(_t$2 || (_t$2 = _$2`
3774
+ display: flex;
3775
+ flex-direction: row;
3776
+ border: var(--goa-border-width-s) solid #dcdcdc;
3777
+ border-radius: var(--goa-border-radius-m);
3778
+ padding: var(--goa-space-xs);
3779
+ width: fit-content;
3780
+ margin-top: var(--goa-space-2xs);
3781
+ `));
3782
+ const FileUploaderStyle = styled.div(_t2$1 || (_t2$1 = _$2`
3783
+ .label {
3784
+ display: block;
3785
+ font-weight: var(--goa-font-weight-bold);
3786
+ color: var(--goa-color-text-default);
3787
+ font-size: var(--goa-font-size-4);
3788
+ padding: 0 0 var(--goa-space-xs) 0;
3789
+ }
3790
+
3791
+ .align-center {
3792
+ text-align-last: center;
3793
+ }
3794
+
3795
+ .file-upload {
3796
+ margin-bottom: var(--goa-space-xs);
3797
+ }
3798
+ `));
3799
+
3800
+ const FileUploaderTester = rankWith(3, and(schemaTypeIs('string'), formatIs('file-urn')));
3801
+
3802
+ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
3803
+ numColumns,
3804
+ errors,
3805
+ label,
3806
+ path,
3807
+ addItem,
3808
+ schema,
3809
+ enabled,
3810
+ translations,
3811
+ rootSchema,
3812
+ uischema
3813
+ }) {
3814
+ var _a, _b;
3815
+ const buttonPosition = ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.addButtonPosition) || 'left';
3816
+ return jsx(Fragment, {
3817
+ children: jsx("div", {
3818
+ style: {
3819
+ textAlign: buttonPosition
3820
+ },
3821
+ children: jsx(GoAButton, {
3822
+ disabled: !enabled,
3823
+ testId: `object-array-toolbar-${label}`,
3824
+ "aria-label": translations.addAriaLabel,
3825
+ onClick: addItem(path, createDefaultValue(schema, rootSchema)),
3826
+ children: ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.addButtonText) || 'Add'
3827
+ })
3828
+ })
3829
+ });
3830
+ });
3831
+
3832
+ let _$1 = t => t,
3833
+ _t$1,
3834
+ _t2,
3835
+ _t3;
3836
+ const DeleteDialogContent = styled.div(_t$1 || (_t$1 = _$1`
3837
+ margin-bottom: var(--goa-space-m);
3838
+ `));
3839
+ const ToolBarHeader = styled.div(_t2 || (_t2 = _$1`
3840
+ margin-bottom: var(--goa-space-l);
3841
+ `));
3842
+ const ObjectArrayTitle = styled.h2(_t3 || (_t3 = _$1`
3843
+ margin-bottom: var(--goa-space-l);
3844
+ `));
3845
+
3846
+ // eslint-disable-next-line
3847
+ const extractScopesFromUISchema = uischema => {
3848
+ var _a;
3849
+ const scopes = [];
3850
+ if (uischema === null || uischema === void 0 ? void 0 : uischema.elements) {
3851
+ // eslint-disable-next-line
3852
+ (_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.forEach(element => {
3853
+ var _a;
3854
+ if (element === null || element === void 0 ? void 0 : element.elements) {
3855
+ // eslint-disable-next-line
3856
+ (_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.forEach(internalElement => {
3857
+ if (internalElement === null || internalElement === void 0 ? void 0 : internalElement.scope) {
3858
+ scopes.push(internalElement === null || internalElement === void 0 ? void 0 : internalElement.scope);
3859
+ }
3860
+ });
3861
+ }
3862
+ });
3863
+ }
3864
+ return scopes;
3865
+ };
3866
+ const GenerateRows = (Cell, schema, rowPath, enabled, cells, uischema) => {
3867
+ if (schema.type === 'object') {
3868
+ const props = {
3869
+ schema,
3870
+ rowPath,
3871
+ enabled,
3872
+ cells,
3873
+ uischema
3874
+ };
3875
+ return jsx(Cell, Object.assign({}, props));
3876
+ } else {
3877
+ // primitives
3878
+ const props = {
3879
+ schema,
3880
+ rowPath,
3881
+ cellPath: rowPath,
3882
+ enabled
3883
+ };
3884
+ return jsx(Cell, Object.assign({}, props), rowPath);
3885
+ }
3886
+ };
3887
+ const getValidColumnProps = scopedSchema => {
3888
+ if (scopedSchema.type === 'object' && typeof scopedSchema.properties === 'object') {
3889
+ return Object.keys(scopedSchema.properties).filter(prop => {
3890
+ var _a;
3891
+ return ((_a = scopedSchema.properties) === null || _a === void 0 ? void 0 : _a[prop].type) !== 'array';
3892
+ });
3893
+ }
3894
+ // primitives
3895
+ return [''];
3896
+ };
3897
+ const EmptyList = ({
3898
+ numColumns,
3899
+ translations
3900
+ }) => jsx(GoAGrid, {
3901
+ minChildWidth: "30ch",
3902
+ children: jsx(Typography, {
3903
+ align: "center",
3904
+ children: jsx("b", {
3905
+ children: translations.noDataMessage
3906
+ })
3907
+ })
3908
+ });
3909
+ const ctxToNonEmptyCellProps = (ctx, ownProps) => {
3910
+ var _a;
3911
+ ownProps.rowPath + (ownProps.schema.type === 'object' ? '.' + ownProps.propName : '');
3912
+ const errors = '';
3913
+ return {
3914
+ uischema: ownProps.uischema,
3915
+ rowPath: ownProps.rowPath,
3916
+ schema: ownProps.schema,
3917
+ rootSchema: (_a = ctx.core) === null || _a === void 0 ? void 0 : _a.schema,
3918
+ errors,
3919
+ enabled: ownProps.enabled,
3920
+ cells: ownProps.cells || ctx.cells,
3921
+ renderers: ownProps.renderers || ctx.renderers
3922
+ };
3923
+ };
3924
+ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent({
3925
+ schema,
3926
+ errors,
3927
+ enabled,
3928
+ renderers,
3929
+ cells,
3930
+ rowPath,
3931
+ isValid,
3932
+ uischema
3933
+ }) {
3934
+ var _a, _b;
3935
+ const propNames = getValidColumnProps(schema);
3936
+ const propScopes = (uischema === null || uischema === void 0 ? void 0 : uischema.scope) ? propNames.map(name => {
3937
+ return `#/properties/${name}`;
3938
+ }) : [];
3939
+ const scopesInElements = extractScopesFromUISchema(uischema);
3940
+ const scopesNotInElements = propScopes.filter(scope => {
3941
+ return !scopesInElements.includes(scope);
3942
+ });
3943
+ /* Create default elements for scope not defined in the uischema
3944
+ * future work: merge the options
3945
+ */
3946
+ const uiSchemaElementsForNotDefined = {
3947
+ type: ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.defaultType) || 'VerticalLayout',
3948
+ elements: scopesNotInElements.map(scope => {
3949
+ return {
3950
+ type: 'Control',
3951
+ scope
3952
+ };
3953
+ })
3954
+ };
3955
+ return jsxs(Fragment, {
3956
+ children: [
3957
+ // eslint-disable-next-line
3958
+ (_b = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _b === void 0 ? void 0 : _b.map(element => {
3959
+ return jsx(JsonFormsDispatch, {
3960
+ schema: schema,
3961
+ uischema: element,
3962
+ path: rowPath,
3963
+ enabled: enabled,
3964
+ renderers: renderers,
3965
+ cells: cells
3966
+ }, rowPath);
3967
+ }), jsx(JsonFormsDispatch, {
3968
+ schema: schema,
3969
+ uischema: uiSchemaElementsForNotDefined,
3970
+ path: rowPath,
3971
+ enabled: enabled,
3972
+ renderers: renderers,
3973
+ cells: cells
3974
+ }), jsx(FormHelperText, {
3975
+ error: !isValid,
3976
+ children: !isValid && errors
3977
+ })]
3978
+ });
3979
+ });
3980
+ const NonEmptyCell = ownProps => {
3981
+ const ctx = useJsonForms();
3982
+ const emptyCellProps = ctxToNonEmptyCellProps(ctx, ownProps);
3983
+ const isValid = isEmpty(emptyCellProps.errors);
3984
+ return jsx(NonEmptyCellComponent, Object.assign({}, emptyCellProps, {
3985
+ isValid: isValid
3986
+ }));
3987
+ };
3988
+ const NonEmptyRowComponent = ({
3989
+ childPath,
3990
+ schema,
3991
+ rowIndex,
3992
+ openDeleteDialog,
3993
+ enabled,
3994
+ cells,
3995
+ path,
3996
+ translations,
3997
+ uischema
3998
+ }) => {
3999
+ return jsx("div", {
4000
+ children: enabled ? jsxs(GoAContainer, {
4001
+ children: [jsx(GoAGrid, {
4002
+ minChildWidth: "30ch",
4003
+ children: jsx(GoAIconButton, {
4004
+ icon: "trash",
4005
+ "aria-label": translations.removeAriaLabel,
4006
+ onClick: () => openDeleteDialog(childPath, rowIndex)
4007
+ })
4008
+ }), GenerateRows(NonEmptyCell, schema, childPath, enabled, cells, uischema)]
4009
+ }) : null
4010
+ }, childPath);
4011
+ };
4012
+ const NonEmptyList = /*#__PURE__*/React.memo(NonEmptyRowComponent);
4013
+ const ObjectArrayList = ({
4014
+ data,
4015
+ path,
4016
+ schema,
4017
+ openDeleteDialog,
4018
+ uischema,
4019
+ config,
4020
+ enabled,
4021
+ cells,
4022
+ translations
4023
+ }) => {
4024
+ const isEmptyList = data === 0;
4025
+ if (isEmptyList) {
4026
+ return jsx(EmptyList, {
4027
+ numColumns: getValidColumnProps(schema).length + 1,
4028
+ translations: translations
4029
+ });
4030
+ }
4031
+ const appliedUiSchemaOptions = merge({}, config, uischema.options);
4032
+ return jsx(Fragment, {
4033
+ children: range(data).map(index => {
4034
+ const childPath = Paths.compose(path, `${index}`);
4035
+ return jsx(NonEmptyList, {
4036
+ childPath: childPath,
4037
+ rowIndex: index,
4038
+ schema: schema,
4039
+ openDeleteDialog: openDeleteDialog,
4040
+ showSortButtons: appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayTableSortButtons,
4041
+ enabled: enabled,
4042
+ cells: cells,
4043
+ path: path,
4044
+ uischema: uischema,
4045
+ translations: translations
4046
+ }, childPath);
4047
+ })
4048
+ });
4049
+ };
4050
+ // eslint-disable-next-line
4051
+ class ObjectArrayControl extends React.Component {
4052
+ constructor() {
4053
+ super(...arguments);
4054
+ // eslint-disable-next-line
4055
+ this.addItem = (path, value) => this.props.addItem(path, value);
4056
+ }
4057
+ render() {
4058
+ var _a;
4059
+ const _b = this.props,
4060
+ {
4061
+ label,
4062
+ path,
4063
+ schema,
4064
+ rootSchema,
4065
+ uischema,
4066
+ errors,
4067
+ openDeleteDialog,
4068
+ visible,
4069
+ enabled,
4070
+ cells,
4071
+ translations,
4072
+ data,
4073
+ config
4074
+ } = _b,
4075
+ additionalProps = __rest(_b, ["label", "path", "schema", "rootSchema", "uischema", "errors", "openDeleteDialog", "visible", "enabled", "cells", "translations", "data", "config"]);
4076
+ const controlElement = uischema;
4077
+ // eslint-disable-next-line
4078
+ const listTitle = label || ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.title);
4079
+ return jsx(Hidden, {
4080
+ xsUp: !visible,
4081
+ children: jsxs("div", {
4082
+ children: [jsxs(ToolBarHeader, {
4083
+ children: [listTitle && jsx(ObjectArrayTitle, {
4084
+ children: listTitle
4085
+ }), jsx(ObjectArrayToolBar, {
4086
+ errors: errors,
4087
+ label: label,
4088
+ addItem: this.addItem,
4089
+ numColumns: 0,
4090
+ path: path,
4091
+ uischema: controlElement,
4092
+ schema: schema,
4093
+ rootSchema: rootSchema,
4094
+ enabled: enabled,
4095
+ translations: translations
4096
+ })]
4097
+ }), jsx("div", {
4098
+ children: jsx(ObjectArrayList, Object.assign({
4099
+ path: path,
4100
+ schema: schema,
4101
+ uischema: uischema,
4102
+ enabled: enabled,
4103
+ openDeleteDialog: openDeleteDialog,
4104
+ translations: translations,
4105
+ data: data,
4106
+ cells: cells,
4107
+ config: config
4108
+ }, additionalProps))
4109
+ })]
4110
+ })
4111
+ });
4112
+ }
4113
+ }
4114
+
4115
+ const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
4116
+ open,
4117
+ onConfirm,
4118
+ onCancel,
4119
+ title,
4120
+ message
4121
+ }) {
4122
+ return jsxs(GoAModal, {
4123
+ open: open,
4124
+ testId: "object-array-modal",
4125
+ heading: title,
4126
+ children: [jsx(DeleteDialogContent, {
4127
+ "data-testid": "object-array-modal-content",
4128
+ children: message
4129
+ }), jsxs(GoAButtonGroup, {
4130
+ alignment: "end",
4131
+ children: [jsx(GoAButton, {
4132
+ type: "secondary",
4133
+ testId: "object-array-modal-button",
4134
+ onClick: () => {
4135
+ onCancel();
4136
+ },
4137
+ children: "Cancel"
4138
+ }), jsx(GoAButton, {
4139
+ type: "primary",
4140
+ testId: "object-array-confirm-button",
4141
+ onClick: () => {
4142
+ onConfirm();
4143
+ },
4144
+ children: "Delete"
4145
+ })]
4146
+ })]
4147
+ }, 1);
4148
+ });
4149
+
4150
+ const ArrayControl = props => {
4151
+ const [open, setOpen] = useState(false);
4152
+ const [path, setPath] = useState();
4153
+ const [rowData, setRowData] = useState(0);
4154
+ const {
4155
+ removeItems,
4156
+ visible
4157
+ } = props;
4158
+ const openDeleteDialog = useCallback((p, rowIndex) => {
4159
+ setOpen(true);
4160
+ setPath(p);
4161
+ setRowData(rowIndex);
4162
+ }, [setOpen, setPath, setRowData]);
4163
+ const deleteCancel = useCallback(() => setOpen(false), [setOpen]);
4164
+ // eslint-disable-next-line
4165
+ const deleteConfirm = useCallback(() => {
4166
+ const p = path === null || path === void 0 ? void 0 : path.substring(0, path.lastIndexOf('.'));
4167
+ if (removeItems && p) {
4168
+ removeItems(p, [rowData])();
4169
+ }
4170
+ setOpen(false);
4171
+ // eslint-disable-next-line
4172
+ }, [setOpen, path, rowData]);
4173
+ return jsxs(Hidden, {
4174
+ xsUp: !visible,
4175
+ children: [jsx(ObjectArrayControl, Object.assign({}, props, {
4176
+ openDeleteDialog: openDeleteDialog
4177
+ })), jsx(DeleteDialog, {
4178
+ open: open,
4179
+ onCancel: deleteCancel,
4180
+ onConfirm: deleteConfirm,
4181
+ title: props.translations.deleteDialogTitle || '',
4182
+ message: props.translations.deleteDialogMessage || ''
4183
+ })]
4184
+ });
4185
+ };
4186
+ const GoAArrayControlTester = rankWith(3, or(isObjectArrayControl, isPrimitiveArrayControl));
4187
+ const GoAArrayControlRenderer = withJsonFormsArrayLayoutProps(ArrayControl);
4188
+ const GoAListWithDetailsTester = rankWith(3, and(uiTypeIs('ListWithDetail')));
4189
+
4190
+ const GoATextCell = props => jsx(GoAInputText, Object.assign({}, props));
4191
+ const GoATextCellTester = rankWith(1, isStringControl);
4192
+ withJsonFormsCellProps(GoATextCell);
4193
+
4194
+ const GoADateCell = props => jsx(GoADateInput, Object.assign({}, props));
4195
+ const GoADateCellTester = rankWith(1, isDateControl);
4196
+ withJsonFormsCellProps(GoADateCell);
4197
+
4198
+ const GoATimeCell = props => jsx(GoADateInput, Object.assign({}, props));
4199
+ const GoATimeCellTester = rankWith(2, isTimeControl);
4200
+ withJsonFormsCellProps(GoATimeCell);
4201
+
4202
+ const GoANumberCell = props => jsx(GoANumberInput, Object.assign({}, props));
4203
+ const GoANumberCellTester = rankWith(1, isNumberControl);
4204
+ withJsonFormsCellProps(GoANumberCell);
4205
+
4206
+ const GoAIntegerCell = props => jsx(GoAInputInteger, Object.assign({}, props));
4207
+ const GoAIntegerCellTester = rankWith(1, isIntegerControl);
4208
+ withJsonFormsCellProps(GoAIntegerCell);
4209
+
4210
+ const InputCells = [{
4211
+ tester: GoATextCellTester,
4212
+ cell: withJsonFormsCellProps(GoATextCell)
4213
+ }, {
4214
+ tester: GoADateCellTester,
4215
+ cell: withJsonFormsCellProps(GoADateCell)
4216
+ }, {
4217
+ tester: GoATimeCellTester,
4218
+ cell: withJsonFormsCellProps(GoATimeCell)
4219
+ }, {
4220
+ tester: GoANumberCellTester,
4221
+ cell: withJsonFormsCellProps(GoANumberCell)
4222
+ }, {
4223
+ tester: GoAIntegerCellTester,
4224
+ cell: withJsonFormsCellProps(GoAIntegerCell)
4225
+ }];
4226
+
4227
+ const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
4228
+ return elements.map((child, index) => jsx("div", {
4229
+ children: jsx(JsonFormsDispatch, {
4230
+ uischema: child,
4231
+ schema: schema,
4232
+ path: path,
4233
+ enabled: enabled,
4234
+ renderers: renderers,
4235
+ cells: cells
4236
+ }, path)
4237
+ }, index));
4238
+ };
4239
+ const LayoutRenderer = ({
4240
+ elements,
4241
+ schema,
4242
+ path,
4243
+ enabled,
4244
+ direction,
4245
+ renderers,
4246
+ cells,
4247
+ visible
4248
+ }) => {
4249
+ if (isEmpty(elements)) {
4250
+ return null;
4251
+ } else {
4252
+ if (direction === 'row') {
4253
+ return jsx(Hidden, {
4254
+ xsUp: !visible,
4255
+ children: jsx(GoAGrid, {
4256
+ minChildWidth: "10ch",
4257
+ children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
4258
+ })
4259
+ });
4260
+ } else {
4261
+ return jsx(Hidden, {
4262
+ xsUp: !visible,
4263
+ children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
4264
+ });
4265
+ }
4266
+ }
4267
+ };
4268
+
4269
+ rankWith(2, uiTypeIs('HorizontalLayout'));
4270
+ const GoAHorizontalLayoutComponent = ({
4271
+ uischema,
4272
+ renderers,
4273
+ cells,
4274
+ schema,
4275
+ path,
4276
+ enabled,
4277
+ visible
4278
+ }) => {
4279
+ const layout = uischema;
4280
+ const childProps = {
4281
+ elements: layout.elements,
4282
+ schema,
4283
+ path,
4284
+ enabled,
4285
+ direction: 'row',
4286
+ visible
4287
+ };
4288
+ return jsx(LayoutRenderer, Object.assign({}, childProps, {
4289
+ renderers: renderers,
4290
+ cells: cells
4291
+ }));
4292
+ };
4293
+ const GoAHorizontalLayout = withJsonFormsLayoutProps(GoAHorizontalLayoutComponent, true);
4294
+
4295
+ const GoAVerticalLayoutComponent = ({
4296
+ uischema,
4297
+ schema,
4298
+ path,
4299
+ enabled,
4300
+ renderers,
4301
+ cells,
4302
+ visible
4303
+ }) => {
4304
+ const verticalLayout = uischema;
4305
+ const childProps = {
4306
+ elements: verticalLayout.elements,
4307
+ schema,
4308
+ path,
4309
+ enabled,
4310
+ direction: 'column',
4311
+ visible
4312
+ };
4313
+ return jsx(LayoutRenderer, Object.assign({}, childProps, {
4314
+ renderers: renderers,
4315
+ cells: cells
4316
+ }));
4317
+ };
4318
+ const GoAVerticalLayout = withJsonFormsLayoutProps(GoAVerticalLayoutComponent, true);
4319
+
4320
+ const groupTester = rankWith(1, uiTypeIs('Group'));
4321
+ const GoAGroupControlComponent = props => {
4322
+ var _a;
4323
+ const {
4324
+ uischema,
4325
+ schema,
4326
+ path,
4327
+ enabled,
4328
+ renderers,
4329
+ cells,
4330
+ visible
4331
+ } = props;
4332
+ const group = uischema;
4333
+ return jsx(Hidden, {
4334
+ xsUp: !visible,
4335
+ children: jsx(GoAContainer, Object.assign({}, group.options, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
4336
+ children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
4337
+ }))
4338
+ });
4339
+ };
4340
+ const GoAGroupLayoutTester = withIncreasedRank(1, groupTester);
4341
+ const GoAGroupControl = withJsonFormsLayoutProps(GoAGroupControlComponent);
4342
+
4343
+ let _ = t => t,
4344
+ _t;
4345
+ const HelpContentDiv = styled.div(_t || (_t = _`
4346
+ .parent-label {
4347
+ font-size: 24px;
4348
+ margin-bottom: var(--goa-space-m);
4349
+ font-weight: bold;
4350
+ }
4351
+
4352
+ .child-label {
4353
+ font-size: 18px;
4354
+ margin-bottom: var(--goa-space-xs);
4355
+ font-weight: bold;
4356
+ }
4357
+ .parent-margin {
4358
+ margin-bottom: var(--goa-space-l);
4359
+ }
4360
+ .child-margin {
4361
+ margin-bottom: var(--goa-space-2xs);
4362
+ }
4363
+ ul {
4364
+ margin: 0 0 0 var(--goa-space-xs);
4365
+ }
4366
+ .single-line {
4367
+ margin: var(--goa-space-2xs) 0 var(--goa-space-2xs) 0;
4368
+ }
4369
+ `));
4370
+
4371
+ const HelpContentComponent = _a => {
4372
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
4373
+ var {
4374
+ isParent = true
4375
+ } = _a,
4376
+ props = __rest(_a, ["isParent"]);
4377
+ const labelClass = isParent ? 'parent-label' : 'child-label';
4378
+ const marginClass = isParent ? 'parent-margin' : 'child-margin';
4379
+ // eslint-disable-next-line
4380
+ const {
4381
+ uischema,
4382
+ visible,
4383
+ label
4384
+ } = props;
4385
+ const renderHelp = () => {
4386
+ var _a, _b, _c;
4387
+ return Array.isArray((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) ? jsx("ul", {
4388
+ children: (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help.map((line, index) => jsx("li", {
4389
+ children: `${line}`
4390
+ }, index))
4391
+ }) : jsx("p", {
4392
+ className: "single-line",
4393
+ children: (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help
4394
+ });
4395
+ };
4396
+ return jsx(Hidden, {
4397
+ xsUp: !visible,
4398
+ children: jsx(HelpContentDiv, {
4399
+ "aria-label": (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.ariaLabel,
4400
+ children: jsxs("div", {
4401
+ className: marginClass,
4402
+ children: [label && !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) && ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && jsxs("div", {
4403
+ className: labelClass,
4404
+ children: [label, jsx("br", {})]
4405
+ }), (!((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) || ((_f = uischema.options) === null || _f === void 0 ? void 0 : _f.variant) !== 'details') && renderHelp(), ((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) && ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'details' && jsxs(GoADetails, {
4406
+ heading: label ? label : '',
4407
+ mt: "3xs",
4408
+ mb: "none",
4409
+ children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_j = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _j === void 0 ? void 0 : _j.length) > 0 && jsx(HelpContents, {
4410
+ elements: uischema === null || uischema === void 0 ? void 0 : uischema.elements
4411
+ })]
4412
+ }), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) !== 'details' && jsx(HelpContents, {
4413
+ elements: uischema.elements,
4414
+ isParent: false
4415
+ })]
4416
+ })
4417
+ })
4418
+ });
4419
+ };
4420
+ const HelpContents = ({
4421
+ elements,
4422
+ isParent: _isParent = false
4423
+ }) => jsx("div", {
4424
+ children: elements === null || elements === void 0 ? void 0 : elements.map(element => {
4425
+ return jsx(HelpContentComponent, {
4426
+ uischema: element,
4427
+ label: element.label,
4428
+ errors: '',
4429
+ data: undefined,
4430
+ enabled: false,
4431
+ visible: true,
4432
+ path: '',
4433
+ handleChange: function (path, value) {
4434
+ throw new Error('Function not implemented.');
4435
+ },
4436
+ rootSchema: {},
4437
+ id: '',
4438
+ schema: {},
4439
+ isParent: _isParent
4440
+ });
4441
+ })
4442
+ });
4443
+ const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
4444
+ const HelpContent = withJsonFormsControlProps(HelpContentComponent);
4445
+
4446
+ const isNullSchema = schema => {
4447
+ return schema === undefined || schema === null;
4448
+ };
4449
+ const isValidScope = (uiSchema, schema) => {
4450
+ if (!('scope' in uiSchema)) {
4451
+ return false;
4452
+ }
4453
+ const scopeComponents = uiSchema.scope.split('/');
4454
+ // get rid of the '#' at the beginning of scope
4455
+ scopeComponents.shift();
4456
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4457
+ let obj = schema;
4458
+ // iterate through the schema to ensure each property exists
4459
+ for (const key of scopeComponents) {
4460
+ if (obj && typeof obj === 'object' && key in obj) {
4461
+ obj = obj[key];
4462
+ } else {
4463
+ return false;
4464
+ }
4465
+ }
4466
+ return true;
4467
+ };
4468
+ const isLayoutType = schema => {
4469
+ return hasType(schema, 'VerticalLayout') || hasType(schema, 'HorizontalLayout') || hasType(schema, 'Categorization') || hasType(schema, 'Group');
4470
+ };
4471
+ const isKnownType = schema => {
4472
+ return hasType(schema, 'Control') || isLayoutType(schema) || hasType(schema, 'HelpContent') || isListWithDetail(schema);
4473
+ };
4474
+ const isListWithDetail = schema => {
4475
+ return hasType(schema, 'ListWithDetail');
4476
+ };
4477
+ const isScopedPrefixed = scope => {
4478
+ const scopeComponents = scope.split('/');
4479
+ return scopeComponents.length > 1 && scopeComponents[0] === '#';
4480
+ };
4481
+ const isEmptyObject = schema => {
4482
+ return Object.keys(schema).length === 0;
4483
+ };
4484
+ const isControlWithNoScope = uiSchema => {
4485
+ return 'type' in uiSchema && uiSchema.type === 'Control' && !('scope' in uiSchema);
4486
+ };
4487
+ const hasElements = schema => {
4488
+ return 'elements' in schema && Array.isArray(schema.elements);
4489
+ };
4490
+ const isEmptyElements = schema => {
4491
+ return 'elements' in schema && schema.elements !== undefined && schema.elements !== null && Object.keys(schema.elements).length === 0;
4492
+ };
4493
+ const hasVariant = schema => {
4494
+ return 'options' in schema && schema.options !== undefined && schema.options !== null && 'variant' in schema.options;
4495
+ };
4496
+ const isValidJsonObject = schema => {
4497
+ return typeof schema === 'object' && Object.keys(schema).length === 0 || 'properties' in schema && ('type' in schema && schema.type === 'object' || !('type' in schema));
4498
+ };
4499
+
4500
+ const errCategorizationHasNonCategories = "Each element of 'Categorizations' must be of type 'Category'";
4501
+ const errCategorizationHasNoElements = 'A Categorization must contain Categories.';
4502
+ const errNoElements = type => `A ${type} must contain elements.`;
4503
+ const errCategorizationHasNoVariant = 'A Categorization must contain Options with a variant.';
4504
+ const errMissingScope = 'A Control must have a scope';
4505
+ const errMalformedScope = scope => `Scope ${scope} must be prefixed with '#/'.`;
4506
+ const errUnknownScope = scope => `Failed to render: unknown scope ${scope}`;
4507
+ const errMissingType = 'UI schema element must have a type';
4508
+ const errUnknownType = type => `Unknown schema type: ${type}. (Names are case sensitive)`;
4509
+ const getUISchemaErrors = (uiSchema, schema) => {
4510
+ // Sometimes the UISchema is null. Ignore those cases, as all checks are done on the UIschema.
4511
+ if (isNullSchema(uiSchema)) {
4512
+ return null;
4513
+ }
4514
+ // silently ignore empty objects
4515
+ if (isEmptyObject(uiSchema)) {
4516
+ return '';
4517
+ }
4518
+ // Check control elements
4519
+ if (isControl(uiSchema) && hasType(uiSchema, 'Control')) {
4520
+ if (!isScopedPrefixed(uiSchema.scope)) {
4521
+ return errMalformedScope(uiSchema.scope);
4522
+ }
4523
+ if (!isValidScope(uiSchema, schema)) {
4524
+ return errUnknownScope(uiSchema.scope);
4525
+ }
4526
+ }
4527
+ // isControl will fail if scope is not present, so make the test explicit...
4528
+ if (isControlWithNoScope(uiSchema)) {
4529
+ return errMissingScope;
4530
+ }
4531
+ if (isListWithDetail(uiSchema)) {
4532
+ if ('scope' in uiSchema) {
4533
+ const scope = uiSchema.scope;
4534
+ if (!isValidScope(uiSchema, schema)) {
4535
+ return errUnknownScope(scope);
4536
+ }
4537
+ } else {
4538
+ return errMissingScope;
4539
+ }
4540
+ }
4541
+ // Make an explicit check for Categorization, as this requires Category elements.
4542
+ // Is layout will fail if some of these conditions are not met, so we do that
4543
+ // check later.
4544
+ if (isCategorization(uiSchema)) {
4545
+ if (!hasElements(uiSchema)) {
4546
+ return errCategorizationHasNoElements;
4547
+ }
4548
+ if (!hasVariant(uiSchema)) {
4549
+ return errCategorizationHasNoVariant;
4550
+ }
4551
+ // ensure each element has type Category, and that each category
4552
+ // has elements
4553
+ if (isLayout(uiSchema)) {
4554
+ const invalidCategorizations = [];
4555
+ const invalidCategories = [];
4556
+ uiSchema.elements.forEach(e => {
4557
+ if (e.type !== 'Category') {
4558
+ invalidCategorizations.push(e.type);
4559
+ }
4560
+ if (!hasElements(e) || isEmptyElements(e)) {
4561
+ invalidCategories.push(e);
4562
+ }
4563
+ });
4564
+ if (invalidCategorizations.length > 0) {
4565
+ return errCategorizationHasNonCategories;
4566
+ }
4567
+ if (invalidCategories.length > 0) {
4568
+ return errNoElements('Category');
4569
+ }
4570
+ }
4571
+ }
4572
+ // Check layout
4573
+ if (isLayoutType(uiSchema)) {
4574
+ if (!hasElements(uiSchema)) {
4575
+ return errNoElements(uiSchema.type);
4576
+ }
4577
+ if (isEmptyElements(uiSchema)) {
4578
+ return errNoElements(uiSchema.type);
4579
+ }
4580
+ }
4581
+ if (!isKnownType(uiSchema)) {
4582
+ if (uiSchema.type === undefined || uiSchema.type.length < 1) {
4583
+ return errMissingType;
4584
+ }
4585
+ return errUnknownType(uiSchema.type);
4586
+ }
4587
+ return null;
4588
+ };
4589
+
4590
+ const isValidJsonSchema = schema => {
4591
+ if (isNullSchema(schema)) {
4592
+ return '';
4593
+ }
4594
+ if (!isValidJsonObject(schema)) {
4595
+ return 'Unable to render: json schema is not valid.';
4596
+ }
4597
+ return null;
4598
+ };
4599
+ // Some 'errors' need not be reported, but we want to handle them
4600
+ // here. e.g. A layout with empty elements should be quietly ignored.
4601
+ // this is handled by the errors !== '' check.
4602
+ const ErrorControl = props => {
4603
+ const {
4604
+ schema,
4605
+ uischema
4606
+ } = props;
4607
+ // Report data schema errors over ui schema ones, as errors in the former
4608
+ // can cause cascading errors in the latter.
4609
+ const dataSchemaErrors = isValidJsonSchema(schema);
4610
+ if (dataSchemaErrors && dataSchemaErrors !== '') {
4611
+ return jsx("p", {
4612
+ children: dataSchemaErrors
4613
+ });
4614
+ }
4615
+ const uiSchemaErrors = getUISchemaErrors(uischema, schema);
4616
+ if (uiSchemaErrors && uiSchemaErrors !== '') {
4617
+ return MessageControl(uiSchemaErrors);
4618
+ }
4619
+ return jsx("span", {});
4620
+ };
4621
+ /**
4622
+ * Note: by returning a rank of 1000, we are saying that this renderer is very important,
4623
+ * one that must get used if there are any errors whatsoever.
4624
+ */
4625
+ const GoAErrorControlTester = rankWith(1000, (uischema, schema, context) => {
4626
+ const validJsonSchema = isValidJsonSchema(schema);
4627
+ const validUiSchema = getUISchemaErrors(uischema, schema);
4628
+ return validUiSchema != null || validJsonSchema != null;
4629
+ });
4630
+ var GoAErrorControl = withJsonFormsControlProps(ErrorControl);
4631
+
4632
+ const countries = ['Argentina', 'Brazil', 'Canada', 'Denmark', 'Egypt', 'France', 'Greece', 'India', 'Japan', 'Kenya'];
4633
+ addData('countries', countries);
4634
+ const GoABaseRenderers = [
4635
+ // controls
4636
+ {
4637
+ tester: GoAEnumControlTester,
4638
+ renderer: GoAEnumControl
4639
+ }, {
4640
+ tester: GoAEnumControlAutoCompleteTester,
4641
+ renderer: GoAEnumAutoCompleteControl
4642
+ }, {
4643
+ tester: GoAIntegerControlTester,
4644
+ renderer: GoAInputIntegerControl
4645
+ }, {
4646
+ tester: GoANumberControlTester,
4647
+ renderer: GoAInputNumberControl
4648
+ }, {
4649
+ tester: GoATextControlTester,
4650
+ renderer: GoAInputTextControl
4651
+ }, {
4652
+ tester: GoADateControlTester,
4653
+ renderer: GoAInputDateControl
4654
+ }, {
4655
+ tester: GoADateTimeControlTester,
4656
+ renderer: GoAInputDateTimeControl
4657
+ }, {
4658
+ tester: GoATimeControlTester,
4659
+ renderer: GoAInputTimeControl
4660
+ }, {
4661
+ tester: materialSliderControlTester,
4662
+ renderer: MaterialSliderControl
4663
+ }, {
4664
+ tester: materialObjectControlTester,
4665
+ renderer: MaterialObjectRenderer
4666
+ }, {
4667
+ tester: materialAllOfControlTester,
4668
+ renderer: MaterialAllOfRenderer
4669
+ }, {
4670
+ tester: materialAnyOfControlTester,
4671
+ renderer: MaterialAnyOfRenderer
4672
+ }, {
4673
+ tester: materialOneOfControlTester,
4674
+ renderer: MaterialOneOfRenderer
4675
+ }, {
4676
+ tester: GoARadioGroupControlTester,
4677
+ renderer: GoAEnumRadioGroupControl
4678
+ }, {
4679
+ tester: GoABooleanControlTester,
4680
+ renderer: GoABooleanControl
4681
+ }, {
4682
+ tester: GoABooleanRadioControlTester,
4683
+ renderer: GoABooleanRadioControl
4684
+ }, {
4685
+ tester: GoAArrayControlTester,
4686
+ renderer: GoAArrayControlRenderer
4687
+ }, {
4688
+ tester: GoAListWithDetailsTester,
4689
+ renderer: GoAArrayControlRenderer
4690
+ }, {
4691
+ tester: materialOneOfRadioGroupControlTester,
4692
+ renderer: MaterialOneOfRadioGroupControl
4693
+ }, {
4694
+ tester: materialOneOfEnumControlTester,
4695
+ renderer: MaterialOneOfEnumControl
4696
+ },
4697
+ // layouts
4698
+ {
4699
+ tester: GoAGroupLayoutTester,
4700
+ renderer: GoAGroupControl
4701
+ }, {
4702
+ tester: materialHorizontalLayoutTester,
4703
+ renderer: GoAHorizontalLayout
4704
+ }, {
4705
+ tester: materialVerticalLayoutTester,
4706
+ renderer: GoAVerticalLayout
4707
+ }, {
4708
+ tester: materialArrayLayoutTester,
4709
+ renderer: MaterialArrayLayout
4710
+ },
4711
+ // additional
4712
+ {
4713
+ tester: GoAErrorControlTester,
4714
+ renderer: GoAErrorControl
4715
+ }, {
4716
+ tester: materialAnyOfStringOrEnumControlTester,
4717
+ renderer: MaterialAnyOfStringOrEnumControl
4718
+ }, {
4719
+ tester: materialEnumArrayRendererTester,
4720
+ renderer: MaterialEnumArrayRenderer
4721
+ }, {
4722
+ tester: materialEnumArrayRendererTester,
4723
+ renderer: MaterialEnumArrayRenderer
4724
+ }, {
4725
+ tester: MultiLineTextControlTester,
4726
+ renderer: MultiLineTextControl
4727
+ }, {
4728
+ tester: HelpContentTester,
4729
+ renderer: HelpContent
4730
+ }];
4731
+ const GoARenderers = [...GoABaseRenderers, {
4732
+ tester: CategorizationRendererTester,
4733
+ renderer: FormStepperControl
4734
+ }, {
4735
+ tester: FileUploaderTester,
4736
+ renderer: withJsonFormsControlProps(FileUploader)
4737
+ }];
4738
+ const GoACells = [{
4739
+ tester: materialBooleanCellTester,
4740
+ cell: MaterialBooleanCell
4741
+ }, {
4742
+ tester: materialBooleanToggleCellTester,
4743
+ cell: MaterialBooleanToggleCell
4744
+ }, {
4745
+ tester: materialEnumCellTester,
4746
+ cell: MaterialEnumCell
4747
+ }, {
4748
+ tester: materialOneOfEnumCellTester,
4749
+ cell: MaterialOneOfEnumCell
4750
+ }, ...InputCells];
4751
+
4752
+ export { ContextProvider, GoABaseRenderers, GoACells, GoARenderers, JsonFormContext, addData, addDataByOptions, addDataByUrl, getAllData, getData };