quicksnack 3.35.1 → 3.35.2

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 (77) hide show
  1. package/dist/UiProvider.d.ts +8 -0
  2. package/dist/UiStateProvider.d.ts +9 -0
  3. package/dist/UiWrapper.d.ts +7 -0
  4. package/dist/animation/SlideInFromTop/SlideInFromTop.d.ts +4 -0
  5. package/dist/animation/SlideOpen/SlideOpen.d.ts +9 -0
  6. package/dist/bundle.js +4751 -0
  7. package/dist/bundle.min.js +890 -0
  8. package/dist/components/Alert/Alert.d.ts +8 -0
  9. package/dist/components/AnimatedCheckmark/AnimatedCheckmark.d.ts +2 -0
  10. package/dist/components/Box/Box.d.ts +23 -0
  11. package/dist/components/BreadCrumbs/BreadCrumbs.d.ts +263 -0
  12. package/dist/components/CollapsiblePanel/CollapsiblePanel.d.ts +7 -0
  13. package/dist/components/ConfirmButton/ConfirmButton.d.ts +8 -0
  14. package/dist/components/ConfirmModal/ConfirmModal.d.ts +15 -0
  15. package/dist/components/ConfirmModal/hooks/useConfirmModal.d.ts +11 -0
  16. package/dist/components/Details/Details.d.ts +7 -0
  17. package/dist/components/Dropdown/Dropdown.d.ts +530 -0
  18. package/dist/components/Dropzone/Dropzone.d.ts +8 -0
  19. package/dist/components/Feedback/Feedback.d.ts +10 -0
  20. package/dist/components/Floater/Floater.d.ts +14 -0
  21. package/dist/components/Floater/FloaterItem.d.ts +8 -0
  22. package/dist/components/Footer/Footer.d.ts +2 -0
  23. package/dist/components/HorizontalScroller/HorizontalScroller.d.ts +2 -0
  24. package/dist/components/Menu/HamburgerButton.d.ts +276 -0
  25. package/dist/components/Menu/Menu.d.ts +268 -0
  26. package/dist/components/Menu/MenuCloseButton.d.ts +276 -0
  27. package/dist/components/Menu/MenuSlideOpenIndicator.d.ts +2 -0
  28. package/dist/components/Menu/SideBar.d.ts +271 -0
  29. package/dist/components/Menu/SideBarHeader.d.ts +6 -0
  30. package/dist/components/Menu/useCloseSidebarOnNavigate.d.ts +1 -0
  31. package/dist/components/Menu/useToggleMobileMenu.d.ts +10 -0
  32. package/dist/components/Modal/Modal.d.ts +8 -0
  33. package/dist/components/Overlay/Overlay.d.ts +261 -0
  34. package/dist/components/Paginator/Paginator.d.ts +8 -0
  35. package/dist/components/Panel/Panel.d.ts +13 -0
  36. package/dist/components/Section/Section.d.ts +3 -0
  37. package/dist/components/Statistic/Statistic.d.ts +11 -0
  38. package/dist/components/Table/Table.d.ts +27 -0
  39. package/dist/components/Tabs/Tab.d.ts +12 -0
  40. package/dist/components/Tabs/TabContent.d.ts +3 -0
  41. package/dist/components/Tabs/Tabs.d.ts +279 -0
  42. package/dist/components/Timeline/Timeline.d.ts +18 -0
  43. package/dist/components/TopBar/TopBar.d.ts +7 -0
  44. package/dist/fonts.d.ts +1 -0
  45. package/dist/form/Button/Button.d.ts +13 -0
  46. package/dist/form/Checkbox/Checkbox.d.ts +8 -0
  47. package/dist/form/FileField/FileField.d.ts +8 -0
  48. package/dist/form/PasswordStrengthField/PasswordStrenghField.d.ts +9 -0
  49. package/dist/form/ScaffoldForm/FormGrid/FormGrid.d.ts +7 -0
  50. package/dist/form/ScaffoldForm/FormGrid/FormGridCell.d.ts +14 -0
  51. package/dist/form/ScaffoldForm/FormGrid/FormGridWrapper.d.ts +10 -0
  52. package/dist/form/ScaffoldForm/ScaffoldField.d.ts +9 -0
  53. package/dist/form/ScaffoldForm/ScaffoldForm.d.ts +10 -0
  54. package/dist/form/ScaffoldForm/ScaffoldFormProvider.d.ts +7 -0
  55. package/dist/form/ScaffoldForm/hooks/useScaffoldFormContext.d.ts +1 -0
  56. package/dist/form/ScaffoldForm/scaffoldFormProps.d.ts +80 -0
  57. package/dist/form/ScaffoldForm/scaffoldPasswordProps.d.ts +19 -0
  58. package/dist/form/ScaffoldForm/types.d.ts +34 -0
  59. package/dist/form/ScaffoldForm/utils/FormPositioner.d.ts +36 -0
  60. package/dist/form/ScaffoldForm/utils/Grid.d.ts +38 -0
  61. package/dist/form/ScaffoldForm/utils/Grid.test.d.ts +1 -0
  62. package/dist/form/ScaffoldForm/utils/assertGridIsValid.d.ts +6 -0
  63. package/dist/form/ScaffoldForm/utils/assertGridIsValid.test.d.ts +1 -0
  64. package/dist/form/ScaffoldForm/utils/equalColumns.d.ts +1 -0
  65. package/dist/form/Select/Select.d.ts +6 -0
  66. package/dist/form/TextField/TextField.d.ts +9 -0
  67. package/dist/index.d.ts +57 -0
  68. package/dist/layouts/BasicLayout/BasicLayout.d.ts +13 -0
  69. package/dist/layouts/FloatingPanelLayout/FloatingPanelLayout.d.ts +12 -0
  70. package/dist/layouts/constants.d.ts +2 -0
  71. package/dist/responsiveness/responsiveProps.d.ts +17 -0
  72. package/dist/responsiveness/useResponsiveBreakpoints.d.ts +6 -0
  73. package/dist/theme.d.ts +2 -0
  74. package/dist/typography/Fonts.d.ts +2 -0
  75. package/dist/typography/Header/Header.d.ts +6 -0
  76. package/dist/typography/Paragraph/Paragraph.d.ts +261 -0
  77. package/package.json +1 -1
package/dist/bundle.js ADDED
@@ -0,0 +1,4751 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var styledComponents = require('styled-components');
5
+ var immer = require('immer');
6
+
7
+ /******************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise, SuppressedError, Symbol */
22
+
23
+
24
+ function __rest(s, e) {
25
+ var t = {};
26
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
27
+ t[p] = s[p];
28
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
29
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
30
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
31
+ t[p[i]] = s[p[i]];
32
+ }
33
+ return t;
34
+ }
35
+
36
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
37
+ var e = new Error(message);
38
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
39
+ };
40
+
41
+ function _extends() {
42
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
43
+ for (var i = 1; i < arguments.length; i++) {
44
+ var source = arguments[i];
45
+ for (var key in source) {
46
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
47
+ target[key] = source[key];
48
+ }
49
+ }
50
+ }
51
+ return target;
52
+ };
53
+ return _extends.apply(this, arguments);
54
+ }
55
+
56
+ function _assertThisInitialized(self) {
57
+ if (self === void 0) {
58
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
59
+ }
60
+ return self;
61
+ }
62
+
63
+ function _setPrototypeOf(o, p) {
64
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
65
+ o.__proto__ = p;
66
+ return o;
67
+ };
68
+ return _setPrototypeOf(o, p);
69
+ }
70
+
71
+ function _inheritsLoose(subClass, superClass) {
72
+ subClass.prototype = Object.create(superClass.prototype);
73
+ subClass.prototype.constructor = subClass;
74
+ _setPrototypeOf(subClass, superClass);
75
+ }
76
+
77
+ function _getPrototypeOf(o) {
78
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
79
+ return o.__proto__ || Object.getPrototypeOf(o);
80
+ };
81
+ return _getPrototypeOf(o);
82
+ }
83
+
84
+ function _isNativeFunction(fn) {
85
+ try {
86
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
87
+ } catch (e) {
88
+ return typeof fn === "function";
89
+ }
90
+ }
91
+
92
+ function _isNativeReflectConstruct() {
93
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
94
+ if (Reflect.construct.sham) return false;
95
+ if (typeof Proxy === "function") return true;
96
+ try {
97
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
98
+ return true;
99
+ } catch (e) {
100
+ return false;
101
+ }
102
+ }
103
+
104
+ function _construct(Parent, args, Class) {
105
+ if (_isNativeReflectConstruct()) {
106
+ _construct = Reflect.construct.bind();
107
+ } else {
108
+ _construct = function _construct(Parent, args, Class) {
109
+ var a = [null];
110
+ a.push.apply(a, args);
111
+ var Constructor = Function.bind.apply(Parent, a);
112
+ var instance = new Constructor();
113
+ if (Class) _setPrototypeOf(instance, Class.prototype);
114
+ return instance;
115
+ };
116
+ }
117
+ return _construct.apply(null, arguments);
118
+ }
119
+
120
+ function _wrapNativeSuper(Class) {
121
+ var _cache = typeof Map === "function" ? new Map() : undefined;
122
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
123
+ if (Class === null || !_isNativeFunction(Class)) return Class;
124
+ if (typeof Class !== "function") {
125
+ throw new TypeError("Super expression must either be null or a function");
126
+ }
127
+ if (typeof _cache !== "undefined") {
128
+ if (_cache.has(Class)) return _cache.get(Class);
129
+ _cache.set(Class, Wrapper);
130
+ }
131
+ function Wrapper() {
132
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
133
+ }
134
+ Wrapper.prototype = Object.create(Class.prototype, {
135
+ constructor: {
136
+ value: Wrapper,
137
+ enumerable: false,
138
+ writable: true,
139
+ configurable: true
140
+ }
141
+ });
142
+ return _setPrototypeOf(Wrapper, Class);
143
+ };
144
+ return _wrapNativeSuper(Class);
145
+ }
146
+
147
+ // based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
148
+
149
+ /**
150
+ * Parse errors.md and turn it into a simple hash of code: message
151
+ * @private
152
+ */
153
+ var ERRORS = {
154
+ "1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
155
+ "2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
156
+ "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
157
+ "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
158
+ "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
159
+ "6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
160
+ "7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
161
+ "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
162
+ "9": "Please provide a number of steps to the modularScale helper.\n\n",
163
+ "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
164
+ "11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
165
+ "12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
166
+ "13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
167
+ "14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
168
+ "15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
169
+ "16": "You must provide a template to this method.\n\n",
170
+ "17": "You passed an unsupported selector state to this method.\n\n",
171
+ "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
172
+ "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
173
+ "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
174
+ "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
175
+ "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
176
+ "23": "fontFace expects a name of a font-family.\n\n",
177
+ "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
178
+ "25": "fontFace expects localFonts to be an array.\n\n",
179
+ "26": "fontFace expects fileFormats to be an array.\n\n",
180
+ "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
181
+ "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
182
+ "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
183
+ "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
184
+ "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
185
+ "32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
186
+ "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
187
+ "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
188
+ "35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
189
+ "36": "Property must be a string value.\n\n",
190
+ "37": "Syntax Error at %s.\n\n",
191
+ "38": "Formula contains a function that needs parentheses at %s.\n\n",
192
+ "39": "Formula is missing closing parenthesis at %s.\n\n",
193
+ "40": "Formula has too many closing parentheses at %s.\n\n",
194
+ "41": "All values in a formula must have the same unit or be unitless.\n\n",
195
+ "42": "Please provide a number of steps to the modularScale helper.\n\n",
196
+ "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
197
+ "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
198
+ "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
199
+ "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
200
+ "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
201
+ "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
202
+ "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
203
+ "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
204
+ "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
205
+ "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
206
+ "53": "fontFace expects localFonts to be an array.\n\n",
207
+ "54": "fontFace expects fileFormats to be an array.\n\n",
208
+ "55": "fontFace expects a name of a font-family.\n\n",
209
+ "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
210
+ "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
211
+ "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
212
+ "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
213
+ "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
214
+ "61": "Property must be a string value.\n\n",
215
+ "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
216
+ "63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
217
+ "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
218
+ "65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
219
+ "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
220
+ "67": "You must provide a template to this method.\n\n",
221
+ "68": "You passed an unsupported selector state to this method.\n\n",
222
+ "69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
223
+ "70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
224
+ "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
225
+ "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
226
+ "73": "Please provide a valid CSS variable.\n\n",
227
+ "74": "CSS variable not found and no default was provided.\n\n",
228
+ "75": "important requires a valid style object, got a %s instead.\n\n",
229
+ "76": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n\n",
230
+ "77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
231
+ "78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
232
+ };
233
+ /**
234
+ * super basic version of sprintf
235
+ * @private
236
+ */
237
+
238
+ function format() {
239
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
240
+ args[_key] = arguments[_key];
241
+ }
242
+
243
+ var a = args[0];
244
+ var b = [];
245
+ var c;
246
+
247
+ for (c = 1; c < args.length; c += 1) {
248
+ b.push(args[c]);
249
+ }
250
+
251
+ b.forEach(function (d) {
252
+ a = a.replace(/%[a-z]/, d);
253
+ });
254
+ return a;
255
+ }
256
+ /**
257
+ * Create an error file out of errors.md for development and a simple web link to the full errors
258
+ * in production mode.
259
+ * @private
260
+ */
261
+
262
+
263
+ var PolishedError = /*#__PURE__*/function (_Error) {
264
+ _inheritsLoose(PolishedError, _Error);
265
+
266
+ function PolishedError(code) {
267
+ var _this;
268
+
269
+ if (process.env.NODE_ENV === 'production') {
270
+ _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
271
+ } else {
272
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
273
+ args[_key2 - 1] = arguments[_key2];
274
+ }
275
+
276
+ _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
277
+ }
278
+
279
+ return _assertThisInitialized(_this);
280
+ }
281
+
282
+ return PolishedError;
283
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
284
+
285
+ function colorToInt(color) {
286
+ return Math.round(color * 255);
287
+ }
288
+
289
+ function convertToInt(red, green, blue) {
290
+ return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
291
+ }
292
+
293
+ function hslToRgb(hue, saturation, lightness, convert) {
294
+ if (convert === void 0) {
295
+ convert = convertToInt;
296
+ }
297
+
298
+ if (saturation === 0) {
299
+ // achromatic
300
+ return convert(lightness, lightness, lightness);
301
+ } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
302
+
303
+
304
+ var huePrime = (hue % 360 + 360) % 360 / 60;
305
+ var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
306
+ var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
307
+ var red = 0;
308
+ var green = 0;
309
+ var blue = 0;
310
+
311
+ if (huePrime >= 0 && huePrime < 1) {
312
+ red = chroma;
313
+ green = secondComponent;
314
+ } else if (huePrime >= 1 && huePrime < 2) {
315
+ red = secondComponent;
316
+ green = chroma;
317
+ } else if (huePrime >= 2 && huePrime < 3) {
318
+ green = chroma;
319
+ blue = secondComponent;
320
+ } else if (huePrime >= 3 && huePrime < 4) {
321
+ green = secondComponent;
322
+ blue = chroma;
323
+ } else if (huePrime >= 4 && huePrime < 5) {
324
+ red = secondComponent;
325
+ blue = chroma;
326
+ } else if (huePrime >= 5 && huePrime < 6) {
327
+ red = chroma;
328
+ blue = secondComponent;
329
+ }
330
+
331
+ var lightnessModification = lightness - chroma / 2;
332
+ var finalRed = red + lightnessModification;
333
+ var finalGreen = green + lightnessModification;
334
+ var finalBlue = blue + lightnessModification;
335
+ return convert(finalRed, finalGreen, finalBlue);
336
+ }
337
+
338
+ var namedColorMap = {
339
+ aliceblue: 'f0f8ff',
340
+ antiquewhite: 'faebd7',
341
+ aqua: '00ffff',
342
+ aquamarine: '7fffd4',
343
+ azure: 'f0ffff',
344
+ beige: 'f5f5dc',
345
+ bisque: 'ffe4c4',
346
+ black: '000',
347
+ blanchedalmond: 'ffebcd',
348
+ blue: '0000ff',
349
+ blueviolet: '8a2be2',
350
+ brown: 'a52a2a',
351
+ burlywood: 'deb887',
352
+ cadetblue: '5f9ea0',
353
+ chartreuse: '7fff00',
354
+ chocolate: 'd2691e',
355
+ coral: 'ff7f50',
356
+ cornflowerblue: '6495ed',
357
+ cornsilk: 'fff8dc',
358
+ crimson: 'dc143c',
359
+ cyan: '00ffff',
360
+ darkblue: '00008b',
361
+ darkcyan: '008b8b',
362
+ darkgoldenrod: 'b8860b',
363
+ darkgray: 'a9a9a9',
364
+ darkgreen: '006400',
365
+ darkgrey: 'a9a9a9',
366
+ darkkhaki: 'bdb76b',
367
+ darkmagenta: '8b008b',
368
+ darkolivegreen: '556b2f',
369
+ darkorange: 'ff8c00',
370
+ darkorchid: '9932cc',
371
+ darkred: '8b0000',
372
+ darksalmon: 'e9967a',
373
+ darkseagreen: '8fbc8f',
374
+ darkslateblue: '483d8b',
375
+ darkslategray: '2f4f4f',
376
+ darkslategrey: '2f4f4f',
377
+ darkturquoise: '00ced1',
378
+ darkviolet: '9400d3',
379
+ deeppink: 'ff1493',
380
+ deepskyblue: '00bfff',
381
+ dimgray: '696969',
382
+ dimgrey: '696969',
383
+ dodgerblue: '1e90ff',
384
+ firebrick: 'b22222',
385
+ floralwhite: 'fffaf0',
386
+ forestgreen: '228b22',
387
+ fuchsia: 'ff00ff',
388
+ gainsboro: 'dcdcdc',
389
+ ghostwhite: 'f8f8ff',
390
+ gold: 'ffd700',
391
+ goldenrod: 'daa520',
392
+ gray: '808080',
393
+ green: '008000',
394
+ greenyellow: 'adff2f',
395
+ grey: '808080',
396
+ honeydew: 'f0fff0',
397
+ hotpink: 'ff69b4',
398
+ indianred: 'cd5c5c',
399
+ indigo: '4b0082',
400
+ ivory: 'fffff0',
401
+ khaki: 'f0e68c',
402
+ lavender: 'e6e6fa',
403
+ lavenderblush: 'fff0f5',
404
+ lawngreen: '7cfc00',
405
+ lemonchiffon: 'fffacd',
406
+ lightblue: 'add8e6',
407
+ lightcoral: 'f08080',
408
+ lightcyan: 'e0ffff',
409
+ lightgoldenrodyellow: 'fafad2',
410
+ lightgray: 'd3d3d3',
411
+ lightgreen: '90ee90',
412
+ lightgrey: 'd3d3d3',
413
+ lightpink: 'ffb6c1',
414
+ lightsalmon: 'ffa07a',
415
+ lightseagreen: '20b2aa',
416
+ lightskyblue: '87cefa',
417
+ lightslategray: '789',
418
+ lightslategrey: '789',
419
+ lightsteelblue: 'b0c4de',
420
+ lightyellow: 'ffffe0',
421
+ lime: '0f0',
422
+ limegreen: '32cd32',
423
+ linen: 'faf0e6',
424
+ magenta: 'f0f',
425
+ maroon: '800000',
426
+ mediumaquamarine: '66cdaa',
427
+ mediumblue: '0000cd',
428
+ mediumorchid: 'ba55d3',
429
+ mediumpurple: '9370db',
430
+ mediumseagreen: '3cb371',
431
+ mediumslateblue: '7b68ee',
432
+ mediumspringgreen: '00fa9a',
433
+ mediumturquoise: '48d1cc',
434
+ mediumvioletred: 'c71585',
435
+ midnightblue: '191970',
436
+ mintcream: 'f5fffa',
437
+ mistyrose: 'ffe4e1',
438
+ moccasin: 'ffe4b5',
439
+ navajowhite: 'ffdead',
440
+ navy: '000080',
441
+ oldlace: 'fdf5e6',
442
+ olive: '808000',
443
+ olivedrab: '6b8e23',
444
+ orange: 'ffa500',
445
+ orangered: 'ff4500',
446
+ orchid: 'da70d6',
447
+ palegoldenrod: 'eee8aa',
448
+ palegreen: '98fb98',
449
+ paleturquoise: 'afeeee',
450
+ palevioletred: 'db7093',
451
+ papayawhip: 'ffefd5',
452
+ peachpuff: 'ffdab9',
453
+ peru: 'cd853f',
454
+ pink: 'ffc0cb',
455
+ plum: 'dda0dd',
456
+ powderblue: 'b0e0e6',
457
+ purple: '800080',
458
+ rebeccapurple: '639',
459
+ red: 'f00',
460
+ rosybrown: 'bc8f8f',
461
+ royalblue: '4169e1',
462
+ saddlebrown: '8b4513',
463
+ salmon: 'fa8072',
464
+ sandybrown: 'f4a460',
465
+ seagreen: '2e8b57',
466
+ seashell: 'fff5ee',
467
+ sienna: 'a0522d',
468
+ silver: 'c0c0c0',
469
+ skyblue: '87ceeb',
470
+ slateblue: '6a5acd',
471
+ slategray: '708090',
472
+ slategrey: '708090',
473
+ snow: 'fffafa',
474
+ springgreen: '00ff7f',
475
+ steelblue: '4682b4',
476
+ tan: 'd2b48c',
477
+ teal: '008080',
478
+ thistle: 'd8bfd8',
479
+ tomato: 'ff6347',
480
+ turquoise: '40e0d0',
481
+ violet: 'ee82ee',
482
+ wheat: 'f5deb3',
483
+ white: 'fff',
484
+ whitesmoke: 'f5f5f5',
485
+ yellow: 'ff0',
486
+ yellowgreen: '9acd32'
487
+ };
488
+ /**
489
+ * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
490
+ * @private
491
+ */
492
+
493
+ function nameToHex(color) {
494
+ if (typeof color !== 'string') return color;
495
+ var normalizedColorName = color.toLowerCase();
496
+ return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
497
+ }
498
+
499
+ var hexRegex = /^#[a-fA-F0-9]{6}$/;
500
+ var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
501
+ var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
502
+ var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
503
+ var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;
504
+ var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
505
+ var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
506
+ var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
507
+ /**
508
+ * Returns an RgbColor or RgbaColor object. This utility function is only useful
509
+ * if want to extract a color component. With the color util `toColorString` you
510
+ * can convert a RgbColor or RgbaColor object back to a string.
511
+ *
512
+ * @example
513
+ * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
514
+ * const color1 = parseToRgb('rgb(255, 0, 0)');
515
+ * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
516
+ * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
517
+ */
518
+
519
+ function parseToRgb(color) {
520
+ if (typeof color !== 'string') {
521
+ throw new PolishedError(3);
522
+ }
523
+
524
+ var normalizedColor = nameToHex(color);
525
+
526
+ if (normalizedColor.match(hexRegex)) {
527
+ return {
528
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
529
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
530
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
531
+ };
532
+ }
533
+
534
+ if (normalizedColor.match(hexRgbaRegex)) {
535
+ var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
536
+ return {
537
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
538
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
539
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
540
+ alpha: alpha
541
+ };
542
+ }
543
+
544
+ if (normalizedColor.match(reducedHexRegex)) {
545
+ return {
546
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
547
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
548
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
549
+ };
550
+ }
551
+
552
+ if (normalizedColor.match(reducedRgbaHexRegex)) {
553
+ var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
554
+
555
+ return {
556
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
557
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
558
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
559
+ alpha: _alpha
560
+ };
561
+ }
562
+
563
+ var rgbMatched = rgbRegex.exec(normalizedColor);
564
+
565
+ if (rgbMatched) {
566
+ return {
567
+ red: parseInt("" + rgbMatched[1], 10),
568
+ green: parseInt("" + rgbMatched[2], 10),
569
+ blue: parseInt("" + rgbMatched[3], 10)
570
+ };
571
+ }
572
+
573
+ var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
574
+
575
+ if (rgbaMatched) {
576
+ return {
577
+ red: parseInt("" + rgbaMatched[1], 10),
578
+ green: parseInt("" + rgbaMatched[2], 10),
579
+ blue: parseInt("" + rgbaMatched[3], 10),
580
+ alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
581
+ };
582
+ }
583
+
584
+ var hslMatched = hslRegex.exec(normalizedColor);
585
+
586
+ if (hslMatched) {
587
+ var hue = parseInt("" + hslMatched[1], 10);
588
+ var saturation = parseInt("" + hslMatched[2], 10) / 100;
589
+ var lightness = parseInt("" + hslMatched[3], 10) / 100;
590
+ var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
591
+ var hslRgbMatched = rgbRegex.exec(rgbColorString);
592
+
593
+ if (!hslRgbMatched) {
594
+ throw new PolishedError(4, normalizedColor, rgbColorString);
595
+ }
596
+
597
+ return {
598
+ red: parseInt("" + hslRgbMatched[1], 10),
599
+ green: parseInt("" + hslRgbMatched[2], 10),
600
+ blue: parseInt("" + hslRgbMatched[3], 10)
601
+ };
602
+ }
603
+
604
+ var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
605
+
606
+ if (hslaMatched) {
607
+ var _hue = parseInt("" + hslaMatched[1], 10);
608
+
609
+ var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
610
+
611
+ var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
612
+
613
+ var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
614
+
615
+ var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
616
+
617
+ if (!_hslRgbMatched) {
618
+ throw new PolishedError(4, normalizedColor, _rgbColorString);
619
+ }
620
+
621
+ return {
622
+ red: parseInt("" + _hslRgbMatched[1], 10),
623
+ green: parseInt("" + _hslRgbMatched[2], 10),
624
+ blue: parseInt("" + _hslRgbMatched[3], 10),
625
+ alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
626
+ };
627
+ }
628
+
629
+ throw new PolishedError(5);
630
+ }
631
+
632
+ /**
633
+ * Reduces hex values if possible e.g. #ff8866 to #f86
634
+ * @private
635
+ */
636
+ var reduceHexValue = function reduceHexValue(value) {
637
+ if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
638
+ return "#" + value[1] + value[3] + value[5];
639
+ }
640
+
641
+ return value;
642
+ };
643
+
644
+ var reduceHexValue$1 = reduceHexValue;
645
+
646
+ function numberToHex(value) {
647
+ var hex = value.toString(16);
648
+ return hex.length === 1 ? "0" + hex : hex;
649
+ }
650
+
651
+ /**
652
+ * Returns a string value for the color. The returned result is the smallest possible hex notation.
653
+ *
654
+ * @example
655
+ * // Styles as object usage
656
+ * const styles = {
657
+ * background: rgb(255, 205, 100),
658
+ * background: rgb({ red: 255, green: 205, blue: 100 }),
659
+ * }
660
+ *
661
+ * // styled-components usage
662
+ * const div = styled.div`
663
+ * background: ${rgb(255, 205, 100)};
664
+ * background: ${rgb({ red: 255, green: 205, blue: 100 })};
665
+ * `
666
+ *
667
+ * // CSS in JS Output
668
+ *
669
+ * element {
670
+ * background: "#ffcd64";
671
+ * background: "#ffcd64";
672
+ * }
673
+ */
674
+ function rgb(value, green, blue) {
675
+ if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
676
+ return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
677
+ } else if (typeof value === 'object' && green === undefined && blue === undefined) {
678
+ return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
679
+ }
680
+
681
+ throw new PolishedError(6);
682
+ }
683
+
684
+ /**
685
+ * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
686
+ *
687
+ * Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
688
+ *
689
+ * @example
690
+ * // Styles as object usage
691
+ * const styles = {
692
+ * background: rgba(255, 205, 100, 0.7),
693
+ * background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
694
+ * background: rgba(255, 205, 100, 1),
695
+ * background: rgba('#ffffff', 0.4),
696
+ * background: rgba('black', 0.7),
697
+ * }
698
+ *
699
+ * // styled-components usage
700
+ * const div = styled.div`
701
+ * background: ${rgba(255, 205, 100, 0.7)};
702
+ * background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
703
+ * background: ${rgba(255, 205, 100, 1)};
704
+ * background: ${rgba('#ffffff', 0.4)};
705
+ * background: ${rgba('black', 0.7)};
706
+ * `
707
+ *
708
+ * // CSS in JS Output
709
+ *
710
+ * element {
711
+ * background: "rgba(255,205,100,0.7)";
712
+ * background: "rgba(255,205,100,0.7)";
713
+ * background: "#ffcd64";
714
+ * background: "rgba(255,255,255,0.4)";
715
+ * background: "rgba(0,0,0,0.7)";
716
+ * }
717
+ */
718
+ function rgba(firstValue, secondValue, thirdValue, fourthValue) {
719
+ if (typeof firstValue === 'string' && typeof secondValue === 'number') {
720
+ var rgbValue = parseToRgb(firstValue);
721
+ return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
722
+ } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
723
+ return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
724
+ } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
725
+ return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
726
+ }
727
+
728
+ throw new PolishedError(7);
729
+ }
730
+
731
+ // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
732
+ // eslint-disable-next-line no-unused-vars
733
+ // eslint-disable-next-line no-unused-vars
734
+ // eslint-disable-next-line no-redeclare
735
+ function curried(f, length, acc) {
736
+ return function fn() {
737
+ // eslint-disable-next-line prefer-rest-params
738
+ var combined = acc.concat(Array.prototype.slice.call(arguments));
739
+ return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
740
+ };
741
+ } // eslint-disable-next-line no-redeclare
742
+
743
+
744
+ function curry(f) {
745
+ // eslint-disable-line no-redeclare
746
+ return curried(f, f.length, []);
747
+ }
748
+
749
+ /**
750
+ * Mixes the two provided colors together by calculating the average of each of the RGB components weighted to the first color by the provided weight.
751
+ *
752
+ * @example
753
+ * // Styles as object usage
754
+ * const styles = {
755
+ * background: mix(0.5, '#f00', '#00f')
756
+ * background: mix(0.25, '#f00', '#00f')
757
+ * background: mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')
758
+ * }
759
+ *
760
+ * // styled-components usage
761
+ * const div = styled.div`
762
+ * background: ${mix(0.5, '#f00', '#00f')};
763
+ * background: ${mix(0.25, '#f00', '#00f')};
764
+ * background: ${mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')};
765
+ * `
766
+ *
767
+ * // CSS in JS Output
768
+ *
769
+ * element {
770
+ * background: "#7f007f";
771
+ * background: "#3f00bf";
772
+ * background: "rgba(63, 0, 191, 0.75)";
773
+ * }
774
+ */
775
+
776
+ function mix(weight, color, otherColor) {
777
+ if (color === 'transparent') return otherColor;
778
+ if (otherColor === 'transparent') return color;
779
+ if (weight === 0) return otherColor;
780
+ var parsedColor1 = parseToRgb(color);
781
+
782
+ var color1 = _extends({}, parsedColor1, {
783
+ alpha: typeof parsedColor1.alpha === 'number' ? parsedColor1.alpha : 1
784
+ });
785
+
786
+ var parsedColor2 = parseToRgb(otherColor);
787
+
788
+ var color2 = _extends({}, parsedColor2, {
789
+ alpha: typeof parsedColor2.alpha === 'number' ? parsedColor2.alpha : 1
790
+ }); // The formula is copied from the original Sass implementation:
791
+ // http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
792
+
793
+
794
+ var alphaDelta = color1.alpha - color2.alpha;
795
+ var x = parseFloat(weight) * 2 - 1;
796
+ var y = x * alphaDelta === -1 ? x : x + alphaDelta;
797
+ var z = 1 + x * alphaDelta;
798
+ var weight1 = (y / z + 1) / 2.0;
799
+ var weight2 = 1 - weight1;
800
+ var mixedColor = {
801
+ red: Math.floor(color1.red * weight1 + color2.red * weight2),
802
+ green: Math.floor(color1.green * weight1 + color2.green * weight2),
803
+ blue: Math.floor(color1.blue * weight1 + color2.blue * weight2),
804
+ alpha: color1.alpha * parseFloat(weight) + color2.alpha * (1 - parseFloat(weight))
805
+ };
806
+ return rgba(mixedColor);
807
+ } // prettier-ignore
808
+
809
+
810
+ var curriedMix = /*#__PURE__*/curry
811
+ /* ::<number | string, string, string, string> */
812
+ (mix);
813
+ var mix$1 = curriedMix;
814
+
815
+ /**
816
+ * Shades a color by mixing it with black. `shade` can produce
817
+ * hue shifts, where as `darken` manipulates the luminance channel and therefore
818
+ * doesn't produce hue shifts.
819
+ *
820
+ * @example
821
+ * // Styles as object usage
822
+ * const styles = {
823
+ * background: shade(0.25, '#00f')
824
+ * }
825
+ *
826
+ * // styled-components usage
827
+ * const div = styled.div`
828
+ * background: ${shade(0.25, '#00f')};
829
+ * `
830
+ *
831
+ * // CSS in JS Output
832
+ *
833
+ * element {
834
+ * background: "#00003f";
835
+ * }
836
+ */
837
+
838
+ function shade(percentage, color) {
839
+ if (color === 'transparent') return color;
840
+ return mix$1(parseFloat(percentage), 'rgb(0, 0, 0)', color);
841
+ } // prettier-ignore
842
+
843
+
844
+ var curriedShade = /*#__PURE__*/curry
845
+ /* ::<number | string, string, string> */
846
+ (shade);
847
+ var curriedShade$1 = curriedShade;
848
+
849
+ const SPACING = 4;
850
+ const BLACK = 'rgba(0,0,0,.87)';
851
+ const WHITE = '#fff';
852
+ const darkenPalette = (amount, palette, colorsToDarken) => Object
853
+ .entries(palette)
854
+ .reduce((acc, [key, val]) => (Object.assign(Object.assign({}, acc), { [key]: colorsToDarken.includes(key)
855
+ ? curriedShade$1(amount, val)
856
+ : val })), palette);
857
+ const createButtonPalette = (_a) => {
858
+ var { colorsToDarken } = _a, palette = __rest(_a, ["colorsToDarken"]);
859
+ return ({
860
+ idle: palette,
861
+ hover: darkenPalette(.1, palette, colorsToDarken),
862
+ active: darkenPalette(.2, palette, colorsToDarken),
863
+ });
864
+ };
865
+ const createPanePalette = (palette) => ({
866
+ main: {
867
+ idle: palette,
868
+ hover: darkenPalette(.05, palette, ['background'])
869
+ },
870
+ alternate: {
871
+ idle: darkenPalette(.02, palette, ['background']),
872
+ hover: darkenPalette(.05, palette, ['background']),
873
+ }
874
+ });
875
+ const theme = {
876
+ spacing: (...args) => args.map(arg => `${arg * SPACING}px`).join(' '),
877
+ palette: {
878
+ common: {
879
+ black: BLACK,
880
+ white: WHITE,
881
+ },
882
+ colors: {
883
+ blue: '#007bff',
884
+ indigo: '#6610f2',
885
+ purple: '#6f42c1',
886
+ pink: '#e83e8c',
887
+ red: '#e83e3e',
888
+ orange: '#fd7e14',
889
+ yellow: '#ffc107',
890
+ green: '#23B294',
891
+ teal: '#20c997',
892
+ cyan: '#17a2b8',
893
+ gray: '#6c757d',
894
+ grayDark: '#343a40',
895
+ light: '#f8f9fa',
896
+ dark: '#343a40',
897
+ },
898
+ form: {
899
+ hint: '#C7C7C7',
900
+ error: '#9f3a38',
901
+ },
902
+ button: {
903
+ basic: createButtonPalette({
904
+ colorsToDarken: ['background', 'text'],
905
+ background: WHITE,
906
+ text: BLACK,
907
+ }),
908
+ default: createButtonPalette({
909
+ colorsToDarken: ['background', 'text'],
910
+ background: '#e0e1e2',
911
+ text: BLACK,
912
+ }),
913
+ text: {
914
+ idle: {
915
+ text: '#999c9e',
916
+ background: 'transparent'
917
+ },
918
+ active: {
919
+ text: BLACK,
920
+ background: 'transparent'
921
+ },
922
+ hover: {
923
+ text: BLACK,
924
+ background: 'transparent'
925
+ }
926
+ },
927
+ danger: createButtonPalette({
928
+ colorsToDarken: ['background'],
929
+ background: '#EC5969',
930
+ text: WHITE,
931
+ }),
932
+ primary: createButtonPalette({
933
+ colorsToDarken: ['background'],
934
+ background: '#2284C4',
935
+ text: WHITE,
936
+ }),
937
+ secondary: createButtonPalette({
938
+ colorsToDarken: ['background'],
939
+ background: '#23B294',
940
+ text: WHITE
941
+ }),
942
+ },
943
+ pane: {
944
+ basic: createPanePalette({
945
+ text: BLACK,
946
+ background: WHITE,
947
+ border: '#ddd'
948
+ }),
949
+ emphasized: createPanePalette({
950
+ text: BLACK,
951
+ background: '#f3f3f3',
952
+ border: '#ddd'
953
+ }),
954
+ info: createPanePalette({
955
+ text: '#0c5460',
956
+ background: '#d1ecf1',
957
+ border: '#bee5eb'
958
+ }),
959
+ negative: createPanePalette({
960
+ text: '#721c24',
961
+ background: '#f8d7da',
962
+ border: '#f5c6cb'
963
+ }),
964
+ positive: createPanePalette({
965
+ text: '#155724',
966
+ background: '#d4edda',
967
+ border: '#c3e6cb',
968
+ }),
969
+ warning: createPanePalette({
970
+ text: '#856404',
971
+ background: '#fff3cd',
972
+ border: '#ffeeba'
973
+ })
974
+ }
975
+ }
976
+ };
977
+
978
+ // Fix for styled-components with react-18.
979
+ // Can be removed once this issue is resolved.
980
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/59765#issuecomment-1092938253
981
+ const ThemeProviderFixed = styledComponents.ThemeProvider;
982
+ const UiProvider = ({ children, theme: themeOverride }) => (React.createElement(ThemeProviderFixed, { theme: themeOverride || theme }, children));
983
+
984
+ const noop$1 = () => { };
985
+ const UiState = React.createContext({
986
+ isSideMenuOpen: false,
987
+ closeSideMenu: noop$1,
988
+ openSideMenu: noop$1,
989
+ });
990
+ const useUiStateContext = () => React.useContext(UiState);
991
+ const UiStateProvider = ({ children }) => {
992
+ const [isSideMenuOpen, setIsSideMenuOpen] = React.useState(false);
993
+ const handleCloseSideMenu = React.useCallback(() => setIsSideMenuOpen(false), []);
994
+ const handleOpenSideMenu = React.useCallback(() => setIsSideMenuOpen(true), []);
995
+ return (React.createElement(UiState.Provider, { value: {
996
+ isSideMenuOpen,
997
+ closeSideMenu: handleCloseSideMenu,
998
+ openSideMenu: handleOpenSideMenu,
999
+ } }, children));
1000
+ };
1001
+
1002
+ const Wrapper$d = styledComponents.styled.div `
1003
+ display: flex;
1004
+ flex-direction: column;
1005
+ height: 100%;
1006
+ font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
1007
+ color: ${props => props.theme.palette.common.black};
1008
+ font-size: 14px;
1009
+ `;
1010
+ const UiWrapper = ({ theme, children }) => (React.createElement(UiProvider, { theme: theme },
1011
+ React.createElement(UiStateProvider, null,
1012
+ React.createElement(Wrapper$d, null, children))));
1013
+
1014
+ function memoize(fn) {
1015
+ var cache = Object.create(null);
1016
+ return function (arg) {
1017
+ if (cache[arg] === undefined) cache[arg] = fn(arg);
1018
+ return cache[arg];
1019
+ };
1020
+ }
1021
+
1022
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
1023
+
1024
+ var isPropValid = /* #__PURE__ */memoize(function (prop) {
1025
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
1026
+ /* o */
1027
+ && prop.charCodeAt(1) === 110
1028
+ /* n */
1029
+ && prop.charCodeAt(2) < 91;
1030
+ }
1031
+ /* Z+1 */
1032
+ );
1033
+
1034
+ const slideInFromTop = styledComponents.keyframes `
1035
+ 0% {
1036
+ opacity: 0;
1037
+ transform: translateY(-5px);
1038
+ }
1039
+ 100% {
1040
+ opacity: 1;
1041
+ transform: translateY(0);
1042
+ }
1043
+ `;
1044
+ const SlideInFromTop = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1045
+ animation: ${slideInFromTop} ${props => props.speed || '.3s'} ease-in 0s 1;
1046
+ `;
1047
+
1048
+ const sharedStyles$1 = styledComponents.css `
1049
+ margin: 0 0;
1050
+ padding: 0 0;
1051
+ font-weight: 700;
1052
+ line-height: 1.28571429em;
1053
+ `;
1054
+ const H1 = styledComponents.styled.h1.withConfig({ shouldForwardProp: isPropValid }) `
1055
+ font-size: 2rem;
1056
+ min-height: 1rem;
1057
+ ${sharedStyles$1}
1058
+ `;
1059
+ const H2 = styledComponents.styled.h2.withConfig({ shouldForwardProp: isPropValid }) `
1060
+ font-size: 1.71428571rem;
1061
+ ${sharedStyles$1}
1062
+ `;
1063
+ const H3 = styledComponents.styled.h3.withConfig({ shouldForwardProp: isPropValid }) `
1064
+ font-size: 1.28571429rem;
1065
+ ${sharedStyles$1}
1066
+ `;
1067
+ const H4 = styledComponents.styled.h4.withConfig({ shouldForwardProp: isPropValid }) `
1068
+ font-size: 1.07142857rem;
1069
+ ${sharedStyles$1}
1070
+ `;
1071
+ const H5 = styledComponents.styled.h5.withConfig({ shouldForwardProp: isPropValid }) `
1072
+ font-size: 1rem;
1073
+ ${sharedStyles$1}
1074
+ `;
1075
+ const mapping = {
1076
+ 1: H1,
1077
+ 2: H2,
1078
+ 3: H3,
1079
+ 4: H4,
1080
+ 5: H5,
1081
+ };
1082
+ const Header = (_a) => {
1083
+ var { level = 1 } = _a, restProps = __rest(_a, ["level"]);
1084
+ const Component = mapping[level];
1085
+ // @ts-ignore
1086
+ return React.createElement(Component, Object.assign({}, restProps));
1087
+ };
1088
+
1089
+ const Paragraph = styledComponents.styled.p `
1090
+ font-size: 14px;
1091
+ line-height: 20px;
1092
+ // margin: 0 0 1em;
1093
+ margin: 0;
1094
+ `;
1095
+
1096
+ const breakPoints = [
1097
+ "mobile",
1098
+ "tablet",
1099
+ "laptop",
1100
+ "desktop",
1101
+ ];
1102
+ const BreakPointValues = {
1103
+ mobile: 0,
1104
+ tablet: 768,
1105
+ laptop: 1024,
1106
+ desktop: 1430,
1107
+ };
1108
+ /**
1109
+ * Wraps given cssRules in the corresponding media-query:
1110
+ */
1111
+ const mq = (bk, cssRules) => styledComponents.css `
1112
+ @media screen and (min-width: ${BreakPointValues[bk]}px) {
1113
+ ${cssRules}
1114
+ }
1115
+ `;
1116
+ const isResponsiveObject = (obj) => {
1117
+ if (typeof obj !== "object") {
1118
+ return false;
1119
+ }
1120
+ const keys = Object.keys(obj);
1121
+ for (const breakPoint of breakPoints) {
1122
+ if (keys.includes(breakPoint)) {
1123
+ return true;
1124
+ }
1125
+ }
1126
+ return false;
1127
+ };
1128
+ /**
1129
+ * Wraps 'responsive-props' in media-queries if necessary.
1130
+ */
1131
+ const responsiveProps = (props, map) => {
1132
+ const nonResponsiveRules = Object
1133
+ .entries(map)
1134
+ .filter(([key]) => props[key] !== undefined && !isResponsiveObject(props[key]))
1135
+ .map(([key, fun]) => fun(props[key]));
1136
+ const mediaQueries = breakPoints
1137
+ .map(bp => {
1138
+ // See if we can make css-rules for this breakpoint:
1139
+ const responsiveCssRules = Object
1140
+ .entries(map)
1141
+ .filter(([key]) => { var _a; return ((_a = props === null || props === void 0 ? void 0 : props[key]) === null || _a === void 0 ? void 0 : _a[bp]) !== undefined; })
1142
+ .map(([key, fun]) => fun(props[key][bp]));
1143
+ return (responsiveCssRules.length > 0)
1144
+ ? mq(bp, responsiveCssRules) // Wrap css-rules in a mediaQuery
1145
+ : undefined; // Undefined -> filter out later
1146
+ })
1147
+ .filter(_ => _ !== undefined);
1148
+ return [
1149
+ mediaQueries, ...nonResponsiveRules
1150
+ ];
1151
+ };
1152
+
1153
+ const Box = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1154
+ box-sizing: border-box;
1155
+
1156
+ ${(props) => responsiveProps(props, {
1157
+ "p": unit => styledComponents.css `padding: ${props.theme.spacing(unit)};`,
1158
+ "pt": unit => styledComponents.css `padding-top: ${props.theme.spacing(unit)};`,
1159
+ "pr": unit => styledComponents.css `padding-right: ${props.theme.spacing(unit)};`,
1160
+ "pb": unit => styledComponents.css `padding-bottom: ${props.theme.spacing(unit)};`,
1161
+ "pl": unit => styledComponents.css `padding-left: ${props.theme.spacing(unit)};`,
1162
+ "m": unit => styledComponents.css `margin: ${props.theme.spacing(unit)};`,
1163
+ "mt": unit => styledComponents.css `margin-top: ${props.theme.spacing(unit)};`,
1164
+ "mr": unit => styledComponents.css `margin-right: ${props.theme.spacing(unit)};`,
1165
+ "mb": unit => styledComponents.css `margin-bottom: ${props.theme.spacing(unit)};`,
1166
+ "ml": unit => styledComponents.css `margin-left: ${props.theme.spacing(unit)};`,
1167
+ "display": unit => styledComponents.css `display: ${unit};`,
1168
+ "flexGrow": unit => styledComponents.css `flex-grow: ${unit};`,
1169
+ "flexShrink": unit => styledComponents.css `flex-shrink: ${unit};`,
1170
+ "flexDirection": unit => styledComponents.css `flex-direction: ${unit};`,
1171
+ "alignItems": unit => styledComponents.css `align-items: ${unit};`,
1172
+ "textAlign": unit => styledComponents.css `text-align: ${unit};`,
1173
+ "justifyContent": unit => styledComponents.css `justify-content: ${unit};`,
1174
+ "width": unit => styledComponents.css `width: ${typeof unit === 'number' ? props.theme.spacing(unit) : unit};`,
1175
+ })}
1176
+ `;
1177
+
1178
+ const Wrapper$c = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1179
+ border-radius: 4px;
1180
+ border: 1px solid ${props => props.theme.palette.pane[props.variant].main.idle.border};
1181
+ background-color: ${props => props.theme.palette.pane[props.variant].main.idle.background};
1182
+ color: ${props => props.theme.palette.pane[props.variant].main.idle.text};
1183
+ `;
1184
+ const Alert = ({ children, title, variant = "basic" }) => (React.createElement(Wrapper$c, { variant: variant },
1185
+ React.createElement(Box, { p: 3 },
1186
+ title && (React.createElement(Box, { pb: children ? 1 : 0 },
1187
+ React.createElement(Header, { level: 4 }, title))),
1188
+ children && React.createElement(Paragraph, null, children))));
1189
+
1190
+ const green = '#20c997';
1191
+ const Mask = styledComponents.styled.g `
1192
+ fill: none;
1193
+ stroke: ${green};
1194
+ stroke-width: 10;
1195
+ `;
1196
+ const polyLineAnimation = styledComponents.keyframes `
1197
+ 0% {
1198
+ stroke-dashoffset: 100px
1199
+ }
1200
+ 100% {
1201
+ stroke-dashoffset: 0px
1202
+ }
1203
+ `;
1204
+ const Polyline = styledComponents.styled.polyline `
1205
+ stroke-dasharray: 100px, 100px;
1206
+ stroke-dashoffset: 200px;
1207
+ animation: ${polyLineAnimation} 0.42s ease-in-out 0.8s backwards;
1208
+ stroke: ${green};
1209
+ stroke-width: 10;
1210
+ `;
1211
+ const circleAnimation = styledComponents.keyframes `
1212
+ 0% {
1213
+ stroke-dashoffset: 480px
1214
+ }
1215
+ 100% {
1216
+ stroke-dashoffset: 960px
1217
+ }
1218
+ `;
1219
+ const Circle$1 = styledComponents.styled.circle `
1220
+ stroke-dasharray: 480px, 480px;
1221
+ stroke-dashoffset: 960px;
1222
+ animation: ${circleAnimation} 0.6s ease-in-out backwards;
1223
+ stroke: ${green};
1224
+ stroke-width: 10;
1225
+ `;
1226
+ const circleColoredAnimation = styledComponents.keyframes `
1227
+ 0% {
1228
+ opacity:0;
1229
+ }
1230
+ 100% {
1231
+ opacity:100;
1232
+ }
1233
+ `;
1234
+ const CircleColored = styledComponents.styled.circle `
1235
+ stroke-dasharray: 480px, 480px;
1236
+ stroke-dashoffset: 960px;
1237
+ animation: ${circleColoredAnimation} 1.2s ease-in-out 1.4s backwards;
1238
+ fill: #effaf8;
1239
+ `;
1240
+ const AnimatedCheckmark = () => (React.createElement("svg", { viewBox: "0 0 154 154" },
1241
+ React.createElement(Mask, null,
1242
+ React.createElement(Circle$1, { cx: '77', cy: '77', r: '72' }),
1243
+ React.createElement(CircleColored, { cx: '77', cy: '77', r: '72' }),
1244
+ React.createElement(Polyline, { points: "43.5,77.8 63.7,97.9 112.2,49.4" }))));
1245
+
1246
+ function styleInject(css, ref) {
1247
+ if ( ref === void 0 ) ref = {};
1248
+ var insertAt = ref.insertAt;
1249
+
1250
+ if (!css || typeof document === 'undefined') { return; }
1251
+
1252
+ var head = document.head || document.getElementsByTagName('head')[0];
1253
+ var style = document.createElement('style');
1254
+ style.type = 'text/css';
1255
+
1256
+ if (insertAt === 'top') {
1257
+ if (head.firstChild) {
1258
+ head.insertBefore(style, head.firstChild);
1259
+ } else {
1260
+ head.appendChild(style);
1261
+ }
1262
+ } else {
1263
+ head.appendChild(style);
1264
+ }
1265
+
1266
+ if (style.styleSheet) {
1267
+ style.styleSheet.cssText = css;
1268
+ } else {
1269
+ style.appendChild(document.createTextNode(css));
1270
+ }
1271
+ }
1272
+
1273
+ var css_248z = ".BreadCrumbs-module_breadcrumbs__-UMJj {\n list-style: none;\n padding: 0;\n margin: 0;\n display:flex;\n}\n\n.BreadCrumbs-module_crumb__SSW-t {\n display: flex;\n\n &:not(:last-of-type):after {\n content: \"/\";\n color: var(--colors-gray);\n line-height: 1em;\n margin: auto auto;\n padding: 0 var(--spacing-2) 0 0;\n }\n}";
1274
+ var classes = {"breadcrumbs":"BreadCrumbs-module_breadcrumbs__-UMJj","crumb":"BreadCrumbs-module_crumb__SSW-t"};
1275
+ styleInject(css_248z);
1276
+
1277
+ const BreadCrumbs = (props) => React.createElement("ul", Object.assign({ className: classes.breadcrumbs }, props));
1278
+ const Crumb = styledComponents.styled.li `
1279
+ display: flex;
1280
+
1281
+ &:not(:last-of-type):after {
1282
+ content: "/";
1283
+ color: ${props => props.theme.palette.colors.gray};
1284
+ line-height: 1em;
1285
+ content: "/";
1286
+ margin: auto auto;
1287
+ padding: ${props => props.theme.spacing(0, 2, 0, 0)};
1288
+ }
1289
+ `;
1290
+
1291
+ const Wrapper$b = styledComponents.styled.div `
1292
+ background-color: ${props => props.theme.palette.common.white};
1293
+ border-radius: 4px;
1294
+ border: 1px solid #DEDEDF;
1295
+ box-shadow: 0px 2px 3px rgb(0 0 0 / 6%);
1296
+ `;
1297
+ const Meta = styledComponents.styled(Box) `
1298
+ font-size: 12px;
1299
+ font-style: italic;
1300
+ `;
1301
+ const Title = styledComponents.styled(Box) `
1302
+ ${(props) => props.panelHasChildren && styledComponents.css `
1303
+ border-radius: 4px;
1304
+ border-bottom: 1px solid rgba(34,36,38,.15);
1305
+ `}
1306
+
1307
+ ${(props) => !!props.onClick && styledComponents.css `
1308
+ cursor: pointer;
1309
+ user-select: none;
1310
+ `}
1311
+ `;
1312
+ const Footer$1 = styledComponents.styled(Box) `
1313
+ border-radius: 4px;
1314
+ background-color: #FFF;
1315
+ border-top: 1px solid rgba(34,36,38,.15);
1316
+ `;
1317
+ const Panel = ({ children, className, title, titleAction, titleMeta, onClickTitle, footer, p = 3, titleLevel = 5 }) => (React.createElement(Wrapper$b, { className: className },
1318
+ title && (React.createElement(Title, { p: 3, panelHasChildren: !!children, display: "flex", alignItems: "center", onClick: onClickTitle },
1319
+ React.createElement(Box, { flexGrow: 1 },
1320
+ React.createElement(Header, { level: titleLevel }, title)),
1321
+ titleMeta && React.createElement(Meta, null, titleMeta),
1322
+ titleAction && React.createElement(Box, { pl: 5 }, titleAction))),
1323
+ children && (React.createElement(Box, { p: p }, children)),
1324
+ footer && (React.createElement(Footer$1, { p: 3 }, footer))));
1325
+
1326
+ const Animation = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1327
+ transform: ${props => props.isOpen ? `translate(0)` : `translateY(-101%)`};
1328
+ transition-duration: ${props => props.duration || 0.25}s;
1329
+ transition-property: transform;
1330
+ }
1331
+ `;
1332
+ const Wrapper$a = styledComponents.styled.div `
1333
+ overflow: hidden;
1334
+ `;
1335
+ const Hider = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1336
+ display: ${props => props.isHidden ? 'none' : 'block'};
1337
+ `;
1338
+ // Returns the boolean value in the next tick.
1339
+ // Allows for transition to start when DOM is updated, it prevents a flickers.
1340
+ const useOnNextTick = (val) => {
1341
+ const [delayedVal, setDelayedVal] = React.useState(val);
1342
+ React.useEffect(() => {
1343
+ const timeout = setTimeout(() => setDelayedVal(val), 0);
1344
+ return () => clearTimeout(timeout);
1345
+ }, [val, setDelayedVal]);
1346
+ return delayedVal;
1347
+ };
1348
+ const SlideOpen = ({ isOpen, children, duration, onChange }) => {
1349
+ const isDelayedOpen = useOnNextTick(isOpen);
1350
+ const [isHidden, setIsHidden] = React.useState(!isOpen);
1351
+ const handleTransitionEnd = React.useCallback(() => {
1352
+ if (!isOpen) {
1353
+ setIsHidden(true);
1354
+ onChange === null || onChange === void 0 ? void 0 : onChange(false);
1355
+ }
1356
+ }, [isOpen, onChange]);
1357
+ React.useEffect(() => {
1358
+ if (isOpen) {
1359
+ setIsHidden(false);
1360
+ onChange === null || onChange === void 0 ? void 0 : onChange(true);
1361
+ }
1362
+ }, [isOpen, onChange]);
1363
+ return (React.createElement(Wrapper$a, null,
1364
+ React.createElement(Animation, { isOpen: isDelayedOpen, onTransitionEndCapture: handleTransitionEnd, duration: duration },
1365
+ React.createElement(Hider, { isHidden: isHidden }, children))));
1366
+ };
1367
+
1368
+ const TitleActionWrapper = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1369
+ transform: scaleY( ${props => props.isOpen ? '-1' : '1'} );
1370
+ `;
1371
+ const StyledPanel$2 = styledComponents.styled(Panel) `
1372
+ ${props => !props.isOpen && styledComponents.css `border-bottom: 0;`}
1373
+ `;
1374
+ const CollapsiblePanel = (_a) => {
1375
+ var { isInitiallyOpen, children, titleAction } = _a, rest = __rest(_a, ["isInitiallyOpen", "children", "titleAction"]);
1376
+ const [isOpen, setIsOpen] = React.useState(isInitiallyOpen);
1377
+ const toggleOpen = React.useCallback(() => setIsOpen(!isOpen), [setIsOpen, isOpen]);
1378
+ return (React.createElement(StyledPanel$2, Object.assign({}, rest, { isOpen: isOpen, onClickTitle: toggleOpen, p: 0, titleAction: React.createElement(TitleActionWrapper, { isOpen: isOpen }, titleAction) }),
1379
+ React.createElement(SlideOpen, { isOpen: isOpen },
1380
+ React.createElement(Box, { p: 3 }, children))));
1381
+ };
1382
+
1383
+ const useConfirmModal = ({ onConfirm }) => {
1384
+ const [isOpen, setIsOpen] = React.useState(false);
1385
+ const onCancel = () => setIsOpen(false);
1386
+ const handleOpen = () => setIsOpen(true);
1387
+ const handleConfirm = () => {
1388
+ onConfirm();
1389
+ setIsOpen(false);
1390
+ };
1391
+ return [
1392
+ {
1393
+ onCancel,
1394
+ onConfirm: handleConfirm,
1395
+ isOpen,
1396
+ },
1397
+ handleOpen,
1398
+ ];
1399
+ };
1400
+
1401
+ const delay = styledComponents.keyframes `
1402
+ 0% {
1403
+ opacity: 0;
1404
+ }
1405
+ 100% {
1406
+ opacity: 1;
1407
+ }
1408
+ `;
1409
+ const Overlay = styledComponents.styled.div `
1410
+ position: fixed;
1411
+ top: 0;
1412
+ left: 0;
1413
+ right: 0;
1414
+ bottom: 0;
1415
+ z-index: 10;
1416
+ opacity: 0;
1417
+ background-color: rgba(0,0,0,0.6);
1418
+ animation: ${delay} 0.2s forwards;
1419
+ `;
1420
+
1421
+ const Wrapper$9 = styledComponents.styled.div `
1422
+ position: fixed;
1423
+ top: 0;
1424
+ left: 0;
1425
+ right: 0;
1426
+ bottom: 0;
1427
+
1428
+ display: flex;
1429
+ align-items: center;
1430
+ justify-content: center;
1431
+
1432
+ z-index: 50;
1433
+ `;
1434
+ const StyledPanel$1 = styledComponents.styled(Panel) `
1435
+ box-shadow: 0 8px 8px 0 rgba(34,36,38,.15);
1436
+ `;
1437
+ const Content = styledComponents.styled.div `
1438
+ line-height: ${props => props.theme.spacing(6)};
1439
+ font-size: 15px;
1440
+ `;
1441
+ const Modal = (_a) => {
1442
+ var { children, handleClickOverlay, buttons } = _a, panelProps = __rest(_a, ["children", "handleClickOverlay", "buttons"]);
1443
+ return (React.createElement(React.Fragment, null,
1444
+ React.createElement(Overlay, { onClick: handleClickOverlay }),
1445
+ React.createElement(Wrapper$9, null,
1446
+ React.createElement(SlideInFromTop, null,
1447
+ React.createElement(StyledPanel$1, Object.assign({ footer: buttons ? (React.createElement(Box, { display: "flex", justifyContent: "flex-end" }, buttons)) : undefined }, panelProps), children && (React.createElement(Content, null, children)))))));
1448
+ };
1449
+
1450
+ const Wrapper$8 = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1451
+ ${props => props.stretch && `width: 100%;`}
1452
+ ${props => props.actionButton || props.stretch
1453
+ ? styledComponents.css `margin: 0;`
1454
+ : styledComponents.css `margin: ${props => props.theme.spacing(0, 2, 0, 0)};`}
1455
+ `;
1456
+ const StyledButton$1 = styledComponents.styled.button.withConfig({ shouldForwardProp: isPropValid }) `
1457
+ font-size: 14px;
1458
+ font-weight: bold;
1459
+ letter-spacing: 1px;
1460
+ line-height: 1em;
1461
+ outline: 0;
1462
+ border: none;
1463
+ border-radius: 4px;
1464
+ cursor: pointer;
1465
+ text-decoration: none;
1466
+ font-family: "Open Sans", Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
1467
+ transition: background-color .1s ease, color .1s ease;
1468
+ display: flex;
1469
+ flex-direction: row;
1470
+ align-items: center;
1471
+ user-select: none;
1472
+ min-height: ${props => props.inline ? 'auto' : '38px'};
1473
+
1474
+ ${props => props.stretch && styledComponents.css `
1475
+ width: 100%;
1476
+ display: block;
1477
+ `}
1478
+
1479
+ ${props => props.actionButton && styledComponents.css `
1480
+ width: 100%;
1481
+ ${mq('laptop', `width: auto`)}
1482
+ `}
1483
+
1484
+
1485
+ ${props => props.variant !== 'text'
1486
+ ? !props.icon
1487
+ ? styledComponents.css `padding: ${props.theme.spacing(3, 5)}; min-width: ${props => props.theme.spacing(10)};`
1488
+ : props.hasChildren && styledComponents.css `position: relative; padding: ${props.theme.spacing(3, 5, 3, 13)};`
1489
+ : styledComponents.css `font-weight: 700; padding: 0;`}
1490
+
1491
+ &:disabled {
1492
+ opacity: .5;
1493
+ cursor: default;
1494
+ }
1495
+
1496
+ &:focus {
1497
+ background-blend-mode: darken;
1498
+ }
1499
+
1500
+ ${(props) => {
1501
+ if (props.variant === "basic") {
1502
+ return `
1503
+ border: 1px solid rgba(34,36,38,.15);
1504
+ `;
1505
+ }
1506
+ }}
1507
+
1508
+ ${(props) => {
1509
+ var _a;
1510
+ const { idle, hover, active } = theme.palette.button[(_a = props.variant) !== null && _a !== void 0 ? _a : 'default'];
1511
+ return `
1512
+ color: ${idle.text};
1513
+ background-color: ${idle.background};
1514
+
1515
+ &:not(:disabled) {
1516
+ &:hover, &:focus {
1517
+ color: ${hover.text};
1518
+ background-color: ${hover.background};
1519
+ }
1520
+
1521
+ &:active {
1522
+ color: ${active.text};
1523
+ background-color: ${active.background};
1524
+ }
1525
+ }
1526
+
1527
+ `;
1528
+ }}
1529
+ `;
1530
+ const IconWrapper$1 = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
1531
+ ${props => props.variant !== "text" && styledComponents.css `
1532
+ min-width: ${props.theme.spacing(10)};
1533
+ `}
1534
+
1535
+ ${props => props.variant === "text"
1536
+ ? props.hasChildren && styledComponents.css `
1537
+ padding-right: ${props.theme.spacing(2)};
1538
+ `
1539
+ : props.hasChildren && styledComponents.css `
1540
+ position: absolute;
1541
+ left: 0;
1542
+ top: 0;
1543
+ width: ${props => props.theme.spacing(10)};
1544
+ height: 100%;
1545
+ background-color: rgba(0,0,0,.05);
1546
+
1547
+ & > svg {
1548
+ transform: translate(-50%, -50%);
1549
+ position: absolute;
1550
+ top: 50%;
1551
+ left: 50%;
1552
+ }
1553
+ `}
1554
+ `;
1555
+ const Button$1 = React.forwardRef((_a, ref) => {
1556
+ var { children, icon, stretch } = _a, props = __rest(_a, ["children", "icon", "stretch"]);
1557
+ return (React.createElement(Wrapper$8, { actionButton: props.actionButton, stretch: stretch },
1558
+ React.createElement(StyledButton$1, Object.assign({ ref: ref, icon: icon, hasChildren: !!children, stretch: stretch }, props),
1559
+ icon && (React.createElement(IconWrapper$1, { variant: props.variant, hasChildren: !!children }, icon)),
1560
+ children)));
1561
+ });
1562
+
1563
+ const ConfirmModal = ({ title, children, cancelLabel = "Nee, annuleren", confirmLabel = "Ja", confirmVariant = 'secondary', confirmIcon, cancelIcon, isOpen, onCancel, onConfirm, }) => {
1564
+ return isOpen ? (React.createElement(Modal, { title: title, handleClickOverlay: onCancel, buttons: React.createElement(React.Fragment, null,
1565
+ React.createElement(Button$1, { "data-testid": "btn-cancel", onClick: onCancel, variant: "basic", icon: cancelIcon }, cancelLabel),
1566
+ React.createElement(Button$1, { "data-testid": "btn-confirm", onClick: onConfirm, variant: confirmVariant, icon: confirmIcon }, confirmLabel)) }, children)) : null;
1567
+ };
1568
+
1569
+ const noop = () => { };
1570
+ const ConfirmButton = (_a) => {
1571
+ var _b;
1572
+ var { modalProps } = _a, buttonProps = __rest(_a, ["modalProps"]);
1573
+ const [modalHandlerProps, openModal] = useConfirmModal({
1574
+ onConfirm: (_b = modalProps.onConfirm) !== null && _b !== void 0 ? _b : noop
1575
+ });
1576
+ return React.createElement(React.Fragment, null,
1577
+ React.createElement(Button$1, Object.assign({}, buttonProps, { onClick: openModal })),
1578
+ React.createElement(ConfirmModal, Object.assign({ title: "Are you sure?" }, modalProps, modalHandlerProps)));
1579
+ };
1580
+
1581
+ const StyledTable = styledComponents.styled.table.withConfig({ shouldForwardProp: isPropValid }) `
1582
+ border-radius: 4px;
1583
+ width: 100%;
1584
+ border-collapse: separate;
1585
+ border-spacing: 0;
1586
+
1587
+ ${(props) => responsiveProps(props, {
1588
+ "tableLayout": unit => styledComponents.css `table-layout: ${unit};`,
1589
+ })}
1590
+ `;
1591
+ const StyledTableRow = styledComponents.styled.tr.withConfig({ shouldForwardProp: isPropValid }) `
1592
+ & > td {
1593
+ transition: background-color .1s ease, color .1s ease;
1594
+ }
1595
+
1596
+ ${props => Object.entries(props.theme.palette.pane).map(([variant, value]) => `
1597
+ &:nth-child(odd) > td.${variant} {
1598
+ color: ${value.main.idle.text};
1599
+ background-color: ${value.main.idle.background};
1600
+ }
1601
+ &:nth-child(even) > td.${variant} {
1602
+ color: ${value.alternate.idle.text};
1603
+ background-color: ${value.alternate.idle.background};
1604
+ }
1605
+
1606
+
1607
+ ${!props.disableHover && `
1608
+ &:nth-child(odd):hover > td.${variant} {
1609
+ color: ${value.main.hover.text};
1610
+ background-color: ${value.main.hover.background};
1611
+ }
1612
+ &:nth-child(even):hover > td.${variant} {
1613
+ color: ${value.alternate.hover.text};
1614
+ background-color: ${value.alternate.hover.background};
1615
+ }
1616
+ `}
1617
+ `)}
1618
+ `;
1619
+ const StyledTableCell = styledComponents.styled.td.withConfig({ shouldForwardProp: isPropValid }) `
1620
+ border-top: 1px solid rgba(34,36,38,.1);
1621
+ border-right: 1px solid rgba(34,36,38,.1);
1622
+ padding: ${props => props.theme.spacing(2, 3)};
1623
+
1624
+ &:last-of-type {
1625
+ border-right: 0;
1626
+ }
1627
+
1628
+ ${(props) => responsiveProps(props, {
1629
+ width: unit => styledComponents.css `width: ${unit};`,
1630
+ })}
1631
+ `;
1632
+ const StyledTableHeadCell = styledComponents.styled.th.withConfig({ shouldForwardProp: isPropValid }) `
1633
+ border-right: 1px solid rgba(34,36,38,.1);
1634
+ text-align: left;
1635
+ padding: ${props => props.theme.spacing(2, 3)};
1636
+ font-weight: 700;
1637
+ transition: background-color .1s ease, color .1s ease;
1638
+
1639
+ &:last-of-type {
1640
+ border-right: 0;
1641
+ }
1642
+
1643
+ ${props => !!props.variant && styledComponents.css `
1644
+ color: ${props.theme.palette.pane[props.variant].main.idle.text};
1645
+ background-color: ${props.theme.palette.pane[props.variant].main.idle.background};
1646
+
1647
+ &:hover {
1648
+ color: ${props.theme.palette.pane[props.variant].main.hover.text};
1649
+ background-color: ${props.theme.palette.pane[props.variant].main.hover.background};
1650
+ }
1651
+ `}
1652
+
1653
+ ${props => props.width ? `width: ${props.width};` : ''}
1654
+
1655
+ ${props => props.sortable && `
1656
+ cursor: pointer;
1657
+ user-select: none;
1658
+
1659
+ &:hover {
1660
+ background-color: ${props.theme.palette.pane.basic.main.hover.background};
1661
+ }
1662
+ `}
1663
+
1664
+ ${props => props.sortDirection && `
1665
+ position:relative;
1666
+
1667
+ &:after {
1668
+ content: " ";
1669
+ position: absolute;
1670
+ right: 15px;
1671
+ top: 50%;
1672
+
1673
+ height: 0;
1674
+ width: 0;
1675
+ border: 5px solid transparent;
1676
+
1677
+ ${props.sortDirection === 'asc' ? `
1678
+ border-top-color: #000;
1679
+ transform: translateY(-25%);
1680
+ ` : `
1681
+ border-bottom-color: #000;
1682
+ transform: translateY(-75%);
1683
+ `}
1684
+ }
1685
+ `}
1686
+ `;
1687
+ // Wrapper to allow for dot notated components:
1688
+ const Table = (props) => (React.createElement(StyledTable, Object.assign({}, props)));
1689
+ const TableCell = (_a) => {
1690
+ var { variant, className } = _a, rest = __rest(_a, ["variant", "className"]);
1691
+ return (React.createElement(StyledTableCell, Object.assign({ className: `${className || ''} ${variant || 'basic'}` }, rest)));
1692
+ };
1693
+ Table.Row = StyledTableRow;
1694
+ Table.HeadCell = StyledTableHeadCell;
1695
+ Table.Cell = TableCell;
1696
+
1697
+ const StyledCell = styledComponents.styled(Table.Cell) `
1698
+ ${(props) => props.firstRow && styledComponents.css ` border-top: 0px !important;`}
1699
+ ${(props) => props.width && styledComponents.css ` width: ${props.width};`}
1700
+ vertical-align: top;
1701
+ `;
1702
+ const Details = ({ details, firstColumnWidth }) => (React.createElement(Table, null,
1703
+ React.createElement("tbody", null, Object.entries(details).map(([key, val], index) => (React.createElement(Table.Row, { key: key, disableHover: true },
1704
+ React.createElement(StyledCell, { width: firstColumnWidth, firstRow: index === 0 }, key),
1705
+ React.createElement(StyledCell, { firstRow: index === 0 }, val)))))));
1706
+
1707
+ const Wrapper$7 = styledComponents.styled.div `
1708
+ position: relative;
1709
+ `;
1710
+ const Dropper = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
1711
+ border-radius: 4px;
1712
+ border: 1px solid rgba(34,36,38,.15);
1713
+ position: absolute;
1714
+ box-shadow: 0 8px 8px 0 rgba(34,36,38,.15);
1715
+ background-color: ${props => props.theme.palette.common.white};
1716
+ z-index: 100;
1717
+
1718
+ ${props => props.align === 'right' ? styledComponents.css `right: 0;` : styledComponents.css `left: 0;`}
1719
+ `;
1720
+ const DropdownMenu = styledComponents.styled.ul `
1721
+ list-style: none;
1722
+ margin: 0;
1723
+ padding: ${props => props.theme.spacing(2, 0)};
1724
+ `;
1725
+ const DropdownMenuItem = styledComponents.styled.li `
1726
+ cursor: pointer;
1727
+ padding: ${props => props.theme.spacing(0, 3)};
1728
+ &:hover {
1729
+ background-color: #ddd;
1730
+ }
1731
+ `;
1732
+ const Dropdown = ({ buttonProps, align, children, stayOpenOnClick }) => {
1733
+ const dropper = React.useRef(null);
1734
+ const [isOpen, setIsOpen] = React.useState(false);
1735
+ const handleOpen = React.useCallback(() => setIsOpen(true), [setIsOpen]);
1736
+ const handleClose = React.useCallback((e) => {
1737
+ var _a;
1738
+ if (stayOpenOnClick && ((_a = dropper.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
1739
+ return;
1740
+ setIsOpen(false);
1741
+ }, [setIsOpen, stayOpenOnClick]);
1742
+ React.useEffect(() => {
1743
+ if (isOpen) {
1744
+ setTimeout(() => document.addEventListener('click', handleClose), 1);
1745
+ }
1746
+ return () => {
1747
+ document.removeEventListener('click', handleClose);
1748
+ };
1749
+ }, [isOpen, handleClose]);
1750
+ return (React.createElement(Wrapper$7, null,
1751
+ React.createElement(Button$1, Object.assign({}, buttonProps, { onClick: handleOpen })),
1752
+ isOpen && (React.createElement(SlideInFromTop, { speed: '.1s' },
1753
+ React.createElement(Dropper, { ref: dropper, align: align || 'left' }, children)))));
1754
+ };
1755
+
1756
+ const HiddenInput$1 = styledComponents.styled.input `
1757
+ display: none;
1758
+ `;
1759
+ const StyledDropZone = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
1760
+ display: flex;
1761
+ flex-direction: column;
1762
+ align-items: center;
1763
+ justify-content: center;
1764
+ border-radius: 4px;
1765
+ height: ${props => props.theme.spacing(25)};
1766
+
1767
+ border-radius: 4px;
1768
+ border: 1px solid rgba(34,36,38,.15);
1769
+
1770
+ & > * {
1771
+ pointerEvents: none;
1772
+ }
1773
+
1774
+ ${props => props.isReadyToDrop && styledComponents.css `
1775
+ background-color: #FAFAFA;
1776
+ `}
1777
+ `;
1778
+ const Dropzone = (_a) => {
1779
+ var { onChange, icon, label } = _a, rest = __rest(_a, ["onChange", "icon", "label"]);
1780
+ const fileInput = React.useRef(null);
1781
+ const dropzone = React.useRef(null);
1782
+ const [isReadyToDrop, setIsReadyToDrop] = React.useState(false);
1783
+ const handleChange = React.useCallback((fileList) => {
1784
+ if (fileList && onChange) {
1785
+ onChange(Array.from(fileList));
1786
+ }
1787
+ }, [onChange]);
1788
+ const handleDragOver = React.useCallback((e) => {
1789
+ e.preventDefault();
1790
+ setIsReadyToDrop(true);
1791
+ }, []);
1792
+ const handleDragLeave = React.useCallback((e) => {
1793
+ e.preventDefault();
1794
+ setIsReadyToDrop(false);
1795
+ }, []);
1796
+ const handleDrop = React.useCallback((e) => {
1797
+ var _a;
1798
+ e.preventDefault();
1799
+ setIsReadyToDrop(false);
1800
+ handleChange((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files);
1801
+ }, [handleChange]);
1802
+ const handleClick = React.useCallback(() => {
1803
+ var _a;
1804
+ // We trigger the 'file pick' dialog by delegating the click to a hidden file-input.
1805
+ (_a = fileInput.current) === null || _a === void 0 ? void 0 : _a.click();
1806
+ }, [fileInput]);
1807
+ const handleInputChange = React.useCallback(() => {
1808
+ var _a;
1809
+ handleChange((_a = fileInput === null || fileInput === void 0 ? void 0 : fileInput.current) === null || _a === void 0 ? void 0 : _a.files);
1810
+ }, [fileInput, handleChange]);
1811
+ return (React.createElement(StyledDropZone, Object.assign({ ref: dropzone, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: handleClick, isReadyToDrop: isReadyToDrop }, rest),
1812
+ React.createElement(HiddenInput$1, { "data-testid": "dropzone-file-input", type: "file", ref: fileInput, onChange: handleInputChange, multiple: true }),
1813
+ React.createElement(Box, null,
1814
+ React.createElement(Button$1, { variant: "text", color: "secondary", type: "button", icon: icon }, label))));
1815
+ };
1816
+
1817
+ const StyledBox$6 = styledComponents.styled(Box) `
1818
+ width: 300px;
1819
+ `;
1820
+ const Feedback = ({ onConfirm, buttonLabel, buttonIcon, title, subtitle }) => (React.createElement(Modal, { handleClickOverlay: onConfirm, buttons: React.createElement(Button$1, { "data-testid": 'confirm', stretch: true, icon: buttonIcon, variant: 'secondary', onClick: onConfirm }, buttonLabel) },
1821
+ React.createElement(StyledBox$6, { pt: 3, pb: 3 },
1822
+ React.createElement(Box, { pb: 5, textAlign: "center" },
1823
+ React.createElement(Header, null, title),
1824
+ subtitle && React.createElement(Box, { pt: 5 },
1825
+ React.createElement(Header, { level: 5 }, subtitle))),
1826
+ React.createElement(Box, { pt: 5, pb: 5, pl: 7, pr: 7 },
1827
+ React.createElement(AnimatedCheckmark, null)))));
1828
+
1829
+ const horizontalPadding = { laptop: 1 };
1830
+ const verticalPadding = { mobile: 1, laptop: 0 };
1831
+ const flexGrow = { laptop: 1 };
1832
+ const FloaterItem = (_a) => {
1833
+ var { stretch, laptopWidth } = _a, props = __rest(_a, ["stretch", "laptopWidth"]);
1834
+ const width = React.useMemo(() => ({ laptop: laptopWidth }), [laptopWidth]);
1835
+ return React.createElement(Box, Object.assign({ flexGrow: stretch ? flexGrow : undefined, width: width, pt: verticalPadding, pb: verticalPadding, pl: horizontalPadding, pr: horizontalPadding }, props));
1836
+ };
1837
+
1838
+ const horizontalMargin = { laptop: -1 };
1839
+ const verticalMargin = { mobile: -1, laptop: 0 };
1840
+ const display = { mobile: "block", laptop: "flex" };
1841
+ const hasElement = (item) => !!item.element;
1842
+ const Floater = (_a) => {
1843
+ var { items, forceEqualWidth = false, stretch = false } = _a, props = __rest(_a, ["items", "forceEqualWidth", "stretch"]);
1844
+ return React.createElement(Box, Object.assign({ mb: verticalMargin, mt: verticalMargin, ml: horizontalMargin, mr: horizontalMargin, display: display }, props), items
1845
+ .filter(Boolean)
1846
+ .map((item, i) => hasElement(item)
1847
+ ? (React.createElement(FloaterItem, { key: i, laptopWidth: item.forceEqualWidth ? `${100 / items.length}%` : undefined, stretch: item.stretch || false }, item.element))
1848
+ : React.createElement(FloaterItem, { key: i, laptopWidth: forceEqualWidth ? `${100 / items.length}%` : undefined, stretch: stretch }, item)));
1849
+ };
1850
+
1851
+ const SIDEBAR_COLLAPSED_WIDTH = 15;
1852
+ const StyledSidebar = styledComponents.styled(Box) `
1853
+ float: left;
1854
+
1855
+ height: 100%;
1856
+ width: 100%;
1857
+
1858
+ background-color: #243646;
1859
+
1860
+ position: fixed;
1861
+ top: 0;
1862
+ left: 0;
1863
+ right: 0;
1864
+ bottom: 0;
1865
+
1866
+ z-index: 900;
1867
+
1868
+ display: ${props => props.isMobileMenuOpen ? 'block' : 'none'};
1869
+ pointer-events: auto;
1870
+
1871
+ ${mq("laptop", styledComponents.css `
1872
+ position: static;
1873
+ display: block;
1874
+ width: auto;
1875
+ min-width: ${props => { var _a; return props.theme.spacing((_a = props.minWidth) !== null && _a !== void 0 ? _a : 75); }};
1876
+ box-shadow: 2px 0px 6px -1px rgba(0,0,0,0.74);
1877
+
1878
+ transition: transform .1s ease-out;
1879
+ transform: ${props => props.isDesktopMenuOpen
1880
+ ? 'transform: translateX(0);'
1881
+ : styledComponents.css `translateX(calc(-100% + ${props => props.theme.spacing(SIDEBAR_COLLAPSED_WIDTH)}));`};
1882
+
1883
+ & ul {
1884
+ opacity: ${props => props.isDesktopMenuOpen ? '1' : '0'};
1885
+ }
1886
+ `)}
1887
+ `;
1888
+ const SideBar = (props) => {
1889
+ const { closeSideMenu, openSideMenu, isSideMenuOpen } = useUiStateContext();
1890
+ return React.createElement(StyledSidebar, Object.assign({ isDesktopMenuOpen: isSideMenuOpen }, props, { onMouseEnter: openSideMenu, onMouseLeave: closeSideMenu }));
1891
+ };
1892
+
1893
+ const StyledBox$5 = styledComponents.styled(Box) `
1894
+ background-color: ${props => props.theme.palette.common.white};
1895
+ border-top: 1px solid #DDDDDD;
1896
+ box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.04);
1897
+ box-sizing: border-box;
1898
+ `;
1899
+ const Footer = ({ children }) => (React.createElement(StyledBox$5, { pt: 2, pb: 2, pr: 5, pl: { mobile: 5, laptop: SIDEBAR_COLLAPSED_WIDTH + 5 } }, children));
1900
+
1901
+ const Scroller = styledComponents.styled(Box) `
1902
+ overflow-x: auto;
1903
+ overflow-y: hidden;
1904
+ `;
1905
+ const HorizontalScroller = ({ children }) => (React.createElement(Scroller, null, children));
1906
+
1907
+ const HamburgerButton = styledComponents.styled(Button$1) `
1908
+ margin-right: ${props => props.theme.spacing(3)};
1909
+ ${mq("laptop", `display: none;`)}
1910
+ `;
1911
+
1912
+ const Menu = styledComponents.styled.ul `
1913
+ padding: 0;
1914
+ margin: 0;
1915
+ list-style: none;
1916
+ `;
1917
+ const StyledMenuItem = styledComponents.styled.li.withConfig({ shouldForwardProp: isPropValid }) `
1918
+ padding: ${props => props.theme.spacing(.5, 5)};
1919
+
1920
+ ${props => props.isOpen && styledComponents.css `
1921
+ border-left: ${props.theme.spacing(1)} solid ${props.theme.palette.colors.blue};
1922
+ background: #293846;
1923
+
1924
+ & > * {
1925
+ margin-left: ${props.theme.spacing(-1)};
1926
+ }
1927
+ `}
1928
+
1929
+ & button:hover, & button:active, & button:focus {
1930
+ color: ${props => props.theme.palette.common.white} !important;
1931
+ }
1932
+
1933
+ & button {
1934
+ width: 100%;
1935
+ }
1936
+
1937
+ ${props => props.isActive && styledComponents.css `
1938
+ & button {
1939
+ color: ${props.theme.palette.common.white};
1940
+ }
1941
+ `}
1942
+ `;
1943
+ const MenuItem = ({ item, isOpen, isActive, children }) => {
1944
+ const [isDelayedOpen, setDelayedOpen] = React.useState(!!isOpen);
1945
+ return (React.createElement(StyledMenuItem, { isOpen: isDelayedOpen, isActive: !!isActive },
1946
+ item,
1947
+ children && (React.createElement(SlideOpen, { onChange: setDelayedOpen, isOpen: !!isOpen, duration: .25 }, children))));
1948
+ };
1949
+
1950
+ const MenuCloseButton = styledComponents.styled(Button$1) `
1951
+ ${mq("laptop", `display: none;`)}
1952
+ `;
1953
+
1954
+ const StyledBox$4 = styledComponents.styled(Box) `
1955
+ display: none;
1956
+ ${mq("laptop", `display: flex;`)}
1957
+
1958
+ height: 100%;
1959
+ flex-direction: row;
1960
+ align-items: center;
1961
+
1962
+ width: ${props => props.theme.spacing(SIDEBAR_COLLAPSED_WIDTH)};
1963
+
1964
+ & > svg {
1965
+ margin: 0 auto;
1966
+ }
1967
+
1968
+ ${StyledSidebar}:hover & {
1969
+ display:none;
1970
+ }
1971
+ `;
1972
+ const MenuSlideOpenIndicator = ({ children }) => (React.createElement(StyledBox$4, null, children));
1973
+
1974
+ const VerticalRhythmLaptop = 7;
1975
+ const VerticalRhythmMobile = 4;
1976
+
1977
+ const StyledBox$3 = styledComponents.styled(Box) `
1978
+ box-sizing: border-box;
1979
+ color: ${props => props.theme.palette.button.text.idle.text};
1980
+ font-weight: bold;
1981
+
1982
+ display: flex;
1983
+ text-align: center;
1984
+
1985
+ font-size: 14px;
1986
+ font-weight: bold;
1987
+ letter-spacing: 1px;
1988
+ line-height: 1em;
1989
+
1990
+ background-color: rgba(0,0,0,.2);
1991
+
1992
+ ${mq('laptop', styledComponents.css `
1993
+ min-height: ${props => props.theme.spacing(12)};
1994
+ `)}
1995
+ `;
1996
+ const SideBarHeader = ({ children, right }) => (React.createElement(StyledBox$3, { mb: VerticalRhythmLaptop },
1997
+ React.createElement(Box, { flexGrow: 1, display: "flex" },
1998
+ React.createElement(Box, { flexGrow: 1, display: "flex", flexDirection: "column", justifyContent: "center" }, children)),
1999
+ right && React.createElement(Box, null, right)));
2000
+
2001
+ const useCloseSidebarOnNavigate = (pathName) => {
2002
+ const { closeSideMenu } = useUiStateContext();
2003
+ React.useEffect(() => {
2004
+ closeSideMenu();
2005
+ }, [pathName, closeSideMenu]);
2006
+ };
2007
+
2008
+ const useToggleMobileMenu = ({ currentRoute }) => {
2009
+ const [isOpen, setIsOpen] = React.useState(false);
2010
+ const toggle = React.useCallback(() => {
2011
+ setIsOpen((val) => !val);
2012
+ }, []);
2013
+ const open = React.useCallback(() => {
2014
+ setIsOpen(true);
2015
+ }, []);
2016
+ const close = React.useCallback(() => {
2017
+ setIsOpen(false);
2018
+ }, []);
2019
+ React.useEffect(() => {
2020
+ close();
2021
+ }, [currentRoute, close]);
2022
+ return {
2023
+ isOpen,
2024
+ open,
2025
+ close,
2026
+ toggle
2027
+ };
2028
+ };
2029
+
2030
+ const useResponsiveBreakpoints = () => {
2031
+ const [windowWidth, setWindowWidth] = React.useState(window.innerWidth);
2032
+ React.useEffect(() => {
2033
+ const onResize = () => setWindowWidth(window.innerWidth);
2034
+ window.addEventListener('resize', onResize);
2035
+ return () => window.removeEventListener('resize', onResize);
2036
+ }, []);
2037
+ const responsiveMap = React.useMemo(() => ({
2038
+ isMobile: windowWidth >= BreakPointValues.mobile,
2039
+ isTablet: windowWidth >= BreakPointValues.tablet,
2040
+ isLaptop: windowWidth >= BreakPointValues.laptop,
2041
+ isDesktop: windowWidth >= BreakPointValues.desktop
2042
+ }), [windowWidth]);
2043
+ return responsiveMap;
2044
+ };
2045
+
2046
+ const Wrapper$6 = styledComponents.styled.div `
2047
+ display: flex;
2048
+ `;
2049
+ const Button = styledComponents.styled.button.withConfig({ shouldForwardProp: isPropValid }) `
2050
+ user-select:none;
2051
+ cursor: pointer;
2052
+
2053
+ min-height: ${props => props.theme.spacing(8)};
2054
+ padding: .2em 1.3em .2em;
2055
+ margin: 0;
2056
+ line-height: 1em;
2057
+ outline: 0;
2058
+ border: 1px solid rgba(34,36,38,.15);
2059
+
2060
+ font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
2061
+ background-color: ${props => props.active ? '#F2F2F2' : '#fff'};
2062
+
2063
+ &:not(:first-of-type) {
2064
+ border-left: 0;
2065
+ }
2066
+
2067
+ ${props => !props.disabled && (`
2068
+ &:hover {
2069
+ background-color: #E9E9E9;
2070
+ }
2071
+ `)}
2072
+ `;
2073
+ const range = (start, end) => {
2074
+ let nums = [];
2075
+ for (let i = start; i < end; i++) {
2076
+ nums.push(i);
2077
+ }
2078
+ return nums;
2079
+ };
2080
+ const Paginator = (props) => {
2081
+ const { isTablet } = useResponsiveBreakpoints();
2082
+ const { pageCount, onChange } = props;
2083
+ const currentPage = Math.min(Math.max(props.currentPage, 0), pageCount);
2084
+ const clamSize = isTablet ? 2 : 0;
2085
+ const clamLower = Math.max(1, currentPage - clamSize);
2086
+ const clamUpper = Math.min(pageCount, currentPage + clamSize);
2087
+ return (React.createElement(Wrapper$6, null,
2088
+ React.createElement(Button, { "data-testid": "paginate-prev", disabled: currentPage === 1, onClick: () => onChange(currentPage - 1) }, "\u27E8"),
2089
+ clamLower > 1 && (React.createElement(Button, { "data-testid": "paginate-page-1", active: currentPage === 1, onClick: () => onChange(1) }, "1")),
2090
+ clamLower > 2 && (React.createElement(Button, { disabled: true }, "...")),
2091
+ range(clamLower, clamUpper + 1).map((pageNumber) => (React.createElement(Button, { "data-testid": `paginate-page-${pageNumber}`, key: pageNumber, active: currentPage === pageNumber, onClick: () => onChange(pageNumber) }, pageNumber))),
2092
+ clamUpper < pageCount - 1 && (React.createElement(Button, { disabled: true }, "...")),
2093
+ clamUpper < pageCount && (React.createElement(Button, { "data-testid": `paginate-page-${pageCount}`, active: currentPage === pageCount, onClick: () => onChange(pageCount) }, pageCount)),
2094
+ React.createElement(Button, { "data-testid": "paginate-next", disabled: currentPage === pageCount, onClick: () => onChange(currentPage + 1) }, "\u27E9")));
2095
+ };
2096
+
2097
+ const Section = (props) => (React.createElement(Box, Object.assign({ pb: { laptop: VerticalRhythmLaptop, mobile: VerticalRhythmMobile } }, props)));
2098
+
2099
+ const Wrapper$5 = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2100
+ display: flex;
2101
+ border-radius: ${props => props.theme.spacing(1)};
2102
+ padding: ${props => props.theme.spacing(4)};
2103
+ background-color: ${props => props.theme.palette.colors[props.backgroundColor]};
2104
+ box-sizing: border-box;
2105
+ height: 100%;
2106
+ `;
2107
+ const Label$2 = styledComponents.styled.div `
2108
+ text-transform: uppercase;
2109
+ color: ${props => props.theme.palette.common.white};
2110
+ font-size: ${props => props.theme.spacing(3)};
2111
+ `;
2112
+ const Value = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2113
+ color: ${props => props.theme.palette.common.white};
2114
+ font-weight: bold;
2115
+ font-size: ${props => props.theme.spacing(props.smallerValue ? 5.5 : 7.5)};
2116
+ `;
2117
+ const IconWrapper = styledComponents.styled.div `
2118
+ margin: ${props => props.theme.spacing(1)} 0 auto 0;
2119
+ & svg {
2120
+ height: 100%;
2121
+ width: ${props => props.theme.spacing(10)};
2122
+ color: white;
2123
+ }
2124
+ `;
2125
+ const Statistic = ({ icon, value, label, backgroundColor, smallerValue }) => (React.createElement(Wrapper$5, { backgroundColor: backgroundColor },
2126
+ React.createElement(IconWrapper, null, icon),
2127
+ React.createElement(Box, { flexGrow: 1, textAlign: "right" },
2128
+ React.createElement(Label$2, null, label),
2129
+ React.createElement(Value, { smallerValue: smallerValue }, value))));
2130
+
2131
+ const StyledBox$2 = styledComponents.styled(Box) `
2132
+
2133
+ padding: ${props => props.theme.spacing(2.5, 5)};
2134
+
2135
+ ${props => !props.isActive && styledComponents.css `
2136
+ cursor: pointer;
2137
+ color: #337ab7;
2138
+ &:hover,
2139
+ &:focus {
2140
+ color: #23527c;
2141
+ text-decoration: underline;
2142
+ }
2143
+ `}
2144
+
2145
+ ${props => props.isActive && styledComponents.css `
2146
+ font-weight: bold;
2147
+ border: 1px solid rgba(34,36,38,.15);
2148
+ border-bottom: 0px;
2149
+ margin-bottom: -1px;
2150
+ border-top-left-radius: 4px;
2151
+ border-top-right-radius: 4px;
2152
+ background-color: ${props => props.theme.palette.common.white};
2153
+ `}
2154
+
2155
+ ${props => props.variant && `
2156
+ font-weight: bold;
2157
+ color: ${props.theme.palette.form[props.variant]};
2158
+ &:hover {
2159
+ color: ${props.theme.palette.form[props.variant]};
2160
+ }
2161
+ `}
2162
+
2163
+ `;
2164
+ const Tab = (_a) => {
2165
+ var { id, isActive, onClick } = _a, restProps = __rest(_a, ["id", "isActive", "onClick"]);
2166
+ const handleClick = React.useCallback(() => {
2167
+ if (!isActive) {
2168
+ onClick === null || onClick === void 0 ? void 0 : onClick(id);
2169
+ }
2170
+ }, [id, isActive, onClick]);
2171
+ return React.createElement(StyledBox$2, Object.assign({}, restProps, { onClick: handleClick, isActive: isActive }));
2172
+ };
2173
+
2174
+ const StyledBox$1 = styledComponents.styled(Box) `
2175
+ background-color: ${props => props.theme.palette.common.white};
2176
+ border: 1px solid rgba(34,36,38,.15);
2177
+ border-top: 0px;
2178
+ `;
2179
+ const TabContent = (props) => React.createElement(StyledBox$1, Object.assign({ p: 3 }, props));
2180
+
2181
+ const Tabs = styledComponents.styled(Box) `
2182
+ display: flex;
2183
+ border-bottom: 1px solid rgba(34,36,38,.15);
2184
+ `;
2185
+
2186
+ const FlatPanel = styledComponents.styled(Panel) `
2187
+ box-shadow: none;
2188
+ `;
2189
+ const Wrapper$4 = styledComponents.styled(Box) `
2190
+ display: flex;
2191
+
2192
+ &:last-of-type .line:before {
2193
+ background: none;
2194
+ }
2195
+ `;
2196
+ const Line = styledComponents.styled(Box) `
2197
+ position: relative;
2198
+ margin-right: ${props => props.theme.spacing(4)};
2199
+ top: 4px;
2200
+
2201
+ &:before {
2202
+ background: #e7eaec;
2203
+ content: '';
2204
+ position: absolute;
2205
+ top: 0;
2206
+ left: ${props => props.theme.spacing(4.5)};
2207
+ height: 100%;
2208
+ width: ${props => props.theme.spacing(1)};
2209
+ }
2210
+
2211
+ `;
2212
+ const Circle = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2213
+ position: relative;
2214
+ background-color: ${props => props.color};
2215
+ color: #fff;
2216
+
2217
+ left: 0;
2218
+ width: ${props => props.theme.spacing(10)};
2219
+ height: ${props => props.theme.spacing(10)};
2220
+ border-radius: 50%;
2221
+ font-size: ${props => props.theme.spacing(4)};
2222
+
2223
+ & > * {
2224
+ position: absolute;
2225
+ top: 50%;
2226
+ left: 50%;
2227
+ transform: translate(-50%, -50%);
2228
+ }
2229
+ `;
2230
+ const Timeline = ({ title, icon, color, isInitiallyOpen, titleMeta, chevron, children }) => (React.createElement(Wrapper$4, null,
2231
+ React.createElement(Line, null,
2232
+ React.createElement(Circle, { color: color }, icon)),
2233
+ React.createElement(Box, { pb: 4, flexGrow: 1 },
2234
+ React.createElement(CollapsiblePanel, { isInitiallyOpen: isInitiallyOpen, titleMeta: titleMeta, title: title, titleAction: chevron }, children))));
2235
+ const SimpleTimeline = ({ color, icon, title, titleMeta }) => (React.createElement(Wrapper$4, null,
2236
+ React.createElement(Line, { className: 'line' },
2237
+ React.createElement(Circle, { color: color }, icon)),
2238
+ React.createElement(Box, { pb: 4, flexGrow: 1 },
2239
+ React.createElement(FlatPanel, { titleMeta: titleMeta, title: title }))));
2240
+
2241
+ const StyledBox = styledComponents.styled(Box) `
2242
+ background-color: #FFFFFF;
2243
+ border-bottom: 1px solid #DDDDDD;
2244
+ box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.04);
2245
+ box-sizing: border-box;
2246
+ `;
2247
+ const TopBar = ({ left, right }) => (React.createElement(StyledBox, null,
2248
+ React.createElement(Box, { display: "flex", alignItems: "center", pb: 1, pt: 1, pr: 5, pl: { mobile: 5, laptop: 5 + SIDEBAR_COLLAPSED_WIDTH } },
2249
+ React.createElement(Box, { flexGrow: 1, display: "flex", pl: 2 }, left),
2250
+ React.createElement(Box, { flexGrow: 1, display: "flex", justifyContent: 'flex-end' }, right))));
2251
+
2252
+ const Label$1 = styledComponents.styled.label `
2253
+ position: relative;
2254
+ `;
2255
+ const Input$1 = styledComponents.styled.input.withConfig({ shouldForwardProp: isPropValid }) `
2256
+ position: absolute;
2257
+ top: 0;
2258
+ left: 0;
2259
+
2260
+ width: 17px;
2261
+ height: 17px;
2262
+
2263
+ z-index: 99;
2264
+ opacity: 0;
2265
+ margin-right: ${props => props.theme.spacing(2)};
2266
+ transform: translateY(1px);
2267
+
2268
+ &~span {
2269
+ user-select: none;
2270
+ padding-left: 1.85714em;
2271
+ cursor: pointer;
2272
+ font-size: .92857143em;
2273
+ }
2274
+
2275
+ &~span:before, &~span:after {
2276
+ position: absolute;
2277
+ top: 0;
2278
+ left: 0;
2279
+ width: 17px;
2280
+ height: 17px;
2281
+ line-height: 17px;
2282
+ content: '';
2283
+ border-radius: 4px;
2284
+ border: 1px solid rgba(34,36,38,.15);
2285
+ z-index:0;
2286
+ }
2287
+
2288
+ &:checked~span {
2289
+ font-style: italic;
2290
+ }
2291
+
2292
+ &:checked~span:before {
2293
+ background: #fff;
2294
+ border-color: rgba(34,36,38,.35);
2295
+ }
2296
+
2297
+ &:checked~span:after {
2298
+ font-style: normal;
2299
+ text-align: center;
2300
+ content: '\\2714';
2301
+ opacity: 1;
2302
+ color: ${props => props.theme.palette.common.black}
2303
+ }
2304
+
2305
+ &:focus~span:before, &:focus~span:after {
2306
+ border-color: #85b7d9;
2307
+ border-radius: 4px;
2308
+ background: #fff;
2309
+ box-shadow: 0 0 0 0 rgba(34,36,38,.35) inset;
2310
+ }
2311
+
2312
+ &.error~span {
2313
+ color: ${props => props.theme.palette.form.error};
2314
+ }
2315
+
2316
+ &.error~span:before, &.error~span:after {
2317
+ background: #fff6f6;
2318
+ border-color: #e0b4b4;
2319
+ color: #9f3a38;
2320
+ }
2321
+ `;
2322
+ const Span = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
2323
+ ${props => props.dimmed ? styledComponents.css `color: #999c9e;` : ''}
2324
+ `;
2325
+ const Checkbox = React.forwardRef((_a, ref) => {
2326
+ var { options, spacing = 1, name, dimmed } = _a, restProps = __rest(_a, ["options", "spacing", "name", "dimmed"]);
2327
+ return (React.createElement(React.Fragment, null, Object.entries(options).map(([value, label]) => (React.createElement(Box, { key: value, mt: spacing, mb: spacing },
2328
+ React.createElement(Label$1, { key: value },
2329
+ React.createElement(Input$1, Object.assign({ type: "checkbox", value: value, name: name, ref: ref }, restProps)),
2330
+ React.createElement(Span, { dimmed: dimmed }, label)))))));
2331
+ });
2332
+
2333
+ const sharedStyles = styledComponents.css `
2334
+ padding: .67857143em 1em;
2335
+ line-height: 1.21428571em;
2336
+ border-radius: 4px;
2337
+ border: 1px solid rgba(34,36,38,.15);
2338
+
2339
+ color: ${props => props.theme.palette.common.black};
2340
+ font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
2341
+
2342
+ font-size: 1em;
2343
+ outline: none;
2344
+
2345
+ &:disabled, &:read-only {
2346
+ background-color: #FAFAFA;
2347
+ }
2348
+
2349
+ &:focus {
2350
+ color: rgba(0,0,0,.95);
2351
+ border-color: #85b7d9;
2352
+ background: #fff;
2353
+ box-shadow: 0 0 0 0 rgba(34,36,38,.35) inset;
2354
+ }
2355
+
2356
+ &.error {
2357
+ background: #fff6f6;
2358
+ border-color: #e0b4b4;
2359
+ color: #9f3a38;
2360
+ }
2361
+
2362
+ &.error:focus {
2363
+ background: #fff6f6;
2364
+ }
2365
+
2366
+ &:focus::placeholder {
2367
+ color:rgba(115,115,115,.87)
2368
+ }
2369
+
2370
+ &::placeholder {
2371
+ color:rgba(191,191,191,.87);
2372
+ }
2373
+
2374
+ &.error::placeholder {
2375
+ color: #e7bdbc;
2376
+ }
2377
+
2378
+ &.error:focus::placeholder {
2379
+ color: #da9796;
2380
+ }
2381
+ `;
2382
+ const Input = styledComponents.styled.input.withConfig({ shouldForwardProp: isPropValid }) `
2383
+ ${sharedStyles}
2384
+ `;
2385
+ const Textarea = styledComponents.styled.textarea.withConfig({ shouldForwardProp: isPropValid }) `
2386
+ ${sharedStyles}
2387
+ height: 100%;
2388
+ `;
2389
+ const TextField = React.forwardRef((_a, ref) => {
2390
+ var { multiline = false } = _a, restProps = __rest(_a, ["multiline"]);
2391
+ return multiline
2392
+ ? React.createElement(Textarea, Object.assign({ ref: ref }, restProps))
2393
+ : React.createElement(Input, Object.assign({ ref: ref, type: "text" }, restProps));
2394
+ });
2395
+
2396
+ const Wrapper$3 = styledComponents.styled.div `
2397
+ position: relative;
2398
+ display: flex;
2399
+ `;
2400
+ const HiddenInput = styledComponents.styled.input.withConfig({ shouldForwardProp: isPropValid }) `
2401
+ position: absolute;
2402
+ left: 0;
2403
+ right: 0;
2404
+ top: 0;
2405
+ bottom: 0;
2406
+ width: 100%;
2407
+ opacity:0;
2408
+ `;
2409
+ const StyledButton = styledComponents.styled(Button$1) `
2410
+ height: 40px;
2411
+
2412
+ .has-error & {
2413
+ background: #fff6f6;
2414
+ border-color: #e0b4b4;
2415
+ color: #9f3a38;
2416
+ }
2417
+ `;
2418
+ const StyledTextField = styledComponents.styled(TextField) `
2419
+ flex: 1;
2420
+ padding-right: ${props => props.theme.spacing(8)}
2421
+ `;
2422
+ const DeleteButton = styledComponents.styled.button `
2423
+ background-color: transparent;
2424
+ border: 0;
2425
+ outline: 0;
2426
+ padding: 0;
2427
+
2428
+ position: absolute;
2429
+ right: 0;
2430
+ height: 100%;
2431
+
2432
+ cursor: pointer;
2433
+
2434
+ &:after {
2435
+ box-sizing: border-box;
2436
+
2437
+ color: rgba(0, 0, 0, .3);
2438
+ content: "×";
2439
+
2440
+ text-align: center;
2441
+ vertical-align: middle;
2442
+ display: table-cell;
2443
+
2444
+ font-size: 20px;
2445
+ height: 38px;
2446
+ width: 38px;
2447
+ line-height: 38px;
2448
+ padding: 0 8px;
2449
+ }
2450
+ `;
2451
+ const FileField = React.forwardRef((_a, ref) => {
2452
+ var { className, placeholder, chooseFileLabel = "Choose file", changeFileLabel = "Change file", onClear } = _a, props = __rest(_a, ["className", "placeholder", "chooseFileLabel", "changeFileLabel", "onClear"]);
2453
+ const [originalRef, setOriginalRef] = React.useState();
2454
+ const [fileName, setFilename] = React.useState("");
2455
+ const handleChange = React.useCallback((e) => {
2456
+ var _a;
2457
+ const files = (e === null || e === void 0 ? void 0 : e.target).files;
2458
+ setFilename(((_a = files === null || files === void 0 ? void 0 : files[0]) === null || _a === void 0 ? void 0 : _a.name) || "");
2459
+ }, []);
2460
+ const handleRemove = React.useCallback(() => {
2461
+ if (originalRef) {
2462
+ originalRef.value = '';
2463
+ originalRef.files = null;
2464
+ originalRef.dispatchEvent(new Event('change', { bubbles: true }));
2465
+ if (onClear) {
2466
+ onClear();
2467
+ }
2468
+ }
2469
+ }, [originalRef, onClear]);
2470
+ const extendedRef = React.useMemo(() => (el) => {
2471
+ el === null || el === void 0 ? void 0 : el.addEventListener('change', handleChange);
2472
+ setOriginalRef(el);
2473
+ if (typeof ref === 'function') {
2474
+ ref === null || ref === void 0 ? void 0 : ref(el);
2475
+ }
2476
+ }, [ref, handleChange]);
2477
+ return (React.createElement(Wrapper$3, null,
2478
+ React.createElement(HiddenInput, Object.assign({ type: 'file', ref: extendedRef }, props)),
2479
+ React.createElement(StyledButton, { variant: 'basic' }, !!fileName ? changeFileLabel : chooseFileLabel),
2480
+ React.createElement(StyledTextField, { placeholder: placeholder, className: className, disabled: true, value: fileName }),
2481
+ !!fileName && onClear && React.createElement(DeleteButton, { "data-testid": 'file-clear', onClick: handleRemove })));
2482
+ });
2483
+
2484
+ const Wrapper$2 = styledComponents.styled.div `
2485
+ position: relative;
2486
+ `;
2487
+ const StyledSelect = styledComponents.styled.select.withConfig({ shouldForwardProp: isPropValid }) `
2488
+ width: 100%;
2489
+
2490
+ padding: .67857143em 1em;
2491
+ line-height: 1.21428571em;
2492
+ border-radius: 4px;
2493
+ border: 1px solid rgba(34,36,38,.15);
2494
+
2495
+ color: ${props => props.theme.palette.common.black};
2496
+ font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
2497
+
2498
+ font-size: 1em;
2499
+ outline: none;
2500
+
2501
+ appearance: none;
2502
+
2503
+ &.error {
2504
+ background: #fff6f6;
2505
+ border-color: #e0b4b4;
2506
+ color: #9f3a38;
2507
+ }
2508
+
2509
+ &.error~div {
2510
+ color: #9f3a38;
2511
+ }
2512
+ `;
2513
+ const PaddingOverlay = styledComponents.styled.div `
2514
+ pointer-events: none;
2515
+ padding: 0 1em;
2516
+ position:absolute;
2517
+ height: 100%;
2518
+ top: 0;
2519
+ right: 0;
2520
+ font-size: 17px;
2521
+ line-height: 40px;
2522
+ `;
2523
+ const Select = React.forwardRef((_a, ref) => {
2524
+ var { options } = _a, props = __rest(_a, ["options"]);
2525
+ const optionsArray = Array.isArray(options)
2526
+ ? options
2527
+ : Object.entries(options);
2528
+ return (React.createElement(Wrapper$2, null,
2529
+ React.createElement(StyledSelect, Object.assign({ ref: ref }, props), optionsArray.map(([value, label]) => (React.createElement("option", { key: value, value: value }, label)))),
2530
+ React.createElement(PaddingOverlay, null, "\u25BE")));
2531
+ });
2532
+
2533
+ const passwordMinLength = (val) => val.length >= 8;
2534
+ const passwordHasNumbers = (val) => /\d/.test(val);
2535
+ const passwordHasLowerAndUppercase = (val) => /[a-z]/.test(val) && /[A-Z]/.test(val);
2536
+ const passwordHasSpecialChars = (val) => /[-’/`~!#*$@_%+=.,^&(){}[\]|;:”<>?\\]/.test(val);
2537
+ const checks = [passwordMinLength, passwordHasNumbers, passwordHasLowerAndUppercase, passwordHasSpecialChars];
2538
+ const maxScore = checks.length + 1;
2539
+ const calculatePasswordScore = (val) => checks
2540
+ .map((check) => check(val))
2541
+ .reduce((acc, value) => value
2542
+ ? acc + 1
2543
+ : acc, 1);
2544
+ const Progress = styledComponents.styled.div `
2545
+ margin-top: ${props => props.theme.spacing(1)};
2546
+ height: 3px;
2547
+ background-color: #f5f5f5;
2548
+ border-radius: 4px;
2549
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
2550
+ `;
2551
+ const ProgressBar = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2552
+ width: ${props => props.score ? (props.score / maxScore) * 100 : 0}%;
2553
+ height: 100%;
2554
+ background-color: ${props => props.score <= 2 ? '#e90f10' : props.score <= 3 ? '#ffad00' : '#02b502'} ;
2555
+ transition: width .6s ease, background-color .6s ease;
2556
+ `;
2557
+ const PasswordStrengthField = React.forwardRef((props, ref) => {
2558
+ const [score, setScore] = React.useState(0);
2559
+ const handleChange = React.useCallback((e) => {
2560
+ const target = e.target;
2561
+ setScore(target.value ? calculatePasswordScore(target.value) : 0);
2562
+ }, []);
2563
+ const extendedRef = React.useMemo(() => (el) => {
2564
+ el === null || el === void 0 ? void 0 : el.addEventListener('keyup', handleChange);
2565
+ if (typeof ref === 'function') {
2566
+ ref === null || ref === void 0 ? void 0 : ref(el);
2567
+ }
2568
+ }, [ref, handleChange]);
2569
+ return React.createElement(React.Fragment, null,
2570
+ React.createElement(TextField, Object.assign({}, props, { type: "password", ref: extendedRef })),
2571
+ React.createElement(Progress, null,
2572
+ React.createElement(ProgressBar, { score: score })));
2573
+ });
2574
+
2575
+ function toVal(mix) {
2576
+ var k, y, str='';
2577
+
2578
+ if (typeof mix === 'string' || typeof mix === 'number') {
2579
+ str += mix;
2580
+ } else if (typeof mix === 'object') {
2581
+ if (Array.isArray(mix)) {
2582
+ for (k=0; k < mix.length; k++) {
2583
+ if (mix[k]) {
2584
+ if (y = toVal(mix[k])) {
2585
+ str && (str += ' ');
2586
+ str += y;
2587
+ }
2588
+ }
2589
+ }
2590
+ } else {
2591
+ for (k in mix) {
2592
+ if (mix[k]) {
2593
+ str && (str += ' ');
2594
+ str += k;
2595
+ }
2596
+ }
2597
+ }
2598
+ }
2599
+
2600
+ return str;
2601
+ }
2602
+
2603
+ function clsx () {
2604
+ var i=0, tmp, x, str='';
2605
+ while (i < arguments.length) {
2606
+ if (tmp = arguments[i++]) {
2607
+ if (x = toVal(tmp)) {
2608
+ str && (str += ' ');
2609
+ str += x;
2610
+ }
2611
+ }
2612
+ }
2613
+ return str;
2614
+ }
2615
+
2616
+ const NUM_ROWS_PER_FIELD = 2;
2617
+ // NOTE:
2618
+ //
2619
+ // We have to implement our own version of -ms-grid.
2620
+ // Styled-components does not automatically prefix it, as the specs do not completely overlap.
2621
+ // https://github.com/thysultan/stylis.js/issues/51
2622
+ //
2623
+ // We can achieve our goals using both specs though.
2624
+ const generateDimensionsCss = (position, rowOffset) => {
2625
+ const parts = [];
2626
+ if (position === undefined) {
2627
+ return parts;
2628
+ }
2629
+ if (position.row !== undefined) {
2630
+ parts.push(styledComponents.css `
2631
+ grid-row-start: ${(position.row * NUM_ROWS_PER_FIELD) + 1 + rowOffset};
2632
+ -ms-grid-row: ${(position.row * NUM_ROWS_PER_FIELD) + 1 + rowOffset};
2633
+ `);
2634
+ }
2635
+ if (position.rowSpan && rowOffset) {
2636
+ parts.push(styledComponents.css `
2637
+ grid-row-end: span ${(position.rowSpan * NUM_ROWS_PER_FIELD) - 1};
2638
+ -ms-grid-row-span: ${(position.rowSpan * NUM_ROWS_PER_FIELD) - 1};
2639
+ `);
2640
+ }
2641
+ if (position.column !== undefined) {
2642
+ parts.push(styledComponents.css `
2643
+ grid-column-start: ${position.column + 1};
2644
+ -ms-grid-column: ${position.column + 1};
2645
+ `);
2646
+ }
2647
+ if (position.columnSpan !== undefined) {
2648
+ parts.push(styledComponents.css `
2649
+ grid-column-end: span ${position.columnSpan};
2650
+ -ms-grid-column-span: ${position.columnSpan};
2651
+ `);
2652
+ }
2653
+ return parts;
2654
+ };
2655
+ const FormGridCell = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2656
+ margin: 0px 8px;
2657
+
2658
+ ${props => props.rowOffset !== undefined && styledComponents.css `
2659
+ display: flex;
2660
+ flex-direction: column;
2661
+ margin-bottom: 16px;`}
2662
+
2663
+ align-self: ${props => props.rowOffset === undefined ? "end" : "initial"};
2664
+ -ms-grid-row-align: ${props => props.rowOffset === undefined ? "end" : "initial"};
2665
+
2666
+ ${(props) => responsiveProps(props, {
2667
+ "align": unit => styledComponents.css `text-align: ${unit};`,
2668
+ "position": unit => { var _a; return generateDimensionsCss(unit, (_a = props.rowOffset) !== null && _a !== void 0 ? _a : 0); }
2669
+ })}
2670
+ `;
2671
+ FormGridCell.displayName = "FormGridCell";
2672
+
2673
+ const Label = styledComponents.styled.label.withConfig({ shouldForwardProp: isPropValid }) `
2674
+ display: block;
2675
+ color: ${(props => !!props.error ? props.theme.palette.form.error : props.theme.palette.common.black)} ;
2676
+ font-weight: bold;
2677
+ margin: ${props => props.theme.spacing(0, 0, 1, 0)};
2678
+ line-height: 1.4em;
2679
+ font-size: .92857143em;
2680
+ `;
2681
+ const Hint = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2682
+ color: ${(props => !!props.error ? "#da9796;" : props.theme.palette.form.hint)};
2683
+ margin: ${props => props.theme.spacing(-1, 0, 1, 0)};
2684
+ line-height: 1.4em;
2685
+ font-size: .92857143em;
2686
+ `;
2687
+ const RequiredAsterisk = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
2688
+ color: ${props => props.theme.palette.form.hint};
2689
+ `;
2690
+ const Error$1 = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2691
+ color: ${props => props.theme.palette.form.error};
2692
+ margin: ${props => props.theme.spacing(1, 0, 0, 0)};
2693
+ font-weight: bold;
2694
+ font-style: italic;
2695
+ line-height: 1.4em;
2696
+ font-size: .92857143em;
2697
+ `;
2698
+ const getFormGridWrapperProps = ({ position, align, label, hint, error, isRequired }) => ({ position, align, label, hint, error, isRequired });
2699
+ const FormGridWrapper = ({ position, align, label, hint, error, isRequired, children }) => (React.createElement(React.Fragment, null,
2700
+ React.createElement(FormGridCell, { position: position, align: align, className: 'form-grid-cell__label-hint' },
2701
+ label && (React.createElement(Label, { error: error },
2702
+ label,
2703
+ isRequired && React.createElement(RequiredAsterisk, null, " *"))),
2704
+ hint && (React.createElement(Hint, { error: error }, hint))),
2705
+ React.createElement(FormGridCell, { position: position, align: align, rowOffset: 1, className: clsx({ 'form-grid-cell__field-error': true, 'has-error': !!error }) },
2706
+ children,
2707
+ error && (React.createElement(Error$1, null, error)))));
2708
+
2709
+ const FormGrid = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2710
+ margin: 0 -8px -16px -8px;
2711
+
2712
+ display: -ms-grid;
2713
+ display: grid;
2714
+
2715
+ -ms-grid-columns: 1fr;
2716
+
2717
+ ${(props) => responsiveProps(props, {
2718
+ columns: (string) => styledComponents.css `
2719
+ -ms-grid-columns: ${string};
2720
+ grid-template-columns: ${string};
2721
+ `
2722
+ })}
2723
+ `;
2724
+ FormGrid.displayName = "FormGrid";
2725
+
2726
+ const Wrapper$1 = styledComponents.styled(Box) `
2727
+ background-color: #F3F3F4;
2728
+ `;
2729
+ const WrapperInner = styledComponents.styled(Box) `
2730
+ position: relative;
2731
+ `;
2732
+ const SidebarWrapper = styledComponents.styled(Box) `
2733
+ position: absolute;
2734
+ height: 100%;
2735
+ z-index: 50;
2736
+ pointer-events: none;
2737
+ `;
2738
+ const ContentBox = styledComponents.styled(Box) `
2739
+ height: 100%;
2740
+ `;
2741
+ const BasicLayout = ({ sideBarProps, topBarProps, footerProps, isLoading, loader, children }) => {
2742
+ return (React.createElement(Wrapper$1, { flexGrow: 1, display: "flex", flexDirection: "column" },
2743
+ React.createElement(WrapperInner, { flexGrow: 1, flexShrink: 0 },
2744
+ sideBarProps && (React.createElement(SidebarWrapper, null,
2745
+ React.createElement(SideBar, Object.assign({}, sideBarProps)))),
2746
+ React.createElement(ContentBox, { display: "flex", flexDirection: "column" },
2747
+ React.createElement(TopBar, Object.assign({}, topBarProps)),
2748
+ React.createElement(Box, { p: { laptop: VerticalRhythmLaptop, mobile: VerticalRhythmMobile }, pl: { laptop: VerticalRhythmLaptop + SIDEBAR_COLLAPSED_WIDTH }, flexGrow: 1 }, isLoading && loader
2749
+ ? loader
2750
+ : children),
2751
+ React.createElement(Footer, Object.assign({}, footerProps))))));
2752
+ };
2753
+
2754
+ const Wrapper = styledComponents.styled(Box) `
2755
+ background-color: ${props => props.baseColor || 'white'};
2756
+ position: absolute;
2757
+ min-width: 100%;
2758
+ min-height: 100%;
2759
+ `;
2760
+ const Background = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
2761
+ position: absolute;
2762
+ top: 0;
2763
+ left: 0;
2764
+ width: 100%;
2765
+ height: 100%;
2766
+
2767
+ opacity: ${props => { var _a; return (_a = props.opacity) !== null && _a !== void 0 ? _a : 1; }} ;
2768
+ background: url("${props => props.imageUrl}");
2769
+ background-size: cover;
2770
+ `;
2771
+ const StyledAnimation = styledComponents.styled(SlideInFromTop) `
2772
+ z-index: 10;
2773
+ margin: auto auto;
2774
+ `;
2775
+ const StyledPanel = styledComponents.styled(Panel) `
2776
+ box-shadow: 0 8px 8px 0 rgba(34,36,38,.15);
2777
+ min-width: 280px;
2778
+ `;
2779
+ const Logo = styledComponents.styled.img `
2780
+ display:none;
2781
+ position: absolute;
2782
+ left: 0;
2783
+ top: ${props => props.theme.spacing(8)};
2784
+ ${mq("tablet", `display: block;`)}
2785
+ `;
2786
+ const FloatingPanelLayout = ({ panelProps, imageUrl, alert, logoUrl, backgroundBaseColor, backgroundOpacity }) => (React.createElement(Wrapper, { display: "flex", alignItems: "center", baseColor: backgroundBaseColor },
2787
+ React.createElement(Background, { imageUrl: imageUrl, opacity: backgroundOpacity }),
2788
+ logoUrl && (React.createElement(Logo, { src: logoUrl, alt: "Logo" })),
2789
+ React.createElement(StyledAnimation, null,
2790
+ alert && (React.createElement(Box, { pb: VerticalRhythmLaptop }, alert)),
2791
+ React.createElement(StyledPanel, Object.assign({}, panelProps)))));
2792
+
2793
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2794
+
2795
+ function getDefaultExportFromCjs (x) {
2796
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
2797
+ }
2798
+
2799
+ /**
2800
+ * lodash (Custom Build) <https://lodash.com/>
2801
+ * Build: `lodash modularize exports="npm" -o ./`
2802
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
2803
+ * Released under MIT license <https://lodash.com/license>
2804
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
2805
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
2806
+ */
2807
+
2808
+ /** Used as references for various `Number` constants. */
2809
+ var INFINITY = 1 / 0,
2810
+ MAX_SAFE_INTEGER$1 = 9007199254740991,
2811
+ MAX_INTEGER = 1.7976931348623157e+308,
2812
+ NAN = 0 / 0;
2813
+
2814
+ /** `Object#toString` result references. */
2815
+ var funcTag$1 = '[object Function]',
2816
+ genTag$1 = '[object GeneratorFunction]',
2817
+ symbolTag = '[object Symbol]';
2818
+
2819
+ /** Used to match leading and trailing whitespace. */
2820
+ var reTrim = /^\s+|\s+$/g;
2821
+
2822
+ /** Used to detect bad signed hexadecimal string values. */
2823
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
2824
+
2825
+ /** Used to detect binary string values. */
2826
+ var reIsBinary = /^0b[01]+$/i;
2827
+
2828
+ /** Used to detect octal string values. */
2829
+ var reIsOctal = /^0o[0-7]+$/i;
2830
+
2831
+ /** Used to detect unsigned integer values. */
2832
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
2833
+
2834
+ /** Built-in method references without a dependency on `root`. */
2835
+ var freeParseInt = parseInt;
2836
+
2837
+ /** Used for built-in method references. */
2838
+ var objectProto$1 = Object.prototype;
2839
+
2840
+ /**
2841
+ * Used to resolve the
2842
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2843
+ * of values.
2844
+ */
2845
+ var objectToString$1 = objectProto$1.toString;
2846
+
2847
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2848
+ var nativeCeil = Math.ceil,
2849
+ nativeMax$1 = Math.max;
2850
+
2851
+ /**
2852
+ * The base implementation of `_.slice` without an iteratee call guard.
2853
+ *
2854
+ * @private
2855
+ * @param {Array} array The array to slice.
2856
+ * @param {number} [start=0] The start position.
2857
+ * @param {number} [end=array.length] The end position.
2858
+ * @returns {Array} Returns the slice of `array`.
2859
+ */
2860
+ function baseSlice(array, start, end) {
2861
+ var index = -1,
2862
+ length = array.length;
2863
+
2864
+ if (start < 0) {
2865
+ start = -start > length ? 0 : (length + start);
2866
+ }
2867
+ end = end > length ? length : end;
2868
+ if (end < 0) {
2869
+ end += length;
2870
+ }
2871
+ length = start > end ? 0 : ((end - start) >>> 0);
2872
+ start >>>= 0;
2873
+
2874
+ var result = Array(length);
2875
+ while (++index < length) {
2876
+ result[index] = array[index + start];
2877
+ }
2878
+ return result;
2879
+ }
2880
+
2881
+ /**
2882
+ * Checks if `value` is a valid array-like index.
2883
+ *
2884
+ * @private
2885
+ * @param {*} value The value to check.
2886
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
2887
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
2888
+ */
2889
+ function isIndex(value, length) {
2890
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
2891
+ return !!length &&
2892
+ (typeof value == 'number' || reIsUint.test(value)) &&
2893
+ (value > -1 && value % 1 == 0 && value < length);
2894
+ }
2895
+
2896
+ /**
2897
+ * Checks if the given arguments are from an iteratee call.
2898
+ *
2899
+ * @private
2900
+ * @param {*} value The potential iteratee value argument.
2901
+ * @param {*} index The potential iteratee index or key argument.
2902
+ * @param {*} object The potential iteratee object argument.
2903
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
2904
+ * else `false`.
2905
+ */
2906
+ function isIterateeCall(value, index, object) {
2907
+ if (!isObject$1(object)) {
2908
+ return false;
2909
+ }
2910
+ var type = typeof index;
2911
+ if (type == 'number'
2912
+ ? (isArrayLike$1(object) && isIndex(index, object.length))
2913
+ : (type == 'string' && index in object)
2914
+ ) {
2915
+ return eq$1(object[index], value);
2916
+ }
2917
+ return false;
2918
+ }
2919
+
2920
+ /**
2921
+ * Creates an array of elements split into groups the length of `size`.
2922
+ * If `array` can't be split evenly, the final chunk will be the remaining
2923
+ * elements.
2924
+ *
2925
+ * @static
2926
+ * @memberOf _
2927
+ * @since 3.0.0
2928
+ * @category Array
2929
+ * @param {Array} array The array to process.
2930
+ * @param {number} [size=1] The length of each chunk
2931
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
2932
+ * @returns {Array} Returns the new array of chunks.
2933
+ * @example
2934
+ *
2935
+ * _.chunk(['a', 'b', 'c', 'd'], 2);
2936
+ * // => [['a', 'b'], ['c', 'd']]
2937
+ *
2938
+ * _.chunk(['a', 'b', 'c', 'd'], 3);
2939
+ * // => [['a', 'b', 'c'], ['d']]
2940
+ */
2941
+ function chunk(array, size, guard) {
2942
+ if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
2943
+ size = 1;
2944
+ } else {
2945
+ size = nativeMax$1(toInteger(size), 0);
2946
+ }
2947
+ var length = array ? array.length : 0;
2948
+ if (!length || size < 1) {
2949
+ return [];
2950
+ }
2951
+ var index = 0,
2952
+ resIndex = 0,
2953
+ result = Array(nativeCeil(length / size));
2954
+
2955
+ while (index < length) {
2956
+ result[resIndex++] = baseSlice(array, index, (index += size));
2957
+ }
2958
+ return result;
2959
+ }
2960
+
2961
+ /**
2962
+ * Performs a
2963
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2964
+ * comparison between two values to determine if they are equivalent.
2965
+ *
2966
+ * @static
2967
+ * @memberOf _
2968
+ * @since 4.0.0
2969
+ * @category Lang
2970
+ * @param {*} value The value to compare.
2971
+ * @param {*} other The other value to compare.
2972
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2973
+ * @example
2974
+ *
2975
+ * var object = { 'a': 1 };
2976
+ * var other = { 'a': 1 };
2977
+ *
2978
+ * _.eq(object, object);
2979
+ * // => true
2980
+ *
2981
+ * _.eq(object, other);
2982
+ * // => false
2983
+ *
2984
+ * _.eq('a', 'a');
2985
+ * // => true
2986
+ *
2987
+ * _.eq('a', Object('a'));
2988
+ * // => false
2989
+ *
2990
+ * _.eq(NaN, NaN);
2991
+ * // => true
2992
+ */
2993
+ function eq$1(value, other) {
2994
+ return value === other || (value !== value && other !== other);
2995
+ }
2996
+
2997
+ /**
2998
+ * Checks if `value` is array-like. A value is considered array-like if it's
2999
+ * not a function and has a `value.length` that's an integer greater than or
3000
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
3001
+ *
3002
+ * @static
3003
+ * @memberOf _
3004
+ * @since 4.0.0
3005
+ * @category Lang
3006
+ * @param {*} value The value to check.
3007
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
3008
+ * @example
3009
+ *
3010
+ * _.isArrayLike([1, 2, 3]);
3011
+ * // => true
3012
+ *
3013
+ * _.isArrayLike(document.body.children);
3014
+ * // => true
3015
+ *
3016
+ * _.isArrayLike('abc');
3017
+ * // => true
3018
+ *
3019
+ * _.isArrayLike(_.noop);
3020
+ * // => false
3021
+ */
3022
+ function isArrayLike$1(value) {
3023
+ return value != null && isLength$1(value.length) && !isFunction$1(value);
3024
+ }
3025
+
3026
+ /**
3027
+ * Checks if `value` is classified as a `Function` object.
3028
+ *
3029
+ * @static
3030
+ * @memberOf _
3031
+ * @since 0.1.0
3032
+ * @category Lang
3033
+ * @param {*} value The value to check.
3034
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
3035
+ * @example
3036
+ *
3037
+ * _.isFunction(_);
3038
+ * // => true
3039
+ *
3040
+ * _.isFunction(/abc/);
3041
+ * // => false
3042
+ */
3043
+ function isFunction$1(value) {
3044
+ // The use of `Object#toString` avoids issues with the `typeof` operator
3045
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
3046
+ var tag = isObject$1(value) ? objectToString$1.call(value) : '';
3047
+ return tag == funcTag$1 || tag == genTag$1;
3048
+ }
3049
+
3050
+ /**
3051
+ * Checks if `value` is a valid array-like length.
3052
+ *
3053
+ * **Note:** This method is loosely based on
3054
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
3055
+ *
3056
+ * @static
3057
+ * @memberOf _
3058
+ * @since 4.0.0
3059
+ * @category Lang
3060
+ * @param {*} value The value to check.
3061
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
3062
+ * @example
3063
+ *
3064
+ * _.isLength(3);
3065
+ * // => true
3066
+ *
3067
+ * _.isLength(Number.MIN_VALUE);
3068
+ * // => false
3069
+ *
3070
+ * _.isLength(Infinity);
3071
+ * // => false
3072
+ *
3073
+ * _.isLength('3');
3074
+ * // => false
3075
+ */
3076
+ function isLength$1(value) {
3077
+ return typeof value == 'number' &&
3078
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
3079
+ }
3080
+
3081
+ /**
3082
+ * Checks if `value` is the
3083
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
3084
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
3085
+ *
3086
+ * @static
3087
+ * @memberOf _
3088
+ * @since 0.1.0
3089
+ * @category Lang
3090
+ * @param {*} value The value to check.
3091
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
3092
+ * @example
3093
+ *
3094
+ * _.isObject({});
3095
+ * // => true
3096
+ *
3097
+ * _.isObject([1, 2, 3]);
3098
+ * // => true
3099
+ *
3100
+ * _.isObject(_.noop);
3101
+ * // => true
3102
+ *
3103
+ * _.isObject(null);
3104
+ * // => false
3105
+ */
3106
+ function isObject$1(value) {
3107
+ var type = typeof value;
3108
+ return !!value && (type == 'object' || type == 'function');
3109
+ }
3110
+
3111
+ /**
3112
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
3113
+ * and has a `typeof` result of "object".
3114
+ *
3115
+ * @static
3116
+ * @memberOf _
3117
+ * @since 4.0.0
3118
+ * @category Lang
3119
+ * @param {*} value The value to check.
3120
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3121
+ * @example
3122
+ *
3123
+ * _.isObjectLike({});
3124
+ * // => true
3125
+ *
3126
+ * _.isObjectLike([1, 2, 3]);
3127
+ * // => true
3128
+ *
3129
+ * _.isObjectLike(_.noop);
3130
+ * // => false
3131
+ *
3132
+ * _.isObjectLike(null);
3133
+ * // => false
3134
+ */
3135
+ function isObjectLike$1(value) {
3136
+ return !!value && typeof value == 'object';
3137
+ }
3138
+
3139
+ /**
3140
+ * Checks if `value` is classified as a `Symbol` primitive or object.
3141
+ *
3142
+ * @static
3143
+ * @memberOf _
3144
+ * @since 4.0.0
3145
+ * @category Lang
3146
+ * @param {*} value The value to check.
3147
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
3148
+ * @example
3149
+ *
3150
+ * _.isSymbol(Symbol.iterator);
3151
+ * // => true
3152
+ *
3153
+ * _.isSymbol('abc');
3154
+ * // => false
3155
+ */
3156
+ function isSymbol(value) {
3157
+ return typeof value == 'symbol' ||
3158
+ (isObjectLike$1(value) && objectToString$1.call(value) == symbolTag);
3159
+ }
3160
+
3161
+ /**
3162
+ * Converts `value` to a finite number.
3163
+ *
3164
+ * @static
3165
+ * @memberOf _
3166
+ * @since 4.12.0
3167
+ * @category Lang
3168
+ * @param {*} value The value to convert.
3169
+ * @returns {number} Returns the converted number.
3170
+ * @example
3171
+ *
3172
+ * _.toFinite(3.2);
3173
+ * // => 3.2
3174
+ *
3175
+ * _.toFinite(Number.MIN_VALUE);
3176
+ * // => 5e-324
3177
+ *
3178
+ * _.toFinite(Infinity);
3179
+ * // => 1.7976931348623157e+308
3180
+ *
3181
+ * _.toFinite('3.2');
3182
+ * // => 3.2
3183
+ */
3184
+ function toFinite(value) {
3185
+ if (!value) {
3186
+ return value === 0 ? value : 0;
3187
+ }
3188
+ value = toNumber(value);
3189
+ if (value === INFINITY || value === -INFINITY) {
3190
+ var sign = (value < 0 ? -1 : 1);
3191
+ return sign * MAX_INTEGER;
3192
+ }
3193
+ return value === value ? value : 0;
3194
+ }
3195
+
3196
+ /**
3197
+ * Converts `value` to an integer.
3198
+ *
3199
+ * **Note:** This method is loosely based on
3200
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
3201
+ *
3202
+ * @static
3203
+ * @memberOf _
3204
+ * @since 4.0.0
3205
+ * @category Lang
3206
+ * @param {*} value The value to convert.
3207
+ * @returns {number} Returns the converted integer.
3208
+ * @example
3209
+ *
3210
+ * _.toInteger(3.2);
3211
+ * // => 3
3212
+ *
3213
+ * _.toInteger(Number.MIN_VALUE);
3214
+ * // => 0
3215
+ *
3216
+ * _.toInteger(Infinity);
3217
+ * // => 1.7976931348623157e+308
3218
+ *
3219
+ * _.toInteger('3.2');
3220
+ * // => 3
3221
+ */
3222
+ function toInteger(value) {
3223
+ var result = toFinite(value),
3224
+ remainder = result % 1;
3225
+
3226
+ return result === result ? (remainder ? result - remainder : result) : 0;
3227
+ }
3228
+
3229
+ /**
3230
+ * Converts `value` to a number.
3231
+ *
3232
+ * @static
3233
+ * @memberOf _
3234
+ * @since 4.0.0
3235
+ * @category Lang
3236
+ * @param {*} value The value to process.
3237
+ * @returns {number} Returns the number.
3238
+ * @example
3239
+ *
3240
+ * _.toNumber(3.2);
3241
+ * // => 3.2
3242
+ *
3243
+ * _.toNumber(Number.MIN_VALUE);
3244
+ * // => 5e-324
3245
+ *
3246
+ * _.toNumber(Infinity);
3247
+ * // => Infinity
3248
+ *
3249
+ * _.toNumber('3.2');
3250
+ * // => 3.2
3251
+ */
3252
+ function toNumber(value) {
3253
+ if (typeof value == 'number') {
3254
+ return value;
3255
+ }
3256
+ if (isSymbol(value)) {
3257
+ return NAN;
3258
+ }
3259
+ if (isObject$1(value)) {
3260
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
3261
+ value = isObject$1(other) ? (other + '') : other;
3262
+ }
3263
+ if (typeof value != 'string') {
3264
+ return value === 0 ? value : +value;
3265
+ }
3266
+ value = value.replace(reTrim, '');
3267
+ var isBinary = reIsBinary.test(value);
3268
+ return (isBinary || reIsOctal.test(value))
3269
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
3270
+ : (reIsBadHex.test(value) ? NAN : +value);
3271
+ }
3272
+
3273
+ var lodash_chunk = chunk;
3274
+
3275
+ var _chunk = /*@__PURE__*/getDefaultExportFromCjs(lodash_chunk);
3276
+
3277
+ /**
3278
+ * Two dimensional array grid.
3279
+ * Useful to position elements with.
3280
+ *
3281
+ * Example:
3282
+ *
3283
+ * new Grid([
3284
+ * [1,2,3],
3285
+ * [4,5,6],
3286
+ * [7,8,9]
3287
+ * ])
3288
+ *
3289
+ */
3290
+ class Grid {
3291
+ constructor(grid) {
3292
+ this.grid = grid;
3293
+ }
3294
+ getValues() {
3295
+ return this.grid;
3296
+ }
3297
+ /**
3298
+ * Returns an array of distinct values in this grid
3299
+ */
3300
+ getDistinctValues() {
3301
+ const values = [];
3302
+ this.grid.forEach((row) => {
3303
+ row.forEach((item) => {
3304
+ if (!values.includes(item)) {
3305
+ values.push(item);
3306
+ }
3307
+ });
3308
+ });
3309
+ return values;
3310
+ }
3311
+ sliceArea(topLeft, bottomRight) {
3312
+ if (topLeft.x > bottomRight.x || topLeft.y > bottomRight.y) {
3313
+ throw new Error("Coordinates are mixed up. Please ensure topLeft is actually in the top-left corner. And bottomRight is actually in the bottom-right corner");
3314
+ }
3315
+ return new Grid(this.grid
3316
+ .slice(topLeft.y, bottomRight.y + 1)
3317
+ .map(row => row.slice(topLeft.x, bottomRight.x + 1)));
3318
+ }
3319
+ getCoordinatesForValue(value) {
3320
+ const x = [];
3321
+ const y = [];
3322
+ this.grid.forEach((row, yIndex) => {
3323
+ row.forEach((item, xIndex) => {
3324
+ if (item === value) {
3325
+ x.push(xIndex);
3326
+ y.push(yIndex);
3327
+ }
3328
+ });
3329
+ });
3330
+ return {
3331
+ topLeft: { x: Math.min(...x), y: Math.min(...y) },
3332
+ bottomRight: { x: Math.max(...x), y: Math.max(...y) }
3333
+ };
3334
+ }
3335
+ }
3336
+
3337
+ /**
3338
+ * lodash (Custom Build) <https://lodash.com/>
3339
+ * Build: `lodash modularize exports="npm" -o ./`
3340
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
3341
+ * Released under MIT license <https://lodash.com/license>
3342
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
3343
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3344
+ */
3345
+
3346
+ /** Used as the size to enable large array optimizations. */
3347
+ var LARGE_ARRAY_SIZE = 200;
3348
+
3349
+ /** Used to stand-in for `undefined` hash values. */
3350
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
3351
+
3352
+ /** Used as references for various `Number` constants. */
3353
+ var MAX_SAFE_INTEGER = 9007199254740991;
3354
+
3355
+ /** `Object#toString` result references. */
3356
+ var argsTag = '[object Arguments]',
3357
+ funcTag = '[object Function]',
3358
+ genTag = '[object GeneratorFunction]';
3359
+
3360
+ /**
3361
+ * Used to match `RegExp`
3362
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
3363
+ */
3364
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3365
+
3366
+ /** Used to detect host constructors (Safari). */
3367
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
3368
+
3369
+ /** Detect free variable `global` from Node.js. */
3370
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
3371
+
3372
+ /** Detect free variable `self`. */
3373
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
3374
+
3375
+ /** Used as a reference to the global object. */
3376
+ var root = freeGlobal || freeSelf || Function('return this')();
3377
+
3378
+ /**
3379
+ * A faster alternative to `Function#apply`, this function invokes `func`
3380
+ * with the `this` binding of `thisArg` and the arguments of `args`.
3381
+ *
3382
+ * @private
3383
+ * @param {Function} func The function to invoke.
3384
+ * @param {*} thisArg The `this` binding of `func`.
3385
+ * @param {Array} args The arguments to invoke `func` with.
3386
+ * @returns {*} Returns the result of `func`.
3387
+ */
3388
+ function apply(func, thisArg, args) {
3389
+ switch (args.length) {
3390
+ case 0: return func.call(thisArg);
3391
+ case 1: return func.call(thisArg, args[0]);
3392
+ case 2: return func.call(thisArg, args[0], args[1]);
3393
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
3394
+ }
3395
+ return func.apply(thisArg, args);
3396
+ }
3397
+
3398
+ /**
3399
+ * A specialized version of `_.includes` for arrays without support for
3400
+ * specifying an index to search from.
3401
+ *
3402
+ * @private
3403
+ * @param {Array} [array] The array to inspect.
3404
+ * @param {*} target The value to search for.
3405
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
3406
+ */
3407
+ function arrayIncludes(array, value) {
3408
+ var length = array ? array.length : 0;
3409
+ return !!length && baseIndexOf(array, value, 0) > -1;
3410
+ }
3411
+
3412
+ /**
3413
+ * This function is like `arrayIncludes` except that it accepts a comparator.
3414
+ *
3415
+ * @private
3416
+ * @param {Array} [array] The array to inspect.
3417
+ * @param {*} target The value to search for.
3418
+ * @param {Function} comparator The comparator invoked per element.
3419
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
3420
+ */
3421
+ function arrayIncludesWith(array, value, comparator) {
3422
+ var index = -1,
3423
+ length = array ? array.length : 0;
3424
+
3425
+ while (++index < length) {
3426
+ if (comparator(value, array[index])) {
3427
+ return true;
3428
+ }
3429
+ }
3430
+ return false;
3431
+ }
3432
+
3433
+ /**
3434
+ * A specialized version of `_.map` for arrays without support for iteratee
3435
+ * shorthands.
3436
+ *
3437
+ * @private
3438
+ * @param {Array} [array] The array to iterate over.
3439
+ * @param {Function} iteratee The function invoked per iteration.
3440
+ * @returns {Array} Returns the new mapped array.
3441
+ */
3442
+ function arrayMap(array, iteratee) {
3443
+ var index = -1,
3444
+ length = array ? array.length : 0,
3445
+ result = Array(length);
3446
+
3447
+ while (++index < length) {
3448
+ result[index] = iteratee(array[index], index, array);
3449
+ }
3450
+ return result;
3451
+ }
3452
+
3453
+ /**
3454
+ * Appends the elements of `values` to `array`.
3455
+ *
3456
+ * @private
3457
+ * @param {Array} array The array to modify.
3458
+ * @param {Array} values The values to append.
3459
+ * @returns {Array} Returns `array`.
3460
+ */
3461
+ function arrayPush(array, values) {
3462
+ var index = -1,
3463
+ length = values.length,
3464
+ offset = array.length;
3465
+
3466
+ while (++index < length) {
3467
+ array[offset + index] = values[index];
3468
+ }
3469
+ return array;
3470
+ }
3471
+
3472
+ /**
3473
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
3474
+ * support for iteratee shorthands.
3475
+ *
3476
+ * @private
3477
+ * @param {Array} array The array to inspect.
3478
+ * @param {Function} predicate The function invoked per iteration.
3479
+ * @param {number} fromIndex The index to search from.
3480
+ * @param {boolean} [fromRight] Specify iterating from right to left.
3481
+ * @returns {number} Returns the index of the matched value, else `-1`.
3482
+ */
3483
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
3484
+ var length = array.length,
3485
+ index = fromIndex + (fromRight ? 1 : -1);
3486
+
3487
+ while ((fromRight ? index-- : ++index < length)) {
3488
+ if (predicate(array[index], index, array)) {
3489
+ return index;
3490
+ }
3491
+ }
3492
+ return -1;
3493
+ }
3494
+
3495
+ /**
3496
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
3497
+ *
3498
+ * @private
3499
+ * @param {Array} array The array to inspect.
3500
+ * @param {*} value The value to search for.
3501
+ * @param {number} fromIndex The index to search from.
3502
+ * @returns {number} Returns the index of the matched value, else `-1`.
3503
+ */
3504
+ function baseIndexOf(array, value, fromIndex) {
3505
+ if (value !== value) {
3506
+ return baseFindIndex(array, baseIsNaN, fromIndex);
3507
+ }
3508
+ var index = fromIndex - 1,
3509
+ length = array.length;
3510
+
3511
+ while (++index < length) {
3512
+ if (array[index] === value) {
3513
+ return index;
3514
+ }
3515
+ }
3516
+ return -1;
3517
+ }
3518
+
3519
+ /**
3520
+ * The base implementation of `_.isNaN` without support for number objects.
3521
+ *
3522
+ * @private
3523
+ * @param {*} value The value to check.
3524
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
3525
+ */
3526
+ function baseIsNaN(value) {
3527
+ return value !== value;
3528
+ }
3529
+
3530
+ /**
3531
+ * The base implementation of `_.unary` without support for storing metadata.
3532
+ *
3533
+ * @private
3534
+ * @param {Function} func The function to cap arguments for.
3535
+ * @returns {Function} Returns the new capped function.
3536
+ */
3537
+ function baseUnary(func) {
3538
+ return function(value) {
3539
+ return func(value);
3540
+ };
3541
+ }
3542
+
3543
+ /**
3544
+ * Checks if a cache value for `key` exists.
3545
+ *
3546
+ * @private
3547
+ * @param {Object} cache The cache to query.
3548
+ * @param {string} key The key of the entry to check.
3549
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3550
+ */
3551
+ function cacheHas(cache, key) {
3552
+ return cache.has(key);
3553
+ }
3554
+
3555
+ /**
3556
+ * Gets the value at `key` of `object`.
3557
+ *
3558
+ * @private
3559
+ * @param {Object} [object] The object to query.
3560
+ * @param {string} key The key of the property to get.
3561
+ * @returns {*} Returns the property value.
3562
+ */
3563
+ function getValue(object, key) {
3564
+ return object == null ? undefined : object[key];
3565
+ }
3566
+
3567
+ /**
3568
+ * Checks if `value` is a host object in IE < 9.
3569
+ *
3570
+ * @private
3571
+ * @param {*} value The value to check.
3572
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
3573
+ */
3574
+ function isHostObject(value) {
3575
+ // Many host objects are `Object` objects that can coerce to strings
3576
+ // despite having improperly defined `toString` methods.
3577
+ var result = false;
3578
+ if (value != null && typeof value.toString != 'function') {
3579
+ try {
3580
+ result = !!(value + '');
3581
+ } catch (e) {}
3582
+ }
3583
+ return result;
3584
+ }
3585
+
3586
+ /** Used for built-in method references. */
3587
+ var arrayProto = Array.prototype,
3588
+ funcProto = Function.prototype,
3589
+ objectProto = Object.prototype;
3590
+
3591
+ /** Used to detect overreaching core-js shims. */
3592
+ var coreJsData = root['__core-js_shared__'];
3593
+
3594
+ /** Used to detect methods masquerading as native. */
3595
+ var maskSrcKey = (function() {
3596
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
3597
+ return uid ? ('Symbol(src)_1.' + uid) : '';
3598
+ }());
3599
+
3600
+ /** Used to resolve the decompiled source of functions. */
3601
+ var funcToString = funcProto.toString;
3602
+
3603
+ /** Used to check objects for own properties. */
3604
+ var hasOwnProperty = objectProto.hasOwnProperty;
3605
+
3606
+ /**
3607
+ * Used to resolve the
3608
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
3609
+ * of values.
3610
+ */
3611
+ var objectToString = objectProto.toString;
3612
+
3613
+ /** Used to detect if a method is native. */
3614
+ var reIsNative = RegExp('^' +
3615
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
3616
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
3617
+ );
3618
+
3619
+ /** Built-in value references. */
3620
+ var Symbol = root.Symbol,
3621
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
3622
+ splice = arrayProto.splice,
3623
+ spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
3624
+
3625
+ /* Built-in method references for those with the same name as other `lodash` methods. */
3626
+ var nativeMax = Math.max;
3627
+
3628
+ /* Built-in method references that are verified to be native. */
3629
+ var Map$1 = getNative(root, 'Map'),
3630
+ nativeCreate = getNative(Object, 'create');
3631
+
3632
+ /**
3633
+ * Creates a hash object.
3634
+ *
3635
+ * @private
3636
+ * @constructor
3637
+ * @param {Array} [entries] The key-value pairs to cache.
3638
+ */
3639
+ function Hash(entries) {
3640
+ var index = -1,
3641
+ length = entries ? entries.length : 0;
3642
+
3643
+ this.clear();
3644
+ while (++index < length) {
3645
+ var entry = entries[index];
3646
+ this.set(entry[0], entry[1]);
3647
+ }
3648
+ }
3649
+
3650
+ /**
3651
+ * Removes all key-value entries from the hash.
3652
+ *
3653
+ * @private
3654
+ * @name clear
3655
+ * @memberOf Hash
3656
+ */
3657
+ function hashClear() {
3658
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
3659
+ }
3660
+
3661
+ /**
3662
+ * Removes `key` and its value from the hash.
3663
+ *
3664
+ * @private
3665
+ * @name delete
3666
+ * @memberOf Hash
3667
+ * @param {Object} hash The hash to modify.
3668
+ * @param {string} key The key of the value to remove.
3669
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3670
+ */
3671
+ function hashDelete(key) {
3672
+ return this.has(key) && delete this.__data__[key];
3673
+ }
3674
+
3675
+ /**
3676
+ * Gets the hash value for `key`.
3677
+ *
3678
+ * @private
3679
+ * @name get
3680
+ * @memberOf Hash
3681
+ * @param {string} key The key of the value to get.
3682
+ * @returns {*} Returns the entry value.
3683
+ */
3684
+ function hashGet(key) {
3685
+ var data = this.__data__;
3686
+ if (nativeCreate) {
3687
+ var result = data[key];
3688
+ return result === HASH_UNDEFINED ? undefined : result;
3689
+ }
3690
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
3691
+ }
3692
+
3693
+ /**
3694
+ * Checks if a hash value for `key` exists.
3695
+ *
3696
+ * @private
3697
+ * @name has
3698
+ * @memberOf Hash
3699
+ * @param {string} key The key of the entry to check.
3700
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3701
+ */
3702
+ function hashHas(key) {
3703
+ var data = this.__data__;
3704
+ return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
3705
+ }
3706
+
3707
+ /**
3708
+ * Sets the hash `key` to `value`.
3709
+ *
3710
+ * @private
3711
+ * @name set
3712
+ * @memberOf Hash
3713
+ * @param {string} key The key of the value to set.
3714
+ * @param {*} value The value to set.
3715
+ * @returns {Object} Returns the hash instance.
3716
+ */
3717
+ function hashSet(key, value) {
3718
+ var data = this.__data__;
3719
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
3720
+ return this;
3721
+ }
3722
+
3723
+ // Add methods to `Hash`.
3724
+ Hash.prototype.clear = hashClear;
3725
+ Hash.prototype['delete'] = hashDelete;
3726
+ Hash.prototype.get = hashGet;
3727
+ Hash.prototype.has = hashHas;
3728
+ Hash.prototype.set = hashSet;
3729
+
3730
+ /**
3731
+ * Creates an list cache object.
3732
+ *
3733
+ * @private
3734
+ * @constructor
3735
+ * @param {Array} [entries] The key-value pairs to cache.
3736
+ */
3737
+ function ListCache(entries) {
3738
+ var index = -1,
3739
+ length = entries ? entries.length : 0;
3740
+
3741
+ this.clear();
3742
+ while (++index < length) {
3743
+ var entry = entries[index];
3744
+ this.set(entry[0], entry[1]);
3745
+ }
3746
+ }
3747
+
3748
+ /**
3749
+ * Removes all key-value entries from the list cache.
3750
+ *
3751
+ * @private
3752
+ * @name clear
3753
+ * @memberOf ListCache
3754
+ */
3755
+ function listCacheClear() {
3756
+ this.__data__ = [];
3757
+ }
3758
+
3759
+ /**
3760
+ * Removes `key` and its value from the list cache.
3761
+ *
3762
+ * @private
3763
+ * @name delete
3764
+ * @memberOf ListCache
3765
+ * @param {string} key The key of the value to remove.
3766
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3767
+ */
3768
+ function listCacheDelete(key) {
3769
+ var data = this.__data__,
3770
+ index = assocIndexOf(data, key);
3771
+
3772
+ if (index < 0) {
3773
+ return false;
3774
+ }
3775
+ var lastIndex = data.length - 1;
3776
+ if (index == lastIndex) {
3777
+ data.pop();
3778
+ } else {
3779
+ splice.call(data, index, 1);
3780
+ }
3781
+ return true;
3782
+ }
3783
+
3784
+ /**
3785
+ * Gets the list cache value for `key`.
3786
+ *
3787
+ * @private
3788
+ * @name get
3789
+ * @memberOf ListCache
3790
+ * @param {string} key The key of the value to get.
3791
+ * @returns {*} Returns the entry value.
3792
+ */
3793
+ function listCacheGet(key) {
3794
+ var data = this.__data__,
3795
+ index = assocIndexOf(data, key);
3796
+
3797
+ return index < 0 ? undefined : data[index][1];
3798
+ }
3799
+
3800
+ /**
3801
+ * Checks if a list cache value for `key` exists.
3802
+ *
3803
+ * @private
3804
+ * @name has
3805
+ * @memberOf ListCache
3806
+ * @param {string} key The key of the entry to check.
3807
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3808
+ */
3809
+ function listCacheHas(key) {
3810
+ return assocIndexOf(this.__data__, key) > -1;
3811
+ }
3812
+
3813
+ /**
3814
+ * Sets the list cache `key` to `value`.
3815
+ *
3816
+ * @private
3817
+ * @name set
3818
+ * @memberOf ListCache
3819
+ * @param {string} key The key of the value to set.
3820
+ * @param {*} value The value to set.
3821
+ * @returns {Object} Returns the list cache instance.
3822
+ */
3823
+ function listCacheSet(key, value) {
3824
+ var data = this.__data__,
3825
+ index = assocIndexOf(data, key);
3826
+
3827
+ if (index < 0) {
3828
+ data.push([key, value]);
3829
+ } else {
3830
+ data[index][1] = value;
3831
+ }
3832
+ return this;
3833
+ }
3834
+
3835
+ // Add methods to `ListCache`.
3836
+ ListCache.prototype.clear = listCacheClear;
3837
+ ListCache.prototype['delete'] = listCacheDelete;
3838
+ ListCache.prototype.get = listCacheGet;
3839
+ ListCache.prototype.has = listCacheHas;
3840
+ ListCache.prototype.set = listCacheSet;
3841
+
3842
+ /**
3843
+ * Creates a map cache object to store key-value pairs.
3844
+ *
3845
+ * @private
3846
+ * @constructor
3847
+ * @param {Array} [entries] The key-value pairs to cache.
3848
+ */
3849
+ function MapCache(entries) {
3850
+ var index = -1,
3851
+ length = entries ? entries.length : 0;
3852
+
3853
+ this.clear();
3854
+ while (++index < length) {
3855
+ var entry = entries[index];
3856
+ this.set(entry[0], entry[1]);
3857
+ }
3858
+ }
3859
+
3860
+ /**
3861
+ * Removes all key-value entries from the map.
3862
+ *
3863
+ * @private
3864
+ * @name clear
3865
+ * @memberOf MapCache
3866
+ */
3867
+ function mapCacheClear() {
3868
+ this.__data__ = {
3869
+ 'hash': new Hash,
3870
+ 'map': new (Map$1 || ListCache),
3871
+ 'string': new Hash
3872
+ };
3873
+ }
3874
+
3875
+ /**
3876
+ * Removes `key` and its value from the map.
3877
+ *
3878
+ * @private
3879
+ * @name delete
3880
+ * @memberOf MapCache
3881
+ * @param {string} key The key of the value to remove.
3882
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3883
+ */
3884
+ function mapCacheDelete(key) {
3885
+ return getMapData(this, key)['delete'](key);
3886
+ }
3887
+
3888
+ /**
3889
+ * Gets the map value for `key`.
3890
+ *
3891
+ * @private
3892
+ * @name get
3893
+ * @memberOf MapCache
3894
+ * @param {string} key The key of the value to get.
3895
+ * @returns {*} Returns the entry value.
3896
+ */
3897
+ function mapCacheGet(key) {
3898
+ return getMapData(this, key).get(key);
3899
+ }
3900
+
3901
+ /**
3902
+ * Checks if a map value for `key` exists.
3903
+ *
3904
+ * @private
3905
+ * @name has
3906
+ * @memberOf MapCache
3907
+ * @param {string} key The key of the entry to check.
3908
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3909
+ */
3910
+ function mapCacheHas(key) {
3911
+ return getMapData(this, key).has(key);
3912
+ }
3913
+
3914
+ /**
3915
+ * Sets the map `key` to `value`.
3916
+ *
3917
+ * @private
3918
+ * @name set
3919
+ * @memberOf MapCache
3920
+ * @param {string} key The key of the value to set.
3921
+ * @param {*} value The value to set.
3922
+ * @returns {Object} Returns the map cache instance.
3923
+ */
3924
+ function mapCacheSet(key, value) {
3925
+ getMapData(this, key).set(key, value);
3926
+ return this;
3927
+ }
3928
+
3929
+ // Add methods to `MapCache`.
3930
+ MapCache.prototype.clear = mapCacheClear;
3931
+ MapCache.prototype['delete'] = mapCacheDelete;
3932
+ MapCache.prototype.get = mapCacheGet;
3933
+ MapCache.prototype.has = mapCacheHas;
3934
+ MapCache.prototype.set = mapCacheSet;
3935
+
3936
+ /**
3937
+ *
3938
+ * Creates an array cache object to store unique values.
3939
+ *
3940
+ * @private
3941
+ * @constructor
3942
+ * @param {Array} [values] The values to cache.
3943
+ */
3944
+ function SetCache(values) {
3945
+ var index = -1,
3946
+ length = values ? values.length : 0;
3947
+
3948
+ this.__data__ = new MapCache;
3949
+ while (++index < length) {
3950
+ this.add(values[index]);
3951
+ }
3952
+ }
3953
+
3954
+ /**
3955
+ * Adds `value` to the array cache.
3956
+ *
3957
+ * @private
3958
+ * @name add
3959
+ * @memberOf SetCache
3960
+ * @alias push
3961
+ * @param {*} value The value to cache.
3962
+ * @returns {Object} Returns the cache instance.
3963
+ */
3964
+ function setCacheAdd(value) {
3965
+ this.__data__.set(value, HASH_UNDEFINED);
3966
+ return this;
3967
+ }
3968
+
3969
+ /**
3970
+ * Checks if `value` is in the array cache.
3971
+ *
3972
+ * @private
3973
+ * @name has
3974
+ * @memberOf SetCache
3975
+ * @param {*} value The value to search for.
3976
+ * @returns {number} Returns `true` if `value` is found, else `false`.
3977
+ */
3978
+ function setCacheHas(value) {
3979
+ return this.__data__.has(value);
3980
+ }
3981
+
3982
+ // Add methods to `SetCache`.
3983
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
3984
+ SetCache.prototype.has = setCacheHas;
3985
+
3986
+ /**
3987
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
3988
+ *
3989
+ * @private
3990
+ * @param {Array} array The array to inspect.
3991
+ * @param {*} key The key to search for.
3992
+ * @returns {number} Returns the index of the matched value, else `-1`.
3993
+ */
3994
+ function assocIndexOf(array, key) {
3995
+ var length = array.length;
3996
+ while (length--) {
3997
+ if (eq(array[length][0], key)) {
3998
+ return length;
3999
+ }
4000
+ }
4001
+ return -1;
4002
+ }
4003
+
4004
+ /**
4005
+ * The base implementation of methods like `_.difference` without support
4006
+ * for excluding multiple arrays or iteratee shorthands.
4007
+ *
4008
+ * @private
4009
+ * @param {Array} array The array to inspect.
4010
+ * @param {Array} values The values to exclude.
4011
+ * @param {Function} [iteratee] The iteratee invoked per element.
4012
+ * @param {Function} [comparator] The comparator invoked per element.
4013
+ * @returns {Array} Returns the new array of filtered values.
4014
+ */
4015
+ function baseDifference(array, values, iteratee, comparator) {
4016
+ var index = -1,
4017
+ includes = arrayIncludes,
4018
+ isCommon = true,
4019
+ length = array.length,
4020
+ result = [],
4021
+ valuesLength = values.length;
4022
+
4023
+ if (!length) {
4024
+ return result;
4025
+ }
4026
+ if (iteratee) {
4027
+ values = arrayMap(values, baseUnary(iteratee));
4028
+ }
4029
+ if (comparator) {
4030
+ includes = arrayIncludesWith;
4031
+ isCommon = false;
4032
+ }
4033
+ else if (values.length >= LARGE_ARRAY_SIZE) {
4034
+ includes = cacheHas;
4035
+ isCommon = false;
4036
+ values = new SetCache(values);
4037
+ }
4038
+ outer:
4039
+ while (++index < length) {
4040
+ var value = array[index],
4041
+ computed = iteratee ? iteratee(value) : value;
4042
+
4043
+ value = (comparator || value !== 0) ? value : 0;
4044
+ if (isCommon && computed === computed) {
4045
+ var valuesIndex = valuesLength;
4046
+ while (valuesIndex--) {
4047
+ if (values[valuesIndex] === computed) {
4048
+ continue outer;
4049
+ }
4050
+ }
4051
+ result.push(value);
4052
+ }
4053
+ else if (!includes(values, computed, comparator)) {
4054
+ result.push(value);
4055
+ }
4056
+ }
4057
+ return result;
4058
+ }
4059
+
4060
+ /**
4061
+ * The base implementation of `_.flatten` with support for restricting flattening.
4062
+ *
4063
+ * @private
4064
+ * @param {Array} array The array to flatten.
4065
+ * @param {number} depth The maximum recursion depth.
4066
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
4067
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
4068
+ * @param {Array} [result=[]] The initial result value.
4069
+ * @returns {Array} Returns the new flattened array.
4070
+ */
4071
+ function baseFlatten(array, depth, predicate, isStrict, result) {
4072
+ var index = -1,
4073
+ length = array.length;
4074
+
4075
+ predicate || (predicate = isFlattenable);
4076
+ result || (result = []);
4077
+
4078
+ while (++index < length) {
4079
+ var value = array[index];
4080
+ if (depth > 0 && predicate(value)) {
4081
+ if (depth > 1) {
4082
+ // Recursively flatten arrays (susceptible to call stack limits).
4083
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
4084
+ } else {
4085
+ arrayPush(result, value);
4086
+ }
4087
+ } else if (!isStrict) {
4088
+ result[result.length] = value;
4089
+ }
4090
+ }
4091
+ return result;
4092
+ }
4093
+
4094
+ /**
4095
+ * The base implementation of `_.isNative` without bad shim checks.
4096
+ *
4097
+ * @private
4098
+ * @param {*} value The value to check.
4099
+ * @returns {boolean} Returns `true` if `value` is a native function,
4100
+ * else `false`.
4101
+ */
4102
+ function baseIsNative(value) {
4103
+ if (!isObject(value) || isMasked(value)) {
4104
+ return false;
4105
+ }
4106
+ var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
4107
+ return pattern.test(toSource(value));
4108
+ }
4109
+
4110
+ /**
4111
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
4112
+ *
4113
+ * @private
4114
+ * @param {Function} func The function to apply a rest parameter to.
4115
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
4116
+ * @returns {Function} Returns the new function.
4117
+ */
4118
+ function baseRest(func, start) {
4119
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
4120
+ return function() {
4121
+ var args = arguments,
4122
+ index = -1,
4123
+ length = nativeMax(args.length - start, 0),
4124
+ array = Array(length);
4125
+
4126
+ while (++index < length) {
4127
+ array[index] = args[start + index];
4128
+ }
4129
+ index = -1;
4130
+ var otherArgs = Array(start + 1);
4131
+ while (++index < start) {
4132
+ otherArgs[index] = args[index];
4133
+ }
4134
+ otherArgs[start] = array;
4135
+ return apply(func, this, otherArgs);
4136
+ };
4137
+ }
4138
+
4139
+ /**
4140
+ * Gets the data for `map`.
4141
+ *
4142
+ * @private
4143
+ * @param {Object} map The map to query.
4144
+ * @param {string} key The reference key.
4145
+ * @returns {*} Returns the map data.
4146
+ */
4147
+ function getMapData(map, key) {
4148
+ var data = map.__data__;
4149
+ return isKeyable(key)
4150
+ ? data[typeof key == 'string' ? 'string' : 'hash']
4151
+ : data.map;
4152
+ }
4153
+
4154
+ /**
4155
+ * Gets the native function at `key` of `object`.
4156
+ *
4157
+ * @private
4158
+ * @param {Object} object The object to query.
4159
+ * @param {string} key The key of the method to get.
4160
+ * @returns {*} Returns the function if it's native, else `undefined`.
4161
+ */
4162
+ function getNative(object, key) {
4163
+ var value = getValue(object, key);
4164
+ return baseIsNative(value) ? value : undefined;
4165
+ }
4166
+
4167
+ /**
4168
+ * Checks if `value` is a flattenable `arguments` object or array.
4169
+ *
4170
+ * @private
4171
+ * @param {*} value The value to check.
4172
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
4173
+ */
4174
+ function isFlattenable(value) {
4175
+ return isArray(value) || isArguments(value) ||
4176
+ !!(spreadableSymbol && value && value[spreadableSymbol]);
4177
+ }
4178
+
4179
+ /**
4180
+ * Checks if `value` is suitable for use as unique object key.
4181
+ *
4182
+ * @private
4183
+ * @param {*} value The value to check.
4184
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
4185
+ */
4186
+ function isKeyable(value) {
4187
+ var type = typeof value;
4188
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
4189
+ ? (value !== '__proto__')
4190
+ : (value === null);
4191
+ }
4192
+
4193
+ /**
4194
+ * Checks if `func` has its source masked.
4195
+ *
4196
+ * @private
4197
+ * @param {Function} func The function to check.
4198
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
4199
+ */
4200
+ function isMasked(func) {
4201
+ return !!maskSrcKey && (maskSrcKey in func);
4202
+ }
4203
+
4204
+ /**
4205
+ * Converts `func` to its source code.
4206
+ *
4207
+ * @private
4208
+ * @param {Function} func The function to process.
4209
+ * @returns {string} Returns the source code.
4210
+ */
4211
+ function toSource(func) {
4212
+ if (func != null) {
4213
+ try {
4214
+ return funcToString.call(func);
4215
+ } catch (e) {}
4216
+ try {
4217
+ return (func + '');
4218
+ } catch (e) {}
4219
+ }
4220
+ return '';
4221
+ }
4222
+
4223
+ /**
4224
+ * Creates an array of `array` values not included in the other given arrays
4225
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4226
+ * for equality comparisons. The order of result values is determined by the
4227
+ * order they occur in the first array.
4228
+ *
4229
+ * **Note:** Unlike `_.pullAll`, this method returns a new array.
4230
+ *
4231
+ * @static
4232
+ * @memberOf _
4233
+ * @since 0.1.0
4234
+ * @category Array
4235
+ * @param {Array} array The array to inspect.
4236
+ * @param {...Array} [values] The values to exclude.
4237
+ * @returns {Array} Returns the new array of filtered values.
4238
+ * @see _.without, _.xor
4239
+ * @example
4240
+ *
4241
+ * _.difference([2, 1], [2, 3]);
4242
+ * // => [1]
4243
+ */
4244
+ var difference = baseRest(function(array, values) {
4245
+ return isArrayLikeObject(array)
4246
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
4247
+ : [];
4248
+ });
4249
+
4250
+ /**
4251
+ * Performs a
4252
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4253
+ * comparison between two values to determine if they are equivalent.
4254
+ *
4255
+ * @static
4256
+ * @memberOf _
4257
+ * @since 4.0.0
4258
+ * @category Lang
4259
+ * @param {*} value The value to compare.
4260
+ * @param {*} other The other value to compare.
4261
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
4262
+ * @example
4263
+ *
4264
+ * var object = { 'a': 1 };
4265
+ * var other = { 'a': 1 };
4266
+ *
4267
+ * _.eq(object, object);
4268
+ * // => true
4269
+ *
4270
+ * _.eq(object, other);
4271
+ * // => false
4272
+ *
4273
+ * _.eq('a', 'a');
4274
+ * // => true
4275
+ *
4276
+ * _.eq('a', Object('a'));
4277
+ * // => false
4278
+ *
4279
+ * _.eq(NaN, NaN);
4280
+ * // => true
4281
+ */
4282
+ function eq(value, other) {
4283
+ return value === other || (value !== value && other !== other);
4284
+ }
4285
+
4286
+ /**
4287
+ * Checks if `value` is likely an `arguments` object.
4288
+ *
4289
+ * @static
4290
+ * @memberOf _
4291
+ * @since 0.1.0
4292
+ * @category Lang
4293
+ * @param {*} value The value to check.
4294
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
4295
+ * else `false`.
4296
+ * @example
4297
+ *
4298
+ * _.isArguments(function() { return arguments; }());
4299
+ * // => true
4300
+ *
4301
+ * _.isArguments([1, 2, 3]);
4302
+ * // => false
4303
+ */
4304
+ function isArguments(value) {
4305
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
4306
+ return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
4307
+ (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
4308
+ }
4309
+
4310
+ /**
4311
+ * Checks if `value` is classified as an `Array` object.
4312
+ *
4313
+ * @static
4314
+ * @memberOf _
4315
+ * @since 0.1.0
4316
+ * @category Lang
4317
+ * @param {*} value The value to check.
4318
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
4319
+ * @example
4320
+ *
4321
+ * _.isArray([1, 2, 3]);
4322
+ * // => true
4323
+ *
4324
+ * _.isArray(document.body.children);
4325
+ * // => false
4326
+ *
4327
+ * _.isArray('abc');
4328
+ * // => false
4329
+ *
4330
+ * _.isArray(_.noop);
4331
+ * // => false
4332
+ */
4333
+ var isArray = Array.isArray;
4334
+
4335
+ /**
4336
+ * Checks if `value` is array-like. A value is considered array-like if it's
4337
+ * not a function and has a `value.length` that's an integer greater than or
4338
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
4339
+ *
4340
+ * @static
4341
+ * @memberOf _
4342
+ * @since 4.0.0
4343
+ * @category Lang
4344
+ * @param {*} value The value to check.
4345
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
4346
+ * @example
4347
+ *
4348
+ * _.isArrayLike([1, 2, 3]);
4349
+ * // => true
4350
+ *
4351
+ * _.isArrayLike(document.body.children);
4352
+ * // => true
4353
+ *
4354
+ * _.isArrayLike('abc');
4355
+ * // => true
4356
+ *
4357
+ * _.isArrayLike(_.noop);
4358
+ * // => false
4359
+ */
4360
+ function isArrayLike(value) {
4361
+ return value != null && isLength(value.length) && !isFunction(value);
4362
+ }
4363
+
4364
+ /**
4365
+ * This method is like `_.isArrayLike` except that it also checks if `value`
4366
+ * is an object.
4367
+ *
4368
+ * @static
4369
+ * @memberOf _
4370
+ * @since 4.0.0
4371
+ * @category Lang
4372
+ * @param {*} value The value to check.
4373
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
4374
+ * else `false`.
4375
+ * @example
4376
+ *
4377
+ * _.isArrayLikeObject([1, 2, 3]);
4378
+ * // => true
4379
+ *
4380
+ * _.isArrayLikeObject(document.body.children);
4381
+ * // => true
4382
+ *
4383
+ * _.isArrayLikeObject('abc');
4384
+ * // => false
4385
+ *
4386
+ * _.isArrayLikeObject(_.noop);
4387
+ * // => false
4388
+ */
4389
+ function isArrayLikeObject(value) {
4390
+ return isObjectLike(value) && isArrayLike(value);
4391
+ }
4392
+
4393
+ /**
4394
+ * Checks if `value` is classified as a `Function` object.
4395
+ *
4396
+ * @static
4397
+ * @memberOf _
4398
+ * @since 0.1.0
4399
+ * @category Lang
4400
+ * @param {*} value The value to check.
4401
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
4402
+ * @example
4403
+ *
4404
+ * _.isFunction(_);
4405
+ * // => true
4406
+ *
4407
+ * _.isFunction(/abc/);
4408
+ * // => false
4409
+ */
4410
+ function isFunction(value) {
4411
+ // The use of `Object#toString` avoids issues with the `typeof` operator
4412
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
4413
+ var tag = isObject(value) ? objectToString.call(value) : '';
4414
+ return tag == funcTag || tag == genTag;
4415
+ }
4416
+
4417
+ /**
4418
+ * Checks if `value` is a valid array-like length.
4419
+ *
4420
+ * **Note:** This method is loosely based on
4421
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
4422
+ *
4423
+ * @static
4424
+ * @memberOf _
4425
+ * @since 4.0.0
4426
+ * @category Lang
4427
+ * @param {*} value The value to check.
4428
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
4429
+ * @example
4430
+ *
4431
+ * _.isLength(3);
4432
+ * // => true
4433
+ *
4434
+ * _.isLength(Number.MIN_VALUE);
4435
+ * // => false
4436
+ *
4437
+ * _.isLength(Infinity);
4438
+ * // => false
4439
+ *
4440
+ * _.isLength('3');
4441
+ * // => false
4442
+ */
4443
+ function isLength(value) {
4444
+ return typeof value == 'number' &&
4445
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
4446
+ }
4447
+
4448
+ /**
4449
+ * Checks if `value` is the
4450
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
4451
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
4452
+ *
4453
+ * @static
4454
+ * @memberOf _
4455
+ * @since 0.1.0
4456
+ * @category Lang
4457
+ * @param {*} value The value to check.
4458
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
4459
+ * @example
4460
+ *
4461
+ * _.isObject({});
4462
+ * // => true
4463
+ *
4464
+ * _.isObject([1, 2, 3]);
4465
+ * // => true
4466
+ *
4467
+ * _.isObject(_.noop);
4468
+ * // => true
4469
+ *
4470
+ * _.isObject(null);
4471
+ * // => false
4472
+ */
4473
+ function isObject(value) {
4474
+ var type = typeof value;
4475
+ return !!value && (type == 'object' || type == 'function');
4476
+ }
4477
+
4478
+ /**
4479
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
4480
+ * and has a `typeof` result of "object".
4481
+ *
4482
+ * @static
4483
+ * @memberOf _
4484
+ * @since 4.0.0
4485
+ * @category Lang
4486
+ * @param {*} value The value to check.
4487
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4488
+ * @example
4489
+ *
4490
+ * _.isObjectLike({});
4491
+ * // => true
4492
+ *
4493
+ * _.isObjectLike([1, 2, 3]);
4494
+ * // => true
4495
+ *
4496
+ * _.isObjectLike(_.noop);
4497
+ * // => false
4498
+ *
4499
+ * _.isObjectLike(null);
4500
+ * // => false
4501
+ */
4502
+ function isObjectLike(value) {
4503
+ return !!value && typeof value == 'object';
4504
+ }
4505
+
4506
+ var lodash_difference = difference;
4507
+
4508
+ var _difference = /*@__PURE__*/getDefaultExportFromCjs(lodash_difference);
4509
+
4510
+ /**
4511
+ * Makes sure all values in the grid have a rectangular shape.
4512
+ * We don't support Tetris types.
4513
+ */
4514
+ const assertGridIsValid = (availableKeys, grid) => {
4515
+ const distinctValues = grid.getDistinctValues();
4516
+ // Check if all `availableKeys` have a place in the given grid
4517
+ if (distinctValues.length < availableKeys.length) {
4518
+ throw new Error(`Not all given fields are present in the grid. Please add these fields ${_difference(distinctValues, availableKeys).map(_ => `"${_}"`).join(", ")}`);
4519
+ }
4520
+ // We don't support tetris-shaped values:
4521
+ // E.g:
4522
+ // [
4523
+ // [1,1,1],
4524
+ // [0,1,0]
4525
+ // ]
4526
+ distinctValues.forEach((value) => {
4527
+ if (!availableKeys.includes(value)) {
4528
+ throw new Error(`${value} is not an existing field. Existing fields are ${availableKeys.map(_ => `"${_}"`).join(", ")}.`);
4529
+ }
4530
+ const coordinates = grid.getCoordinatesForValue(value);
4531
+ const subGrid = grid.sliceArea(coordinates.topLeft, coordinates.bottomRight);
4532
+ const subGridDistinctValues = subGrid.getDistinctValues();
4533
+ if (subGridDistinctValues.length !== 1 || subGridDistinctValues[0] !== value) {
4534
+ throw new Error(`Grid contains an unsupported shape. Please make sure "${value}" has a rectangular shape.`);
4535
+ }
4536
+ });
4537
+ return true;
4538
+ };
4539
+
4540
+ const equalColumns = (num, buttonGutter) => {
4541
+ const fractions = [...Array(num)].map(_ => "1fr");
4542
+ if (buttonGutter) {
4543
+ fractions.push("auto");
4544
+ }
4545
+ return fractions.join(" ");
4546
+ };
4547
+
4548
+ class FormPositioner {
4549
+ constructor(fields, columns = {} // -> ignore property, its used to pass along internally.
4550
+ ) {
4551
+ this.fields = fields;
4552
+ this.columns = columns;
4553
+ }
4554
+ /**
4555
+ * Position form elements responsively in a grid.
4556
+ * Example usage:
4557
+ *
4558
+ *
4559
+ * .setGrid("laptop", [ // Breakpoint from laptop to bigger
4560
+ * ["title", "title", "title"], // NOTE: title has a colspan of 3
4561
+ * ["street", "number", "city"],
4562
+ * ["code", "description", "description"], // NOTE: description has a colspan of 2, and a rowspan of 2
4563
+ * ["status", "description", "description"]
4564
+ * ])
4565
+ * .setVertical("mobileS", 1) // NOTE: align everything in a single column for mobileS until laptop
4566
+ *
4567
+ */
4568
+ setGrid(breakPoint, columns, arrayGrid) {
4569
+ // We save the columns setting in a different prop.
4570
+ if (typeof this.columns === "object") {
4571
+ this.columns[breakPoint] = columns;
4572
+ }
4573
+ // Wrap array grid in a Grid object.
4574
+ // It has some nice utility functions to work with.
4575
+ const grid = new Grid(arrayGrid);
4576
+ // Make sure the given grid is a valid grid:
4577
+ assertGridIsValid(Object.keys(this.fields), grid);
4578
+ // Update position attributes for the given fields:
4579
+ const fields = immer.produce(this.fields, draftState => {
4580
+ Object
4581
+ .keys(this.fields)
4582
+ .forEach(key => {
4583
+ const fieldProps = draftState[key].props;
4584
+ const { topLeft, bottomRight } = grid.getCoordinatesForValue(key);
4585
+ if (fieldProps.position === undefined) {
4586
+ fieldProps.position = {};
4587
+ }
4588
+ if (!isResponsiveObject(fieldProps.position)) {
4589
+ // When there already was a position set, but it wasn't marked responsive,
4590
+ // We set that value to the lowest breakpoint:
4591
+ fieldProps.position = { mobile: fieldProps.position };
4592
+ }
4593
+ // Set values to breakpoint.
4594
+ // @ts-ignore
4595
+ fieldProps.position[breakPoint] = {
4596
+ column: topLeft.x,
4597
+ columnSpan: bottomRight.x - topLeft.x + 1,
4598
+ row: topLeft.y,
4599
+ rowSpan: bottomRight.y - topLeft.y + 1
4600
+ };
4601
+ });
4602
+ });
4603
+ // Return a new formPositioner.
4604
+ // It allows us to chain, while still being immutable.
4605
+ return new FormPositioner(fields, this.columns);
4606
+ }
4607
+ /**
4608
+ * Aligns all input-fields vertically.
4609
+ */
4610
+ setVertical(breakPoint, numColumns = 1, columns) {
4611
+ return this.setGrid(breakPoint, columns !== null && columns !== void 0 ? columns : equalColumns(numColumns, false), _chunk(Object.keys(this.fields), numColumns));
4612
+ }
4613
+ /**
4614
+ * Aligns all input-fields horizontally.
4615
+ */
4616
+ setHorizontal(breakPoint, columns) {
4617
+ const keys = Object.keys(this.fields);
4618
+ return this.setGrid(breakPoint, columns !== null && columns !== void 0 ? columns : equalColumns(keys.length, false), [keys]);
4619
+ }
4620
+ getColumns() {
4621
+ return this.columns;
4622
+ }
4623
+ getFields() {
4624
+ return this.fields;
4625
+ }
4626
+ getScaffoldProps() {
4627
+ return {
4628
+ fields: this.fields,
4629
+ columns: this.columns
4630
+ };
4631
+ }
4632
+ }
4633
+
4634
+ const ScaffoldFormContext = React.createContext({ factory: undefined });
4635
+ const ScaffoldFormProvider = ({ factory, children }) => (React.createElement(ScaffoldFormContext.Provider, { value: { factory: factory } }, children));
4636
+
4637
+ const useScaffoldFormContext = () => React.useContext(ScaffoldFormContext);
4638
+
4639
+ const getComponent = (field) => {
4640
+ switch (field.type) {
4641
+ case "Button":
4642
+ return Button$1;
4643
+ case "Checkbox":
4644
+ return Checkbox;
4645
+ case "Select":
4646
+ return Select;
4647
+ case "FileField":
4648
+ return FileField;
4649
+ case "PasswordStrengthField":
4650
+ return PasswordStrengthField;
4651
+ case "TextField":
4652
+ default:
4653
+ return TextField;
4654
+ }
4655
+ };
4656
+ const ScaffoldField = React.forwardRef((_a, ref) => {
4657
+ var { name, field } = _a, restProps = __rest(_a, ["name", "field"]);
4658
+ const { factory } = useScaffoldFormContext();
4659
+ const formGridWrapperProps = getFormGridWrapperProps(field.props);
4660
+ const Component = (factory === null || factory === void 0 ? void 0 : factory(field)) || getComponent(field);
4661
+ // @ts-ignore
4662
+ if (field.type === "TextField" && field.props.type === "hidden") {
4663
+ return React.createElement(Component, Object.assign({ ref: ref, name: name }, restProps, field.props));
4664
+ }
4665
+ return (React.createElement(FormGridWrapper, Object.assign({}, formGridWrapperProps),
4666
+ React.createElement(Component, Object.assign({ ref: ref, name: name, placeholder: field.props.placeholder || formGridWrapperProps.label, className: clsx(!!formGridWrapperProps.error && 'error', field.props.className) }, restProps, field.props))));
4667
+ });
4668
+
4669
+ const ScaffoldForm = React.forwardRef((_a, ref) => {
4670
+ var { children, columns, fields, prefixFieldNames } = _a, restProps = __rest(_a, ["children", "columns", "fields", "prefixFieldNames"]);
4671
+ return (React.createElement(FormGrid, { columns: columns },
4672
+ Object
4673
+ .entries(fields)
4674
+ .map(([key, fieldProps]) => (
4675
+ // @ts-ignore
4676
+ React.createElement(ScaffoldField, Object.assign({ name: `${prefixFieldNames !== null && prefixFieldNames !== void 0 ? prefixFieldNames : ''}${key}`, key: key, field: fieldProps, ref: ref }, restProps)))),
4677
+ children));
4678
+ });
4679
+
4680
+ exports.Alert = Alert;
4681
+ exports.AnimatedCheckmark = AnimatedCheckmark;
4682
+ exports.BasicLayout = BasicLayout;
4683
+ exports.Box = Box;
4684
+ exports.BreadCrumbs = BreadCrumbs;
4685
+ exports.BreakPointValues = BreakPointValues;
4686
+ exports.Button = Button$1;
4687
+ exports.Checkbox = Checkbox;
4688
+ exports.CollapsiblePanel = CollapsiblePanel;
4689
+ exports.ConfirmButton = ConfirmButton;
4690
+ exports.ConfirmModal = ConfirmModal;
4691
+ exports.Crumb = Crumb;
4692
+ exports.Details = Details;
4693
+ exports.Dropdown = Dropdown;
4694
+ exports.DropdownMenu = DropdownMenu;
4695
+ exports.DropdownMenuItem = DropdownMenuItem;
4696
+ exports.Dropzone = Dropzone;
4697
+ exports.Feedback = Feedback;
4698
+ exports.FileField = FileField;
4699
+ exports.Floater = Floater;
4700
+ exports.FloatingPanelLayout = FloatingPanelLayout;
4701
+ exports.Footer = Footer;
4702
+ exports.FormGrid = FormGrid;
4703
+ exports.FormGridWrapper = FormGridWrapper;
4704
+ exports.FormPositioner = FormPositioner;
4705
+ exports.HamburgerButton = HamburgerButton;
4706
+ exports.Header = Header;
4707
+ exports.HorizontalScroller = HorizontalScroller;
4708
+ exports.Menu = Menu;
4709
+ exports.MenuCloseButton = MenuCloseButton;
4710
+ exports.MenuItem = MenuItem;
4711
+ exports.MenuSlideOpenIndicator = MenuSlideOpenIndicator;
4712
+ exports.Modal = Modal;
4713
+ exports.Overlay = Overlay;
4714
+ exports.Paginator = Paginator;
4715
+ exports.Panel = Panel;
4716
+ exports.Paragraph = Paragraph;
4717
+ exports.PasswordStrengthField = PasswordStrengthField;
4718
+ exports.ScaffoldForm = ScaffoldForm;
4719
+ exports.ScaffoldFormContext = ScaffoldFormContext;
4720
+ exports.ScaffoldFormProvider = ScaffoldFormProvider;
4721
+ exports.Section = Section;
4722
+ exports.Select = Select;
4723
+ exports.SideBarHeader = SideBarHeader;
4724
+ exports.SimpleTimeline = SimpleTimeline;
4725
+ exports.SlideInFromTop = SlideInFromTop;
4726
+ exports.Statistic = Statistic;
4727
+ exports.StyledTable = StyledTable;
4728
+ exports.Tab = Tab;
4729
+ exports.TabContent = TabContent;
4730
+ exports.Table = Table;
4731
+ exports.Tabs = Tabs;
4732
+ exports.TextField = TextField;
4733
+ exports.Timeline = Timeline;
4734
+ exports.TopBar = TopBar;
4735
+ exports.UiProvider = UiProvider;
4736
+ exports.UiWrapper = UiWrapper;
4737
+ exports.VerticalRhythmLaptop = VerticalRhythmLaptop;
4738
+ exports.VerticalRhythmMobile = VerticalRhythmMobile;
4739
+ exports.calculatePasswordScore = calculatePasswordScore;
4740
+ exports.getFormGridWrapperProps = getFormGridWrapperProps;
4741
+ exports.isResponsiveObject = isResponsiveObject;
4742
+ exports.mq = mq;
4743
+ exports.passwordHasLowerAndUppercase = passwordHasLowerAndUppercase;
4744
+ exports.passwordHasNumbers = passwordHasNumbers;
4745
+ exports.passwordHasSpecialChars = passwordHasSpecialChars;
4746
+ exports.passwordMinLength = passwordMinLength;
4747
+ exports.responsiveProps = responsiveProps;
4748
+ exports.theme = theme;
4749
+ exports.useCloseSidebarOnNavigate = useCloseSidebarOnNavigate;
4750
+ exports.useResponsiveBreakpoints = useResponsiveBreakpoints;
4751
+ exports.useToggleMobileMenu = useToggleMobileMenu;