UNPKG

231 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
3 typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactJsonTree = {}, global.React));
5})(this, (function (exports, React) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 function _mergeNamespaces(n, m) {
10 m.forEach(function (e) {
11 e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
12 if (k !== 'default' && !(k in n)) {
13 var d = Object.getOwnPropertyDescriptor(e, k);
14 Object.defineProperty(n, k, d.get ? d : {
15 enumerable: true,
16 get: function () { return e[k]; }
17 });
18 }
19 });
20 });
21 return Object.freeze(n);
22 }
23
24 var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
26 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
27
28 function getDefaultExportFromCjs (x) {
29 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
30 }
31
32 var objectWithoutProperties = {exports: {}};
33
34 var objectWithoutPropertiesLoose = {exports: {}};
35
36 (function (module) {
37 function _objectWithoutPropertiesLoose(source, excluded) {
38 if (source == null) return {};
39 var target = {};
40 var sourceKeys = Object.keys(source);
41 var key, i;
42
43 for (i = 0; i < sourceKeys.length; i++) {
44 key = sourceKeys[i];
45 if (excluded.indexOf(key) >= 0) continue;
46 target[key] = source[key];
47 }
48
49 return target;
50 }
51
52 module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
53 } (objectWithoutPropertiesLoose));
54
55 (function (module) {
56 var objectWithoutPropertiesLoose$1 = objectWithoutPropertiesLoose.exports;
57
58 function _objectWithoutProperties(source, excluded) {
59 if (source == null) return {};
60 var target = objectWithoutPropertiesLoose$1(source, excluded);
61 var key, i;
62
63 if (Object.getOwnPropertySymbols) {
64 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
65
66 for (i = 0; i < sourceSymbolKeys.length; i++) {
67 key = sourceSymbolKeys[i];
68 if (excluded.indexOf(key) >= 0) continue;
69 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
70 target[key] = source[key];
71 }
72 }
73
74 return target;
75 }
76
77 module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
78 } (objectWithoutProperties));
79
80 var _objectWithoutProperties = /*@__PURE__*/getDefaultExportFromCjs(objectWithoutProperties.exports);
81
82 var classCallCheck = {exports: {}};
83
84 (function (module) {
85 function _classCallCheck(instance, Constructor) {
86 if (!(instance instanceof Constructor)) {
87 throw new TypeError("Cannot call a class as a function");
88 }
89 }
90
91 module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
92 } (classCallCheck));
93
94 var _classCallCheck = /*@__PURE__*/getDefaultExportFromCjs(classCallCheck.exports);
95
96 var createClass = {exports: {}};
97
98 (function (module) {
99 function _defineProperties(target, props) {
100 for (var i = 0; i < props.length; i++) {
101 var descriptor = props[i];
102 descriptor.enumerable = descriptor.enumerable || false;
103 descriptor.configurable = true;
104 if ("value" in descriptor) descriptor.writable = true;
105 Object.defineProperty(target, descriptor.key, descriptor);
106 }
107 }
108
109 function _createClass(Constructor, protoProps, staticProps) {
110 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
111 if (staticProps) _defineProperties(Constructor, staticProps);
112 Object.defineProperty(Constructor, "prototype", {
113 writable: false
114 });
115 return Constructor;
116 }
117
118 module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
119 } (createClass));
120
121 var _createClass = /*@__PURE__*/getDefaultExportFromCjs(createClass.exports);
122
123 var inherits = {exports: {}};
124
125 var setPrototypeOf = {exports: {}};
126
127 (function (module) {
128 function _setPrototypeOf(o, p) {
129 module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
130 o.__proto__ = p;
131 return o;
132 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
133 return _setPrototypeOf(o, p);
134 }
135
136 module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
137 } (setPrototypeOf));
138
139 (function (module) {
140 var setPrototypeOf$1 = setPrototypeOf.exports;
141
142 function _inherits(subClass, superClass) {
143 if (typeof superClass !== "function" && superClass !== null) {
144 throw new TypeError("Super expression must either be null or a function");
145 }
146
147 subClass.prototype = Object.create(superClass && superClass.prototype, {
148 constructor: {
149 value: subClass,
150 writable: true,
151 configurable: true
152 }
153 });
154 Object.defineProperty(subClass, "prototype", {
155 writable: false
156 });
157 if (superClass) setPrototypeOf$1(subClass, superClass);
158 }
159
160 module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
161 } (inherits));
162
163 var _inherits = /*@__PURE__*/getDefaultExportFromCjs(inherits.exports);
164
165 var possibleConstructorReturn = {exports: {}};
166
167 var _typeof$1 = {exports: {}};
168
169 (function (module) {
170 function _typeof(obj) {
171 "@babel/helpers - typeof";
172
173 return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
174 return typeof obj;
175 } : function (obj) {
176 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
177 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
178 }
179
180 module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
181 } (_typeof$1));
182
183 var assertThisInitialized = {exports: {}};
184
185 (function (module) {
186 function _assertThisInitialized(self) {
187 if (self === void 0) {
188 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
189 }
190
191 return self;
192 }
193
194 module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
195 } (assertThisInitialized));
196
197 (function (module) {
198 var _typeof = _typeof$1.exports["default"];
199
200 var assertThisInitialized$1 = assertThisInitialized.exports;
201
202 function _possibleConstructorReturn(self, call) {
203 if (call && (_typeof(call) === "object" || typeof call === "function")) {
204 return call;
205 } else if (call !== void 0) {
206 throw new TypeError("Derived constructors may only return object or undefined");
207 }
208
209 return assertThisInitialized$1(self);
210 }
211
212 module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
213 } (possibleConstructorReturn));
214
215 var _possibleConstructorReturn = /*@__PURE__*/getDefaultExportFromCjs(possibleConstructorReturn.exports);
216
217 var getPrototypeOf = {exports: {}};
218
219 (function (module) {
220 function _getPrototypeOf(o) {
221 module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
222 return o.__proto__ || Object.getPrototypeOf(o);
223 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
224 return _getPrototypeOf(o);
225 }
226
227 module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
228 } (getPrototypeOf));
229
230 var _getPrototypeOf = /*@__PURE__*/getDefaultExportFromCjs(getPrototypeOf.exports);
231
232 var defineProperty$1 = {exports: {}};
233
234 (function (module) {
235 function _defineProperty(obj, key, value) {
236 if (key in obj) {
237 Object.defineProperty(obj, key, {
238 value: value,
239 enumerable: true,
240 configurable: true,
241 writable: true
242 });
243 } else {
244 obj[key] = value;
245 }
246
247 return obj;
248 }
249
250 module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
251 } (defineProperty$1));
252
253 var _defineProperty$1 = /*@__PURE__*/getDefaultExportFromCjs(defineProperty$1.exports);
254
255 var slicedToArray = {exports: {}};
256
257 var arrayWithHoles = {exports: {}};
258
259 (function (module) {
260 function _arrayWithHoles(arr) {
261 if (Array.isArray(arr)) return arr;
262 }
263
264 module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
265 } (arrayWithHoles));
266
267 var iterableToArrayLimit = {exports: {}};
268
269 (function (module) {
270 function _iterableToArrayLimit(arr, i) {
271 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
272
273 if (_i == null) return;
274 var _arr = [];
275 var _n = true;
276 var _d = false;
277
278 var _s, _e;
279
280 try {
281 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
282 _arr.push(_s.value);
283
284 if (i && _arr.length === i) break;
285 }
286 } catch (err) {
287 _d = true;
288 _e = err;
289 } finally {
290 try {
291 if (!_n && _i["return"] != null) _i["return"]();
292 } finally {
293 if (_d) throw _e;
294 }
295 }
296
297 return _arr;
298 }
299
300 module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
301 } (iterableToArrayLimit));
302
303 var unsupportedIterableToArray = {exports: {}};
304
305 var arrayLikeToArray = {exports: {}};
306
307 (function (module) {
308 function _arrayLikeToArray(arr, len) {
309 if (len == null || len > arr.length) len = arr.length;
310
311 for (var i = 0, arr2 = new Array(len); i < len; i++) {
312 arr2[i] = arr[i];
313 }
314
315 return arr2;
316 }
317
318 module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
319 } (arrayLikeToArray));
320
321 (function (module) {
322 var arrayLikeToArray$1 = arrayLikeToArray.exports;
323
324 function _unsupportedIterableToArray(o, minLen) {
325 if (!o) return;
326 if (typeof o === "string") return arrayLikeToArray$1(o, minLen);
327 var n = Object.prototype.toString.call(o).slice(8, -1);
328 if (n === "Object" && o.constructor) n = o.constructor.name;
329 if (n === "Map" || n === "Set") return Array.from(o);
330 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray$1(o, minLen);
331 }
332
333 module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
334 } (unsupportedIterableToArray));
335
336 var nonIterableRest = {exports: {}};
337
338 (function (module) {
339 function _nonIterableRest() {
340 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
341 }
342
343 module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
344 } (nonIterableRest));
345
346 (function (module) {
347 var arrayWithHoles$1 = arrayWithHoles.exports;
348
349 var iterableToArrayLimit$1 = iterableToArrayLimit.exports;
350
351 var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
352
353 var nonIterableRest$1 = nonIterableRest.exports;
354
355 function _slicedToArray(arr, i) {
356 return arrayWithHoles$1(arr) || iterableToArrayLimit$1(arr, i) || unsupportedIterableToArray$1(arr, i) || nonIterableRest$1();
357 }
358
359 module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
360 } (slicedToArray));
361
362 var _slicedToArray$1 = /*@__PURE__*/getDefaultExportFromCjs(slicedToArray.exports);
363
364 var propTypes = {exports: {}};
365
366 var reactIs = {exports: {}};
367
368 var reactIs_production_min = {};
369
370 /** @license React v16.13.1
371 * react-is.production.min.js
372 *
373 * Copyright (c) Facebook, Inc. and its affiliates.
374 *
375 * This source code is licensed under the MIT license found in the
376 * LICENSE file in the root directory of this source tree.
377 */
378
379 var hasRequiredReactIs_production_min;
380
381 function requireReactIs_production_min () {
382 if (hasRequiredReactIs_production_min) return reactIs_production_min;
383 hasRequiredReactIs_production_min = 1;
384 var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
385 Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
386 function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
387 reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
388 reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
389 reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
390 return reactIs_production_min;
391 }
392
393 var reactIs_development = {};
394
395 /** @license React v16.13.1
396 * react-is.development.js
397 *
398 * Copyright (c) Facebook, Inc. and its affiliates.
399 *
400 * This source code is licensed under the MIT license found in the
401 * LICENSE file in the root directory of this source tree.
402 */
403
404 var hasRequiredReactIs_development;
405
406 function requireReactIs_development () {
407 if (hasRequiredReactIs_development) return reactIs_development;
408 hasRequiredReactIs_development = 1;
409
410
411
412 if (process.env.NODE_ENV !== "production") {
413 (function() {
414
415 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
416 // nor polyfill, then a plain number is used for performance.
417 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
418 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
419 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
420 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
421 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
422 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
423 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
424 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
425 // (unstable) APIs that have been removed. Can we remove the symbols?
426
427 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
428 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
429 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
430 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
431 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
432 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
433 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
434 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
435 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
436 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
437 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
438
439 function isValidElementType(type) {
440 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
441 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
442 }
443
444 function typeOf(object) {
445 if (typeof object === 'object' && object !== null) {
446 var $$typeof = object.$$typeof;
447
448 switch ($$typeof) {
449 case REACT_ELEMENT_TYPE:
450 var type = object.type;
451
452 switch (type) {
453 case REACT_ASYNC_MODE_TYPE:
454 case REACT_CONCURRENT_MODE_TYPE:
455 case REACT_FRAGMENT_TYPE:
456 case REACT_PROFILER_TYPE:
457 case REACT_STRICT_MODE_TYPE:
458 case REACT_SUSPENSE_TYPE:
459 return type;
460
461 default:
462 var $$typeofType = type && type.$$typeof;
463
464 switch ($$typeofType) {
465 case REACT_CONTEXT_TYPE:
466 case REACT_FORWARD_REF_TYPE:
467 case REACT_LAZY_TYPE:
468 case REACT_MEMO_TYPE:
469 case REACT_PROVIDER_TYPE:
470 return $$typeofType;
471
472 default:
473 return $$typeof;
474 }
475
476 }
477
478 case REACT_PORTAL_TYPE:
479 return $$typeof;
480 }
481 }
482
483 return undefined;
484 } // AsyncMode is deprecated along with isAsyncMode
485
486 var AsyncMode = REACT_ASYNC_MODE_TYPE;
487 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
488 var ContextConsumer = REACT_CONTEXT_TYPE;
489 var ContextProvider = REACT_PROVIDER_TYPE;
490 var Element = REACT_ELEMENT_TYPE;
491 var ForwardRef = REACT_FORWARD_REF_TYPE;
492 var Fragment = REACT_FRAGMENT_TYPE;
493 var Lazy = REACT_LAZY_TYPE;
494 var Memo = REACT_MEMO_TYPE;
495 var Portal = REACT_PORTAL_TYPE;
496 var Profiler = REACT_PROFILER_TYPE;
497 var StrictMode = REACT_STRICT_MODE_TYPE;
498 var Suspense = REACT_SUSPENSE_TYPE;
499 var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
500
501 function isAsyncMode(object) {
502 {
503 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
504 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
505
506 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
507 }
508 }
509
510 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
511 }
512 function isConcurrentMode(object) {
513 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
514 }
515 function isContextConsumer(object) {
516 return typeOf(object) === REACT_CONTEXT_TYPE;
517 }
518 function isContextProvider(object) {
519 return typeOf(object) === REACT_PROVIDER_TYPE;
520 }
521 function isElement(object) {
522 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
523 }
524 function isForwardRef(object) {
525 return typeOf(object) === REACT_FORWARD_REF_TYPE;
526 }
527 function isFragment(object) {
528 return typeOf(object) === REACT_FRAGMENT_TYPE;
529 }
530 function isLazy(object) {
531 return typeOf(object) === REACT_LAZY_TYPE;
532 }
533 function isMemo(object) {
534 return typeOf(object) === REACT_MEMO_TYPE;
535 }
536 function isPortal(object) {
537 return typeOf(object) === REACT_PORTAL_TYPE;
538 }
539 function isProfiler(object) {
540 return typeOf(object) === REACT_PROFILER_TYPE;
541 }
542 function isStrictMode(object) {
543 return typeOf(object) === REACT_STRICT_MODE_TYPE;
544 }
545 function isSuspense(object) {
546 return typeOf(object) === REACT_SUSPENSE_TYPE;
547 }
548
549 reactIs_development.AsyncMode = AsyncMode;
550 reactIs_development.ConcurrentMode = ConcurrentMode;
551 reactIs_development.ContextConsumer = ContextConsumer;
552 reactIs_development.ContextProvider = ContextProvider;
553 reactIs_development.Element = Element;
554 reactIs_development.ForwardRef = ForwardRef;
555 reactIs_development.Fragment = Fragment;
556 reactIs_development.Lazy = Lazy;
557 reactIs_development.Memo = Memo;
558 reactIs_development.Portal = Portal;
559 reactIs_development.Profiler = Profiler;
560 reactIs_development.StrictMode = StrictMode;
561 reactIs_development.Suspense = Suspense;
562 reactIs_development.isAsyncMode = isAsyncMode;
563 reactIs_development.isConcurrentMode = isConcurrentMode;
564 reactIs_development.isContextConsumer = isContextConsumer;
565 reactIs_development.isContextProvider = isContextProvider;
566 reactIs_development.isElement = isElement;
567 reactIs_development.isForwardRef = isForwardRef;
568 reactIs_development.isFragment = isFragment;
569 reactIs_development.isLazy = isLazy;
570 reactIs_development.isMemo = isMemo;
571 reactIs_development.isPortal = isPortal;
572 reactIs_development.isProfiler = isProfiler;
573 reactIs_development.isStrictMode = isStrictMode;
574 reactIs_development.isSuspense = isSuspense;
575 reactIs_development.isValidElementType = isValidElementType;
576 reactIs_development.typeOf = typeOf;
577 })();
578 }
579 return reactIs_development;
580 }
581
582 var hasRequiredReactIs;
583
584 function requireReactIs () {
585 if (hasRequiredReactIs) return reactIs.exports;
586 hasRequiredReactIs = 1;
587 (function (module) {
588
589 if (process.env.NODE_ENV === 'production') {
590 module.exports = requireReactIs_production_min();
591 } else {
592 module.exports = requireReactIs_development();
593 }
594 } (reactIs));
595 return reactIs.exports;
596 }
597
598 /*
599 object-assign
600 (c) Sindre Sorhus
601 @license MIT
602 */
603
604 var objectAssign;
605 var hasRequiredObjectAssign;
606
607 function requireObjectAssign () {
608 if (hasRequiredObjectAssign) return objectAssign;
609 hasRequiredObjectAssign = 1;
610 /* eslint-disable no-unused-vars */
611 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
612 var hasOwnProperty = Object.prototype.hasOwnProperty;
613 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
614
615 function toObject(val) {
616 if (val === null || val === undefined) {
617 throw new TypeError('Object.assign cannot be called with null or undefined');
618 }
619
620 return Object(val);
621 }
622
623 function shouldUseNative() {
624 try {
625 if (!Object.assign) {
626 return false;
627 }
628
629 // Detect buggy property enumeration order in older V8 versions.
630
631 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
632 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
633 test1[5] = 'de';
634 if (Object.getOwnPropertyNames(test1)[0] === '5') {
635 return false;
636 }
637
638 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
639 var test2 = {};
640 for (var i = 0; i < 10; i++) {
641 test2['_' + String.fromCharCode(i)] = i;
642 }
643 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
644 return test2[n];
645 });
646 if (order2.join('') !== '0123456789') {
647 return false;
648 }
649
650 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
651 var test3 = {};
652 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
653 test3[letter] = letter;
654 });
655 if (Object.keys(Object.assign({}, test3)).join('') !==
656 'abcdefghijklmnopqrst') {
657 return false;
658 }
659
660 return true;
661 } catch (err) {
662 // We don't expect any of the above to throw, but better to be safe.
663 return false;
664 }
665 }
666
667 objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
668 var from;
669 var to = toObject(target);
670 var symbols;
671
672 for (var s = 1; s < arguments.length; s++) {
673 from = Object(arguments[s]);
674
675 for (var key in from) {
676 if (hasOwnProperty.call(from, key)) {
677 to[key] = from[key];
678 }
679 }
680
681 if (getOwnPropertySymbols) {
682 symbols = getOwnPropertySymbols(from);
683 for (var i = 0; i < symbols.length; i++) {
684 if (propIsEnumerable.call(from, symbols[i])) {
685 to[symbols[i]] = from[symbols[i]];
686 }
687 }
688 }
689 }
690
691 return to;
692 };
693 return objectAssign;
694 }
695
696 /**
697 * Copyright (c) 2013-present, Facebook, Inc.
698 *
699 * This source code is licensed under the MIT license found in the
700 * LICENSE file in the root directory of this source tree.
701 */
702
703 var ReactPropTypesSecret_1;
704 var hasRequiredReactPropTypesSecret;
705
706 function requireReactPropTypesSecret () {
707 if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
708 hasRequiredReactPropTypesSecret = 1;
709
710 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
711
712 ReactPropTypesSecret_1 = ReactPropTypesSecret;
713 return ReactPropTypesSecret_1;
714 }
715
716 var has;
717 var hasRequiredHas;
718
719 function requireHas () {
720 if (hasRequiredHas) return has;
721 hasRequiredHas = 1;
722 has = Function.call.bind(Object.prototype.hasOwnProperty);
723 return has;
724 }
725
726 /**
727 * Copyright (c) 2013-present, Facebook, Inc.
728 *
729 * This source code is licensed under the MIT license found in the
730 * LICENSE file in the root directory of this source tree.
731 */
732
733 var checkPropTypes_1;
734 var hasRequiredCheckPropTypes;
735
736 function requireCheckPropTypes () {
737 if (hasRequiredCheckPropTypes) return checkPropTypes_1;
738 hasRequiredCheckPropTypes = 1;
739
740 var printWarning = function() {};
741
742 if (process.env.NODE_ENV !== 'production') {
743 var ReactPropTypesSecret = requireReactPropTypesSecret();
744 var loggedTypeFailures = {};
745 var has = requireHas();
746
747 printWarning = function(text) {
748 var message = 'Warning: ' + text;
749 if (typeof console !== 'undefined') {
750 console.error(message);
751 }
752 try {
753 // --- Welcome to debugging React ---
754 // This error was thrown as a convenience so that you can use this stack
755 // to find the callsite that caused this warning to fire.
756 throw new Error(message);
757 } catch (x) { /**/ }
758 };
759 }
760
761 /**
762 * Assert that the values match with the type specs.
763 * Error messages are memorized and will only be shown once.
764 *
765 * @param {object} typeSpecs Map of name to a ReactPropType
766 * @param {object} values Runtime values that need to be type-checked
767 * @param {string} location e.g. "prop", "context", "child context"
768 * @param {string} componentName Name of the component for error messages.
769 * @param {?Function} getStack Returns the component stack.
770 * @private
771 */
772 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
773 if (process.env.NODE_ENV !== 'production') {
774 for (var typeSpecName in typeSpecs) {
775 if (has(typeSpecs, typeSpecName)) {
776 var error;
777 // Prop type validation may throw. In case they do, we don't want to
778 // fail the render phase where it didn't fail before. So we log it.
779 // After these have been cleaned up, we'll let them throw.
780 try {
781 // This is intentionally an invariant that gets caught. It's the same
782 // behavior as without this statement except with a better message.
783 if (typeof typeSpecs[typeSpecName] !== 'function') {
784 var err = Error(
785 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
786 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
787 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
788 );
789 err.name = 'Invariant Violation';
790 throw err;
791 }
792 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
793 } catch (ex) {
794 error = ex;
795 }
796 if (error && !(error instanceof Error)) {
797 printWarning(
798 (componentName || 'React class') + ': type specification of ' +
799 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
800 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
801 'You may have forgotten to pass an argument to the type checker ' +
802 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
803 'shape all require an argument).'
804 );
805 }
806 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
807 // Only monitor this failure once because there tends to be a lot of the
808 // same error.
809 loggedTypeFailures[error.message] = true;
810
811 var stack = getStack ? getStack() : '';
812
813 printWarning(
814 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
815 );
816 }
817 }
818 }
819 }
820 }
821
822 /**
823 * Resets warning cache when testing.
824 *
825 * @private
826 */
827 checkPropTypes.resetWarningCache = function() {
828 if (process.env.NODE_ENV !== 'production') {
829 loggedTypeFailures = {};
830 }
831 };
832
833 checkPropTypes_1 = checkPropTypes;
834 return checkPropTypes_1;
835 }
836
837 /**
838 * Copyright (c) 2013-present, Facebook, Inc.
839 *
840 * This source code is licensed under the MIT license found in the
841 * LICENSE file in the root directory of this source tree.
842 */
843
844 var factoryWithTypeCheckers;
845 var hasRequiredFactoryWithTypeCheckers;
846
847 function requireFactoryWithTypeCheckers () {
848 if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
849 hasRequiredFactoryWithTypeCheckers = 1;
850
851 var ReactIs = requireReactIs();
852 var assign = requireObjectAssign();
853
854 var ReactPropTypesSecret = requireReactPropTypesSecret();
855 var has = requireHas();
856 var checkPropTypes = requireCheckPropTypes();
857
858 var printWarning = function() {};
859
860 if (process.env.NODE_ENV !== 'production') {
861 printWarning = function(text) {
862 var message = 'Warning: ' + text;
863 if (typeof console !== 'undefined') {
864 console.error(message);
865 }
866 try {
867 // --- Welcome to debugging React ---
868 // This error was thrown as a convenience so that you can use this stack
869 // to find the callsite that caused this warning to fire.
870 throw new Error(message);
871 } catch (x) {}
872 };
873 }
874
875 function emptyFunctionThatReturnsNull() {
876 return null;
877 }
878
879 factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
880 /* global Symbol */
881 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
882 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
883
884 /**
885 * Returns the iterator method function contained on the iterable object.
886 *
887 * Be sure to invoke the function with the iterable as context:
888 *
889 * var iteratorFn = getIteratorFn(myIterable);
890 * if (iteratorFn) {
891 * var iterator = iteratorFn.call(myIterable);
892 * ...
893 * }
894 *
895 * @param {?object} maybeIterable
896 * @return {?function}
897 */
898 function getIteratorFn(maybeIterable) {
899 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
900 if (typeof iteratorFn === 'function') {
901 return iteratorFn;
902 }
903 }
904
905 /**
906 * Collection of methods that allow declaration and validation of props that are
907 * supplied to React components. Example usage:
908 *
909 * var Props = require('ReactPropTypes');
910 * var MyArticle = React.createClass({
911 * propTypes: {
912 * // An optional string prop named "description".
913 * description: Props.string,
914 *
915 * // A required enum prop named "category".
916 * category: Props.oneOf(['News','Photos']).isRequired,
917 *
918 * // A prop named "dialog" that requires an instance of Dialog.
919 * dialog: Props.instanceOf(Dialog).isRequired
920 * },
921 * render: function() { ... }
922 * });
923 *
924 * A more formal specification of how these methods are used:
925 *
926 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
927 * decl := ReactPropTypes.{type}(.isRequired)?
928 *
929 * Each and every declaration produces a function with the same signature. This
930 * allows the creation of custom validation functions. For example:
931 *
932 * var MyLink = React.createClass({
933 * propTypes: {
934 * // An optional string or URI prop named "href".
935 * href: function(props, propName, componentName) {
936 * var propValue = props[propName];
937 * if (propValue != null && typeof propValue !== 'string' &&
938 * !(propValue instanceof URI)) {
939 * return new Error(
940 * 'Expected a string or an URI for ' + propName + ' in ' +
941 * componentName
942 * );
943 * }
944 * }
945 * },
946 * render: function() {...}
947 * });
948 *
949 * @internal
950 */
951
952 var ANONYMOUS = '<<anonymous>>';
953
954 // Important!
955 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
956 var ReactPropTypes = {
957 array: createPrimitiveTypeChecker('array'),
958 bigint: createPrimitiveTypeChecker('bigint'),
959 bool: createPrimitiveTypeChecker('boolean'),
960 func: createPrimitiveTypeChecker('function'),
961 number: createPrimitiveTypeChecker('number'),
962 object: createPrimitiveTypeChecker('object'),
963 string: createPrimitiveTypeChecker('string'),
964 symbol: createPrimitiveTypeChecker('symbol'),
965
966 any: createAnyTypeChecker(),
967 arrayOf: createArrayOfTypeChecker,
968 element: createElementTypeChecker(),
969 elementType: createElementTypeTypeChecker(),
970 instanceOf: createInstanceTypeChecker,
971 node: createNodeChecker(),
972 objectOf: createObjectOfTypeChecker,
973 oneOf: createEnumTypeChecker,
974 oneOfType: createUnionTypeChecker,
975 shape: createShapeTypeChecker,
976 exact: createStrictShapeTypeChecker,
977 };
978
979 /**
980 * inlined Object.is polyfill to avoid requiring consumers ship their own
981 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
982 */
983 /*eslint-disable no-self-compare*/
984 function is(x, y) {
985 // SameValue algorithm
986 if (x === y) {
987 // Steps 1-5, 7-10
988 // Steps 6.b-6.e: +0 != -0
989 return x !== 0 || 1 / x === 1 / y;
990 } else {
991 // Step 6.a: NaN == NaN
992 return x !== x && y !== y;
993 }
994 }
995 /*eslint-enable no-self-compare*/
996
997 /**
998 * We use an Error-like object for backward compatibility as people may call
999 * PropTypes directly and inspect their output. However, we don't use real
1000 * Errors anymore. We don't inspect their stack anyway, and creating them
1001 * is prohibitively expensive if they are created too often, such as what
1002 * happens in oneOfType() for any type before the one that matched.
1003 */
1004 function PropTypeError(message, data) {
1005 this.message = message;
1006 this.data = data && typeof data === 'object' ? data: {};
1007 this.stack = '';
1008 }
1009 // Make `instanceof Error` still work for returned errors.
1010 PropTypeError.prototype = Error.prototype;
1011
1012 function createChainableTypeChecker(validate) {
1013 if (process.env.NODE_ENV !== 'production') {
1014 var manualPropTypeCallCache = {};
1015 var manualPropTypeWarningCount = 0;
1016 }
1017 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
1018 componentName = componentName || ANONYMOUS;
1019 propFullName = propFullName || propName;
1020
1021 if (secret !== ReactPropTypesSecret) {
1022 if (throwOnDirectAccess) {
1023 // New behavior only for users of `prop-types` package
1024 var err = new Error(
1025 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1026 'Use `PropTypes.checkPropTypes()` to call them. ' +
1027 'Read more at http://fb.me/use-check-prop-types'
1028 );
1029 err.name = 'Invariant Violation';
1030 throw err;
1031 } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
1032 // Old behavior for people using React.PropTypes
1033 var cacheKey = componentName + ':' + propName;
1034 if (
1035 !manualPropTypeCallCache[cacheKey] &&
1036 // Avoid spamming the console because they are often not actionable except for lib authors
1037 manualPropTypeWarningCount < 3
1038 ) {
1039 printWarning(
1040 'You are manually calling a React.PropTypes validation ' +
1041 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
1042 'and will throw in the standalone `prop-types` package. ' +
1043 'You may be seeing this warning due to a third-party PropTypes ' +
1044 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
1045 );
1046 manualPropTypeCallCache[cacheKey] = true;
1047 manualPropTypeWarningCount++;
1048 }
1049 }
1050 }
1051 if (props[propName] == null) {
1052 if (isRequired) {
1053 if (props[propName] === null) {
1054 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1055 }
1056 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1057 }
1058 return null;
1059 } else {
1060 return validate(props, propName, componentName, location, propFullName);
1061 }
1062 }
1063
1064 var chainedCheckType = checkType.bind(null, false);
1065 chainedCheckType.isRequired = checkType.bind(null, true);
1066
1067 return chainedCheckType;
1068 }
1069
1070 function createPrimitiveTypeChecker(expectedType) {
1071 function validate(props, propName, componentName, location, propFullName, secret) {
1072 var propValue = props[propName];
1073 var propType = getPropType(propValue);
1074 if (propType !== expectedType) {
1075 // `propValue` being instance of, say, date/regexp, pass the 'object'
1076 // check, but we can offer a more precise error message here rather than
1077 // 'of type `object`'.
1078 var preciseType = getPreciseType(propValue);
1079
1080 return new PropTypeError(
1081 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
1082 {expectedType: expectedType}
1083 );
1084 }
1085 return null;
1086 }
1087 return createChainableTypeChecker(validate);
1088 }
1089
1090 function createAnyTypeChecker() {
1091 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1092 }
1093
1094 function createArrayOfTypeChecker(typeChecker) {
1095 function validate(props, propName, componentName, location, propFullName) {
1096 if (typeof typeChecker !== 'function') {
1097 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1098 }
1099 var propValue = props[propName];
1100 if (!Array.isArray(propValue)) {
1101 var propType = getPropType(propValue);
1102 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1103 }
1104 for (var i = 0; i < propValue.length; i++) {
1105 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
1106 if (error instanceof Error) {
1107 return error;
1108 }
1109 }
1110 return null;
1111 }
1112 return createChainableTypeChecker(validate);
1113 }
1114
1115 function createElementTypeChecker() {
1116 function validate(props, propName, componentName, location, propFullName) {
1117 var propValue = props[propName];
1118 if (!isValidElement(propValue)) {
1119 var propType = getPropType(propValue);
1120 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1121 }
1122 return null;
1123 }
1124 return createChainableTypeChecker(validate);
1125 }
1126
1127 function createElementTypeTypeChecker() {
1128 function validate(props, propName, componentName, location, propFullName) {
1129 var propValue = props[propName];
1130 if (!ReactIs.isValidElementType(propValue)) {
1131 var propType = getPropType(propValue);
1132 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
1133 }
1134 return null;
1135 }
1136 return createChainableTypeChecker(validate);
1137 }
1138
1139 function createInstanceTypeChecker(expectedClass) {
1140 function validate(props, propName, componentName, location, propFullName) {
1141 if (!(props[propName] instanceof expectedClass)) {
1142 var expectedClassName = expectedClass.name || ANONYMOUS;
1143 var actualClassName = getClassName(props[propName]);
1144 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1145 }
1146 return null;
1147 }
1148 return createChainableTypeChecker(validate);
1149 }
1150
1151 function createEnumTypeChecker(expectedValues) {
1152 if (!Array.isArray(expectedValues)) {
1153 if (process.env.NODE_ENV !== 'production') {
1154 if (arguments.length > 1) {
1155 printWarning(
1156 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
1157 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
1158 );
1159 } else {
1160 printWarning('Invalid argument supplied to oneOf, expected an array.');
1161 }
1162 }
1163 return emptyFunctionThatReturnsNull;
1164 }
1165
1166 function validate(props, propName, componentName, location, propFullName) {
1167 var propValue = props[propName];
1168 for (var i = 0; i < expectedValues.length; i++) {
1169 if (is(propValue, expectedValues[i])) {
1170 return null;
1171 }
1172 }
1173
1174 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1175 var type = getPreciseType(value);
1176 if (type === 'symbol') {
1177 return String(value);
1178 }
1179 return value;
1180 });
1181 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1182 }
1183 return createChainableTypeChecker(validate);
1184 }
1185
1186 function createObjectOfTypeChecker(typeChecker) {
1187 function validate(props, propName, componentName, location, propFullName) {
1188 if (typeof typeChecker !== 'function') {
1189 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1190 }
1191 var propValue = props[propName];
1192 var propType = getPropType(propValue);
1193 if (propType !== 'object') {
1194 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1195 }
1196 for (var key in propValue) {
1197 if (has(propValue, key)) {
1198 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1199 if (error instanceof Error) {
1200 return error;
1201 }
1202 }
1203 }
1204 return null;
1205 }
1206 return createChainableTypeChecker(validate);
1207 }
1208
1209 function createUnionTypeChecker(arrayOfTypeCheckers) {
1210 if (!Array.isArray(arrayOfTypeCheckers)) {
1211 process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1212 return emptyFunctionThatReturnsNull;
1213 }
1214
1215 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1216 var checker = arrayOfTypeCheckers[i];
1217 if (typeof checker !== 'function') {
1218 printWarning(
1219 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1220 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
1221 );
1222 return emptyFunctionThatReturnsNull;
1223 }
1224 }
1225
1226 function validate(props, propName, componentName, location, propFullName) {
1227 var expectedTypes = [];
1228 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1229 var checker = arrayOfTypeCheckers[i];
1230 var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
1231 if (checkerResult == null) {
1232 return null;
1233 }
1234 if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
1235 expectedTypes.push(checkerResult.data.expectedType);
1236 }
1237 }
1238 var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
1239 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1240 }
1241 return createChainableTypeChecker(validate);
1242 }
1243
1244 function createNodeChecker() {
1245 function validate(props, propName, componentName, location, propFullName) {
1246 if (!isNode(props[propName])) {
1247 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1248 }
1249 return null;
1250 }
1251 return createChainableTypeChecker(validate);
1252 }
1253
1254 function invalidValidatorError(componentName, location, propFullName, key, type) {
1255 return new PropTypeError(
1256 (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
1257 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
1258 );
1259 }
1260
1261 function createShapeTypeChecker(shapeTypes) {
1262 function validate(props, propName, componentName, location, propFullName) {
1263 var propValue = props[propName];
1264 var propType = getPropType(propValue);
1265 if (propType !== 'object') {
1266 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1267 }
1268 for (var key in shapeTypes) {
1269 var checker = shapeTypes[key];
1270 if (typeof checker !== 'function') {
1271 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1272 }
1273 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1274 if (error) {
1275 return error;
1276 }
1277 }
1278 return null;
1279 }
1280 return createChainableTypeChecker(validate);
1281 }
1282
1283 function createStrictShapeTypeChecker(shapeTypes) {
1284 function validate(props, propName, componentName, location, propFullName) {
1285 var propValue = props[propName];
1286 var propType = getPropType(propValue);
1287 if (propType !== 'object') {
1288 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1289 }
1290 // We need to check all keys in case some are required but missing from props.
1291 var allKeys = assign({}, props[propName], shapeTypes);
1292 for (var key in allKeys) {
1293 var checker = shapeTypes[key];
1294 if (has(shapeTypes, key) && typeof checker !== 'function') {
1295 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1296 }
1297 if (!checker) {
1298 return new PropTypeError(
1299 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1300 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1301 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1302 );
1303 }
1304 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1305 if (error) {
1306 return error;
1307 }
1308 }
1309 return null;
1310 }
1311
1312 return createChainableTypeChecker(validate);
1313 }
1314
1315 function isNode(propValue) {
1316 switch (typeof propValue) {
1317 case 'number':
1318 case 'string':
1319 case 'undefined':
1320 return true;
1321 case 'boolean':
1322 return !propValue;
1323 case 'object':
1324 if (Array.isArray(propValue)) {
1325 return propValue.every(isNode);
1326 }
1327 if (propValue === null || isValidElement(propValue)) {
1328 return true;
1329 }
1330
1331 var iteratorFn = getIteratorFn(propValue);
1332 if (iteratorFn) {
1333 var iterator = iteratorFn.call(propValue);
1334 var step;
1335 if (iteratorFn !== propValue.entries) {
1336 while (!(step = iterator.next()).done) {
1337 if (!isNode(step.value)) {
1338 return false;
1339 }
1340 }
1341 } else {
1342 // Iterator will provide entry [k,v] tuples rather than values.
1343 while (!(step = iterator.next()).done) {
1344 var entry = step.value;
1345 if (entry) {
1346 if (!isNode(entry[1])) {
1347 return false;
1348 }
1349 }
1350 }
1351 }
1352 } else {
1353 return false;
1354 }
1355
1356 return true;
1357 default:
1358 return false;
1359 }
1360 }
1361
1362 function isSymbol(propType, propValue) {
1363 // Native Symbol.
1364 if (propType === 'symbol') {
1365 return true;
1366 }
1367
1368 // falsy value can't be a Symbol
1369 if (!propValue) {
1370 return false;
1371 }
1372
1373 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1374 if (propValue['@@toStringTag'] === 'Symbol') {
1375 return true;
1376 }
1377
1378 // Fallback for non-spec compliant Symbols which are polyfilled.
1379 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1380 return true;
1381 }
1382
1383 return false;
1384 }
1385
1386 // Equivalent of `typeof` but with special handling for array and regexp.
1387 function getPropType(propValue) {
1388 var propType = typeof propValue;
1389 if (Array.isArray(propValue)) {
1390 return 'array';
1391 }
1392 if (propValue instanceof RegExp) {
1393 // Old webkits (at least until Android 4.0) return 'function' rather than
1394 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1395 // passes PropTypes.object.
1396 return 'object';
1397 }
1398 if (isSymbol(propType, propValue)) {
1399 return 'symbol';
1400 }
1401 return propType;
1402 }
1403
1404 // This handles more types than `getPropType`. Only used for error messages.
1405 // See `createPrimitiveTypeChecker`.
1406 function getPreciseType(propValue) {
1407 if (typeof propValue === 'undefined' || propValue === null) {
1408 return '' + propValue;
1409 }
1410 var propType = getPropType(propValue);
1411 if (propType === 'object') {
1412 if (propValue instanceof Date) {
1413 return 'date';
1414 } else if (propValue instanceof RegExp) {
1415 return 'regexp';
1416 }
1417 }
1418 return propType;
1419 }
1420
1421 // Returns a string that is postfixed to a warning about an invalid type.
1422 // For example, "undefined" or "of type array"
1423 function getPostfixForTypeWarning(value) {
1424 var type = getPreciseType(value);
1425 switch (type) {
1426 case 'array':
1427 case 'object':
1428 return 'an ' + type;
1429 case 'boolean':
1430 case 'date':
1431 case 'regexp':
1432 return 'a ' + type;
1433 default:
1434 return type;
1435 }
1436 }
1437
1438 // Returns class name of the object, if any.
1439 function getClassName(propValue) {
1440 if (!propValue.constructor || !propValue.constructor.name) {
1441 return ANONYMOUS;
1442 }
1443 return propValue.constructor.name;
1444 }
1445
1446 ReactPropTypes.checkPropTypes = checkPropTypes;
1447 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1448 ReactPropTypes.PropTypes = ReactPropTypes;
1449
1450 return ReactPropTypes;
1451 };
1452 return factoryWithTypeCheckers;
1453 }
1454
1455 /**
1456 * Copyright (c) 2013-present, Facebook, Inc.
1457 *
1458 * This source code is licensed under the MIT license found in the
1459 * LICENSE file in the root directory of this source tree.
1460 */
1461
1462 var factoryWithThrowingShims;
1463 var hasRequiredFactoryWithThrowingShims;
1464
1465 function requireFactoryWithThrowingShims () {
1466 if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1467 hasRequiredFactoryWithThrowingShims = 1;
1468
1469 var ReactPropTypesSecret = requireReactPropTypesSecret();
1470
1471 function emptyFunction() {}
1472 function emptyFunctionWithReset() {}
1473 emptyFunctionWithReset.resetWarningCache = emptyFunction;
1474
1475 factoryWithThrowingShims = function() {
1476 function shim(props, propName, componentName, location, propFullName, secret) {
1477 if (secret === ReactPropTypesSecret) {
1478 // It is still safe when called from React.
1479 return;
1480 }
1481 var err = new Error(
1482 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1483 'Use PropTypes.checkPropTypes() to call them. ' +
1484 'Read more at http://fb.me/use-check-prop-types'
1485 );
1486 err.name = 'Invariant Violation';
1487 throw err;
1488 } shim.isRequired = shim;
1489 function getShim() {
1490 return shim;
1491 } // Important!
1492 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1493 var ReactPropTypes = {
1494 array: shim,
1495 bigint: shim,
1496 bool: shim,
1497 func: shim,
1498 number: shim,
1499 object: shim,
1500 string: shim,
1501 symbol: shim,
1502
1503 any: shim,
1504 arrayOf: getShim,
1505 element: shim,
1506 elementType: shim,
1507 instanceOf: getShim,
1508 node: shim,
1509 objectOf: getShim,
1510 oneOf: getShim,
1511 oneOfType: getShim,
1512 shape: getShim,
1513 exact: getShim,
1514
1515 checkPropTypes: emptyFunctionWithReset,
1516 resetWarningCache: emptyFunction
1517 };
1518
1519 ReactPropTypes.PropTypes = ReactPropTypes;
1520
1521 return ReactPropTypes;
1522 };
1523 return factoryWithThrowingShims;
1524 }
1525
1526 /**
1527 * Copyright (c) 2013-present, Facebook, Inc.
1528 *
1529 * This source code is licensed under the MIT license found in the
1530 * LICENSE file in the root directory of this source tree.
1531 */
1532
1533 if (process.env.NODE_ENV !== 'production') {
1534 var ReactIs = requireReactIs();
1535
1536 // By explicitly using `prop-types` you are opting into new development behavior.
1537 // http://fb.me/prop-types-in-prod
1538 var throwOnDirectAccess = true;
1539 propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1540 } else {
1541 // By explicitly using `prop-types` you are opting into new production behavior.
1542 // http://fb.me/prop-types-in-prod
1543 propTypes.exports = requireFactoryWithThrowingShims()();
1544 }
1545
1546 function objType(obj) {
1547 var type = Object.prototype.toString.call(obj).slice(8, -1);
1548
1549 if (type === 'Object' && typeof obj[Symbol.iterator] === 'function') {
1550 return 'Iterable';
1551 }
1552
1553 if (type === 'Custom' && obj.constructor !== Object && obj instanceof Object) {
1554 // For projects implementing objects overriding `.prototype[Symbol.toStringTag]`
1555 return 'Object';
1556 }
1557
1558 return type;
1559 }
1560
1561 var toConsumableArray = {exports: {}};
1562
1563 var arrayWithoutHoles = {exports: {}};
1564
1565 (function (module) {
1566 var arrayLikeToArray$1 = arrayLikeToArray.exports;
1567
1568 function _arrayWithoutHoles(arr) {
1569 if (Array.isArray(arr)) return arrayLikeToArray$1(arr);
1570 }
1571
1572 module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
1573 } (arrayWithoutHoles));
1574
1575 var iterableToArray = {exports: {}};
1576
1577 (function (module) {
1578 function _iterableToArray(iter) {
1579 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1580 }
1581
1582 module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1583 } (iterableToArray));
1584
1585 var nonIterableSpread = {exports: {}};
1586
1587 (function (module) {
1588 function _nonIterableSpread() {
1589 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1590 }
1591
1592 module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
1593 } (nonIterableSpread));
1594
1595 (function (module) {
1596 var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
1597
1598 var iterableToArray$1 = iterableToArray.exports;
1599
1600 var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
1601
1602 var nonIterableSpread$1 = nonIterableSpread.exports;
1603
1604 function _toConsumableArray(arr) {
1605 return arrayWithoutHoles$1(arr) || iterableToArray$1(arr) || unsupportedIterableToArray$1(arr) || nonIterableSpread$1();
1606 }
1607
1608 module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1609 } (toConsumableArray));
1610
1611 var _toConsumableArray = /*@__PURE__*/getDefaultExportFromCjs(toConsumableArray.exports);
1612
1613 function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1614
1615 function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$a(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1616
1617 var JSONArrow = function JSONArrow(_ref) {
1618 var styling = _ref.styling,
1619 arrowStyle = _ref.arrowStyle,
1620 expanded = _ref.expanded,
1621 nodeType = _ref.nodeType,
1622 onClick = _ref.onClick;
1623 return /*#__PURE__*/React__default["default"].createElement("div", _objectSpread$a(_objectSpread$a({}, styling('arrowContainer', arrowStyle)), {}, {
1624 onClick: onClick
1625 }), /*#__PURE__*/React__default["default"].createElement("div", _objectSpread$a({}, styling(['arrow', 'arrowSign'], nodeType, expanded, arrowStyle)), "\u25B6", arrowStyle === 'double' && /*#__PURE__*/React__default["default"].createElement("div", _objectSpread$a({}, styling(['arrowSign', 'arrowSignInner'])), "\u25B6")));
1626 };
1627
1628 JSONArrow.propTypes = {
1629 styling: propTypes.exports.func.isRequired,
1630 arrowStyle: propTypes.exports.oneOf(['single', 'double']),
1631 expanded: propTypes.exports.bool.isRequired,
1632 nodeType: propTypes.exports.string.isRequired,
1633 onClick: propTypes.exports.func.isRequired
1634 };
1635 JSONArrow.defaultProps = {
1636 arrowStyle: 'single'
1637 };
1638
1639 function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1640
1641 function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
1642
1643 function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1644
1645 function getLength(type, collection) {
1646 if (type === 'Object') {
1647 // eslint-disable-next-line @typescript-eslint/ban-types
1648 return Object.keys(collection).length;
1649 } else if (type === 'Array') {
1650 return collection.length;
1651 }
1652
1653 return Infinity;
1654 }
1655
1656 function isIterableMap(collection) {
1657 return typeof collection.set === 'function';
1658 }
1659
1660 function getEntries(type, collection, sortObjectKeys) {
1661 var from = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1662 var to = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity;
1663 var res;
1664
1665 if (type === 'Object') {
1666 var keys = Object.getOwnPropertyNames(collection);
1667
1668 if (sortObjectKeys) {
1669 keys.sort(sortObjectKeys === true ? undefined : sortObjectKeys);
1670 }
1671
1672 keys = keys.slice(from, to + 1);
1673 res = {
1674 entries: keys.map(function (key) {
1675 return {
1676 key: key,
1677 value: collection[key]
1678 };
1679 })
1680 };
1681 } else if (type === 'Array') {
1682 res = {
1683 entries: collection.slice(from, to + 1).map(function (val, idx) {
1684 return {
1685 key: idx + from,
1686 value: val
1687 };
1688 })
1689 };
1690 } else {
1691 var idx = 0;
1692 var entries = [];
1693 var done = true;
1694 var isMap = isIterableMap(collection);
1695
1696 var _iterator = _createForOfIteratorHelper$1(collection),
1697 _step;
1698
1699 try {
1700 for (_iterator.s(); !(_step = _iterator.n()).done;) {
1701 var item = _step.value;
1702
1703 if (idx > to) {
1704 done = false;
1705 break;
1706 }
1707
1708 if (from <= idx) {
1709 if (isMap && Array.isArray(item)) {
1710 if (typeof item[0] === 'string' || typeof item[0] === 'number') {
1711 entries.push({
1712 key: item[0],
1713 value: item[1]
1714 });
1715 } else {
1716 entries.push({
1717 key: "[entry ".concat(idx, "]"),
1718 value: {
1719 '[key]': item[0],
1720 '[value]': item[1]
1721 }
1722 });
1723 }
1724 } else {
1725 entries.push({
1726 key: idx,
1727 value: item
1728 });
1729 }
1730 }
1731
1732 idx++;
1733 }
1734 } catch (err) {
1735 _iterator.e(err);
1736 } finally {
1737 _iterator.f();
1738 }
1739
1740 res = {
1741 hasMore: !done,
1742 entries: entries
1743 };
1744 }
1745
1746 return res;
1747 }
1748
1749 function getRanges(from, to, limit) {
1750 var ranges = [];
1751
1752 while (to - from > limit * limit) {
1753 limit = limit * limit;
1754 }
1755
1756 for (var i = from; i <= to; i += limit) {
1757 ranges.push({
1758 from: i,
1759 to: Math.min(to, i + limit - 1)
1760 });
1761 }
1762
1763 return ranges;
1764 }
1765
1766 function getCollectionEntries(type, collection, sortObjectKeys, limit) {
1767 var from = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1768 var to = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : Infinity;
1769 var getEntriesBound = getEntries.bind(null, type, collection, sortObjectKeys);
1770
1771 if (!limit) {
1772 return getEntriesBound().entries;
1773 }
1774
1775 var isSubset = to < Infinity;
1776 var length = Math.min(to - from, getLength(type, collection));
1777
1778 if (type !== 'Iterable') {
1779 if (length <= limit || limit < 7) {
1780 return getEntriesBound(from, to).entries;
1781 }
1782 } else {
1783 if (length <= limit && !isSubset) {
1784 return getEntriesBound(from, to).entries;
1785 }
1786 }
1787
1788 var limitedEntries;
1789
1790 if (type === 'Iterable') {
1791 var _getEntriesBound = getEntriesBound(from, from + limit - 1),
1792 hasMore = _getEntriesBound.hasMore,
1793 entries = _getEntriesBound.entries;
1794
1795 limitedEntries = hasMore ? [].concat(_toConsumableArray(entries), _toConsumableArray(getRanges(from + limit, from + 2 * limit - 1, limit))) : entries;
1796 } else {
1797 limitedEntries = isSubset ? getRanges(from, to, limit) : [].concat(_toConsumableArray(getEntriesBound(0, limit - 5).entries), _toConsumableArray(getRanges(limit - 4, length - 5, limit)), _toConsumableArray(getEntriesBound(length - 4, length - 1).entries));
1798 }
1799
1800 return limitedEntries;
1801 }
1802
1803 function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1804
1805 function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$9(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1806
1807 function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1808
1809 function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1810
1811 var ItemRange = /*#__PURE__*/function (_React$Component) {
1812 _inherits(ItemRange, _React$Component);
1813
1814 var _super = _createSuper$2(ItemRange);
1815
1816 function ItemRange(props) {
1817 var _this;
1818
1819 _classCallCheck(this, ItemRange);
1820
1821 _this = _super.call(this, props);
1822
1823 _this.handleClick = function () {
1824 _this.setState({
1825 expanded: !_this.state.expanded
1826 });
1827 };
1828
1829 _this.state = {
1830 expanded: false
1831 };
1832 return _this;
1833 }
1834
1835 _createClass(ItemRange, [{
1836 key: "render",
1837 value: function render() {
1838 var _this$props = this.props,
1839 styling = _this$props.styling,
1840 from = _this$props.from,
1841 to = _this$props.to,
1842 renderChildNodes = _this$props.renderChildNodes,
1843 nodeType = _this$props.nodeType;
1844 return this.state.expanded ? /*#__PURE__*/React__default["default"].createElement("div", _objectSpread$9({}, styling('itemRange', this.state.expanded)), renderChildNodes(this.props, from, to)) : /*#__PURE__*/React__default["default"].createElement("div", _objectSpread$9(_objectSpread$9({}, styling('itemRange', this.state.expanded)), {}, {
1845 onClick: this.handleClick
1846 }), /*#__PURE__*/React__default["default"].createElement(JSONArrow, {
1847 nodeType: nodeType,
1848 styling: styling,
1849 expanded: false,
1850 onClick: this.handleClick,
1851 arrowStyle: "double"
1852 }), "".concat(from, " ... ").concat(to));
1853 }
1854 }]);
1855
1856 return ItemRange;
1857 }(React__default["default"].Component);
1858 ItemRange.propTypes = {
1859 styling: propTypes.exports.func.isRequired,
1860 from: propTypes.exports.number.isRequired,
1861 to: propTypes.exports.number.isRequired,
1862 renderChildNodes: propTypes.exports.func.isRequired,
1863 nodeType: propTypes.exports.string.isRequired
1864 };
1865
1866 function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1867
1868 function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1869
1870 function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1871
1872 function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1873
1874 function isRange(rangeOrEntry) {
1875 return rangeOrEntry.to !== undefined;
1876 }
1877
1878 function renderChildNodes(props, from, to) {
1879 var nodeType = props.nodeType,
1880 data = props.data,
1881 collectionLimit = props.collectionLimit,
1882 circularCache = props.circularCache,
1883 keyPath = props.keyPath,
1884 postprocessValue = props.postprocessValue,
1885 sortObjectKeys = props.sortObjectKeys;
1886 var childNodes = [];
1887 getCollectionEntries(nodeType, data, sortObjectKeys, collectionLimit, from, to).forEach(function (entry) {
1888 if (isRange(entry)) {
1889 childNodes.push( /*#__PURE__*/React__default["default"].createElement(ItemRange, _objectSpread$8(_objectSpread$8({}, props), {}, {
1890 key: "ItemRange--".concat(entry.from, "-").concat(entry.to),
1891 from: entry.from,
1892 to: entry.to,
1893 renderChildNodes: renderChildNodes
1894 })));
1895 } else {
1896 var key = entry.key,
1897 value = entry.value;
1898 var isCircular = circularCache.indexOf(value) !== -1;
1899 childNodes.push( /*#__PURE__*/React__default["default"].createElement(JSONNode, _objectSpread$8(_objectSpread$8(_objectSpread$8({}, props), {
1900 postprocessValue: postprocessValue,
1901 collectionLimit: collectionLimit
1902 }), {}, {
1903 key: "Node--".concat(key),
1904 keyPath: [key].concat(_toConsumableArray(keyPath)),
1905 value: postprocessValue(value),
1906 circularCache: [].concat(_toConsumableArray(circularCache), [value]),
1907 isCircular: isCircular,
1908 hideRoot: false
1909 })));
1910 }
1911 });
1912 return childNodes;
1913 }
1914
1915 function getStateFromProps$1(props) {
1916 // calculate individual node expansion if necessary
1917 var expanded = !props.isCircular ? props.shouldExpandNode(props.keyPath, props.data, props.level) : false;
1918 return {
1919 expanded: expanded
1920 };
1921 }
1922
1923 var JSONNestedNode = /*#__PURE__*/function (_React$Component) {
1924 _inherits(JSONNestedNode, _React$Component);
1925
1926 var _super = _createSuper$1(JSONNestedNode);
1927
1928 function JSONNestedNode(props) {
1929 var _this;
1930
1931 _classCallCheck(this, JSONNestedNode);
1932
1933 _this = _super.call(this, props);
1934
1935 _this.handleClick = function () {
1936 if (_this.props.expandable) {
1937 _this.setState({
1938 expanded: !_this.state.expanded
1939 });
1940 }
1941 };
1942
1943 _this.state = getStateFromProps$1(props);
1944 return _this;
1945 }
1946
1947 _createClass(JSONNestedNode, [{
1948 key: "UNSAFE_componentWillReceiveProps",
1949 value: function UNSAFE_componentWillReceiveProps(nextProps) {
1950 var nextState = getStateFromProps$1(nextProps);
1951
1952 if (getStateFromProps$1(this.props).expanded !== nextState.expanded) {
1953 this.setState(nextState);
1954 }
1955 }
1956 }, {
1957 key: "shouldComponentUpdate",
1958 value: function shouldComponentUpdate(nextProps, nextState) {
1959 var _this2 = this;
1960
1961 return !!Object.keys(nextProps).find(function (key) {
1962 return key !== 'circularCache' && (key === 'keyPath' ? nextProps[key].join('/') !== _this2.props[key].join('/') : nextProps[key] !== _this2.props[key]);
1963 }) || nextState.expanded !== this.state.expanded;
1964 }
1965 }, {
1966 key: "render",
1967 value: function render() {
1968 var _this$props = this.props,
1969 getItemString = _this$props.getItemString,
1970 nodeTypeIndicator = _this$props.nodeTypeIndicator,
1971 nodeType = _this$props.nodeType,
1972 data = _this$props.data,
1973 hideRoot = _this$props.hideRoot,
1974 createItemString = _this$props.createItemString,
1975 styling = _this$props.styling,
1976 collectionLimit = _this$props.collectionLimit,
1977 keyPath = _this$props.keyPath,
1978 labelRenderer = _this$props.labelRenderer,
1979 expandable = _this$props.expandable;
1980 var expanded = this.state.expanded;
1981 var renderedChildren = expanded || hideRoot && this.props.level === 0 ? renderChildNodes(_objectSpread$8(_objectSpread$8({}, this.props), {}, {
1982 level: this.props.level + 1
1983 })) : null;
1984 var itemType = /*#__PURE__*/React__default["default"].createElement("span", _objectSpread$8({}, styling('nestedNodeItemType', expanded)), nodeTypeIndicator);
1985 var renderedItemString = getItemString(nodeType, data, itemType, createItemString(data, collectionLimit), keyPath);
1986 var stylingArgs = [keyPath, nodeType, expanded, expandable];
1987 return hideRoot ? /*#__PURE__*/React__default["default"].createElement("li", _objectSpread$8({}, styling.apply(void 0, ['rootNode'].concat(stylingArgs))), /*#__PURE__*/React__default["default"].createElement("ul", _objectSpread$8({}, styling.apply(void 0, ['rootNodeChildren'].concat(stylingArgs))), renderedChildren)) : /*#__PURE__*/React__default["default"].createElement("li", _objectSpread$8({}, styling.apply(void 0, ['nestedNode'].concat(stylingArgs))), expandable && /*#__PURE__*/React__default["default"].createElement(JSONArrow, {
1988 styling: styling,
1989 nodeType: nodeType,
1990 expanded: expanded,
1991 onClick: this.handleClick
1992 }), /*#__PURE__*/React__default["default"].createElement("label", _objectSpread$8(_objectSpread$8({}, styling.apply(void 0, [['label', 'nestedNodeLabel']].concat(stylingArgs))), {}, {
1993 onClick: this.handleClick
1994 }), labelRenderer.apply(void 0, stylingArgs)), /*#__PURE__*/React__default["default"].createElement("span", _objectSpread$8(_objectSpread$8({}, styling.apply(void 0, ['nestedNodeItemString'].concat(stylingArgs))), {}, {
1995 onClick: this.handleClick
1996 }), renderedItemString), /*#__PURE__*/React__default["default"].createElement("ul", _objectSpread$8({}, styling.apply(void 0, ['nestedNodeChildren'].concat(stylingArgs))), renderedChildren));
1997 }
1998 }]);
1999
2000 return JSONNestedNode;
2001 }(React__default["default"].Component);
2002 JSONNestedNode.propTypes = {
2003 getItemString: propTypes.exports.func.isRequired,
2004 nodeTypeIndicator: propTypes.exports.any,
2005 nodeType: propTypes.exports.string.isRequired,
2006 data: propTypes.exports.any,
2007 hideRoot: propTypes.exports.bool.isRequired,
2008 createItemString: propTypes.exports.func.isRequired,
2009 styling: propTypes.exports.func.isRequired,
2010 collectionLimit: propTypes.exports.number,
2011 keyPath: propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number])).isRequired,
2012 labelRenderer: propTypes.exports.func.isRequired,
2013 shouldExpandNode: propTypes.exports.func,
2014 level: propTypes.exports.number.isRequired,
2015 sortObjectKeys: propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.bool]),
2016 isCircular: propTypes.exports.bool,
2017 expandable: propTypes.exports.bool
2018 };
2019 JSONNestedNode.defaultProps = {
2020 data: [],
2021 circularCache: [],
2022 level: 0,
2023 expandable: true
2024 };
2025
2026 var _excluded$3 = ["data"];
2027
2028 function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2029
2030 function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2031 // generating and caching it if it hasn't been created yet.
2032
2033 function createItemString$2(data) {
2034 var len = Object.getOwnPropertyNames(data).length;
2035 return "".concat(len, " ").concat(len !== 1 ? 'keys' : 'key');
2036 } // Configures <JSONNestedNode> to render an Object
2037
2038
2039 var JSONObjectNode = function JSONObjectNode(_ref) {
2040 var data = _ref.data,
2041 props = _objectWithoutProperties(_ref, _excluded$3);
2042
2043 return /*#__PURE__*/React__default["default"].createElement(JSONNestedNode, _objectSpread$7(_objectSpread$7({}, props), {}, {
2044 data: data,
2045 nodeType: "Object",
2046 nodeTypeIndicator: props.nodeType === 'Error' ? 'Error()' : '{}',
2047 createItemString: createItemString$2,
2048 expandable: Object.getOwnPropertyNames(data).length > 0
2049 }));
2050 };
2051
2052 JSONObjectNode.propTypes = {
2053 data: propTypes.exports.object,
2054 nodeType: propTypes.exports.string.isRequired
2055 };
2056
2057 var _excluded$2 = ["data"];
2058
2059 function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2060
2061 function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2062 // generating and caching it if it hasn't been created yet.
2063
2064 function createItemString$1(data) {
2065 return "".concat(data.length, " ").concat(data.length !== 1 ? 'items' : 'item');
2066 } // Configures <JSONNestedNode> to render an Array
2067
2068
2069 var JSONArrayNode = function JSONArrayNode(_ref) {
2070 var data = _ref.data,
2071 props = _objectWithoutProperties(_ref, _excluded$2);
2072
2073 return /*#__PURE__*/React__default["default"].createElement(JSONNestedNode, _objectSpread$6(_objectSpread$6({}, props), {}, {
2074 data: data,
2075 nodeType: "Array",
2076 nodeTypeIndicator: "[]",
2077 createItemString: createItemString$1,
2078 expandable: data.length > 0
2079 }));
2080 };
2081
2082 JSONArrayNode.propTypes = {
2083 data: propTypes.exports.array
2084 };
2085
2086 var _extends$1 = {exports: {}};
2087
2088 (function (module) {
2089 function _extends() {
2090 module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {
2091 for (var i = 1; i < arguments.length; i++) {
2092 var source = arguments[i];
2093
2094 for (var key in source) {
2095 if (Object.prototype.hasOwnProperty.call(source, key)) {
2096 target[key] = source[key];
2097 }
2098 }
2099 }
2100
2101 return target;
2102 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
2103 return _extends.apply(this, arguments);
2104 }
2105
2106 module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
2107 } (_extends$1));
2108
2109 var _extends = /*@__PURE__*/getDefaultExportFromCjs(_extends$1.exports);
2110
2111 function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2112
2113 function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2114
2115 function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2116
2117 function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
2118
2119 function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
2120 // generating and caching it if it hasn't been created yet.
2121
2122 function createItemString(data, limit) {
2123 var count = 0;
2124 var hasMore = false;
2125
2126 if (Number.isSafeInteger(data.size)) {
2127 count = data.size;
2128 } else {
2129 // eslint-disable-next-line no-unused-vars
2130 var _iterator = _createForOfIteratorHelper(data),
2131 _step;
2132
2133 try {
2134 for (_iterator.s(); !(_step = _iterator.n()).done;) {
2135 var entry = _step.value;
2136
2137 if (limit && count + 1 > limit) {
2138 hasMore = true;
2139 break;
2140 }
2141
2142 count += 1;
2143 }
2144 } catch (err) {
2145 _iterator.e(err);
2146 } finally {
2147 _iterator.f();
2148 }
2149 }
2150
2151 return "".concat(hasMore ? '>' : '').concat(count, " ").concat(count !== 1 ? 'entries' : 'entry');
2152 } // Configures <JSONNestedNode> to render an iterable
2153
2154
2155 var JSONIterableNode = function JSONIterableNode(_ref) {
2156 var props = _extends({}, _ref);
2157
2158 return /*#__PURE__*/React__default["default"].createElement(JSONNestedNode, _objectSpread$5(_objectSpread$5({}, props), {}, {
2159 nodeType: "Iterable",
2160 nodeTypeIndicator: "()",
2161 createItemString: createItemString
2162 }));
2163 };
2164
2165 function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2166
2167 function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2168
2169 var JSONValueNode = function JSONValueNode(_ref) {
2170 var nodeType = _ref.nodeType,
2171 styling = _ref.styling,
2172 labelRenderer = _ref.labelRenderer,
2173 keyPath = _ref.keyPath,
2174 valueRenderer = _ref.valueRenderer,
2175 value = _ref.value,
2176 _ref$valueGetter = _ref.valueGetter,
2177 valueGetter = _ref$valueGetter === void 0 ? function (value) {
2178 return value;
2179 } : _ref$valueGetter;
2180 return /*#__PURE__*/React__default["default"].createElement("li", _objectSpread$4({}, styling('value', nodeType, keyPath)), /*#__PURE__*/React__default["default"].createElement("label", _objectSpread$4({}, styling(['label', 'valueLabel'], nodeType, keyPath)), labelRenderer(keyPath, nodeType, false, false)), /*#__PURE__*/React__default["default"].createElement("span", _objectSpread$4({}, styling('valueText', nodeType, keyPath)), valueRenderer.apply(void 0, [valueGetter(value), value].concat(_toConsumableArray(keyPath)))));
2181 };
2182
2183 JSONValueNode.propTypes = {
2184 nodeType: propTypes.exports.string.isRequired,
2185 styling: propTypes.exports.func.isRequired,
2186 labelRenderer: propTypes.exports.func.isRequired,
2187 keyPath: propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number]).isRequired).isRequired,
2188 valueRenderer: propTypes.exports.func.isRequired,
2189 value: propTypes.exports.any,
2190 valueGetter: propTypes.exports.func
2191 };
2192
2193 var _excluded$1 = ["getItemString", "keyPath", "labelRenderer", "styling", "value", "valueRenderer", "isCustomNode"];
2194
2195 function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2196
2197 function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2198
2199 var JSONNode = function JSONNode(_ref) {
2200 var getItemString = _ref.getItemString,
2201 keyPath = _ref.keyPath,
2202 labelRenderer = _ref.labelRenderer,
2203 styling = _ref.styling,
2204 value = _ref.value,
2205 valueRenderer = _ref.valueRenderer,
2206 isCustomNode = _ref.isCustomNode,
2207 rest = _objectWithoutProperties(_ref, _excluded$1);
2208
2209 var nodeType = isCustomNode(value) ? 'Custom' : objType(value);
2210 var simpleNodeProps = {
2211 getItemString: getItemString,
2212 key: keyPath[0],
2213 keyPath: keyPath,
2214 labelRenderer: labelRenderer,
2215 nodeType: nodeType,
2216 styling: styling,
2217 value: value,
2218 valueRenderer: valueRenderer
2219 };
2220
2221 var nestedNodeProps = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, rest), simpleNodeProps), {}, {
2222 data: value,
2223 isCustomNode: isCustomNode
2224 });
2225
2226 switch (nodeType) {
2227 case 'Object':
2228 case 'Error':
2229 case 'WeakMap':
2230 case 'WeakSet':
2231 return /*#__PURE__*/React__default["default"].createElement(JSONObjectNode, _objectSpread$3({}, nestedNodeProps));
2232
2233 case 'Array':
2234 return /*#__PURE__*/React__default["default"].createElement(JSONArrayNode, _objectSpread$3({}, nestedNodeProps));
2235
2236 case 'Iterable':
2237 case 'Map':
2238 case 'Set':
2239 return /*#__PURE__*/React__default["default"].createElement(JSONIterableNode, _objectSpread$3({}, nestedNodeProps));
2240
2241 case 'String':
2242 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2243 valueGetter: function valueGetter(raw) {
2244 return "\"".concat(raw, "\"");
2245 }
2246 }));
2247
2248 case 'Number':
2249 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3({}, simpleNodeProps));
2250
2251 case 'Boolean':
2252 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2253 valueGetter: function valueGetter(raw) {
2254 return raw ? 'true' : 'false';
2255 }
2256 }));
2257
2258 case 'Date':
2259 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2260 valueGetter: function valueGetter(raw) {
2261 return raw.toISOString();
2262 }
2263 }));
2264
2265 case 'Null':
2266 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2267 valueGetter: function valueGetter() {
2268 return 'null';
2269 }
2270 }));
2271
2272 case 'Undefined':
2273 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2274 valueGetter: function valueGetter() {
2275 return 'undefined';
2276 }
2277 }));
2278
2279 case 'Function':
2280 case 'Symbol':
2281 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2282 valueGetter: function valueGetter(raw) {
2283 return raw.toString();
2284 }
2285 }));
2286
2287 case 'Custom':
2288 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3({}, simpleNodeProps));
2289
2290 default:
2291 return /*#__PURE__*/React__default["default"].createElement(JSONValueNode, _objectSpread$3(_objectSpread$3({}, simpleNodeProps), {}, {
2292 valueGetter: function valueGetter() {
2293 return "<".concat(nodeType, ">");
2294 }
2295 }));
2296 }
2297 };
2298
2299 JSONNode.propTypes = {
2300 getItemString: propTypes.exports.func.isRequired,
2301 keyPath: propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number]).isRequired).isRequired,
2302 labelRenderer: propTypes.exports.func.isRequired,
2303 styling: propTypes.exports.func.isRequired,
2304 value: propTypes.exports.any,
2305 valueRenderer: propTypes.exports.func.isRequired,
2306 isCustomNode: propTypes.exports.func.isRequired
2307 };
2308
2309 function _typeof(obj) {
2310 "@babel/helpers - typeof";
2311
2312 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2313 return typeof obj;
2314 } : function (obj) {
2315 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2316 }, _typeof(obj);
2317 }
2318
2319 function _defineProperty(obj, key, value) {
2320 if (key in obj) {
2321 Object.defineProperty(obj, key, {
2322 value: value,
2323 enumerable: true,
2324 configurable: true,
2325 writable: true
2326 });
2327 } else {
2328 obj[key] = value;
2329 }
2330
2331 return obj;
2332 }
2333
2334 function _arrayWithHoles(arr) {
2335 if (Array.isArray(arr)) return arr;
2336 }
2337
2338 function _iterableToArrayLimit(arr, i) {
2339 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2340
2341 if (_i == null) return;
2342 var _arr = [];
2343 var _n = true;
2344 var _d = false;
2345
2346 var _s, _e;
2347
2348 try {
2349 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
2350 _arr.push(_s.value);
2351
2352 if (i && _arr.length === i) break;
2353 }
2354 } catch (err) {
2355 _d = true;
2356 _e = err;
2357 } finally {
2358 try {
2359 if (!_n && _i["return"] != null) _i["return"]();
2360 } finally {
2361 if (_d) throw _e;
2362 }
2363 }
2364
2365 return _arr;
2366 }
2367
2368 function _arrayLikeToArray(arr, len) {
2369 if (len == null || len > arr.length) len = arr.length;
2370
2371 for (var i = 0, arr2 = new Array(len); i < len; i++) {
2372 arr2[i] = arr[i];
2373 }
2374
2375 return arr2;
2376 }
2377
2378 function _unsupportedIterableToArray(o, minLen) {
2379 if (!o) return;
2380 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2381 var n = Object.prototype.toString.call(o).slice(8, -1);
2382 if (n === "Object" && o.constructor) n = o.constructor.name;
2383 if (n === "Map" || n === "Set") return Array.from(o);
2384 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2385 }
2386
2387 function _nonIterableRest() {
2388 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2389 }
2390
2391 function _slicedToArray(arr, i) {
2392 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
2393 }
2394
2395 var lib = {};
2396
2397 var threezerotwofour = {exports: {}};
2398
2399 (function (module, exports) {
2400
2401 exports.__esModule = true;
2402 exports['default'] = {
2403 scheme: 'threezerotwofour',
2404 author: 'jan t. sott (http://github.com/idleberg)',
2405 base00: '#090300',
2406 base01: '#3a3432',
2407 base02: '#4a4543',
2408 base03: '#5c5855',
2409 base04: '#807d7c',
2410 base05: '#a5a2a2',
2411 base06: '#d6d5d4',
2412 base07: '#f7f7f7',
2413 base08: '#db2d20',
2414 base09: '#e8bbd0',
2415 base0A: '#fded02',
2416 base0B: '#01a252',
2417 base0C: '#b5e4f4',
2418 base0D: '#01a0e4',
2419 base0E: '#a16a94',
2420 base0F: '#cdab53'
2421 };
2422 module.exports = exports['default'];
2423 } (threezerotwofour, threezerotwofour.exports));
2424
2425 var apathy = {exports: {}};
2426
2427 (function (module, exports) {
2428
2429 exports.__esModule = true;
2430 exports['default'] = {
2431 scheme: 'apathy',
2432 author: 'jannik siebert (https://github.com/janniks)',
2433 base00: '#031A16',
2434 base01: '#0B342D',
2435 base02: '#184E45',
2436 base03: '#2B685E',
2437 base04: '#5F9C92',
2438 base05: '#81B5AC',
2439 base06: '#A7CEC8',
2440 base07: '#D2E7E4',
2441 base08: '#3E9688',
2442 base09: '#3E7996',
2443 base0A: '#3E4C96',
2444 base0B: '#883E96',
2445 base0C: '#963E4C',
2446 base0D: '#96883E',
2447 base0E: '#4C963E',
2448 base0F: '#3E965B'
2449 };
2450 module.exports = exports['default'];
2451 } (apathy, apathy.exports));
2452
2453 var ashes = {exports: {}};
2454
2455 (function (module, exports) {
2456
2457 exports.__esModule = true;
2458 exports['default'] = {
2459 scheme: 'ashes',
2460 author: 'jannik siebert (https://github.com/janniks)',
2461 base00: '#1C2023',
2462 base01: '#393F45',
2463 base02: '#565E65',
2464 base03: '#747C84',
2465 base04: '#ADB3BA',
2466 base05: '#C7CCD1',
2467 base06: '#DFE2E5',
2468 base07: '#F3F4F5',
2469 base08: '#C7AE95',
2470 base09: '#C7C795',
2471 base0A: '#AEC795',
2472 base0B: '#95C7AE',
2473 base0C: '#95AEC7',
2474 base0D: '#AE95C7',
2475 base0E: '#C795AE',
2476 base0F: '#C79595'
2477 };
2478 module.exports = exports['default'];
2479 } (ashes, ashes.exports));
2480
2481 var atelierDune = {exports: {}};
2482
2483 (function (module, exports) {
2484
2485 exports.__esModule = true;
2486 exports['default'] = {
2487 scheme: 'atelier dune',
2488 author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)',
2489 base00: '#20201d',
2490 base01: '#292824',
2491 base02: '#6e6b5e',
2492 base03: '#7d7a68',
2493 base04: '#999580',
2494 base05: '#a6a28c',
2495 base06: '#e8e4cf',
2496 base07: '#fefbec',
2497 base08: '#d73737',
2498 base09: '#b65611',
2499 base0A: '#cfb017',
2500 base0B: '#60ac39',
2501 base0C: '#1fad83',
2502 base0D: '#6684e1',
2503 base0E: '#b854d4',
2504 base0F: '#d43552'
2505 };
2506 module.exports = exports['default'];
2507 } (atelierDune, atelierDune.exports));
2508
2509 var atelierForest = {exports: {}};
2510
2511 (function (module, exports) {
2512
2513 exports.__esModule = true;
2514 exports['default'] = {
2515 scheme: 'atelier forest',
2516 author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)',
2517 base00: '#1b1918',
2518 base01: '#2c2421',
2519 base02: '#68615e',
2520 base03: '#766e6b',
2521 base04: '#9c9491',
2522 base05: '#a8a19f',
2523 base06: '#e6e2e0',
2524 base07: '#f1efee',
2525 base08: '#f22c40',
2526 base09: '#df5320',
2527 base0A: '#d5911a',
2528 base0B: '#5ab738',
2529 base0C: '#00ad9c',
2530 base0D: '#407ee7',
2531 base0E: '#6666ea',
2532 base0F: '#c33ff3'
2533 };
2534 module.exports = exports['default'];
2535 } (atelierForest, atelierForest.exports));
2536
2537 var atelierHeath = {exports: {}};
2538
2539 (function (module, exports) {
2540
2541 exports.__esModule = true;
2542 exports['default'] = {
2543 scheme: 'atelier heath',
2544 author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)',
2545 base00: '#1b181b',
2546 base01: '#292329',
2547 base02: '#695d69',
2548 base03: '#776977',
2549 base04: '#9e8f9e',
2550 base05: '#ab9bab',
2551 base06: '#d8cad8',
2552 base07: '#f7f3f7',
2553 base08: '#ca402b',
2554 base09: '#a65926',
2555 base0A: '#bb8a35',
2556 base0B: '#379a37',
2557 base0C: '#159393',
2558 base0D: '#516aec',
2559 base0E: '#7b59c0',
2560 base0F: '#cc33cc'
2561 };
2562 module.exports = exports['default'];
2563 } (atelierHeath, atelierHeath.exports));
2564
2565 var atelierLakeside = {exports: {}};
2566
2567 (function (module, exports) {
2568
2569 exports.__esModule = true;
2570 exports['default'] = {
2571 scheme: 'atelier lakeside',
2572 author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)',
2573 base00: '#161b1d',
2574 base01: '#1f292e',
2575 base02: '#516d7b',
2576 base03: '#5a7b8c',
2577 base04: '#7195a8',
2578 base05: '#7ea2b4',
2579 base06: '#c1e4f6',
2580 base07: '#ebf8ff',
2581 base08: '#d22d72',
2582 base09: '#935c25',
2583 base0A: '#8a8a0f',
2584 base0B: '#568c3b',
2585 base0C: '#2d8f6f',
2586 base0D: '#257fad',
2587 base0E: '#5d5db1',
2588 base0F: '#b72dd2'
2589 };
2590 module.exports = exports['default'];
2591 } (atelierLakeside, atelierLakeside.exports));
2592
2593 var atelierSeaside = {exports: {}};
2594
2595 (function (module, exports) {
2596
2597 exports.__esModule = true;
2598 exports['default'] = {
2599 scheme: 'atelier seaside',
2600 author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)',
2601 base00: '#131513',
2602 base01: '#242924',
2603 base02: '#5e6e5e',
2604 base03: '#687d68',
2605 base04: '#809980',
2606 base05: '#8ca68c',
2607 base06: '#cfe8cf',
2608 base07: '#f0fff0',
2609 base08: '#e6193c',
2610 base09: '#87711d',
2611 base0A: '#c3c322',
2612 base0B: '#29a329',
2613 base0C: '#1999b3',
2614 base0D: '#3d62f5',
2615 base0E: '#ad2bee',
2616 base0F: '#e619c3'
2617 };
2618 module.exports = exports['default'];
2619 } (atelierSeaside, atelierSeaside.exports));
2620
2621 var bespin = {exports: {}};
2622
2623 (function (module, exports) {
2624
2625 exports.__esModule = true;
2626 exports['default'] = {
2627 scheme: 'bespin',
2628 author: 'jan t. sott',
2629 base00: '#28211c',
2630 base01: '#36312e',
2631 base02: '#5e5d5c',
2632 base03: '#666666',
2633 base04: '#797977',
2634 base05: '#8a8986',
2635 base06: '#9d9b97',
2636 base07: '#baae9e',
2637 base08: '#cf6a4c',
2638 base09: '#cf7d34',
2639 base0A: '#f9ee98',
2640 base0B: '#54be0d',
2641 base0C: '#afc4db',
2642 base0D: '#5ea6ea',
2643 base0E: '#9b859d',
2644 base0F: '#937121'
2645 };
2646 module.exports = exports['default'];
2647 } (bespin, bespin.exports));
2648
2649 var brewer = {exports: {}};
2650
2651 (function (module, exports) {
2652
2653 exports.__esModule = true;
2654 exports['default'] = {
2655 scheme: 'brewer',
2656 author: 'timothée poisot (http://github.com/tpoisot)',
2657 base00: '#0c0d0e',
2658 base01: '#2e2f30',
2659 base02: '#515253',
2660 base03: '#737475',
2661 base04: '#959697',
2662 base05: '#b7b8b9',
2663 base06: '#dadbdc',
2664 base07: '#fcfdfe',
2665 base08: '#e31a1c',
2666 base09: '#e6550d',
2667 base0A: '#dca060',
2668 base0B: '#31a354',
2669 base0C: '#80b1d3',
2670 base0D: '#3182bd',
2671 base0E: '#756bb1',
2672 base0F: '#b15928'
2673 };
2674 module.exports = exports['default'];
2675 } (brewer, brewer.exports));
2676
2677 var bright = {exports: {}};
2678
2679 (function (module, exports) {
2680
2681 exports.__esModule = true;
2682 exports['default'] = {
2683 scheme: 'bright',
2684 author: 'chris kempson (http://chriskempson.com)',
2685 base00: '#000000',
2686 base01: '#303030',
2687 base02: '#505050',
2688 base03: '#b0b0b0',
2689 base04: '#d0d0d0',
2690 base05: '#e0e0e0',
2691 base06: '#f5f5f5',
2692 base07: '#ffffff',
2693 base08: '#fb0120',
2694 base09: '#fc6d24',
2695 base0A: '#fda331',
2696 base0B: '#a1c659',
2697 base0C: '#76c7b7',
2698 base0D: '#6fb3d2',
2699 base0E: '#d381c3',
2700 base0F: '#be643c'
2701 };
2702 module.exports = exports['default'];
2703 } (bright, bright.exports));
2704
2705 var chalk = {exports: {}};
2706
2707 (function (module, exports) {
2708
2709 exports.__esModule = true;
2710 exports['default'] = {
2711 scheme: 'chalk',
2712 author: 'chris kempson (http://chriskempson.com)',
2713 base00: '#151515',
2714 base01: '#202020',
2715 base02: '#303030',
2716 base03: '#505050',
2717 base04: '#b0b0b0',
2718 base05: '#d0d0d0',
2719 base06: '#e0e0e0',
2720 base07: '#f5f5f5',
2721 base08: '#fb9fb1',
2722 base09: '#eda987',
2723 base0A: '#ddb26f',
2724 base0B: '#acc267',
2725 base0C: '#12cfc0',
2726 base0D: '#6fc2ef',
2727 base0E: '#e1a3ee',
2728 base0F: '#deaf8f'
2729 };
2730 module.exports = exports['default'];
2731 } (chalk, chalk.exports));
2732
2733 var codeschool = {exports: {}};
2734
2735 (function (module, exports) {
2736
2737 exports.__esModule = true;
2738 exports['default'] = {
2739 scheme: 'codeschool',
2740 author: 'brettof86',
2741 base00: '#232c31',
2742 base01: '#1c3657',
2743 base02: '#2a343a',
2744 base03: '#3f4944',
2745 base04: '#84898c',
2746 base05: '#9ea7a6',
2747 base06: '#a7cfa3',
2748 base07: '#b5d8f6',
2749 base08: '#2a5491',
2750 base09: '#43820d',
2751 base0A: '#a03b1e',
2752 base0B: '#237986',
2753 base0C: '#b02f30',
2754 base0D: '#484d79',
2755 base0E: '#c59820',
2756 base0F: '#c98344'
2757 };
2758 module.exports = exports['default'];
2759 } (codeschool, codeschool.exports));
2760
2761 var colors = {exports: {}};
2762
2763 (function (module, exports) {
2764
2765 exports.__esModule = true;
2766 exports['default'] = {
2767 scheme: 'colors',
2768 author: 'mrmrs (http://clrs.cc)',
2769 base00: '#111111',
2770 base01: '#333333',
2771 base02: '#555555',
2772 base03: '#777777',
2773 base04: '#999999',
2774 base05: '#bbbbbb',
2775 base06: '#dddddd',
2776 base07: '#ffffff',
2777 base08: '#ff4136',
2778 base09: '#ff851b',
2779 base0A: '#ffdc00',
2780 base0B: '#2ecc40',
2781 base0C: '#7fdbff',
2782 base0D: '#0074d9',
2783 base0E: '#b10dc9',
2784 base0F: '#85144b'
2785 };
2786 module.exports = exports['default'];
2787 } (colors, colors.exports));
2788
2789 var _default = {exports: {}};
2790
2791 (function (module, exports) {
2792
2793 exports.__esModule = true;
2794 exports['default'] = {
2795 scheme: 'default',
2796 author: 'chris kempson (http://chriskempson.com)',
2797 base00: '#181818',
2798 base01: '#282828',
2799 base02: '#383838',
2800 base03: '#585858',
2801 base04: '#b8b8b8',
2802 base05: '#d8d8d8',
2803 base06: '#e8e8e8',
2804 base07: '#f8f8f8',
2805 base08: '#ab4642',
2806 base09: '#dc9656',
2807 base0A: '#f7ca88',
2808 base0B: '#a1b56c',
2809 base0C: '#86c1b9',
2810 base0D: '#7cafc2',
2811 base0E: '#ba8baf',
2812 base0F: '#a16946'
2813 };
2814 module.exports = exports['default'];
2815 } (_default, _default.exports));
2816
2817 var eighties = {exports: {}};
2818
2819 (function (module, exports) {
2820
2821 exports.__esModule = true;
2822 exports['default'] = {
2823 scheme: 'eighties',
2824 author: 'chris kempson (http://chriskempson.com)',
2825 base00: '#2d2d2d',
2826 base01: '#393939',
2827 base02: '#515151',
2828 base03: '#747369',
2829 base04: '#a09f93',
2830 base05: '#d3d0c8',
2831 base06: '#e8e6df',
2832 base07: '#f2f0ec',
2833 base08: '#f2777a',
2834 base09: '#f99157',
2835 base0A: '#ffcc66',
2836 base0B: '#99cc99',
2837 base0C: '#66cccc',
2838 base0D: '#6699cc',
2839 base0E: '#cc99cc',
2840 base0F: '#d27b53'
2841 };
2842 module.exports = exports['default'];
2843 } (eighties, eighties.exports));
2844
2845 var embers = {exports: {}};
2846
2847 (function (module, exports) {
2848
2849 exports.__esModule = true;
2850 exports['default'] = {
2851 scheme: 'embers',
2852 author: 'jannik siebert (https://github.com/janniks)',
2853 base00: '#16130F',
2854 base01: '#2C2620',
2855 base02: '#433B32',
2856 base03: '#5A5047',
2857 base04: '#8A8075',
2858 base05: '#A39A90',
2859 base06: '#BEB6AE',
2860 base07: '#DBD6D1',
2861 base08: '#826D57',
2862 base09: '#828257',
2863 base0A: '#6D8257',
2864 base0B: '#57826D',
2865 base0C: '#576D82',
2866 base0D: '#6D5782',
2867 base0E: '#82576D',
2868 base0F: '#825757'
2869 };
2870 module.exports = exports['default'];
2871 } (embers, embers.exports));
2872
2873 var flat = {exports: {}};
2874
2875 (function (module, exports) {
2876
2877 exports.__esModule = true;
2878 exports['default'] = {
2879 scheme: 'flat',
2880 author: 'chris kempson (http://chriskempson.com)',
2881 base00: '#2C3E50',
2882 base01: '#34495E',
2883 base02: '#7F8C8D',
2884 base03: '#95A5A6',
2885 base04: '#BDC3C7',
2886 base05: '#e0e0e0',
2887 base06: '#f5f5f5',
2888 base07: '#ECF0F1',
2889 base08: '#E74C3C',
2890 base09: '#E67E22',
2891 base0A: '#F1C40F',
2892 base0B: '#2ECC71',
2893 base0C: '#1ABC9C',
2894 base0D: '#3498DB',
2895 base0E: '#9B59B6',
2896 base0F: '#be643c'
2897 };
2898 module.exports = exports['default'];
2899 } (flat, flat.exports));
2900
2901 var google = {exports: {}};
2902
2903 (function (module, exports) {
2904
2905 exports.__esModule = true;
2906 exports['default'] = {
2907 scheme: 'google',
2908 author: 'seth wright (http://sethawright.com)',
2909 base00: '#1d1f21',
2910 base01: '#282a2e',
2911 base02: '#373b41',
2912 base03: '#969896',
2913 base04: '#b4b7b4',
2914 base05: '#c5c8c6',
2915 base06: '#e0e0e0',
2916 base07: '#ffffff',
2917 base08: '#CC342B',
2918 base09: '#F96A38',
2919 base0A: '#FBA922',
2920 base0B: '#198844',
2921 base0C: '#3971ED',
2922 base0D: '#3971ED',
2923 base0E: '#A36AC7',
2924 base0F: '#3971ED'
2925 };
2926 module.exports = exports['default'];
2927 } (google, google.exports));
2928
2929 var grayscale = {exports: {}};
2930
2931 (function (module, exports) {
2932
2933 exports.__esModule = true;
2934 exports['default'] = {
2935 scheme: 'grayscale',
2936 author: 'alexandre gavioli (https://github.com/alexx2/)',
2937 base00: '#101010',
2938 base01: '#252525',
2939 base02: '#464646',
2940 base03: '#525252',
2941 base04: '#ababab',
2942 base05: '#b9b9b9',
2943 base06: '#e3e3e3',
2944 base07: '#f7f7f7',
2945 base08: '#7c7c7c',
2946 base09: '#999999',
2947 base0A: '#a0a0a0',
2948 base0B: '#8e8e8e',
2949 base0C: '#868686',
2950 base0D: '#686868',
2951 base0E: '#747474',
2952 base0F: '#5e5e5e'
2953 };
2954 module.exports = exports['default'];
2955 } (grayscale, grayscale.exports));
2956
2957 var greenscreen = {exports: {}};
2958
2959 (function (module, exports) {
2960
2961 exports.__esModule = true;
2962 exports['default'] = {
2963 scheme: 'green screen',
2964 author: 'chris kempson (http://chriskempson.com)',
2965 base00: '#001100',
2966 base01: '#003300',
2967 base02: '#005500',
2968 base03: '#007700',
2969 base04: '#009900',
2970 base05: '#00bb00',
2971 base06: '#00dd00',
2972 base07: '#00ff00',
2973 base08: '#007700',
2974 base09: '#009900',
2975 base0A: '#007700',
2976 base0B: '#00bb00',
2977 base0C: '#005500',
2978 base0D: '#009900',
2979 base0E: '#00bb00',
2980 base0F: '#005500'
2981 };
2982 module.exports = exports['default'];
2983 } (greenscreen, greenscreen.exports));
2984
2985 var harmonic = {exports: {}};
2986
2987 (function (module, exports) {
2988
2989 exports.__esModule = true;
2990 exports['default'] = {
2991 scheme: 'harmonic16',
2992 author: 'jannik siebert (https://github.com/janniks)',
2993 base00: '#0b1c2c',
2994 base01: '#223b54',
2995 base02: '#405c79',
2996 base03: '#627e99',
2997 base04: '#aabcce',
2998 base05: '#cbd6e2',
2999 base06: '#e5ebf1',
3000 base07: '#f7f9fb',
3001 base08: '#bf8b56',
3002 base09: '#bfbf56',
3003 base0A: '#8bbf56',
3004 base0B: '#56bf8b',
3005 base0C: '#568bbf',
3006 base0D: '#8b56bf',
3007 base0E: '#bf568b',
3008 base0F: '#bf5656'
3009 };
3010 module.exports = exports['default'];
3011 } (harmonic, harmonic.exports));
3012
3013 var hopscotch = {exports: {}};
3014
3015 (function (module, exports) {
3016
3017 exports.__esModule = true;
3018 exports['default'] = {
3019 scheme: 'hopscotch',
3020 author: 'jan t. sott',
3021 base00: '#322931',
3022 base01: '#433b42',
3023 base02: '#5c545b',
3024 base03: '#797379',
3025 base04: '#989498',
3026 base05: '#b9b5b8',
3027 base06: '#d5d3d5',
3028 base07: '#ffffff',
3029 base08: '#dd464c',
3030 base09: '#fd8b19',
3031 base0A: '#fdcc59',
3032 base0B: '#8fc13e',
3033 base0C: '#149b93',
3034 base0D: '#1290bf',
3035 base0E: '#c85e7c',
3036 base0F: '#b33508'
3037 };
3038 module.exports = exports['default'];
3039 } (hopscotch, hopscotch.exports));
3040
3041 var isotope = {exports: {}};
3042
3043 (function (module, exports) {
3044
3045 exports.__esModule = true;
3046 exports['default'] = {
3047 scheme: 'isotope',
3048 author: 'jan t. sott',
3049 base00: '#000000',
3050 base01: '#404040',
3051 base02: '#606060',
3052 base03: '#808080',
3053 base04: '#c0c0c0',
3054 base05: '#d0d0d0',
3055 base06: '#e0e0e0',
3056 base07: '#ffffff',
3057 base08: '#ff0000',
3058 base09: '#ff9900',
3059 base0A: '#ff0099',
3060 base0B: '#33ff00',
3061 base0C: '#00ffff',
3062 base0D: '#0066ff',
3063 base0E: '#cc00ff',
3064 base0F: '#3300ff'
3065 };
3066 module.exports = exports['default'];
3067 } (isotope, isotope.exports));
3068
3069 var marrakesh = {exports: {}};
3070
3071 (function (module, exports) {
3072
3073 exports.__esModule = true;
3074 exports['default'] = {
3075 scheme: 'marrakesh',
3076 author: 'alexandre gavioli (http://github.com/alexx2/)',
3077 base00: '#201602',
3078 base01: '#302e00',
3079 base02: '#5f5b17',
3080 base03: '#6c6823',
3081 base04: '#86813b',
3082 base05: '#948e48',
3083 base06: '#ccc37a',
3084 base07: '#faf0a5',
3085 base08: '#c35359',
3086 base09: '#b36144',
3087 base0A: '#a88339',
3088 base0B: '#18974e',
3089 base0C: '#75a738',
3090 base0D: '#477ca1',
3091 base0E: '#8868b3',
3092 base0F: '#b3588e'
3093 };
3094 module.exports = exports['default'];
3095 } (marrakesh, marrakesh.exports));
3096
3097 var mocha = {exports: {}};
3098
3099 (function (module, exports) {
3100
3101 exports.__esModule = true;
3102 exports['default'] = {
3103 scheme: 'mocha',
3104 author: 'chris kempson (http://chriskempson.com)',
3105 base00: '#3B3228',
3106 base01: '#534636',
3107 base02: '#645240',
3108 base03: '#7e705a',
3109 base04: '#b8afad',
3110 base05: '#d0c8c6',
3111 base06: '#e9e1dd',
3112 base07: '#f5eeeb',
3113 base08: '#cb6077',
3114 base09: '#d28b71',
3115 base0A: '#f4bc87',
3116 base0B: '#beb55b',
3117 base0C: '#7bbda4',
3118 base0D: '#8ab3b5',
3119 base0E: '#a89bb9',
3120 base0F: '#bb9584'
3121 };
3122 module.exports = exports['default'];
3123 } (mocha, mocha.exports));
3124
3125 var monokai = {exports: {}};
3126
3127 (function (module, exports) {
3128
3129 exports.__esModule = true;
3130 exports['default'] = {
3131 scheme: 'monokai',
3132 author: 'wimer hazenberg (http://www.monokai.nl)',
3133 base00: '#272822',
3134 base01: '#383830',
3135 base02: '#49483e',
3136 base03: '#75715e',
3137 base04: '#a59f85',
3138 base05: '#f8f8f2',
3139 base06: '#f5f4f1',
3140 base07: '#f9f8f5',
3141 base08: '#f92672',
3142 base09: '#fd971f',
3143 base0A: '#f4bf75',
3144 base0B: '#a6e22e',
3145 base0C: '#a1efe4',
3146 base0D: '#66d9ef',
3147 base0E: '#ae81ff',
3148 base0F: '#cc6633'
3149 };
3150 module.exports = exports['default'];
3151 } (monokai, monokai.exports));
3152
3153 var ocean = {exports: {}};
3154
3155 (function (module, exports) {
3156
3157 exports.__esModule = true;
3158 exports['default'] = {
3159 scheme: 'ocean',
3160 author: 'chris kempson (http://chriskempson.com)',
3161 base00: '#2b303b',
3162 base01: '#343d46',
3163 base02: '#4f5b66',
3164 base03: '#65737e',
3165 base04: '#a7adba',
3166 base05: '#c0c5ce',
3167 base06: '#dfe1e8',
3168 base07: '#eff1f5',
3169 base08: '#bf616a',
3170 base09: '#d08770',
3171 base0A: '#ebcb8b',
3172 base0B: '#a3be8c',
3173 base0C: '#96b5b4',
3174 base0D: '#8fa1b3',
3175 base0E: '#b48ead',
3176 base0F: '#ab7967'
3177 };
3178 module.exports = exports['default'];
3179 } (ocean, ocean.exports));
3180
3181 var paraiso = {exports: {}};
3182
3183 (function (module, exports) {
3184
3185 exports.__esModule = true;
3186 exports['default'] = {
3187 scheme: 'paraiso',
3188 author: 'jan t. sott',
3189 base00: '#2f1e2e',
3190 base01: '#41323f',
3191 base02: '#4f424c',
3192 base03: '#776e71',
3193 base04: '#8d8687',
3194 base05: '#a39e9b',
3195 base06: '#b9b6b0',
3196 base07: '#e7e9db',
3197 base08: '#ef6155',
3198 base09: '#f99b15',
3199 base0A: '#fec418',
3200 base0B: '#48b685',
3201 base0C: '#5bc4bf',
3202 base0D: '#06b6ef',
3203 base0E: '#815ba4',
3204 base0F: '#e96ba8'
3205 };
3206 module.exports = exports['default'];
3207 } (paraiso, paraiso.exports));
3208
3209 var pop = {exports: {}};
3210
3211 (function (module, exports) {
3212
3213 exports.__esModule = true;
3214 exports['default'] = {
3215 scheme: 'pop',
3216 author: 'chris kempson (http://chriskempson.com)',
3217 base00: '#000000',
3218 base01: '#202020',
3219 base02: '#303030',
3220 base03: '#505050',
3221 base04: '#b0b0b0',
3222 base05: '#d0d0d0',
3223 base06: '#e0e0e0',
3224 base07: '#ffffff',
3225 base08: '#eb008a',
3226 base09: '#f29333',
3227 base0A: '#f8ca12',
3228 base0B: '#37b349',
3229 base0C: '#00aabb',
3230 base0D: '#0e5a94',
3231 base0E: '#b31e8d',
3232 base0F: '#7a2d00'
3233 };
3234 module.exports = exports['default'];
3235 } (pop, pop.exports));
3236
3237 var railscasts = {exports: {}};
3238
3239 (function (module, exports) {
3240
3241 exports.__esModule = true;
3242 exports['default'] = {
3243 scheme: 'railscasts',
3244 author: 'ryan bates (http://railscasts.com)',
3245 base00: '#2b2b2b',
3246 base01: '#272935',
3247 base02: '#3a4055',
3248 base03: '#5a647e',
3249 base04: '#d4cfc9',
3250 base05: '#e6e1dc',
3251 base06: '#f4f1ed',
3252 base07: '#f9f7f3',
3253 base08: '#da4939',
3254 base09: '#cc7833',
3255 base0A: '#ffc66d',
3256 base0B: '#a5c261',
3257 base0C: '#519f50',
3258 base0D: '#6d9cbe',
3259 base0E: '#b6b3eb',
3260 base0F: '#bc9458'
3261 };
3262 module.exports = exports['default'];
3263 } (railscasts, railscasts.exports));
3264
3265 var shapeshifter = {exports: {}};
3266
3267 (function (module, exports) {
3268
3269 exports.__esModule = true;
3270 exports['default'] = {
3271 scheme: 'shapeshifter',
3272 author: 'tyler benziger (http://tybenz.com)',
3273 base00: '#000000',
3274 base01: '#040404',
3275 base02: '#102015',
3276 base03: '#343434',
3277 base04: '#555555',
3278 base05: '#ababab',
3279 base06: '#e0e0e0',
3280 base07: '#f9f9f9',
3281 base08: '#e92f2f',
3282 base09: '#e09448',
3283 base0A: '#dddd13',
3284 base0B: '#0ed839',
3285 base0C: '#23edda',
3286 base0D: '#3b48e3',
3287 base0E: '#f996e2',
3288 base0F: '#69542d'
3289 };
3290 module.exports = exports['default'];
3291 } (shapeshifter, shapeshifter.exports));
3292
3293 var solarized$1 = {exports: {}};
3294
3295 (function (module, exports) {
3296
3297 exports.__esModule = true;
3298 exports['default'] = {
3299 scheme: 'solarized',
3300 author: 'ethan schoonover (http://ethanschoonover.com/solarized)',
3301 base00: '#002b36',
3302 base01: '#073642',
3303 base02: '#586e75',
3304 base03: '#657b83',
3305 base04: '#839496',
3306 base05: '#93a1a1',
3307 base06: '#eee8d5',
3308 base07: '#fdf6e3',
3309 base08: '#dc322f',
3310 base09: '#cb4b16',
3311 base0A: '#b58900',
3312 base0B: '#859900',
3313 base0C: '#2aa198',
3314 base0D: '#268bd2',
3315 base0E: '#6c71c4',
3316 base0F: '#d33682'
3317 };
3318 module.exports = exports['default'];
3319 } (solarized$1, solarized$1.exports));
3320
3321 var summerfruit = {exports: {}};
3322
3323 (function (module, exports) {
3324
3325 exports.__esModule = true;
3326 exports['default'] = {
3327 scheme: 'summerfruit',
3328 author: 'christopher corley (http://cscorley.github.io/)',
3329 base00: '#151515',
3330 base01: '#202020',
3331 base02: '#303030',
3332 base03: '#505050',
3333 base04: '#B0B0B0',
3334 base05: '#D0D0D0',
3335 base06: '#E0E0E0',
3336 base07: '#FFFFFF',
3337 base08: '#FF0086',
3338 base09: '#FD8900',
3339 base0A: '#ABA800',
3340 base0B: '#00C918',
3341 base0C: '#1faaaa',
3342 base0D: '#3777E6',
3343 base0E: '#AD00A1',
3344 base0F: '#cc6633'
3345 };
3346 module.exports = exports['default'];
3347 } (summerfruit, summerfruit.exports));
3348
3349 var tomorrow = {exports: {}};
3350
3351 (function (module, exports) {
3352
3353 exports.__esModule = true;
3354 exports['default'] = {
3355 scheme: 'tomorrow',
3356 author: 'chris kempson (http://chriskempson.com)',
3357 base00: '#1d1f21',
3358 base01: '#282a2e',
3359 base02: '#373b41',
3360 base03: '#969896',
3361 base04: '#b4b7b4',
3362 base05: '#c5c8c6',
3363 base06: '#e0e0e0',
3364 base07: '#ffffff',
3365 base08: '#cc6666',
3366 base09: '#de935f',
3367 base0A: '#f0c674',
3368 base0B: '#b5bd68',
3369 base0C: '#8abeb7',
3370 base0D: '#81a2be',
3371 base0E: '#b294bb',
3372 base0F: '#a3685a'
3373 };
3374 module.exports = exports['default'];
3375 } (tomorrow, tomorrow.exports));
3376
3377 var tube = {exports: {}};
3378
3379 (function (module, exports) {
3380
3381 exports.__esModule = true;
3382 exports['default'] = {
3383 scheme: 'london tube',
3384 author: 'jan t. sott',
3385 base00: '#231f20',
3386 base01: '#1c3f95',
3387 base02: '#5a5758',
3388 base03: '#737171',
3389 base04: '#959ca1',
3390 base05: '#d9d8d8',
3391 base06: '#e7e7e8',
3392 base07: '#ffffff',
3393 base08: '#ee2e24',
3394 base09: '#f386a1',
3395 base0A: '#ffd204',
3396 base0B: '#00853e',
3397 base0C: '#85cebc',
3398 base0D: '#009ddc',
3399 base0E: '#98005d',
3400 base0F: '#b06110'
3401 };
3402 module.exports = exports['default'];
3403 } (tube, tube.exports));
3404
3405 var twilight = {exports: {}};
3406
3407 (function (module, exports) {
3408
3409 exports.__esModule = true;
3410 exports['default'] = {
3411 scheme: 'twilight',
3412 author: 'david hart (http://hart-dev.com)',
3413 base00: '#1e1e1e',
3414 base01: '#323537',
3415 base02: '#464b50',
3416 base03: '#5f5a60',
3417 base04: '#838184',
3418 base05: '#a7a7a7',
3419 base06: '#c3c3c3',
3420 base07: '#ffffff',
3421 base08: '#cf6a4c',
3422 base09: '#cda869',
3423 base0A: '#f9ee98',
3424 base0B: '#8f9d6a',
3425 base0C: '#afc4db',
3426 base0D: '#7587a6',
3427 base0E: '#9b859d',
3428 base0F: '#9b703f'
3429 };
3430 module.exports = exports['default'];
3431 } (twilight, twilight.exports));
3432
3433 (function (exports) {
3434
3435 exports.__esModule = true;
3436
3437 function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
3438
3439 var _threezerotwofour = threezerotwofour.exports;
3440
3441 exports.threezerotwofour = _interopRequire(_threezerotwofour);
3442
3443 var _apathy = apathy.exports;
3444
3445 exports.apathy = _interopRequire(_apathy);
3446
3447 var _ashes = ashes.exports;
3448
3449 exports.ashes = _interopRequire(_ashes);
3450
3451 var _atelierDune = atelierDune.exports;
3452
3453 exports.atelierDune = _interopRequire(_atelierDune);
3454
3455 var _atelierForest = atelierForest.exports;
3456
3457 exports.atelierForest = _interopRequire(_atelierForest);
3458
3459 var _atelierHeath = atelierHeath.exports;
3460
3461 exports.atelierHeath = _interopRequire(_atelierHeath);
3462
3463 var _atelierLakeside = atelierLakeside.exports;
3464
3465 exports.atelierLakeside = _interopRequire(_atelierLakeside);
3466
3467 var _atelierSeaside = atelierSeaside.exports;
3468
3469 exports.atelierSeaside = _interopRequire(_atelierSeaside);
3470
3471 var _bespin = bespin.exports;
3472
3473 exports.bespin = _interopRequire(_bespin);
3474
3475 var _brewer = brewer.exports;
3476
3477 exports.brewer = _interopRequire(_brewer);
3478
3479 var _bright = bright.exports;
3480
3481 exports.bright = _interopRequire(_bright);
3482
3483 var _chalk = chalk.exports;
3484
3485 exports.chalk = _interopRequire(_chalk);
3486
3487 var _codeschool = codeschool.exports;
3488
3489 exports.codeschool = _interopRequire(_codeschool);
3490
3491 var _colors = colors.exports;
3492
3493 exports.colors = _interopRequire(_colors);
3494
3495 var _default$1 = _default.exports;
3496
3497 exports['default'] = _interopRequire(_default$1);
3498
3499 var _eighties = eighties.exports;
3500
3501 exports.eighties = _interopRequire(_eighties);
3502
3503 var _embers = embers.exports;
3504
3505 exports.embers = _interopRequire(_embers);
3506
3507 var _flat = flat.exports;
3508
3509 exports.flat = _interopRequire(_flat);
3510
3511 var _google = google.exports;
3512
3513 exports.google = _interopRequire(_google);
3514
3515 var _grayscale = grayscale.exports;
3516
3517 exports.grayscale = _interopRequire(_grayscale);
3518
3519 var _greenscreen = greenscreen.exports;
3520
3521 exports.greenscreen = _interopRequire(_greenscreen);
3522
3523 var _harmonic = harmonic.exports;
3524
3525 exports.harmonic = _interopRequire(_harmonic);
3526
3527 var _hopscotch = hopscotch.exports;
3528
3529 exports.hopscotch = _interopRequire(_hopscotch);
3530
3531 var _isotope = isotope.exports;
3532
3533 exports.isotope = _interopRequire(_isotope);
3534
3535 var _marrakesh = marrakesh.exports;
3536
3537 exports.marrakesh = _interopRequire(_marrakesh);
3538
3539 var _mocha = mocha.exports;
3540
3541 exports.mocha = _interopRequire(_mocha);
3542
3543 var _monokai = monokai.exports;
3544
3545 exports.monokai = _interopRequire(_monokai);
3546
3547 var _ocean = ocean.exports;
3548
3549 exports.ocean = _interopRequire(_ocean);
3550
3551 var _paraiso = paraiso.exports;
3552
3553 exports.paraiso = _interopRequire(_paraiso);
3554
3555 var _pop = pop.exports;
3556
3557 exports.pop = _interopRequire(_pop);
3558
3559 var _railscasts = railscasts.exports;
3560
3561 exports.railscasts = _interopRequire(_railscasts);
3562
3563 var _shapeshifter = shapeshifter.exports;
3564
3565 exports.shapeshifter = _interopRequire(_shapeshifter);
3566
3567 var _solarized = solarized$1.exports;
3568
3569 exports.solarized = _interopRequire(_solarized);
3570
3571 var _summerfruit = summerfruit.exports;
3572
3573 exports.summerfruit = _interopRequire(_summerfruit);
3574
3575 var _tomorrow = tomorrow.exports;
3576
3577 exports.tomorrow = _interopRequire(_tomorrow);
3578
3579 var _tube = tube.exports;
3580
3581 exports.tube = _interopRequire(_tube);
3582
3583 var _twilight = twilight.exports;
3584
3585 exports.twilight = _interopRequire(_twilight);
3586 } (lib));
3587
3588 var index = /*@__PURE__*/getDefaultExportFromCjs(lib);
3589
3590 var base16 = /*#__PURE__*/_mergeNamespaces({
3591 __proto__: null,
3592 'default': index
3593 }, [lib]);
3594
3595 var colorString$1 = {exports: {}};
3596
3597 var colorName = {
3598 "aliceblue": [240, 248, 255],
3599 "antiquewhite": [250, 235, 215],
3600 "aqua": [0, 255, 255],
3601 "aquamarine": [127, 255, 212],
3602 "azure": [240, 255, 255],
3603 "beige": [245, 245, 220],
3604 "bisque": [255, 228, 196],
3605 "black": [0, 0, 0],
3606 "blanchedalmond": [255, 235, 205],
3607 "blue": [0, 0, 255],
3608 "blueviolet": [138, 43, 226],
3609 "brown": [165, 42, 42],
3610 "burlywood": [222, 184, 135],
3611 "cadetblue": [95, 158, 160],
3612 "chartreuse": [127, 255, 0],
3613 "chocolate": [210, 105, 30],
3614 "coral": [255, 127, 80],
3615 "cornflowerblue": [100, 149, 237],
3616 "cornsilk": [255, 248, 220],
3617 "crimson": [220, 20, 60],
3618 "cyan": [0, 255, 255],
3619 "darkblue": [0, 0, 139],
3620 "darkcyan": [0, 139, 139],
3621 "darkgoldenrod": [184, 134, 11],
3622 "darkgray": [169, 169, 169],
3623 "darkgreen": [0, 100, 0],
3624 "darkgrey": [169, 169, 169],
3625 "darkkhaki": [189, 183, 107],
3626 "darkmagenta": [139, 0, 139],
3627 "darkolivegreen": [85, 107, 47],
3628 "darkorange": [255, 140, 0],
3629 "darkorchid": [153, 50, 204],
3630 "darkred": [139, 0, 0],
3631 "darksalmon": [233, 150, 122],
3632 "darkseagreen": [143, 188, 143],
3633 "darkslateblue": [72, 61, 139],
3634 "darkslategray": [47, 79, 79],
3635 "darkslategrey": [47, 79, 79],
3636 "darkturquoise": [0, 206, 209],
3637 "darkviolet": [148, 0, 211],
3638 "deeppink": [255, 20, 147],
3639 "deepskyblue": [0, 191, 255],
3640 "dimgray": [105, 105, 105],
3641 "dimgrey": [105, 105, 105],
3642 "dodgerblue": [30, 144, 255],
3643 "firebrick": [178, 34, 34],
3644 "floralwhite": [255, 250, 240],
3645 "forestgreen": [34, 139, 34],
3646 "fuchsia": [255, 0, 255],
3647 "gainsboro": [220, 220, 220],
3648 "ghostwhite": [248, 248, 255],
3649 "gold": [255, 215, 0],
3650 "goldenrod": [218, 165, 32],
3651 "gray": [128, 128, 128],
3652 "green": [0, 128, 0],
3653 "greenyellow": [173, 255, 47],
3654 "grey": [128, 128, 128],
3655 "honeydew": [240, 255, 240],
3656 "hotpink": [255, 105, 180],
3657 "indianred": [205, 92, 92],
3658 "indigo": [75, 0, 130],
3659 "ivory": [255, 255, 240],
3660 "khaki": [240, 230, 140],
3661 "lavender": [230, 230, 250],
3662 "lavenderblush": [255, 240, 245],
3663 "lawngreen": [124, 252, 0],
3664 "lemonchiffon": [255, 250, 205],
3665 "lightblue": [173, 216, 230],
3666 "lightcoral": [240, 128, 128],
3667 "lightcyan": [224, 255, 255],
3668 "lightgoldenrodyellow": [250, 250, 210],
3669 "lightgray": [211, 211, 211],
3670 "lightgreen": [144, 238, 144],
3671 "lightgrey": [211, 211, 211],
3672 "lightpink": [255, 182, 193],
3673 "lightsalmon": [255, 160, 122],
3674 "lightseagreen": [32, 178, 170],
3675 "lightskyblue": [135, 206, 250],
3676 "lightslategray": [119, 136, 153],
3677 "lightslategrey": [119, 136, 153],
3678 "lightsteelblue": [176, 196, 222],
3679 "lightyellow": [255, 255, 224],
3680 "lime": [0, 255, 0],
3681 "limegreen": [50, 205, 50],
3682 "linen": [250, 240, 230],
3683 "magenta": [255, 0, 255],
3684 "maroon": [128, 0, 0],
3685 "mediumaquamarine": [102, 205, 170],
3686 "mediumblue": [0, 0, 205],
3687 "mediumorchid": [186, 85, 211],
3688 "mediumpurple": [147, 112, 219],
3689 "mediumseagreen": [60, 179, 113],
3690 "mediumslateblue": [123, 104, 238],
3691 "mediumspringgreen": [0, 250, 154],
3692 "mediumturquoise": [72, 209, 204],
3693 "mediumvioletred": [199, 21, 133],
3694 "midnightblue": [25, 25, 112],
3695 "mintcream": [245, 255, 250],
3696 "mistyrose": [255, 228, 225],
3697 "moccasin": [255, 228, 181],
3698 "navajowhite": [255, 222, 173],
3699 "navy": [0, 0, 128],
3700 "oldlace": [253, 245, 230],
3701 "olive": [128, 128, 0],
3702 "olivedrab": [107, 142, 35],
3703 "orange": [255, 165, 0],
3704 "orangered": [255, 69, 0],
3705 "orchid": [218, 112, 214],
3706 "palegoldenrod": [238, 232, 170],
3707 "palegreen": [152, 251, 152],
3708 "paleturquoise": [175, 238, 238],
3709 "palevioletred": [219, 112, 147],
3710 "papayawhip": [255, 239, 213],
3711 "peachpuff": [255, 218, 185],
3712 "peru": [205, 133, 63],
3713 "pink": [255, 192, 203],
3714 "plum": [221, 160, 221],
3715 "powderblue": [176, 224, 230],
3716 "purple": [128, 0, 128],
3717 "rebeccapurple": [102, 51, 153],
3718 "red": [255, 0, 0],
3719 "rosybrown": [188, 143, 143],
3720 "royalblue": [65, 105, 225],
3721 "saddlebrown": [139, 69, 19],
3722 "salmon": [250, 128, 114],
3723 "sandybrown": [244, 164, 96],
3724 "seagreen": [46, 139, 87],
3725 "seashell": [255, 245, 238],
3726 "sienna": [160, 82, 45],
3727 "silver": [192, 192, 192],
3728 "skyblue": [135, 206, 235],
3729 "slateblue": [106, 90, 205],
3730 "slategray": [112, 128, 144],
3731 "slategrey": [112, 128, 144],
3732 "snow": [255, 250, 250],
3733 "springgreen": [0, 255, 127],
3734 "steelblue": [70, 130, 180],
3735 "tan": [210, 180, 140],
3736 "teal": [0, 128, 128],
3737 "thistle": [216, 191, 216],
3738 "tomato": [255, 99, 71],
3739 "turquoise": [64, 224, 208],
3740 "violet": [238, 130, 238],
3741 "wheat": [245, 222, 179],
3742 "white": [255, 255, 255],
3743 "whitesmoke": [245, 245, 245],
3744 "yellow": [255, 255, 0],
3745 "yellowgreen": [154, 205, 50]
3746 };
3747
3748 var simpleSwizzle = {exports: {}};
3749
3750 var isArrayish$1 = function isArrayish(obj) {
3751 if (!obj || typeof obj === 'string') {
3752 return false;
3753 }
3754
3755 return obj instanceof Array || Array.isArray(obj) ||
3756 (obj.length >= 0 && (obj.splice instanceof Function ||
3757 (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
3758 };
3759
3760 var isArrayish = isArrayish$1;
3761
3762 var concat = Array.prototype.concat;
3763 var slice = Array.prototype.slice;
3764
3765 var swizzle$1 = simpleSwizzle.exports = function swizzle(args) {
3766 var results = [];
3767
3768 for (var i = 0, len = args.length; i < len; i++) {
3769 var arg = args[i];
3770
3771 if (isArrayish(arg)) {
3772 // http://jsperf.com/javascript-array-concat-vs-push/98
3773 results = concat.call(results, slice.call(arg));
3774 } else {
3775 results.push(arg);
3776 }
3777 }
3778
3779 return results;
3780 };
3781
3782 swizzle$1.wrap = function (fn) {
3783 return function () {
3784 return fn(swizzle$1(arguments));
3785 };
3786 };
3787
3788 /* MIT license */
3789
3790 var colorNames = colorName;
3791 var swizzle = simpleSwizzle.exports;
3792 var hasOwnProperty$1 = Object.hasOwnProperty;
3793
3794 var reverseNames = Object.create(null);
3795
3796 // create a list of reverse color names
3797 for (var name in colorNames) {
3798 if (hasOwnProperty$1.call(colorNames, name)) {
3799 reverseNames[colorNames[name]] = name;
3800 }
3801 }
3802
3803 var cs = colorString$1.exports = {
3804 to: {},
3805 get: {}
3806 };
3807
3808 cs.get = function (string) {
3809 var prefix = string.substring(0, 3).toLowerCase();
3810 var val;
3811 var model;
3812 switch (prefix) {
3813 case 'hsl':
3814 val = cs.get.hsl(string);
3815 model = 'hsl';
3816 break;
3817 case 'hwb':
3818 val = cs.get.hwb(string);
3819 model = 'hwb';
3820 break;
3821 default:
3822 val = cs.get.rgb(string);
3823 model = 'rgb';
3824 break;
3825 }
3826
3827 if (!val) {
3828 return null;
3829 }
3830
3831 return {model: model, value: val};
3832 };
3833
3834 cs.get.rgb = function (string) {
3835 if (!string) {
3836 return null;
3837 }
3838
3839 var abbr = /^#([a-f0-9]{3,4})$/i;
3840 var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
3841 var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
3842 var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
3843 var keyword = /^(\w+)$/;
3844
3845 var rgb = [0, 0, 0, 1];
3846 var match;
3847 var i;
3848 var hexAlpha;
3849
3850 if (match = string.match(hex)) {
3851 hexAlpha = match[2];
3852 match = match[1];
3853
3854 for (i = 0; i < 3; i++) {
3855 // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
3856 var i2 = i * 2;
3857 rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
3858 }
3859
3860 if (hexAlpha) {
3861 rgb[3] = parseInt(hexAlpha, 16) / 255;
3862 }
3863 } else if (match = string.match(abbr)) {
3864 match = match[1];
3865 hexAlpha = match[3];
3866
3867 for (i = 0; i < 3; i++) {
3868 rgb[i] = parseInt(match[i] + match[i], 16);
3869 }
3870
3871 if (hexAlpha) {
3872 rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
3873 }
3874 } else if (match = string.match(rgba)) {
3875 for (i = 0; i < 3; i++) {
3876 rgb[i] = parseInt(match[i + 1], 0);
3877 }
3878
3879 if (match[4]) {
3880 if (match[5]) {
3881 rgb[3] = parseFloat(match[4]) * 0.01;
3882 } else {
3883 rgb[3] = parseFloat(match[4]);
3884 }
3885 }
3886 } else if (match = string.match(per)) {
3887 for (i = 0; i < 3; i++) {
3888 rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
3889 }
3890
3891 if (match[4]) {
3892 if (match[5]) {
3893 rgb[3] = parseFloat(match[4]) * 0.01;
3894 } else {
3895 rgb[3] = parseFloat(match[4]);
3896 }
3897 }
3898 } else if (match = string.match(keyword)) {
3899 if (match[1] === 'transparent') {
3900 return [0, 0, 0, 0];
3901 }
3902
3903 if (!hasOwnProperty$1.call(colorNames, match[1])) {
3904 return null;
3905 }
3906
3907 rgb = colorNames[match[1]];
3908 rgb[3] = 1;
3909
3910 return rgb;
3911 } else {
3912 return null;
3913 }
3914
3915 for (i = 0; i < 3; i++) {
3916 rgb[i] = clamp(rgb[i], 0, 255);
3917 }
3918 rgb[3] = clamp(rgb[3], 0, 1);
3919
3920 return rgb;
3921 };
3922
3923 cs.get.hsl = function (string) {
3924 if (!string) {
3925 return null;
3926 }
3927
3928 var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
3929 var match = string.match(hsl);
3930
3931 if (match) {
3932 var alpha = parseFloat(match[4]);
3933 var h = ((parseFloat(match[1]) % 360) + 360) % 360;
3934 var s = clamp(parseFloat(match[2]), 0, 100);
3935 var l = clamp(parseFloat(match[3]), 0, 100);
3936 var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
3937
3938 return [h, s, l, a];
3939 }
3940
3941 return null;
3942 };
3943
3944 cs.get.hwb = function (string) {
3945 if (!string) {
3946 return null;
3947 }
3948
3949 var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
3950 var match = string.match(hwb);
3951
3952 if (match) {
3953 var alpha = parseFloat(match[4]);
3954 var h = ((parseFloat(match[1]) % 360) + 360) % 360;
3955 var w = clamp(parseFloat(match[2]), 0, 100);
3956 var b = clamp(parseFloat(match[3]), 0, 100);
3957 var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
3958 return [h, w, b, a];
3959 }
3960
3961 return null;
3962 };
3963
3964 cs.to.hex = function () {
3965 var rgba = swizzle(arguments);
3966
3967 return (
3968 '#' +
3969 hexDouble(rgba[0]) +
3970 hexDouble(rgba[1]) +
3971 hexDouble(rgba[2]) +
3972 (rgba[3] < 1
3973 ? (hexDouble(Math.round(rgba[3] * 255)))
3974 : '')
3975 );
3976 };
3977
3978 cs.to.rgb = function () {
3979 var rgba = swizzle(arguments);
3980
3981 return rgba.length < 4 || rgba[3] === 1
3982 ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
3983 : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
3984 };
3985
3986 cs.to.rgb.percent = function () {
3987 var rgba = swizzle(arguments);
3988
3989 var r = Math.round(rgba[0] / 255 * 100);
3990 var g = Math.round(rgba[1] / 255 * 100);
3991 var b = Math.round(rgba[2] / 255 * 100);
3992
3993 return rgba.length < 4 || rgba[3] === 1
3994 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
3995 : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
3996 };
3997
3998 cs.to.hsl = function () {
3999 var hsla = swizzle(arguments);
4000 return hsla.length < 4 || hsla[3] === 1
4001 ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
4002 : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
4003 };
4004
4005 // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
4006 // (hwb have alpha optional & 1 is default value)
4007 cs.to.hwb = function () {
4008 var hwba = swizzle(arguments);
4009
4010 var a = '';
4011 if (hwba.length >= 4 && hwba[3] !== 1) {
4012 a = ', ' + hwba[3];
4013 }
4014
4015 return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
4016 };
4017
4018 cs.to.keyword = function (rgb) {
4019 return reverseNames[rgb.slice(0, 3)];
4020 };
4021
4022 // helpers
4023 function clamp(num, min, max) {
4024 return Math.min(Math.max(min, num), max);
4025 }
4026
4027 function hexDouble(num) {
4028 var str = Math.round(num).toString(16).toUpperCase();
4029 return (str.length < 2) ? '0' + str : str;
4030 }
4031
4032 /* MIT license */
4033
4034 /* eslint-disable no-mixed-operators */
4035 const cssKeywords = colorName;
4036
4037 // NOTE: conversions should only return primitive values (i.e. arrays, or
4038 // values that give correct `typeof` results).
4039 // do not use box values types (i.e. Number(), String(), etc.)
4040
4041 const reverseKeywords = {};
4042 for (const key of Object.keys(cssKeywords)) {
4043 reverseKeywords[cssKeywords[key]] = key;
4044 }
4045
4046 const convert$2 = {
4047 rgb: {channels: 3, labels: 'rgb'},
4048 hsl: {channels: 3, labels: 'hsl'},
4049 hsv: {channels: 3, labels: 'hsv'},
4050 hwb: {channels: 3, labels: 'hwb'},
4051 cmyk: {channels: 4, labels: 'cmyk'},
4052 xyz: {channels: 3, labels: 'xyz'},
4053 lab: {channels: 3, labels: 'lab'},
4054 lch: {channels: 3, labels: 'lch'},
4055 hex: {channels: 1, labels: ['hex']},
4056 keyword: {channels: 1, labels: ['keyword']},
4057 ansi16: {channels: 1, labels: ['ansi16']},
4058 ansi256: {channels: 1, labels: ['ansi256']},
4059 hcg: {channels: 3, labels: ['h', 'c', 'g']},
4060 apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
4061 gray: {channels: 1, labels: ['gray']}
4062 };
4063
4064 var conversions$2 = convert$2;
4065
4066 // Hide .channels and .labels properties
4067 for (const model of Object.keys(convert$2)) {
4068 if (!('channels' in convert$2[model])) {
4069 throw new Error('missing channels property: ' + model);
4070 }
4071
4072 if (!('labels' in convert$2[model])) {
4073 throw new Error('missing channel labels property: ' + model);
4074 }
4075
4076 if (convert$2[model].labels.length !== convert$2[model].channels) {
4077 throw new Error('channel and label counts mismatch: ' + model);
4078 }
4079
4080 const {channels, labels} = convert$2[model];
4081 delete convert$2[model].channels;
4082 delete convert$2[model].labels;
4083 Object.defineProperty(convert$2[model], 'channels', {value: channels});
4084 Object.defineProperty(convert$2[model], 'labels', {value: labels});
4085 }
4086
4087 convert$2.rgb.hsl = function (rgb) {
4088 const r = rgb[0] / 255;
4089 const g = rgb[1] / 255;
4090 const b = rgb[2] / 255;
4091 const min = Math.min(r, g, b);
4092 const max = Math.max(r, g, b);
4093 const delta = max - min;
4094 let h;
4095 let s;
4096
4097 if (max === min) {
4098 h = 0;
4099 } else if (r === max) {
4100 h = (g - b) / delta;
4101 } else if (g === max) {
4102 h = 2 + (b - r) / delta;
4103 } else if (b === max) {
4104 h = 4 + (r - g) / delta;
4105 }
4106
4107 h = Math.min(h * 60, 360);
4108
4109 if (h < 0) {
4110 h += 360;
4111 }
4112
4113 const l = (min + max) / 2;
4114
4115 if (max === min) {
4116 s = 0;
4117 } else if (l <= 0.5) {
4118 s = delta / (max + min);
4119 } else {
4120 s = delta / (2 - max - min);
4121 }
4122
4123 return [h, s * 100, l * 100];
4124 };
4125
4126 convert$2.rgb.hsv = function (rgb) {
4127 let rdif;
4128 let gdif;
4129 let bdif;
4130 let h;
4131 let s;
4132
4133 const r = rgb[0] / 255;
4134 const g = rgb[1] / 255;
4135 const b = rgb[2] / 255;
4136 const v = Math.max(r, g, b);
4137 const diff = v - Math.min(r, g, b);
4138 const diffc = function (c) {
4139 return (v - c) / 6 / diff + 1 / 2;
4140 };
4141
4142 if (diff === 0) {
4143 h = 0;
4144 s = 0;
4145 } else {
4146 s = diff / v;
4147 rdif = diffc(r);
4148 gdif = diffc(g);
4149 bdif = diffc(b);
4150
4151 if (r === v) {
4152 h = bdif - gdif;
4153 } else if (g === v) {
4154 h = (1 / 3) + rdif - bdif;
4155 } else if (b === v) {
4156 h = (2 / 3) + gdif - rdif;
4157 }
4158
4159 if (h < 0) {
4160 h += 1;
4161 } else if (h > 1) {
4162 h -= 1;
4163 }
4164 }
4165
4166 return [
4167 h * 360,
4168 s * 100,
4169 v * 100
4170 ];
4171 };
4172
4173 convert$2.rgb.hwb = function (rgb) {
4174 const r = rgb[0];
4175 const g = rgb[1];
4176 let b = rgb[2];
4177 const h = convert$2.rgb.hsl(rgb)[0];
4178 const w = 1 / 255 * Math.min(r, Math.min(g, b));
4179
4180 b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
4181
4182 return [h, w * 100, b * 100];
4183 };
4184
4185 convert$2.rgb.cmyk = function (rgb) {
4186 const r = rgb[0] / 255;
4187 const g = rgb[1] / 255;
4188 const b = rgb[2] / 255;
4189
4190 const k = Math.min(1 - r, 1 - g, 1 - b);
4191 const c = (1 - r - k) / (1 - k) || 0;
4192 const m = (1 - g - k) / (1 - k) || 0;
4193 const y = (1 - b - k) / (1 - k) || 0;
4194
4195 return [c * 100, m * 100, y * 100, k * 100];
4196 };
4197
4198 function comparativeDistance(x, y) {
4199 /*
4200 See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
4201 */
4202 return (
4203 ((x[0] - y[0]) ** 2) +
4204 ((x[1] - y[1]) ** 2) +
4205 ((x[2] - y[2]) ** 2)
4206 );
4207 }
4208
4209 convert$2.rgb.keyword = function (rgb) {
4210 const reversed = reverseKeywords[rgb];
4211 if (reversed) {
4212 return reversed;
4213 }
4214
4215 let currentClosestDistance = Infinity;
4216 let currentClosestKeyword;
4217
4218 for (const keyword of Object.keys(cssKeywords)) {
4219 const value = cssKeywords[keyword];
4220
4221 // Compute comparative distance
4222 const distance = comparativeDistance(rgb, value);
4223
4224 // Check if its less, if so set as closest
4225 if (distance < currentClosestDistance) {
4226 currentClosestDistance = distance;
4227 currentClosestKeyword = keyword;
4228 }
4229 }
4230
4231 return currentClosestKeyword;
4232 };
4233
4234 convert$2.keyword.rgb = function (keyword) {
4235 return cssKeywords[keyword];
4236 };
4237
4238 convert$2.rgb.xyz = function (rgb) {
4239 let r = rgb[0] / 255;
4240 let g = rgb[1] / 255;
4241 let b = rgb[2] / 255;
4242
4243 // Assume sRGB
4244 r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
4245 g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
4246 b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
4247
4248 const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
4249 const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
4250 const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
4251
4252 return [x * 100, y * 100, z * 100];
4253 };
4254
4255 convert$2.rgb.lab = function (rgb) {
4256 const xyz = convert$2.rgb.xyz(rgb);
4257 let x = xyz[0];
4258 let y = xyz[1];
4259 let z = xyz[2];
4260
4261 x /= 95.047;
4262 y /= 100;
4263 z /= 108.883;
4264
4265 x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
4266 y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
4267 z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
4268
4269 const l = (116 * y) - 16;
4270 const a = 500 * (x - y);
4271 const b = 200 * (y - z);
4272
4273 return [l, a, b];
4274 };
4275
4276 convert$2.hsl.rgb = function (hsl) {
4277 const h = hsl[0] / 360;
4278 const s = hsl[1] / 100;
4279 const l = hsl[2] / 100;
4280 let t2;
4281 let t3;
4282 let val;
4283
4284 if (s === 0) {
4285 val = l * 255;
4286 return [val, val, val];
4287 }
4288
4289 if (l < 0.5) {
4290 t2 = l * (1 + s);
4291 } else {
4292 t2 = l + s - l * s;
4293 }
4294
4295 const t1 = 2 * l - t2;
4296
4297 const rgb = [0, 0, 0];
4298 for (let i = 0; i < 3; i++) {
4299 t3 = h + 1 / 3 * -(i - 1);
4300 if (t3 < 0) {
4301 t3++;
4302 }
4303
4304 if (t3 > 1) {
4305 t3--;
4306 }
4307
4308 if (6 * t3 < 1) {
4309 val = t1 + (t2 - t1) * 6 * t3;
4310 } else if (2 * t3 < 1) {
4311 val = t2;
4312 } else if (3 * t3 < 2) {
4313 val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
4314 } else {
4315 val = t1;
4316 }
4317
4318 rgb[i] = val * 255;
4319 }
4320
4321 return rgb;
4322 };
4323
4324 convert$2.hsl.hsv = function (hsl) {
4325 const h = hsl[0];
4326 let s = hsl[1] / 100;
4327 let l = hsl[2] / 100;
4328 let smin = s;
4329 const lmin = Math.max(l, 0.01);
4330
4331 l *= 2;
4332 s *= (l <= 1) ? l : 2 - l;
4333 smin *= lmin <= 1 ? lmin : 2 - lmin;
4334 const v = (l + s) / 2;
4335 const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
4336
4337 return [h, sv * 100, v * 100];
4338 };
4339
4340 convert$2.hsv.rgb = function (hsv) {
4341 const h = hsv[0] / 60;
4342 const s = hsv[1] / 100;
4343 let v = hsv[2] / 100;
4344 const hi = Math.floor(h) % 6;
4345
4346 const f = h - Math.floor(h);
4347 const p = 255 * v * (1 - s);
4348 const q = 255 * v * (1 - (s * f));
4349 const t = 255 * v * (1 - (s * (1 - f)));
4350 v *= 255;
4351
4352 switch (hi) {
4353 case 0:
4354 return [v, t, p];
4355 case 1:
4356 return [q, v, p];
4357 case 2:
4358 return [p, v, t];
4359 case 3:
4360 return [p, q, v];
4361 case 4:
4362 return [t, p, v];
4363 case 5:
4364 return [v, p, q];
4365 }
4366 };
4367
4368 convert$2.hsv.hsl = function (hsv) {
4369 const h = hsv[0];
4370 const s = hsv[1] / 100;
4371 const v = hsv[2] / 100;
4372 const vmin = Math.max(v, 0.01);
4373 let sl;
4374 let l;
4375
4376 l = (2 - s) * v;
4377 const lmin = (2 - s) * vmin;
4378 sl = s * vmin;
4379 sl /= (lmin <= 1) ? lmin : 2 - lmin;
4380 sl = sl || 0;
4381 l /= 2;
4382
4383 return [h, sl * 100, l * 100];
4384 };
4385
4386 // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
4387 convert$2.hwb.rgb = function (hwb) {
4388 const h = hwb[0] / 360;
4389 let wh = hwb[1] / 100;
4390 let bl = hwb[2] / 100;
4391 const ratio = wh + bl;
4392 let f;
4393
4394 // Wh + bl cant be > 1
4395 if (ratio > 1) {
4396 wh /= ratio;
4397 bl /= ratio;
4398 }
4399
4400 const i = Math.floor(6 * h);
4401 const v = 1 - bl;
4402 f = 6 * h - i;
4403
4404 if ((i & 0x01) !== 0) {
4405 f = 1 - f;
4406 }
4407
4408 const n = wh + f * (v - wh); // Linear interpolation
4409
4410 let r;
4411 let g;
4412 let b;
4413 /* eslint-disable max-statements-per-line,no-multi-spaces */
4414 switch (i) {
4415 default:
4416 case 6:
4417 case 0: r = v; g = n; b = wh; break;
4418 case 1: r = n; g = v; b = wh; break;
4419 case 2: r = wh; g = v; b = n; break;
4420 case 3: r = wh; g = n; b = v; break;
4421 case 4: r = n; g = wh; b = v; break;
4422 case 5: r = v; g = wh; b = n; break;
4423 }
4424 /* eslint-enable max-statements-per-line,no-multi-spaces */
4425
4426 return [r * 255, g * 255, b * 255];
4427 };
4428
4429 convert$2.cmyk.rgb = function (cmyk) {
4430 const c = cmyk[0] / 100;
4431 const m = cmyk[1] / 100;
4432 const y = cmyk[2] / 100;
4433 const k = cmyk[3] / 100;
4434
4435 const r = 1 - Math.min(1, c * (1 - k) + k);
4436 const g = 1 - Math.min(1, m * (1 - k) + k);
4437 const b = 1 - Math.min(1, y * (1 - k) + k);
4438
4439 return [r * 255, g * 255, b * 255];
4440 };
4441
4442 convert$2.xyz.rgb = function (xyz) {
4443 const x = xyz[0] / 100;
4444 const y = xyz[1] / 100;
4445 const z = xyz[2] / 100;
4446 let r;
4447 let g;
4448 let b;
4449
4450 r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
4451 g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
4452 b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
4453
4454 // Assume sRGB
4455 r = r > 0.0031308
4456 ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
4457 : r * 12.92;
4458
4459 g = g > 0.0031308
4460 ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
4461 : g * 12.92;
4462
4463 b = b > 0.0031308
4464 ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
4465 : b * 12.92;
4466
4467 r = Math.min(Math.max(0, r), 1);
4468 g = Math.min(Math.max(0, g), 1);
4469 b = Math.min(Math.max(0, b), 1);
4470
4471 return [r * 255, g * 255, b * 255];
4472 };
4473
4474 convert$2.xyz.lab = function (xyz) {
4475 let x = xyz[0];
4476 let y = xyz[1];
4477 let z = xyz[2];
4478
4479 x /= 95.047;
4480 y /= 100;
4481 z /= 108.883;
4482
4483 x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
4484 y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
4485 z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
4486
4487 const l = (116 * y) - 16;
4488 const a = 500 * (x - y);
4489 const b = 200 * (y - z);
4490
4491 return [l, a, b];
4492 };
4493
4494 convert$2.lab.xyz = function (lab) {
4495 const l = lab[0];
4496 const a = lab[1];
4497 const b = lab[2];
4498 let x;
4499 let y;
4500 let z;
4501
4502 y = (l + 16) / 116;
4503 x = a / 500 + y;
4504 z = y - b / 200;
4505
4506 const y2 = y ** 3;
4507 const x2 = x ** 3;
4508 const z2 = z ** 3;
4509 y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
4510 x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
4511 z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
4512
4513 x *= 95.047;
4514 y *= 100;
4515 z *= 108.883;
4516
4517 return [x, y, z];
4518 };
4519
4520 convert$2.lab.lch = function (lab) {
4521 const l = lab[0];
4522 const a = lab[1];
4523 const b = lab[2];
4524 let h;
4525
4526 const hr = Math.atan2(b, a);
4527 h = hr * 360 / 2 / Math.PI;
4528
4529 if (h < 0) {
4530 h += 360;
4531 }
4532
4533 const c = Math.sqrt(a * a + b * b);
4534
4535 return [l, c, h];
4536 };
4537
4538 convert$2.lch.lab = function (lch) {
4539 const l = lch[0];
4540 const c = lch[1];
4541 const h = lch[2];
4542
4543 const hr = h / 360 * 2 * Math.PI;
4544 const a = c * Math.cos(hr);
4545 const b = c * Math.sin(hr);
4546
4547 return [l, a, b];
4548 };
4549
4550 convert$2.rgb.ansi16 = function (args, saturation = null) {
4551 const [r, g, b] = args;
4552 let value = saturation === null ? convert$2.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
4553
4554 value = Math.round(value / 50);
4555
4556 if (value === 0) {
4557 return 30;
4558 }
4559
4560 let ansi = 30
4561 + ((Math.round(b / 255) << 2)
4562 | (Math.round(g / 255) << 1)
4563 | Math.round(r / 255));
4564
4565 if (value === 2) {
4566 ansi += 60;
4567 }
4568
4569 return ansi;
4570 };
4571
4572 convert$2.hsv.ansi16 = function (args) {
4573 // Optimization here; we already know the value and don't need to get
4574 // it converted for us.
4575 return convert$2.rgb.ansi16(convert$2.hsv.rgb(args), args[2]);
4576 };
4577
4578 convert$2.rgb.ansi256 = function (args) {
4579 const r = args[0];
4580 const g = args[1];
4581 const b = args[2];
4582
4583 // We use the extended greyscale palette here, with the exception of
4584 // black and white. normal palette only has 4 greyscale shades.
4585 if (r === g && g === b) {
4586 if (r < 8) {
4587 return 16;
4588 }
4589
4590 if (r > 248) {
4591 return 231;
4592 }
4593
4594 return Math.round(((r - 8) / 247) * 24) + 232;
4595 }
4596
4597 const ansi = 16
4598 + (36 * Math.round(r / 255 * 5))
4599 + (6 * Math.round(g / 255 * 5))
4600 + Math.round(b / 255 * 5);
4601
4602 return ansi;
4603 };
4604
4605 convert$2.ansi16.rgb = function (args) {
4606 let color = args % 10;
4607
4608 // Handle greyscale
4609 if (color === 0 || color === 7) {
4610 if (args > 50) {
4611 color += 3.5;
4612 }
4613
4614 color = color / 10.5 * 255;
4615
4616 return [color, color, color];
4617 }
4618
4619 const mult = (~~(args > 50) + 1) * 0.5;
4620 const r = ((color & 1) * mult) * 255;
4621 const g = (((color >> 1) & 1) * mult) * 255;
4622 const b = (((color >> 2) & 1) * mult) * 255;
4623
4624 return [r, g, b];
4625 };
4626
4627 convert$2.ansi256.rgb = function (args) {
4628 // Handle greyscale
4629 if (args >= 232) {
4630 const c = (args - 232) * 10 + 8;
4631 return [c, c, c];
4632 }
4633
4634 args -= 16;
4635
4636 let rem;
4637 const r = Math.floor(args / 36) / 5 * 255;
4638 const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
4639 const b = (rem % 6) / 5 * 255;
4640
4641 return [r, g, b];
4642 };
4643
4644 convert$2.rgb.hex = function (args) {
4645 const integer = ((Math.round(args[0]) & 0xFF) << 16)
4646 + ((Math.round(args[1]) & 0xFF) << 8)
4647 + (Math.round(args[2]) & 0xFF);
4648
4649 const string = integer.toString(16).toUpperCase();
4650 return '000000'.substring(string.length) + string;
4651 };
4652
4653 convert$2.hex.rgb = function (args) {
4654 const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
4655 if (!match) {
4656 return [0, 0, 0];
4657 }
4658
4659 let colorString = match[0];
4660
4661 if (match[0].length === 3) {
4662 colorString = colorString.split('').map(char => {
4663 return char + char;
4664 }).join('');
4665 }
4666
4667 const integer = parseInt(colorString, 16);
4668 const r = (integer >> 16) & 0xFF;
4669 const g = (integer >> 8) & 0xFF;
4670 const b = integer & 0xFF;
4671
4672 return [r, g, b];
4673 };
4674
4675 convert$2.rgb.hcg = function (rgb) {
4676 const r = rgb[0] / 255;
4677 const g = rgb[1] / 255;
4678 const b = rgb[2] / 255;
4679 const max = Math.max(Math.max(r, g), b);
4680 const min = Math.min(Math.min(r, g), b);
4681 const chroma = (max - min);
4682 let grayscale;
4683 let hue;
4684
4685 if (chroma < 1) {
4686 grayscale = min / (1 - chroma);
4687 } else {
4688 grayscale = 0;
4689 }
4690
4691 if (chroma <= 0) {
4692 hue = 0;
4693 } else
4694 if (max === r) {
4695 hue = ((g - b) / chroma) % 6;
4696 } else
4697 if (max === g) {
4698 hue = 2 + (b - r) / chroma;
4699 } else {
4700 hue = 4 + (r - g) / chroma;
4701 }
4702
4703 hue /= 6;
4704 hue %= 1;
4705
4706 return [hue * 360, chroma * 100, grayscale * 100];
4707 };
4708
4709 convert$2.hsl.hcg = function (hsl) {
4710 const s = hsl[1] / 100;
4711 const l = hsl[2] / 100;
4712
4713 const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
4714
4715 let f = 0;
4716 if (c < 1.0) {
4717 f = (l - 0.5 * c) / (1.0 - c);
4718 }
4719
4720 return [hsl[0], c * 100, f * 100];
4721 };
4722
4723 convert$2.hsv.hcg = function (hsv) {
4724 const s = hsv[1] / 100;
4725 const v = hsv[2] / 100;
4726
4727 const c = s * v;
4728 let f = 0;
4729
4730 if (c < 1.0) {
4731 f = (v - c) / (1 - c);
4732 }
4733
4734 return [hsv[0], c * 100, f * 100];
4735 };
4736
4737 convert$2.hcg.rgb = function (hcg) {
4738 const h = hcg[0] / 360;
4739 const c = hcg[1] / 100;
4740 const g = hcg[2] / 100;
4741
4742 if (c === 0.0) {
4743 return [g * 255, g * 255, g * 255];
4744 }
4745
4746 const pure = [0, 0, 0];
4747 const hi = (h % 1) * 6;
4748 const v = hi % 1;
4749 const w = 1 - v;
4750 let mg = 0;
4751
4752 /* eslint-disable max-statements-per-line */
4753 switch (Math.floor(hi)) {
4754 case 0:
4755 pure[0] = 1; pure[1] = v; pure[2] = 0; break;
4756 case 1:
4757 pure[0] = w; pure[1] = 1; pure[2] = 0; break;
4758 case 2:
4759 pure[0] = 0; pure[1] = 1; pure[2] = v; break;
4760 case 3:
4761 pure[0] = 0; pure[1] = w; pure[2] = 1; break;
4762 case 4:
4763 pure[0] = v; pure[1] = 0; pure[2] = 1; break;
4764 default:
4765 pure[0] = 1; pure[1] = 0; pure[2] = w;
4766 }
4767 /* eslint-enable max-statements-per-line */
4768
4769 mg = (1.0 - c) * g;
4770
4771 return [
4772 (c * pure[0] + mg) * 255,
4773 (c * pure[1] + mg) * 255,
4774 (c * pure[2] + mg) * 255
4775 ];
4776 };
4777
4778 convert$2.hcg.hsv = function (hcg) {
4779 const c = hcg[1] / 100;
4780 const g = hcg[2] / 100;
4781
4782 const v = c + g * (1.0 - c);
4783 let f = 0;
4784
4785 if (v > 0.0) {
4786 f = c / v;
4787 }
4788
4789 return [hcg[0], f * 100, v * 100];
4790 };
4791
4792 convert$2.hcg.hsl = function (hcg) {
4793 const c = hcg[1] / 100;
4794 const g = hcg[2] / 100;
4795
4796 const l = g * (1.0 - c) + 0.5 * c;
4797 let s = 0;
4798
4799 if (l > 0.0 && l < 0.5) {
4800 s = c / (2 * l);
4801 } else
4802 if (l >= 0.5 && l < 1.0) {
4803 s = c / (2 * (1 - l));
4804 }
4805
4806 return [hcg[0], s * 100, l * 100];
4807 };
4808
4809 convert$2.hcg.hwb = function (hcg) {
4810 const c = hcg[1] / 100;
4811 const g = hcg[2] / 100;
4812 const v = c + g * (1.0 - c);
4813 return [hcg[0], (v - c) * 100, (1 - v) * 100];
4814 };
4815
4816 convert$2.hwb.hcg = function (hwb) {
4817 const w = hwb[1] / 100;
4818 const b = hwb[2] / 100;
4819 const v = 1 - b;
4820 const c = v - w;
4821 let g = 0;
4822
4823 if (c < 1) {
4824 g = (v - c) / (1 - c);
4825 }
4826
4827 return [hwb[0], c * 100, g * 100];
4828 };
4829
4830 convert$2.apple.rgb = function (apple) {
4831 return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
4832 };
4833
4834 convert$2.rgb.apple = function (rgb) {
4835 return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
4836 };
4837
4838 convert$2.gray.rgb = function (args) {
4839 return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
4840 };
4841
4842 convert$2.gray.hsl = function (args) {
4843 return [0, 0, args[0]];
4844 };
4845
4846 convert$2.gray.hsv = convert$2.gray.hsl;
4847
4848 convert$2.gray.hwb = function (gray) {
4849 return [0, 100, gray[0]];
4850 };
4851
4852 convert$2.gray.cmyk = function (gray) {
4853 return [0, 0, 0, gray[0]];
4854 };
4855
4856 convert$2.gray.lab = function (gray) {
4857 return [gray[0], 0, 0];
4858 };
4859
4860 convert$2.gray.hex = function (gray) {
4861 const val = Math.round(gray[0] / 100 * 255) & 0xFF;
4862 const integer = (val << 16) + (val << 8) + val;
4863
4864 const string = integer.toString(16).toUpperCase();
4865 return '000000'.substring(string.length) + string;
4866 };
4867
4868 convert$2.rgb.gray = function (rgb) {
4869 const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
4870 return [val / 255 * 100];
4871 };
4872
4873 const conversions$1 = conversions$2;
4874
4875 /*
4876 This function routes a model to all other models.
4877
4878 all functions that are routed have a property `.conversion` attached
4879 to the returned synthetic function. This property is an array
4880 of strings, each with the steps in between the 'from' and 'to'
4881 color models (inclusive).
4882
4883 conversions that are not possible simply are not included.
4884 */
4885
4886 function buildGraph() {
4887 const graph = {};
4888 // https://jsperf.com/object-keys-vs-for-in-with-closure/3
4889 const models = Object.keys(conversions$1);
4890
4891 for (let len = models.length, i = 0; i < len; i++) {
4892 graph[models[i]] = {
4893 // http://jsperf.com/1-vs-infinity
4894 // micro-opt, but this is simple.
4895 distance: -1,
4896 parent: null
4897 };
4898 }
4899
4900 return graph;
4901 }
4902
4903 // https://en.wikipedia.org/wiki/Breadth-first_search
4904 function deriveBFS(fromModel) {
4905 const graph = buildGraph();
4906 const queue = [fromModel]; // Unshift -> queue -> pop
4907
4908 graph[fromModel].distance = 0;
4909
4910 while (queue.length) {
4911 const current = queue.pop();
4912 const adjacents = Object.keys(conversions$1[current]);
4913
4914 for (let len = adjacents.length, i = 0; i < len; i++) {
4915 const adjacent = adjacents[i];
4916 const node = graph[adjacent];
4917
4918 if (node.distance === -1) {
4919 node.distance = graph[current].distance + 1;
4920 node.parent = current;
4921 queue.unshift(adjacent);
4922 }
4923 }
4924 }
4925
4926 return graph;
4927 }
4928
4929 function link(from, to) {
4930 return function (args) {
4931 return to(from(args));
4932 };
4933 }
4934
4935 function wrapConversion(toModel, graph) {
4936 const path = [graph[toModel].parent, toModel];
4937 let fn = conversions$1[graph[toModel].parent][toModel];
4938
4939 let cur = graph[toModel].parent;
4940 while (graph[cur].parent) {
4941 path.unshift(graph[cur].parent);
4942 fn = link(conversions$1[graph[cur].parent][cur], fn);
4943 cur = graph[cur].parent;
4944 }
4945
4946 fn.conversion = path;
4947 return fn;
4948 }
4949
4950 var route$1 = function (fromModel) {
4951 const graph = deriveBFS(fromModel);
4952 const conversion = {};
4953
4954 const models = Object.keys(graph);
4955 for (let len = models.length, i = 0; i < len; i++) {
4956 const toModel = models[i];
4957 const node = graph[toModel];
4958
4959 if (node.parent === null) {
4960 // No possible conversion, or this node is the source model.
4961 continue;
4962 }
4963
4964 conversion[toModel] = wrapConversion(toModel, graph);
4965 }
4966
4967 return conversion;
4968 };
4969
4970 const conversions = conversions$2;
4971 const route = route$1;
4972
4973 const convert$1 = {};
4974
4975 const models = Object.keys(conversions);
4976
4977 function wrapRaw(fn) {
4978 const wrappedFn = function (...args) {
4979 const arg0 = args[0];
4980 if (arg0 === undefined || arg0 === null) {
4981 return arg0;
4982 }
4983
4984 if (arg0.length > 1) {
4985 args = arg0;
4986 }
4987
4988 return fn(args);
4989 };
4990
4991 // Preserve .conversion property if there is one
4992 if ('conversion' in fn) {
4993 wrappedFn.conversion = fn.conversion;
4994 }
4995
4996 return wrappedFn;
4997 }
4998
4999 function wrapRounded(fn) {
5000 const wrappedFn = function (...args) {
5001 const arg0 = args[0];
5002
5003 if (arg0 === undefined || arg0 === null) {
5004 return arg0;
5005 }
5006
5007 if (arg0.length > 1) {
5008 args = arg0;
5009 }
5010
5011 const result = fn(args);
5012
5013 // We're assuming the result is an array here.
5014 // see notice in conversions.js; don't use box types
5015 // in conversion functions.
5016 if (typeof result === 'object') {
5017 for (let len = result.length, i = 0; i < len; i++) {
5018 result[i] = Math.round(result[i]);
5019 }
5020 }
5021
5022 return result;
5023 };
5024
5025 // Preserve .conversion property if there is one
5026 if ('conversion' in fn) {
5027 wrappedFn.conversion = fn.conversion;
5028 }
5029
5030 return wrappedFn;
5031 }
5032
5033 models.forEach(fromModel => {
5034 convert$1[fromModel] = {};
5035
5036 Object.defineProperty(convert$1[fromModel], 'channels', {value: conversions[fromModel].channels});
5037 Object.defineProperty(convert$1[fromModel], 'labels', {value: conversions[fromModel].labels});
5038
5039 const routes = route(fromModel);
5040 const routeModels = Object.keys(routes);
5041
5042 routeModels.forEach(toModel => {
5043 const fn = routes[toModel];
5044
5045 convert$1[fromModel][toModel] = wrapRounded(fn);
5046 convert$1[fromModel][toModel].raw = wrapRaw(fn);
5047 });
5048 });
5049
5050 var colorConvert = convert$1;
5051
5052 const colorString = colorString$1.exports;
5053 const convert = colorConvert;
5054
5055 const skippedModels = [
5056 // To be honest, I don't really feel like keyword belongs in color convert, but eh.
5057 'keyword',
5058
5059 // Gray conflicts with some method names, and has its own method defined.
5060 'gray',
5061
5062 // Shouldn't really be in color-convert either...
5063 'hex',
5064 ];
5065
5066 const hashedModelKeys = {};
5067 for (const model of Object.keys(convert)) {
5068 hashedModelKeys[[...convert[model].labels].sort().join('')] = model;
5069 }
5070
5071 const limiters = {};
5072
5073 function Color(object, model) {
5074 if (!(this instanceof Color)) {
5075 return new Color(object, model);
5076 }
5077
5078 if (model && model in skippedModels) {
5079 model = null;
5080 }
5081
5082 if (model && !(model in convert)) {
5083 throw new Error('Unknown model: ' + model);
5084 }
5085
5086 let i;
5087 let channels;
5088
5089 if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
5090 this.model = 'rgb';
5091 this.color = [0, 0, 0];
5092 this.valpha = 1;
5093 } else if (object instanceof Color) {
5094 this.model = object.model;
5095 this.color = [...object.color];
5096 this.valpha = object.valpha;
5097 } else if (typeof object === 'string') {
5098 const result = colorString.get(object);
5099 if (result === null) {
5100 throw new Error('Unable to parse color from string: ' + object);
5101 }
5102
5103 this.model = result.model;
5104 channels = convert[this.model].channels;
5105 this.color = result.value.slice(0, channels);
5106 this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
5107 } else if (object.length > 0) {
5108 this.model = model || 'rgb';
5109 channels = convert[this.model].channels;
5110 const newArray = Array.prototype.slice.call(object, 0, channels);
5111 this.color = zeroArray(newArray, channels);
5112 this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
5113 } else if (typeof object === 'number') {
5114 // This is always RGB - can be converted later on.
5115 this.model = 'rgb';
5116 this.color = [
5117 (object >> 16) & 0xFF,
5118 (object >> 8) & 0xFF,
5119 object & 0xFF,
5120 ];
5121 this.valpha = 1;
5122 } else {
5123 this.valpha = 1;
5124
5125 const keys = Object.keys(object);
5126 if ('alpha' in object) {
5127 keys.splice(keys.indexOf('alpha'), 1);
5128 this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
5129 }
5130
5131 const hashedKeys = keys.sort().join('');
5132 if (!(hashedKeys in hashedModelKeys)) {
5133 throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
5134 }
5135
5136 this.model = hashedModelKeys[hashedKeys];
5137
5138 const {labels} = convert[this.model];
5139 const color = [];
5140 for (i = 0; i < labels.length; i++) {
5141 color.push(object[labels[i]]);
5142 }
5143
5144 this.color = zeroArray(color);
5145 }
5146
5147 // Perform limitations (clamping, etc.)
5148 if (limiters[this.model]) {
5149 channels = convert[this.model].channels;
5150 for (i = 0; i < channels; i++) {
5151 const limit = limiters[this.model][i];
5152 if (limit) {
5153 this.color[i] = limit(this.color[i]);
5154 }
5155 }
5156 }
5157
5158 this.valpha = Math.max(0, Math.min(1, this.valpha));
5159
5160 if (Object.freeze) {
5161 Object.freeze(this);
5162 }
5163 }
5164
5165 Color.prototype = {
5166 toString() {
5167 return this.string();
5168 },
5169
5170 toJSON() {
5171 return this[this.model]();
5172 },
5173
5174 string(places) {
5175 let self = this.model in colorString.to ? this : this.rgb();
5176 self = self.round(typeof places === 'number' ? places : 1);
5177 const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
5178 return colorString.to[self.model](args);
5179 },
5180
5181 percentString(places) {
5182 const self = this.rgb().round(typeof places === 'number' ? places : 1);
5183 const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
5184 return colorString.to.rgb.percent(args);
5185 },
5186
5187 array() {
5188 return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
5189 },
5190
5191 object() {
5192 const result = {};
5193 const {channels} = convert[this.model];
5194 const {labels} = convert[this.model];
5195
5196 for (let i = 0; i < channels; i++) {
5197 result[labels[i]] = this.color[i];
5198 }
5199
5200 if (this.valpha !== 1) {
5201 result.alpha = this.valpha;
5202 }
5203
5204 return result;
5205 },
5206
5207 unitArray() {
5208 const rgb = this.rgb().color;
5209 rgb[0] /= 255;
5210 rgb[1] /= 255;
5211 rgb[2] /= 255;
5212
5213 if (this.valpha !== 1) {
5214 rgb.push(this.valpha);
5215 }
5216
5217 return rgb;
5218 },
5219
5220 unitObject() {
5221 const rgb = this.rgb().object();
5222 rgb.r /= 255;
5223 rgb.g /= 255;
5224 rgb.b /= 255;
5225
5226 if (this.valpha !== 1) {
5227 rgb.alpha = this.valpha;
5228 }
5229
5230 return rgb;
5231 },
5232
5233 round(places) {
5234 places = Math.max(places || 0, 0);
5235 return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
5236 },
5237
5238 alpha(value) {
5239 if (value !== undefined) {
5240 return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
5241 }
5242
5243 return this.valpha;
5244 },
5245
5246 // Rgb
5247 red: getset('rgb', 0, maxfn(255)),
5248 green: getset('rgb', 1, maxfn(255)),
5249 blue: getset('rgb', 2, maxfn(255)),
5250
5251 hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
5252
5253 saturationl: getset('hsl', 1, maxfn(100)),
5254 lightness: getset('hsl', 2, maxfn(100)),
5255
5256 saturationv: getset('hsv', 1, maxfn(100)),
5257 value: getset('hsv', 2, maxfn(100)),
5258
5259 chroma: getset('hcg', 1, maxfn(100)),
5260 gray: getset('hcg', 2, maxfn(100)),
5261
5262 white: getset('hwb', 1, maxfn(100)),
5263 wblack: getset('hwb', 2, maxfn(100)),
5264
5265 cyan: getset('cmyk', 0, maxfn(100)),
5266 magenta: getset('cmyk', 1, maxfn(100)),
5267 yellow: getset('cmyk', 2, maxfn(100)),
5268 black: getset('cmyk', 3, maxfn(100)),
5269
5270 x: getset('xyz', 0, maxfn(95.047)),
5271 y: getset('xyz', 1, maxfn(100)),
5272 z: getset('xyz', 2, maxfn(108.833)),
5273
5274 l: getset('lab', 0, maxfn(100)),
5275 a: getset('lab', 1),
5276 b: getset('lab', 2),
5277
5278 keyword(value) {
5279 if (value !== undefined) {
5280 return new Color(value);
5281 }
5282
5283 return convert[this.model].keyword(this.color);
5284 },
5285
5286 hex(value) {
5287 if (value !== undefined) {
5288 return new Color(value);
5289 }
5290
5291 return colorString.to.hex(this.rgb().round().color);
5292 },
5293
5294 hexa(value) {
5295 if (value !== undefined) {
5296 return new Color(value);
5297 }
5298
5299 const rgbArray = this.rgb().round().color;
5300
5301 let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
5302 if (alphaHex.length === 1) {
5303 alphaHex = '0' + alphaHex;
5304 }
5305
5306 return colorString.to.hex(rgbArray) + alphaHex;
5307 },
5308
5309 rgbNumber() {
5310 const rgb = this.rgb().color;
5311 return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
5312 },
5313
5314 luminosity() {
5315 // http://www.w3.org/TR/WCAG20/#relativeluminancedef
5316 const rgb = this.rgb().color;
5317
5318 const lum = [];
5319 for (const [i, element] of rgb.entries()) {
5320 const chan = element / 255;
5321 lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
5322 }
5323
5324 return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
5325 },
5326
5327 contrast(color2) {
5328 // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
5329 const lum1 = this.luminosity();
5330 const lum2 = color2.luminosity();
5331
5332 if (lum1 > lum2) {
5333 return (lum1 + 0.05) / (lum2 + 0.05);
5334 }
5335
5336 return (lum2 + 0.05) / (lum1 + 0.05);
5337 },
5338
5339 level(color2) {
5340 // https://www.w3.org/TR/WCAG/#contrast-enhanced
5341 const contrastRatio = this.contrast(color2);
5342 if (contrastRatio >= 7) {
5343 return 'AAA';
5344 }
5345
5346 return (contrastRatio >= 4.5) ? 'AA' : '';
5347 },
5348
5349 isDark() {
5350 // YIQ equation from http://24ways.org/2010/calculating-color-contrast
5351 const rgb = this.rgb().color;
5352 const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
5353 return yiq < 128;
5354 },
5355
5356 isLight() {
5357 return !this.isDark();
5358 },
5359
5360 negate() {
5361 const rgb = this.rgb();
5362 for (let i = 0; i < 3; i++) {
5363 rgb.color[i] = 255 - rgb.color[i];
5364 }
5365
5366 return rgb;
5367 },
5368
5369 lighten(ratio) {
5370 const hsl = this.hsl();
5371 hsl.color[2] += hsl.color[2] * ratio;
5372 return hsl;
5373 },
5374
5375 darken(ratio) {
5376 const hsl = this.hsl();
5377 hsl.color[2] -= hsl.color[2] * ratio;
5378 return hsl;
5379 },
5380
5381 saturate(ratio) {
5382 const hsl = this.hsl();
5383 hsl.color[1] += hsl.color[1] * ratio;
5384 return hsl;
5385 },
5386
5387 desaturate(ratio) {
5388 const hsl = this.hsl();
5389 hsl.color[1] -= hsl.color[1] * ratio;
5390 return hsl;
5391 },
5392
5393 whiten(ratio) {
5394 const hwb = this.hwb();
5395 hwb.color[1] += hwb.color[1] * ratio;
5396 return hwb;
5397 },
5398
5399 blacken(ratio) {
5400 const hwb = this.hwb();
5401 hwb.color[2] += hwb.color[2] * ratio;
5402 return hwb;
5403 },
5404
5405 grayscale() {
5406 // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
5407 const rgb = this.rgb().color;
5408 const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
5409 return Color.rgb(value, value, value);
5410 },
5411
5412 fade(ratio) {
5413 return this.alpha(this.valpha - (this.valpha * ratio));
5414 },
5415
5416 opaquer(ratio) {
5417 return this.alpha(this.valpha + (this.valpha * ratio));
5418 },
5419
5420 rotate(degrees) {
5421 const hsl = this.hsl();
5422 let hue = hsl.color[0];
5423 hue = (hue + degrees) % 360;
5424 hue = hue < 0 ? 360 + hue : hue;
5425 hsl.color[0] = hue;
5426 return hsl;
5427 },
5428
5429 mix(mixinColor, weight) {
5430 // Ported from sass implementation in C
5431 // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
5432 if (!mixinColor || !mixinColor.rgb) {
5433 throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
5434 }
5435
5436 const color1 = mixinColor.rgb();
5437 const color2 = this.rgb();
5438 const p = weight === undefined ? 0.5 : weight;
5439
5440 const w = 2 * p - 1;
5441 const a = color1.alpha() - color2.alpha();
5442
5443 const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
5444 const w2 = 1 - w1;
5445
5446 return Color.rgb(
5447 w1 * color1.red() + w2 * color2.red(),
5448 w1 * color1.green() + w2 * color2.green(),
5449 w1 * color1.blue() + w2 * color2.blue(),
5450 color1.alpha() * p + color2.alpha() * (1 - p));
5451 },
5452 };
5453
5454 // Model conversion methods and static constructors
5455 for (const model of Object.keys(convert)) {
5456 if (skippedModels.includes(model)) {
5457 continue;
5458 }
5459
5460 const {channels} = convert[model];
5461
5462 // Conversion methods
5463 Color.prototype[model] = function (...args) {
5464 if (this.model === model) {
5465 return new Color(this);
5466 }
5467
5468 if (args.length > 0) {
5469 return new Color(args, model);
5470 }
5471
5472 return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);
5473 };
5474
5475 // 'static' construction methods
5476 Color[model] = function (...args) {
5477 let color = args[0];
5478 if (typeof color === 'number') {
5479 color = zeroArray(args, channels);
5480 }
5481
5482 return new Color(color, model);
5483 };
5484 }
5485
5486 function roundTo(number, places) {
5487 return Number(number.toFixed(places));
5488 }
5489
5490 function roundToPlace(places) {
5491 return function (number) {
5492 return roundTo(number, places);
5493 };
5494 }
5495
5496 function getset(model, channel, modifier) {
5497 model = Array.isArray(model) ? model : [model];
5498
5499 for (const m of model) {
5500 (limiters[m] || (limiters[m] = []))[channel] = modifier;
5501 }
5502
5503 model = model[0];
5504
5505 return function (value) {
5506 let result;
5507
5508 if (value !== undefined) {
5509 if (modifier) {
5510 value = modifier(value);
5511 }
5512
5513 result = this[model]();
5514 result.color[channel] = value;
5515 return result;
5516 }
5517
5518 result = this[model]().color[channel];
5519 if (modifier) {
5520 result = modifier(result);
5521 }
5522
5523 return result;
5524 };
5525 }
5526
5527 function maxfn(max) {
5528 return function (v) {
5529 return Math.max(0, Math.min(max, v));
5530 };
5531 }
5532
5533 function assertArray(value) {
5534 return Array.isArray(value) ? value : [value];
5535 }
5536
5537 function zeroArray(array, length) {
5538 for (let i = 0; i < length; i++) {
5539 if (typeof array[i] !== 'number') {
5540 array[i] = 0;
5541 }
5542 }
5543
5544 return array;
5545 }
5546
5547 var color = Color;
5548
5549 /**
5550 * lodash (Custom Build) <https://lodash.com/>
5551 * Build: `lodash modularize exports="npm" -o ./`
5552 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
5553 * Released under MIT license <https://lodash.com/license>
5554 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
5555 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5556 */
5557
5558 /** Used as the `TypeError` message for "Functions" methods. */
5559 var FUNC_ERROR_TEXT = 'Expected a function';
5560
5561 /** Used as the internal argument placeholder. */
5562 var PLACEHOLDER = '__lodash_placeholder__';
5563
5564 /** Used to compose bitmasks for function metadata. */
5565 var BIND_FLAG = 1,
5566 BIND_KEY_FLAG = 2,
5567 CURRY_BOUND_FLAG = 4,
5568 CURRY_FLAG = 8,
5569 CURRY_RIGHT_FLAG = 16,
5570 PARTIAL_FLAG = 32,
5571 PARTIAL_RIGHT_FLAG = 64,
5572 ARY_FLAG = 128,
5573 REARG_FLAG = 256,
5574 FLIP_FLAG = 512;
5575
5576 /** Used as references for various `Number` constants. */
5577 var INFINITY = 1 / 0,
5578 MAX_SAFE_INTEGER = 9007199254740991,
5579 MAX_INTEGER = 1.7976931348623157e+308,
5580 NAN = 0 / 0;
5581
5582 /** Used to associate wrap methods with their bit flags. */
5583 var wrapFlags = [
5584 ['ary', ARY_FLAG],
5585 ['bind', BIND_FLAG],
5586 ['bindKey', BIND_KEY_FLAG],
5587 ['curry', CURRY_FLAG],
5588 ['curryRight', CURRY_RIGHT_FLAG],
5589 ['flip', FLIP_FLAG],
5590 ['partial', PARTIAL_FLAG],
5591 ['partialRight', PARTIAL_RIGHT_FLAG],
5592 ['rearg', REARG_FLAG]
5593 ];
5594
5595 /** `Object#toString` result references. */
5596 var funcTag = '[object Function]',
5597 genTag = '[object GeneratorFunction]',
5598 symbolTag = '[object Symbol]';
5599
5600 /**
5601 * Used to match `RegExp`
5602 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
5603 */
5604 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
5605
5606 /** Used to match leading and trailing whitespace. */
5607 var reTrim = /^\s+|\s+$/g;
5608
5609 /** Used to match wrap detail comments. */
5610 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
5611 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
5612 reSplitDetails = /,? & /;
5613
5614 /** Used to detect bad signed hexadecimal string values. */
5615 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5616
5617 /** Used to detect binary string values. */
5618 var reIsBinary = /^0b[01]+$/i;
5619
5620 /** Used to detect host constructors (Safari). */
5621 var reIsHostCtor = /^\[object .+?Constructor\]$/;
5622
5623 /** Used to detect octal string values. */
5624 var reIsOctal = /^0o[0-7]+$/i;
5625
5626 /** Used to detect unsigned integer values. */
5627 var reIsUint = /^(?:0|[1-9]\d*)$/;
5628
5629 /** Built-in method references without a dependency on `root`. */
5630 var freeParseInt = parseInt;
5631
5632 /** Detect free variable `global` from Node.js. */
5633 var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
5634
5635 /** Detect free variable `self`. */
5636 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
5637
5638 /** Used as a reference to the global object. */
5639 var root = freeGlobal || freeSelf || Function('return this')();
5640
5641 /**
5642 * A faster alternative to `Function#apply`, this function invokes `func`
5643 * with the `this` binding of `thisArg` and the arguments of `args`.
5644 *
5645 * @private
5646 * @param {Function} func The function to invoke.
5647 * @param {*} thisArg The `this` binding of `func`.
5648 * @param {Array} args The arguments to invoke `func` with.
5649 * @returns {*} Returns the result of `func`.
5650 */
5651 function apply(func, thisArg, args) {
5652 switch (args.length) {
5653 case 0: return func.call(thisArg);
5654 case 1: return func.call(thisArg, args[0]);
5655 case 2: return func.call(thisArg, args[0], args[1]);
5656 case 3: return func.call(thisArg, args[0], args[1], args[2]);
5657 }
5658 return func.apply(thisArg, args);
5659 }
5660
5661 /**
5662 * A specialized version of `_.forEach` for arrays without support for
5663 * iteratee shorthands.
5664 *
5665 * @private
5666 * @param {Array} [array] The array to iterate over.
5667 * @param {Function} iteratee The function invoked per iteration.
5668 * @returns {Array} Returns `array`.
5669 */
5670 function arrayEach(array, iteratee) {
5671 var index = -1,
5672 length = array ? array.length : 0;
5673
5674 while (++index < length) {
5675 if (iteratee(array[index], index, array) === false) {
5676 break;
5677 }
5678 }
5679 return array;
5680 }
5681
5682 /**
5683 * A specialized version of `_.includes` for arrays without support for
5684 * specifying an index to search from.
5685 *
5686 * @private
5687 * @param {Array} [array] The array to inspect.
5688 * @param {*} target The value to search for.
5689 * @returns {boolean} Returns `true` if `target` is found, else `false`.
5690 */
5691 function arrayIncludes(array, value) {
5692 var length = array ? array.length : 0;
5693 return !!length && baseIndexOf(array, value, 0) > -1;
5694 }
5695
5696 /**
5697 * The base implementation of `_.findIndex` and `_.findLastIndex` without
5698 * support for iteratee shorthands.
5699 *
5700 * @private
5701 * @param {Array} array The array to inspect.
5702 * @param {Function} predicate The function invoked per iteration.
5703 * @param {number} fromIndex The index to search from.
5704 * @param {boolean} [fromRight] Specify iterating from right to left.
5705 * @returns {number} Returns the index of the matched value, else `-1`.
5706 */
5707 function baseFindIndex(array, predicate, fromIndex, fromRight) {
5708 var length = array.length,
5709 index = fromIndex + (fromRight ? 1 : -1);
5710
5711 while ((fromRight ? index-- : ++index < length)) {
5712 if (predicate(array[index], index, array)) {
5713 return index;
5714 }
5715 }
5716 return -1;
5717 }
5718
5719 /**
5720 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
5721 *
5722 * @private
5723 * @param {Array} array The array to inspect.
5724 * @param {*} value The value to search for.
5725 * @param {number} fromIndex The index to search from.
5726 * @returns {number} Returns the index of the matched value, else `-1`.
5727 */
5728 function baseIndexOf(array, value, fromIndex) {
5729 if (value !== value) {
5730 return baseFindIndex(array, baseIsNaN, fromIndex);
5731 }
5732 var index = fromIndex - 1,
5733 length = array.length;
5734
5735 while (++index < length) {
5736 if (array[index] === value) {
5737 return index;
5738 }
5739 }
5740 return -1;
5741 }
5742
5743 /**
5744 * The base implementation of `_.isNaN` without support for number objects.
5745 *
5746 * @private
5747 * @param {*} value The value to check.
5748 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
5749 */
5750 function baseIsNaN(value) {
5751 return value !== value;
5752 }
5753
5754 /**
5755 * Gets the number of `placeholder` occurrences in `array`.
5756 *
5757 * @private
5758 * @param {Array} array The array to inspect.
5759 * @param {*} placeholder The placeholder to search for.
5760 * @returns {number} Returns the placeholder count.
5761 */
5762 function countHolders(array, placeholder) {
5763 var length = array.length,
5764 result = 0;
5765
5766 while (length--) {
5767 if (array[length] === placeholder) {
5768 result++;
5769 }
5770 }
5771 return result;
5772 }
5773
5774 /**
5775 * Gets the value at `key` of `object`.
5776 *
5777 * @private
5778 * @param {Object} [object] The object to query.
5779 * @param {string} key The key of the property to get.
5780 * @returns {*} Returns the property value.
5781 */
5782 function getValue(object, key) {
5783 return object == null ? undefined : object[key];
5784 }
5785
5786 /**
5787 * Checks if `value` is a host object in IE < 9.
5788 *
5789 * @private
5790 * @param {*} value The value to check.
5791 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
5792 */
5793 function isHostObject(value) {
5794 // Many host objects are `Object` objects that can coerce to strings
5795 // despite having improperly defined `toString` methods.
5796 var result = false;
5797 if (value != null && typeof value.toString != 'function') {
5798 try {
5799 result = !!(value + '');
5800 } catch (e) {}
5801 }
5802 return result;
5803 }
5804
5805 /**
5806 * Replaces all `placeholder` elements in `array` with an internal placeholder
5807 * and returns an array of their indexes.
5808 *
5809 * @private
5810 * @param {Array} array The array to modify.
5811 * @param {*} placeholder The placeholder to replace.
5812 * @returns {Array} Returns the new array of placeholder indexes.
5813 */
5814 function replaceHolders(array, placeholder) {
5815 var index = -1,
5816 length = array.length,
5817 resIndex = 0,
5818 result = [];
5819
5820 while (++index < length) {
5821 var value = array[index];
5822 if (value === placeholder || value === PLACEHOLDER) {
5823 array[index] = PLACEHOLDER;
5824 result[resIndex++] = index;
5825 }
5826 }
5827 return result;
5828 }
5829
5830 /** Used for built-in method references. */
5831 var funcProto = Function.prototype,
5832 objectProto = Object.prototype;
5833
5834 /** Used to detect overreaching core-js shims. */
5835 var coreJsData = root['__core-js_shared__'];
5836
5837 /** Used to detect methods masquerading as native. */
5838 var maskSrcKey = (function() {
5839 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
5840 return uid ? ('Symbol(src)_1.' + uid) : '';
5841 }());
5842
5843 /** Used to resolve the decompiled source of functions. */
5844 var funcToString = funcProto.toString;
5845
5846 /** Used to check objects for own properties. */
5847 var hasOwnProperty = objectProto.hasOwnProperty;
5848
5849 /**
5850 * Used to resolve the
5851 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
5852 * of values.
5853 */
5854 var objectToString = objectProto.toString;
5855
5856 /** Used to detect if a method is native. */
5857 var reIsNative = RegExp('^' +
5858 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
5859 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
5860 );
5861
5862 /** Built-in value references. */
5863 var objectCreate = Object.create;
5864
5865 /* Built-in method references for those with the same name as other `lodash` methods. */
5866 var nativeMax = Math.max,
5867 nativeMin = Math.min;
5868
5869 /* Used to set `toString` methods. */
5870 var defineProperty = (function() {
5871 var func = getNative(Object, 'defineProperty'),
5872 name = getNative.name;
5873
5874 return (name && name.length > 2) ? func : undefined;
5875 }());
5876
5877 /**
5878 * The base implementation of `_.create` without support for assigning
5879 * properties to the created object.
5880 *
5881 * @private
5882 * @param {Object} prototype The object to inherit from.
5883 * @returns {Object} Returns the new object.
5884 */
5885 function baseCreate(proto) {
5886 return isObject(proto) ? objectCreate(proto) : {};
5887 }
5888
5889 /**
5890 * The base implementation of `_.isNative` without bad shim checks.
5891 *
5892 * @private
5893 * @param {*} value The value to check.
5894 * @returns {boolean} Returns `true` if `value` is a native function,
5895 * else `false`.
5896 */
5897 function baseIsNative(value) {
5898 if (!isObject(value) || isMasked(value)) {
5899 return false;
5900 }
5901 var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
5902 return pattern.test(toSource(value));
5903 }
5904
5905 /**
5906 * Creates an array that is the composition of partially applied arguments,
5907 * placeholders, and provided arguments into a single array of arguments.
5908 *
5909 * @private
5910 * @param {Array} args The provided arguments.
5911 * @param {Array} partials The arguments to prepend to those provided.
5912 * @param {Array} holders The `partials` placeholder indexes.
5913 * @params {boolean} [isCurried] Specify composing for a curried function.
5914 * @returns {Array} Returns the new array of composed arguments.
5915 */
5916 function composeArgs(args, partials, holders, isCurried) {
5917 var argsIndex = -1,
5918 argsLength = args.length,
5919 holdersLength = holders.length,
5920 leftIndex = -1,
5921 leftLength = partials.length,
5922 rangeLength = nativeMax(argsLength - holdersLength, 0),
5923 result = Array(leftLength + rangeLength),
5924 isUncurried = !isCurried;
5925
5926 while (++leftIndex < leftLength) {
5927 result[leftIndex] = partials[leftIndex];
5928 }
5929 while (++argsIndex < holdersLength) {
5930 if (isUncurried || argsIndex < argsLength) {
5931 result[holders[argsIndex]] = args[argsIndex];
5932 }
5933 }
5934 while (rangeLength--) {
5935 result[leftIndex++] = args[argsIndex++];
5936 }
5937 return result;
5938 }
5939
5940 /**
5941 * This function is like `composeArgs` except that the arguments composition
5942 * is tailored for `_.partialRight`.
5943 *
5944 * @private
5945 * @param {Array} args The provided arguments.
5946 * @param {Array} partials The arguments to append to those provided.
5947 * @param {Array} holders The `partials` placeholder indexes.
5948 * @params {boolean} [isCurried] Specify composing for a curried function.
5949 * @returns {Array} Returns the new array of composed arguments.
5950 */
5951 function composeArgsRight(args, partials, holders, isCurried) {
5952 var argsIndex = -1,
5953 argsLength = args.length,
5954 holdersIndex = -1,
5955 holdersLength = holders.length,
5956 rightIndex = -1,
5957 rightLength = partials.length,
5958 rangeLength = nativeMax(argsLength - holdersLength, 0),
5959 result = Array(rangeLength + rightLength),
5960 isUncurried = !isCurried;
5961
5962 while (++argsIndex < rangeLength) {
5963 result[argsIndex] = args[argsIndex];
5964 }
5965 var offset = argsIndex;
5966 while (++rightIndex < rightLength) {
5967 result[offset + rightIndex] = partials[rightIndex];
5968 }
5969 while (++holdersIndex < holdersLength) {
5970 if (isUncurried || argsIndex < argsLength) {
5971 result[offset + holders[holdersIndex]] = args[argsIndex++];
5972 }
5973 }
5974 return result;
5975 }
5976
5977 /**
5978 * Copies the values of `source` to `array`.
5979 *
5980 * @private
5981 * @param {Array} source The array to copy values from.
5982 * @param {Array} [array=[]] The array to copy values to.
5983 * @returns {Array} Returns `array`.
5984 */
5985 function copyArray(source, array) {
5986 var index = -1,
5987 length = source.length;
5988
5989 array || (array = Array(length));
5990 while (++index < length) {
5991 array[index] = source[index];
5992 }
5993 return array;
5994 }
5995
5996 /**
5997 * Creates a function that wraps `func` to invoke it with the optional `this`
5998 * binding of `thisArg`.
5999 *
6000 * @private
6001 * @param {Function} func The function to wrap.
6002 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6003 * @param {*} [thisArg] The `this` binding of `func`.
6004 * @returns {Function} Returns the new wrapped function.
6005 */
6006 function createBind(func, bitmask, thisArg) {
6007 var isBind = bitmask & BIND_FLAG,
6008 Ctor = createCtor(func);
6009
6010 function wrapper() {
6011 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
6012 return fn.apply(isBind ? thisArg : this, arguments);
6013 }
6014 return wrapper;
6015 }
6016
6017 /**
6018 * Creates a function that produces an instance of `Ctor` regardless of
6019 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
6020 *
6021 * @private
6022 * @param {Function} Ctor The constructor to wrap.
6023 * @returns {Function} Returns the new wrapped function.
6024 */
6025 function createCtor(Ctor) {
6026 return function() {
6027 // Use a `switch` statement to work with class constructors. See
6028 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
6029 // for more details.
6030 var args = arguments;
6031 switch (args.length) {
6032 case 0: return new Ctor;
6033 case 1: return new Ctor(args[0]);
6034 case 2: return new Ctor(args[0], args[1]);
6035 case 3: return new Ctor(args[0], args[1], args[2]);
6036 case 4: return new Ctor(args[0], args[1], args[2], args[3]);
6037 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
6038 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
6039 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
6040 }
6041 var thisBinding = baseCreate(Ctor.prototype),
6042 result = Ctor.apply(thisBinding, args);
6043
6044 // Mimic the constructor's `return` behavior.
6045 // See https://es5.github.io/#x13.2.2 for more details.
6046 return isObject(result) ? result : thisBinding;
6047 };
6048 }
6049
6050 /**
6051 * Creates a function that wraps `func` to enable currying.
6052 *
6053 * @private
6054 * @param {Function} func The function to wrap.
6055 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6056 * @param {number} arity The arity of `func`.
6057 * @returns {Function} Returns the new wrapped function.
6058 */
6059 function createCurry(func, bitmask, arity) {
6060 var Ctor = createCtor(func);
6061
6062 function wrapper() {
6063 var length = arguments.length,
6064 args = Array(length),
6065 index = length,
6066 placeholder = getHolder(wrapper);
6067
6068 while (index--) {
6069 args[index] = arguments[index];
6070 }
6071 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
6072 ? []
6073 : replaceHolders(args, placeholder);
6074
6075 length -= holders.length;
6076 if (length < arity) {
6077 return createRecurry(
6078 func, bitmask, createHybrid, wrapper.placeholder, undefined,
6079 args, holders, undefined, undefined, arity - length);
6080 }
6081 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
6082 return apply(fn, this, args);
6083 }
6084 return wrapper;
6085 }
6086
6087 /**
6088 * Creates a function that wraps `func` to invoke it with optional `this`
6089 * binding of `thisArg`, partial application, and currying.
6090 *
6091 * @private
6092 * @param {Function|string} func The function or method name to wrap.
6093 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6094 * @param {*} [thisArg] The `this` binding of `func`.
6095 * @param {Array} [partials] The arguments to prepend to those provided to
6096 * the new function.
6097 * @param {Array} [holders] The `partials` placeholder indexes.
6098 * @param {Array} [partialsRight] The arguments to append to those provided
6099 * to the new function.
6100 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
6101 * @param {Array} [argPos] The argument positions of the new function.
6102 * @param {number} [ary] The arity cap of `func`.
6103 * @param {number} [arity] The arity of `func`.
6104 * @returns {Function} Returns the new wrapped function.
6105 */
6106 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
6107 var isAry = bitmask & ARY_FLAG,
6108 isBind = bitmask & BIND_FLAG,
6109 isBindKey = bitmask & BIND_KEY_FLAG,
6110 isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),
6111 isFlip = bitmask & FLIP_FLAG,
6112 Ctor = isBindKey ? undefined : createCtor(func);
6113
6114 function wrapper() {
6115 var length = arguments.length,
6116 args = Array(length),
6117 index = length;
6118
6119 while (index--) {
6120 args[index] = arguments[index];
6121 }
6122 if (isCurried) {
6123 var placeholder = getHolder(wrapper),
6124 holdersCount = countHolders(args, placeholder);
6125 }
6126 if (partials) {
6127 args = composeArgs(args, partials, holders, isCurried);
6128 }
6129 if (partialsRight) {
6130 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
6131 }
6132 length -= holdersCount;
6133 if (isCurried && length < arity) {
6134 var newHolders = replaceHolders(args, placeholder);
6135 return createRecurry(
6136 func, bitmask, createHybrid, wrapper.placeholder, thisArg,
6137 args, newHolders, argPos, ary, arity - length
6138 );
6139 }
6140 var thisBinding = isBind ? thisArg : this,
6141 fn = isBindKey ? thisBinding[func] : func;
6142
6143 length = args.length;
6144 if (argPos) {
6145 args = reorder(args, argPos);
6146 } else if (isFlip && length > 1) {
6147 args.reverse();
6148 }
6149 if (isAry && ary < length) {
6150 args.length = ary;
6151 }
6152 if (this && this !== root && this instanceof wrapper) {
6153 fn = Ctor || createCtor(fn);
6154 }
6155 return fn.apply(thisBinding, args);
6156 }
6157 return wrapper;
6158 }
6159
6160 /**
6161 * Creates a function that wraps `func` to invoke it with the `this` binding
6162 * of `thisArg` and `partials` prepended to the arguments it receives.
6163 *
6164 * @private
6165 * @param {Function} func The function to wrap.
6166 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6167 * @param {*} thisArg The `this` binding of `func`.
6168 * @param {Array} partials The arguments to prepend to those provided to
6169 * the new function.
6170 * @returns {Function} Returns the new wrapped function.
6171 */
6172 function createPartial(func, bitmask, thisArg, partials) {
6173 var isBind = bitmask & BIND_FLAG,
6174 Ctor = createCtor(func);
6175
6176 function wrapper() {
6177 var argsIndex = -1,
6178 argsLength = arguments.length,
6179 leftIndex = -1,
6180 leftLength = partials.length,
6181 args = Array(leftLength + argsLength),
6182 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
6183
6184 while (++leftIndex < leftLength) {
6185 args[leftIndex] = partials[leftIndex];
6186 }
6187 while (argsLength--) {
6188 args[leftIndex++] = arguments[++argsIndex];
6189 }
6190 return apply(fn, isBind ? thisArg : this, args);
6191 }
6192 return wrapper;
6193 }
6194
6195 /**
6196 * Creates a function that wraps `func` to continue currying.
6197 *
6198 * @private
6199 * @param {Function} func The function to wrap.
6200 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6201 * @param {Function} wrapFunc The function to create the `func` wrapper.
6202 * @param {*} placeholder The placeholder value.
6203 * @param {*} [thisArg] The `this` binding of `func`.
6204 * @param {Array} [partials] The arguments to prepend to those provided to
6205 * the new function.
6206 * @param {Array} [holders] The `partials` placeholder indexes.
6207 * @param {Array} [argPos] The argument positions of the new function.
6208 * @param {number} [ary] The arity cap of `func`.
6209 * @param {number} [arity] The arity of `func`.
6210 * @returns {Function} Returns the new wrapped function.
6211 */
6212 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
6213 var isCurry = bitmask & CURRY_FLAG,
6214 newHolders = isCurry ? holders : undefined,
6215 newHoldersRight = isCurry ? undefined : holders,
6216 newPartials = isCurry ? partials : undefined,
6217 newPartialsRight = isCurry ? undefined : partials;
6218
6219 bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
6220 bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
6221
6222 if (!(bitmask & CURRY_BOUND_FLAG)) {
6223 bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
6224 }
6225
6226 var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity);
6227 result.placeholder = placeholder;
6228 return setWrapToString(result, func, bitmask);
6229 }
6230
6231 /**
6232 * Creates a function that either curries or invokes `func` with optional
6233 * `this` binding and partially applied arguments.
6234 *
6235 * @private
6236 * @param {Function|string} func The function or method name to wrap.
6237 * @param {number} bitmask The bitmask flags.
6238 * The bitmask may be composed of the following flags:
6239 * 1 - `_.bind`
6240 * 2 - `_.bindKey`
6241 * 4 - `_.curry` or `_.curryRight` of a bound function
6242 * 8 - `_.curry`
6243 * 16 - `_.curryRight`
6244 * 32 - `_.partial`
6245 * 64 - `_.partialRight`
6246 * 128 - `_.rearg`
6247 * 256 - `_.ary`
6248 * 512 - `_.flip`
6249 * @param {*} [thisArg] The `this` binding of `func`.
6250 * @param {Array} [partials] The arguments to be partially applied.
6251 * @param {Array} [holders] The `partials` placeholder indexes.
6252 * @param {Array} [argPos] The argument positions of the new function.
6253 * @param {number} [ary] The arity cap of `func`.
6254 * @param {number} [arity] The arity of `func`.
6255 * @returns {Function} Returns the new wrapped function.
6256 */
6257 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
6258 var isBindKey = bitmask & BIND_KEY_FLAG;
6259 if (!isBindKey && typeof func != 'function') {
6260 throw new TypeError(FUNC_ERROR_TEXT);
6261 }
6262 var length = partials ? partials.length : 0;
6263 if (!length) {
6264 bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
6265 partials = holders = undefined;
6266 }
6267 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
6268 arity = arity === undefined ? arity : toInteger(arity);
6269 length -= holders ? holders.length : 0;
6270
6271 if (bitmask & PARTIAL_RIGHT_FLAG) {
6272 var partialsRight = partials,
6273 holdersRight = holders;
6274
6275 partials = holders = undefined;
6276 }
6277
6278 var newData = [
6279 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
6280 argPos, ary, arity
6281 ];
6282
6283 func = newData[0];
6284 bitmask = newData[1];
6285 thisArg = newData[2];
6286 partials = newData[3];
6287 holders = newData[4];
6288 arity = newData[9] = newData[9] == null
6289 ? (isBindKey ? 0 : func.length)
6290 : nativeMax(newData[9] - length, 0);
6291
6292 if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) {
6293 bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG);
6294 }
6295 if (!bitmask || bitmask == BIND_FLAG) {
6296 var result = createBind(func, bitmask, thisArg);
6297 } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) {
6298 result = createCurry(func, bitmask, arity);
6299 } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {
6300 result = createPartial(func, bitmask, thisArg, partials);
6301 } else {
6302 result = createHybrid.apply(undefined, newData);
6303 }
6304 return setWrapToString(result, func, bitmask);
6305 }
6306
6307 /**
6308 * Gets the argument placeholder value for `func`.
6309 *
6310 * @private
6311 * @param {Function} func The function to inspect.
6312 * @returns {*} Returns the placeholder value.
6313 */
6314 function getHolder(func) {
6315 var object = func;
6316 return object.placeholder;
6317 }
6318
6319 /**
6320 * Gets the native function at `key` of `object`.
6321 *
6322 * @private
6323 * @param {Object} object The object to query.
6324 * @param {string} key The key of the method to get.
6325 * @returns {*} Returns the function if it's native, else `undefined`.
6326 */
6327 function getNative(object, key) {
6328 var value = getValue(object, key);
6329 return baseIsNative(value) ? value : undefined;
6330 }
6331
6332 /**
6333 * Extracts wrapper details from the `source` body comment.
6334 *
6335 * @private
6336 * @param {string} source The source to inspect.
6337 * @returns {Array} Returns the wrapper details.
6338 */
6339 function getWrapDetails(source) {
6340 var match = source.match(reWrapDetails);
6341 return match ? match[1].split(reSplitDetails) : [];
6342 }
6343
6344 /**
6345 * Inserts wrapper `details` in a comment at the top of the `source` body.
6346 *
6347 * @private
6348 * @param {string} source The source to modify.
6349 * @returns {Array} details The details to insert.
6350 * @returns {string} Returns the modified source.
6351 */
6352 function insertWrapDetails(source, details) {
6353 var length = details.length,
6354 lastIndex = length - 1;
6355
6356 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
6357 details = details.join(length > 2 ? ', ' : ' ');
6358 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
6359 }
6360
6361 /**
6362 * Checks if `value` is a valid array-like index.
6363 *
6364 * @private
6365 * @param {*} value The value to check.
6366 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
6367 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
6368 */
6369 function isIndex(value, length) {
6370 length = length == null ? MAX_SAFE_INTEGER : length;
6371 return !!length &&
6372 (typeof value == 'number' || reIsUint.test(value)) &&
6373 (value > -1 && value % 1 == 0 && value < length);
6374 }
6375
6376 /**
6377 * Checks if `func` has its source masked.
6378 *
6379 * @private
6380 * @param {Function} func The function to check.
6381 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
6382 */
6383 function isMasked(func) {
6384 return !!maskSrcKey && (maskSrcKey in func);
6385 }
6386
6387 /**
6388 * Reorder `array` according to the specified indexes where the element at
6389 * the first index is assigned as the first element, the element at
6390 * the second index is assigned as the second element, and so on.
6391 *
6392 * @private
6393 * @param {Array} array The array to reorder.
6394 * @param {Array} indexes The arranged array indexes.
6395 * @returns {Array} Returns `array`.
6396 */
6397 function reorder(array, indexes) {
6398 var arrLength = array.length,
6399 length = nativeMin(indexes.length, arrLength),
6400 oldArray = copyArray(array);
6401
6402 while (length--) {
6403 var index = indexes[length];
6404 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
6405 }
6406 return array;
6407 }
6408
6409 /**
6410 * Sets the `toString` method of `wrapper` to mimic the source of `reference`
6411 * with wrapper details in a comment at the top of the source body.
6412 *
6413 * @private
6414 * @param {Function} wrapper The function to modify.
6415 * @param {Function} reference The reference function.
6416 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6417 * @returns {Function} Returns `wrapper`.
6418 */
6419 var setWrapToString = !defineProperty ? identity$1 : function(wrapper, reference, bitmask) {
6420 var source = (reference + '');
6421 return defineProperty(wrapper, 'toString', {
6422 'configurable': true,
6423 'enumerable': false,
6424 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)))
6425 });
6426 };
6427
6428 /**
6429 * Converts `func` to its source code.
6430 *
6431 * @private
6432 * @param {Function} func The function to process.
6433 * @returns {string} Returns the source code.
6434 */
6435 function toSource(func) {
6436 if (func != null) {
6437 try {
6438 return funcToString.call(func);
6439 } catch (e) {}
6440 try {
6441 return (func + '');
6442 } catch (e) {}
6443 }
6444 return '';
6445 }
6446
6447 /**
6448 * Updates wrapper `details` based on `bitmask` flags.
6449 *
6450 * @private
6451 * @returns {Array} details The details to modify.
6452 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6453 * @returns {Array} Returns `details`.
6454 */
6455 function updateWrapDetails(details, bitmask) {
6456 arrayEach(wrapFlags, function(pair) {
6457 var value = '_.' + pair[0];
6458 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
6459 details.push(value);
6460 }
6461 });
6462 return details.sort();
6463 }
6464
6465 /**
6466 * Creates a function that accepts arguments of `func` and either invokes
6467 * `func` returning its result, if at least `arity` number of arguments have
6468 * been provided, or returns a function that accepts the remaining `func`
6469 * arguments, and so on. The arity of `func` may be specified if `func.length`
6470 * is not sufficient.
6471 *
6472 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
6473 * may be used as a placeholder for provided arguments.
6474 *
6475 * **Note:** This method doesn't set the "length" property of curried functions.
6476 *
6477 * @static
6478 * @memberOf _
6479 * @since 2.0.0
6480 * @category Function
6481 * @param {Function} func The function to curry.
6482 * @param {number} [arity=func.length] The arity of `func`.
6483 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
6484 * @returns {Function} Returns the new curried function.
6485 * @example
6486 *
6487 * var abc = function(a, b, c) {
6488 * return [a, b, c];
6489 * };
6490 *
6491 * var curried = _.curry(abc);
6492 *
6493 * curried(1)(2)(3);
6494 * // => [1, 2, 3]
6495 *
6496 * curried(1, 2)(3);
6497 * // => [1, 2, 3]
6498 *
6499 * curried(1, 2, 3);
6500 * // => [1, 2, 3]
6501 *
6502 * // Curried with placeholders.
6503 * curried(1)(_, 3)(2);
6504 * // => [1, 2, 3]
6505 */
6506 function curry(func, arity, guard) {
6507 arity = guard ? undefined : arity;
6508 var result = createWrap(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
6509 result.placeholder = curry.placeholder;
6510 return result;
6511 }
6512
6513 /**
6514 * Checks if `value` is classified as a `Function` object.
6515 *
6516 * @static
6517 * @memberOf _
6518 * @since 0.1.0
6519 * @category Lang
6520 * @param {*} value The value to check.
6521 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
6522 * @example
6523 *
6524 * _.isFunction(_);
6525 * // => true
6526 *
6527 * _.isFunction(/abc/);
6528 * // => false
6529 */
6530 function isFunction(value) {
6531 // The use of `Object#toString` avoids issues with the `typeof` operator
6532 // in Safari 8-9 which returns 'object' for typed array and other constructors.
6533 var tag = isObject(value) ? objectToString.call(value) : '';
6534 return tag == funcTag || tag == genTag;
6535 }
6536
6537 /**
6538 * Checks if `value` is the
6539 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
6540 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
6541 *
6542 * @static
6543 * @memberOf _
6544 * @since 0.1.0
6545 * @category Lang
6546 * @param {*} value The value to check.
6547 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
6548 * @example
6549 *
6550 * _.isObject({});
6551 * // => true
6552 *
6553 * _.isObject([1, 2, 3]);
6554 * // => true
6555 *
6556 * _.isObject(_.noop);
6557 * // => true
6558 *
6559 * _.isObject(null);
6560 * // => false
6561 */
6562 function isObject(value) {
6563 var type = typeof value;
6564 return !!value && (type == 'object' || type == 'function');
6565 }
6566
6567 /**
6568 * Checks if `value` is object-like. A value is object-like if it's not `null`
6569 * and has a `typeof` result of "object".
6570 *
6571 * @static
6572 * @memberOf _
6573 * @since 4.0.0
6574 * @category Lang
6575 * @param {*} value The value to check.
6576 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
6577 * @example
6578 *
6579 * _.isObjectLike({});
6580 * // => true
6581 *
6582 * _.isObjectLike([1, 2, 3]);
6583 * // => true
6584 *
6585 * _.isObjectLike(_.noop);
6586 * // => false
6587 *
6588 * _.isObjectLike(null);
6589 * // => false
6590 */
6591 function isObjectLike(value) {
6592 return !!value && typeof value == 'object';
6593 }
6594
6595 /**
6596 * Checks if `value` is classified as a `Symbol` primitive or object.
6597 *
6598 * @static
6599 * @memberOf _
6600 * @since 4.0.0
6601 * @category Lang
6602 * @param {*} value The value to check.
6603 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
6604 * @example
6605 *
6606 * _.isSymbol(Symbol.iterator);
6607 * // => true
6608 *
6609 * _.isSymbol('abc');
6610 * // => false
6611 */
6612 function isSymbol(value) {
6613 return typeof value == 'symbol' ||
6614 (isObjectLike(value) && objectToString.call(value) == symbolTag);
6615 }
6616
6617 /**
6618 * Converts `value` to a finite number.
6619 *
6620 * @static
6621 * @memberOf _
6622 * @since 4.12.0
6623 * @category Lang
6624 * @param {*} value The value to convert.
6625 * @returns {number} Returns the converted number.
6626 * @example
6627 *
6628 * _.toFinite(3.2);
6629 * // => 3.2
6630 *
6631 * _.toFinite(Number.MIN_VALUE);
6632 * // => 5e-324
6633 *
6634 * _.toFinite(Infinity);
6635 * // => 1.7976931348623157e+308
6636 *
6637 * _.toFinite('3.2');
6638 * // => 3.2
6639 */
6640 function toFinite(value) {
6641 if (!value) {
6642 return value === 0 ? value : 0;
6643 }
6644 value = toNumber(value);
6645 if (value === INFINITY || value === -INFINITY) {
6646 var sign = (value < 0 ? -1 : 1);
6647 return sign * MAX_INTEGER;
6648 }
6649 return value === value ? value : 0;
6650 }
6651
6652 /**
6653 * Converts `value` to an integer.
6654 *
6655 * **Note:** This method is loosely based on
6656 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
6657 *
6658 * @static
6659 * @memberOf _
6660 * @since 4.0.0
6661 * @category Lang
6662 * @param {*} value The value to convert.
6663 * @returns {number} Returns the converted integer.
6664 * @example
6665 *
6666 * _.toInteger(3.2);
6667 * // => 3
6668 *
6669 * _.toInteger(Number.MIN_VALUE);
6670 * // => 0
6671 *
6672 * _.toInteger(Infinity);
6673 * // => 1.7976931348623157e+308
6674 *
6675 * _.toInteger('3.2');
6676 * // => 3
6677 */
6678 function toInteger(value) {
6679 var result = toFinite(value),
6680 remainder = result % 1;
6681
6682 return result === result ? (remainder ? result - remainder : result) : 0;
6683 }
6684
6685 /**
6686 * Converts `value` to a number.
6687 *
6688 * @static
6689 * @memberOf _
6690 * @since 4.0.0
6691 * @category Lang
6692 * @param {*} value The value to process.
6693 * @returns {number} Returns the number.
6694 * @example
6695 *
6696 * _.toNumber(3.2);
6697 * // => 3.2
6698 *
6699 * _.toNumber(Number.MIN_VALUE);
6700 * // => 5e-324
6701 *
6702 * _.toNumber(Infinity);
6703 * // => Infinity
6704 *
6705 * _.toNumber('3.2');
6706 * // => 3.2
6707 */
6708 function toNumber(value) {
6709 if (typeof value == 'number') {
6710 return value;
6711 }
6712 if (isSymbol(value)) {
6713 return NAN;
6714 }
6715 if (isObject(value)) {
6716 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
6717 value = isObject(other) ? (other + '') : other;
6718 }
6719 if (typeof value != 'string') {
6720 return value === 0 ? value : +value;
6721 }
6722 value = value.replace(reTrim, '');
6723 var isBinary = reIsBinary.test(value);
6724 return (isBinary || reIsOctal.test(value))
6725 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
6726 : (reIsBadHex.test(value) ? NAN : +value);
6727 }
6728
6729 /**
6730 * Creates a function that returns `value`.
6731 *
6732 * @static
6733 * @memberOf _
6734 * @since 2.4.0
6735 * @category Util
6736 * @param {*} value The value to return from the new function.
6737 * @returns {Function} Returns the new constant function.
6738 * @example
6739 *
6740 * var objects = _.times(2, _.constant({ 'a': 1 }));
6741 *
6742 * console.log(objects);
6743 * // => [{ 'a': 1 }, { 'a': 1 }]
6744 *
6745 * console.log(objects[0] === objects[1]);
6746 * // => true
6747 */
6748 function constant(value) {
6749 return function() {
6750 return value;
6751 };
6752 }
6753
6754 /**
6755 * This method returns the first argument it receives.
6756 *
6757 * @static
6758 * @since 0.1.0
6759 * @memberOf _
6760 * @category Util
6761 * @param {*} value Any value.
6762 * @returns {*} Returns `value`.
6763 * @example
6764 *
6765 * var object = { 'a': 1 };
6766 *
6767 * console.log(_.identity(object) === object);
6768 * // => true
6769 */
6770 function identity$1(value) {
6771 return value;
6772 }
6773
6774 // Assign default placeholders.
6775 curry.placeholder = {};
6776
6777 var lodash_curry = curry;
6778
6779 function yuv2rgb(yuv) {
6780 var y = yuv[0],
6781 u = yuv[1],
6782 v = yuv[2];
6783 var r, g, b;
6784 r = y * 1 + u * 0 + v * 1.13983;
6785 g = y * 1 + u * -0.39465 + v * -0.5806;
6786 b = y * 1 + u * 2.02311 + v * 0;
6787 r = Math.min(Math.max(0, r), 1);
6788 g = Math.min(Math.max(0, g), 1);
6789 b = Math.min(Math.max(0, b), 1);
6790 return [r * 255, g * 255, b * 255];
6791 }
6792 function rgb2yuv(rgb) {
6793 var r = rgb[0] / 255,
6794 g = rgb[1] / 255,
6795 b = rgb[2] / 255;
6796 var y = r * 0.299 + g * 0.587 + b * 0.114;
6797 var u = r * -0.14713 + g * -0.28886 + b * 0.436;
6798 var v = r * 0.615 + g * -0.51499 + b * -0.10001;
6799 return [y, u, v];
6800 }
6801
6802 function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6803
6804 function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6805 var DEFAULT_BASE16 = index;
6806 var BASE16_KEYS = Object.keys(DEFAULT_BASE16); // we need a correcting factor, so that a dark, but not black background color
6807 // converts to bright enough inversed color
6808
6809 var flip = function flip(x) {
6810 return x < 0.25 ? 1 : x < 0.5 ? 0.9 - x : 1.1 - x;
6811 };
6812
6813 var invertColor = function invertColor(hexString) {
6814 var color$1 = color(hexString);
6815
6816 var _rgb2yuv = rgb2yuv(color$1.array()),
6817 _rgb2yuv2 = _slicedToArray(_rgb2yuv, 3),
6818 y = _rgb2yuv2[0],
6819 u = _rgb2yuv2[1],
6820 v = _rgb2yuv2[2];
6821
6822 var flippedYuv = [flip(y), u, v];
6823 var rgb = yuv2rgb(flippedYuv);
6824 return color.rgb(rgb).hex();
6825 };
6826
6827 var merger = function merger(styling) {
6828 return function (prevStyling) {
6829 return {
6830 className: [prevStyling.className, styling.className].filter(Boolean).join(' '),
6831 style: _objectSpread$2(_objectSpread$2({}, prevStyling.style || {}), styling.style || {})
6832 };
6833 };
6834 };
6835
6836 var mergeStyling = function mergeStyling(customStyling, defaultStyling) {
6837 if (customStyling === undefined) {
6838 return defaultStyling;
6839 }
6840
6841 if (defaultStyling === undefined) {
6842 return customStyling;
6843 }
6844
6845 var customType = _typeof(customStyling);
6846
6847 var defaultType = _typeof(defaultStyling);
6848
6849 switch (customType) {
6850 case 'string':
6851 switch (defaultType) {
6852 case 'string':
6853 return [defaultStyling, customStyling].filter(Boolean).join(' ');
6854
6855 case 'object':
6856 return merger({
6857 className: customStyling,
6858 style: defaultStyling
6859 });
6860
6861 case 'function':
6862 return function (styling) {
6863 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6864 args[_key - 1] = arguments[_key];
6865 }
6866
6867 return merger({
6868 className: customStyling
6869 })(defaultStyling.apply(void 0, [styling].concat(args)));
6870 };
6871 }
6872
6873 break;
6874
6875 case 'object':
6876 switch (defaultType) {
6877 case 'string':
6878 return merger({
6879 className: defaultStyling,
6880 style: customStyling
6881 });
6882
6883 case 'object':
6884 return _objectSpread$2(_objectSpread$2({}, defaultStyling), customStyling);
6885
6886 case 'function':
6887 return function (styling) {
6888 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
6889 args[_key2 - 1] = arguments[_key2];
6890 }
6891
6892 return merger({
6893 style: customStyling
6894 })(defaultStyling.apply(void 0, [styling].concat(args)));
6895 };
6896 }
6897
6898 break;
6899
6900 case 'function':
6901 switch (defaultType) {
6902 case 'string':
6903 return function (styling) {
6904 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
6905 args[_key3 - 1] = arguments[_key3];
6906 }
6907
6908 return customStyling.apply(void 0, [merger(styling)({
6909 className: defaultStyling
6910 })].concat(args));
6911 };
6912
6913 case 'object':
6914 return function (styling) {
6915 for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
6916 args[_key4 - 1] = arguments[_key4];
6917 }
6918
6919 return customStyling.apply(void 0, [merger(styling)({
6920 style: defaultStyling
6921 })].concat(args));
6922 };
6923
6924 case 'function':
6925 return function (styling) {
6926 for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
6927 args[_key5 - 1] = arguments[_key5];
6928 }
6929
6930 return customStyling.apply(void 0, [defaultStyling.apply(void 0, [styling].concat(args))].concat(args));
6931 };
6932 }
6933
6934 }
6935 };
6936
6937 var mergeStylings = function mergeStylings(customStylings, defaultStylings) {
6938 var keys = Object.keys(defaultStylings);
6939
6940 for (var key in customStylings) {
6941 if (keys.indexOf(key) === -1) keys.push(key);
6942 }
6943
6944 return keys.reduce(function (mergedStyling, key) {
6945 return mergedStyling[key] = mergeStyling(customStylings[key], defaultStylings[key]), mergedStyling;
6946 }, {});
6947 };
6948
6949 var getStylingByKeys = function getStylingByKeys(mergedStyling, keys) {
6950 for (var _len6 = arguments.length, args = new Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
6951 args[_key6 - 2] = arguments[_key6];
6952 }
6953
6954 if (keys === null) {
6955 return mergedStyling;
6956 }
6957
6958 if (!Array.isArray(keys)) {
6959 keys = [keys];
6960 }
6961
6962 var styles = keys.map(function (key) {
6963 return mergedStyling[key];
6964 }).filter(Boolean);
6965 var props = styles.reduce(function (obj, s) {
6966 if (typeof s === 'string') {
6967 obj.className = [obj.className, s].filter(Boolean).join(' ');
6968 } else if (_typeof(s) === 'object') {
6969 obj.style = _objectSpread$2(_objectSpread$2({}, obj.style), s);
6970 } else if (typeof s === 'function') {
6971 obj = _objectSpread$2(_objectSpread$2({}, obj), s.apply(void 0, [obj].concat(args)));
6972 }
6973
6974 return obj;
6975 }, {
6976 className: '',
6977 style: {}
6978 });
6979
6980 if (!props.className) {
6981 delete props.className;
6982 }
6983
6984 if (Object.keys(props.style).length === 0) {
6985 delete props.style;
6986 }
6987
6988 return props;
6989 };
6990
6991 var invertBase16Theme = function invertBase16Theme(base16Theme) {
6992 return Object.keys(base16Theme).reduce(function (t, key) {
6993 return t[key] = /^base/.test(key) ? invertColor(base16Theme[key]) : key === 'scheme' ? base16Theme[key] + ':inverted' : base16Theme[key], t;
6994 }, {});
6995 };
6996 var createStyling = lodash_curry(function (getStylingFromBase16) {
6997 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6998 var themeOrStyling = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6999 var _options$defaultBase = options.defaultBase16,
7000 defaultBase16 = _options$defaultBase === void 0 ? DEFAULT_BASE16 : _options$defaultBase,
7001 _options$base16Themes = options.base16Themes,
7002 base16Themes = _options$base16Themes === void 0 ? null : _options$base16Themes;
7003 var base16Theme = getBase16Theme(themeOrStyling, base16Themes);
7004
7005 if (base16Theme) {
7006 themeOrStyling = _objectSpread$2(_objectSpread$2({}, base16Theme), themeOrStyling);
7007 }
7008
7009 var theme = BASE16_KEYS.reduce(function (t, key) {
7010 return t[key] = themeOrStyling[key] || defaultBase16[key], t;
7011 }, {});
7012 var customStyling = Object.keys(themeOrStyling).reduce(function (s, key) {
7013 return BASE16_KEYS.indexOf(key) === -1 ? (s[key] = themeOrStyling[key], s) : s;
7014 }, {});
7015 var defaultStyling = getStylingFromBase16(theme);
7016 var mergedStyling = mergeStylings(customStyling, defaultStyling);
7017
7018 for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key7 = 3; _key7 < _len7; _key7++) {
7019 args[_key7 - 3] = arguments[_key7];
7020 }
7021
7022 return lodash_curry(getStylingByKeys, 2).apply(void 0, [mergedStyling].concat(args));
7023 }, 3);
7024
7025 var isStylingConfig = function isStylingConfig(theme) {
7026 return !!theme.extend;
7027 };
7028
7029 var getBase16Theme = function getBase16Theme(theme, base16Themes) {
7030 if (theme && isStylingConfig(theme) && theme.extend) {
7031 theme = theme.extend;
7032 }
7033
7034 if (typeof theme === 'string') {
7035 var _theme$split = theme.split(':'),
7036 _theme$split2 = _slicedToArray(_theme$split, 2),
7037 _themeName = _theme$split2[0],
7038 modifier = _theme$split2[1];
7039
7040 if (base16Themes) {
7041 theme = base16Themes[_themeName];
7042 } else {
7043 theme = base16[_themeName];
7044 }
7045
7046 if (modifier === 'inverted') {
7047 theme = invertBase16Theme(theme);
7048 }
7049 }
7050
7051 return theme && Object.prototype.hasOwnProperty.call(theme, 'base00') ? theme : undefined;
7052 };
7053 var invertTheme = function invertTheme(theme) {
7054 if (typeof theme === 'string') {
7055 return "".concat(theme, ":inverted");
7056 }
7057
7058 if (theme && isStylingConfig(theme) && theme.extend) {
7059 if (typeof theme.extend === 'string') {
7060 return _objectSpread$2(_objectSpread$2({}, theme), {}, {
7061 extend: "".concat(theme.extend, ":inverted")
7062 });
7063 }
7064
7065 return _objectSpread$2(_objectSpread$2({}, theme), {}, {
7066 extend: invertBase16Theme(theme.extend)
7067 });
7068 }
7069
7070 if (theme) {
7071 return invertBase16Theme(theme);
7072 }
7073
7074 return theme;
7075 };
7076
7077 var solarized = {
7078 scheme: 'solarized',
7079 author: 'ethan schoonover (http://ethanschoonover.com/solarized)',
7080 base00: '#002b36',
7081 base01: '#073642',
7082 base02: '#586e75',
7083 base03: '#657b83',
7084 base04: '#839496',
7085 base05: '#93a1a1',
7086 base06: '#eee8d5',
7087 base07: '#fdf6e3',
7088 base08: '#dc322f',
7089 base09: '#cb4b16',
7090 base0A: '#b58900',
7091 base0B: '#859900',
7092 base0C: '#2aa198',
7093 base0D: '#268bd2',
7094 base0E: '#6c71c4',
7095 base0F: '#d33682'
7096 };
7097
7098 function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7099
7100 function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7101
7102 var colorMap = function colorMap(theme) {
7103 return {
7104 BACKGROUND_COLOR: theme.base00,
7105 TEXT_COLOR: theme.base07,
7106 STRING_COLOR: theme.base0B,
7107 DATE_COLOR: theme.base0B,
7108 NUMBER_COLOR: theme.base09,
7109 BOOLEAN_COLOR: theme.base09,
7110 NULL_COLOR: theme.base08,
7111 UNDEFINED_COLOR: theme.base08,
7112 FUNCTION_COLOR: theme.base08,
7113 SYMBOL_COLOR: theme.base08,
7114 LABEL_COLOR: theme.base0D,
7115 ARROW_COLOR: theme.base0D,
7116 ITEM_STRING_COLOR: theme.base0B,
7117 ITEM_STRING_EXPANDED_COLOR: theme.base03
7118 };
7119 };
7120
7121 var valueColorMap = function valueColorMap(colors) {
7122 return {
7123 String: colors.STRING_COLOR,
7124 Date: colors.DATE_COLOR,
7125 Number: colors.NUMBER_COLOR,
7126 Boolean: colors.BOOLEAN_COLOR,
7127 Null: colors.NULL_COLOR,
7128 Undefined: colors.UNDEFINED_COLOR,
7129 Function: colors.FUNCTION_COLOR,
7130 Symbol: colors.SYMBOL_COLOR
7131 };
7132 };
7133
7134 var getDefaultThemeStyling = function getDefaultThemeStyling(theme) {
7135 var colors = colorMap(theme);
7136 return {
7137 tree: {
7138 border: 0,
7139 padding: 0,
7140 marginTop: '0.5em',
7141 marginBottom: '0.5em',
7142 marginLeft: '0.125em',
7143 marginRight: 0,
7144 listStyle: 'none',
7145 MozUserSelect: 'none',
7146 WebkitUserSelect: 'none',
7147 backgroundColor: colors.BACKGROUND_COLOR
7148 },
7149 value: function value(_ref, nodeType, keyPath) {
7150 var style = _ref.style;
7151 return {
7152 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7153 paddingTop: '0.25em',
7154 paddingRight: 0,
7155 marginLeft: '0.875em',
7156 WebkitUserSelect: 'text',
7157 MozUserSelect: 'text',
7158 wordWrap: 'break-word',
7159 paddingLeft: keyPath.length > 1 ? '2.125em' : '1.25em',
7160 textIndent: '-0.5em',
7161 wordBreak: 'break-all'
7162 })
7163 };
7164 },
7165 label: {
7166 display: 'inline-block',
7167 color: colors.LABEL_COLOR
7168 },
7169 valueLabel: {
7170 margin: '0 0.5em 0 0'
7171 },
7172 valueText: function valueText(_ref2, nodeType) {
7173 var style = _ref2.style;
7174 return {
7175 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7176 color: valueColorMap(colors)[nodeType]
7177 })
7178 };
7179 },
7180 itemRange: function itemRange(styling, expanded) {
7181 return {
7182 style: {
7183 paddingTop: expanded ? 0 : '0.25em',
7184 cursor: 'pointer',
7185 color: colors.LABEL_COLOR
7186 }
7187 };
7188 },
7189 arrow: function arrow(_ref3, nodeType, expanded) {
7190 var style = _ref3.style;
7191 return {
7192 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7193 marginLeft: 0,
7194 transition: '150ms',
7195 WebkitTransition: '150ms',
7196 MozTransition: '150ms',
7197 WebkitTransform: expanded ? 'rotateZ(90deg)' : 'rotateZ(0deg)',
7198 MozTransform: expanded ? 'rotateZ(90deg)' : 'rotateZ(0deg)',
7199 transform: expanded ? 'rotateZ(90deg)' : 'rotateZ(0deg)',
7200 transformOrigin: '45% 50%',
7201 WebkitTransformOrigin: '45% 50%',
7202 MozTransformOrigin: '45% 50%',
7203 position: 'relative',
7204 lineHeight: '1.1em',
7205 fontSize: '0.75em'
7206 })
7207 };
7208 },
7209 arrowContainer: function arrowContainer(_ref4, arrowStyle) {
7210 var style = _ref4.style;
7211 return {
7212 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7213 display: 'inline-block',
7214 paddingRight: '0.5em',
7215 paddingLeft: arrowStyle === 'double' ? '1em' : 0,
7216 cursor: 'pointer'
7217 })
7218 };
7219 },
7220 arrowSign: {
7221 color: colors.ARROW_COLOR
7222 },
7223 arrowSignInner: {
7224 position: 'absolute',
7225 top: 0,
7226 left: '-0.4em'
7227 },
7228 nestedNode: function nestedNode(_ref5, keyPath, nodeType, expanded, expandable) {
7229 var style = _ref5.style;
7230 return {
7231 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7232 position: 'relative',
7233 paddingTop: '0.25em',
7234 marginLeft: keyPath.length > 1 ? '0.875em' : 0,
7235 paddingLeft: !expandable ? '1.125em' : 0
7236 })
7237 };
7238 },
7239 rootNode: {
7240 padding: 0,
7241 margin: 0
7242 },
7243 nestedNodeLabel: function nestedNodeLabel(_ref6, keyPath, nodeType, expanded, expandable) {
7244 var style = _ref6.style;
7245 return {
7246 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7247 margin: 0,
7248 padding: 0,
7249 WebkitUserSelect: expandable ? 'inherit' : 'text',
7250 MozUserSelect: expandable ? 'inherit' : 'text',
7251 cursor: expandable ? 'pointer' : 'default'
7252 })
7253 };
7254 },
7255 nestedNodeItemString: function nestedNodeItemString(_ref7, keyPath, nodeType, expanded) {
7256 var style = _ref7.style;
7257 return {
7258 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7259 paddingLeft: '0.5em',
7260 cursor: 'default',
7261 color: expanded ? colors.ITEM_STRING_EXPANDED_COLOR : colors.ITEM_STRING_COLOR
7262 })
7263 };
7264 },
7265 nestedNodeItemType: {
7266 marginLeft: '0.3em',
7267 marginRight: '0.3em'
7268 },
7269 nestedNodeChildren: function nestedNodeChildren(_ref8, nodeType, expanded) {
7270 var style = _ref8.style;
7271 return {
7272 style: _objectSpread$1(_objectSpread$1({}, style), {}, {
7273 padding: 0,
7274 margin: 0,
7275 listStyle: 'none',
7276 display: expanded ? 'block' : 'none'
7277 })
7278 };
7279 },
7280 rootNodeChildren: {
7281 padding: 0,
7282 margin: 0,
7283 listStyle: 'none'
7284 }
7285 };
7286 };
7287
7288 var createStylingFromTheme = createStyling(getDefaultThemeStyling, {
7289 defaultBase16: solarized
7290 });
7291
7292 var _excluded = ["data", "keyPath", "postprocessValue", "hideRoot", "theme", "invertTheme"];
7293
7294 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7295
7296 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7297
7298 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7299
7300 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7301
7302 var identity = function identity(value) {
7303 return value;
7304 };
7305
7306 var expandRootNode = function expandRootNode(keyPath, data, level) {
7307 return level === 0;
7308 };
7309
7310 var defaultItemString = function defaultItemString(type, data, itemType, itemString) {
7311 return /*#__PURE__*/React__default["default"].createElement("span", null, itemType, " ", itemString);
7312 };
7313
7314 var defaultLabelRenderer = function defaultLabelRenderer(_ref) {
7315 var _ref2 = _slicedToArray$1(_ref, 1),
7316 label = _ref2[0];
7317
7318 return /*#__PURE__*/React__default["default"].createElement("span", null, label, ":");
7319 };
7320
7321 var noCustomNode = function noCustomNode() {
7322 return false;
7323 };
7324
7325 function checkLegacyTheming(theme, props) {
7326 var deprecatedStylingMethodsMap = {
7327 getArrowStyle: 'arrow',
7328 getListStyle: 'nestedNodeChildren',
7329 getItemStringStyle: 'nestedNodeItemString',
7330 getLabelStyle: 'label',
7331 getValueStyle: 'valueText'
7332 };
7333 var deprecatedStylingMethods = Object.keys(deprecatedStylingMethodsMap).filter(function (name) {
7334 return props[name];
7335 });
7336
7337 if (deprecatedStylingMethods.length > 0) {
7338 if (typeof theme === 'string') {
7339 theme = {
7340 extend: theme
7341 };
7342 } else {
7343 theme = _objectSpread({}, theme);
7344 }
7345
7346 deprecatedStylingMethods.forEach(function (name) {
7347 // eslint-disable-next-line no-console
7348 console.error("Styling method \"".concat(name, "\" is deprecated, use \"theme\" property instead"));
7349
7350 theme[deprecatedStylingMethodsMap[name]] = function (_ref3) {
7351 var style = _ref3.style;
7352
7353 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
7354 args[_key - 1] = arguments[_key];
7355 }
7356
7357 return {
7358 style: _objectSpread(_objectSpread({}, style), props[name].apply(props, args))
7359 };
7360 };
7361 });
7362 }
7363
7364 return theme;
7365 }
7366
7367 function getStateFromProps(props) {
7368 var theme = checkLegacyTheming(props.theme, props);
7369
7370 if (props.invertTheme) {
7371 theme = invertTheme(theme);
7372 }
7373
7374 return {
7375 styling: createStylingFromTheme(theme)
7376 };
7377 }
7378
7379 var JSONTree = /*#__PURE__*/function (_React$Component) {
7380 _inherits(JSONTree, _React$Component);
7381
7382 var _super = _createSuper(JSONTree);
7383
7384 function JSONTree(props) {
7385 var _this;
7386
7387 _classCallCheck(this, JSONTree);
7388
7389 _this = _super.call(this, props);
7390 _this.state = getStateFromProps(props);
7391 return _this;
7392 }
7393
7394 _createClass(JSONTree, [{
7395 key: "UNSAFE_componentWillReceiveProps",
7396 value: function UNSAFE_componentWillReceiveProps(nextProps) {
7397 var _this2 = this;
7398
7399 if (['theme', 'invertTheme'].find(function (k) {
7400 return nextProps[k] !== _this2.props[k];
7401 })) {
7402 this.setState(getStateFromProps(nextProps));
7403 }
7404 }
7405 }, {
7406 key: "shouldComponentUpdate",
7407 value: function shouldComponentUpdate(nextProps) {
7408 var _this3 = this;
7409
7410 return !!Object.keys(nextProps).find(function (k) {
7411 return k === 'keyPath' ? nextProps[k].join('/') !== _this3.props[k].join('/') : nextProps[k] !== _this3.props[k];
7412 });
7413 }
7414 }, {
7415 key: "render",
7416 value: function render() {
7417 var _this$props = this.props,
7418 value = _this$props.data,
7419 keyPath = _this$props.keyPath,
7420 postprocessValue = _this$props.postprocessValue,
7421 hideRoot = _this$props.hideRoot;
7422 _this$props.theme;
7423 _this$props.invertTheme;
7424 var rest = _objectWithoutProperties(_this$props, _excluded);
7425
7426 var styling = this.state.styling;
7427 return /*#__PURE__*/React__default["default"].createElement("ul", _objectSpread({}, styling('tree')), /*#__PURE__*/React__default["default"].createElement(JSONNode, _objectSpread(_objectSpread({}, _objectSpread({
7428 postprocessValue: postprocessValue,
7429 hideRoot: hideRoot,
7430 styling: styling
7431 }, rest)), {}, {
7432 keyPath: hideRoot ? [] : keyPath,
7433 value: postprocessValue(value)
7434 })));
7435 }
7436 }]);
7437
7438 return JSONTree;
7439 }(React__default["default"].Component);
7440 JSONTree.propTypes = {
7441 data: propTypes.exports.any,
7442 hideRoot: propTypes.exports.bool,
7443 theme: propTypes.exports.oneOfType([propTypes.exports.object, propTypes.exports.string]),
7444 invertTheme: propTypes.exports.bool,
7445 keyPath: propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number])),
7446 postprocessValue: propTypes.exports.func,
7447 sortObjectKeys: propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.bool])
7448 };
7449 JSONTree.defaultProps = {
7450 shouldExpandNode: expandRootNode,
7451 hideRoot: false,
7452 keyPath: ['root'],
7453 getItemString: defaultItemString,
7454 labelRenderer: defaultLabelRenderer,
7455 valueRenderer: identity,
7456 postprocessValue: identity,
7457 isCustomNode: noCustomNode,
7458 collectionLimit: 50,
7459 invertTheme: true
7460 };
7461
7462 exports.JSONTree = JSONTree;
7463
7464 Object.defineProperty(exports, '__esModule', { value: true });
7465
7466}));