@odigos/ui-kit 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,13 +10,6 @@ import { M as MONITORS_OPTIONS } from './index-D3sp5Hx7.js';
10
10
  import { u as useContainerSize, a as useCopy, g as useTransition, d as useKeyDown, e as useOnClickOutside } from './useTransition-D0ykOLrk.js';
11
11
  import ReactDOM from 'react-dom';
12
12
  import { I as ImageErrorIcon } from './index-DGel4E-Z.js';
13
- import require$$0 from 'babel-runtime/helpers/extends';
14
- import require$$1$1 from 'babel-runtime/core-js/object/get-prototype-of';
15
- import require$$2 from 'babel-runtime/helpers/classCallCheck';
16
- import require$$3 from 'babel-runtime/helpers/createClass';
17
- import require$$4 from 'babel-runtime/helpers/possibleConstructorReturn';
18
- import require$$5 from 'babel-runtime/helpers/inherits';
19
- import require$$1 from 'object-assign';
20
13
  import { I as InfoIcon } from './index-BsH_egEe.js';
21
14
 
22
15
  const TextWrapper$2 = styled.div `
@@ -4593,10 +4586,10 @@ const DataCardFields = ({ data }) => {
4593
4586
  ? '100%'
4594
4587
  : 'unset' },
4595
4588
  React.createElement(Tooltip, { text: tooltip, withIcon: true }, !!title && React.createElement(ItemTitle, null, title)),
4596
- renderValue(type, value))))));
4589
+ React.createElement(RenderValue, { type: type, value: value }))))));
4597
4590
  };
4598
4591
  // We need to maintain this with new components every time we add a new type to "DataCardFieldTypes"
4599
- const renderValue = (type, value) => {
4592
+ const RenderValue = ({ type, value }) => {
4600
4593
  const theme = Theme.useTheme();
4601
4594
  const { clickCopy, isCopied } = useCopy();
4602
4595
  switch (type) {
@@ -6246,1110 +6239,19 @@ function getDefaultExportFromCjs (x) {
6246
6239
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6247
6240
  }
6248
6241
 
6249
- var dist = {};
6242
+ var lottie$2 = {exports: {}};
6250
6243
 
6251
- var propTypes = {exports: {}};
6252
-
6253
- var reactIs = {exports: {}};
6254
-
6255
- var reactIs_production_min = {};
6256
-
6257
- /** @license React v16.13.1
6258
- * react-is.production.min.js
6259
- *
6260
- * Copyright (c) Facebook, Inc. and its affiliates.
6261
- *
6262
- * This source code is licensed under the MIT license found in the
6263
- * LICENSE file in the root directory of this source tree.
6264
- */
6265
-
6266
- var hasRequiredReactIs_production_min;
6267
-
6268
- function requireReactIs_production_min () {
6269
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
6270
- hasRequiredReactIs_production_min = 1;
6271
- 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?
6272
- 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;
6273
- 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;
6274
- 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};
6275
- 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};
6276
- 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;
6277
- return reactIs_production_min;
6278
- }
6279
-
6280
- var reactIs_development = {};
6281
-
6282
- /** @license React v16.13.1
6283
- * react-is.development.js
6284
- *
6285
- * Copyright (c) Facebook, Inc. and its affiliates.
6286
- *
6287
- * This source code is licensed under the MIT license found in the
6288
- * LICENSE file in the root directory of this source tree.
6289
- */
6290
-
6291
- var hasRequiredReactIs_development;
6292
-
6293
- function requireReactIs_development () {
6294
- if (hasRequiredReactIs_development) return reactIs_development;
6295
- hasRequiredReactIs_development = 1;
6296
-
6297
-
6298
-
6299
- if (process.env.NODE_ENV !== "production") {
6300
- (function() {
6301
-
6302
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
6303
- // nor polyfill, then a plain number is used for performance.
6304
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
6305
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
6306
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
6307
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
6308
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
6309
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
6310
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
6311
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
6312
- // (unstable) APIs that have been removed. Can we remove the symbols?
6313
-
6314
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
6315
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
6316
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
6317
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
6318
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
6319
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
6320
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
6321
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
6322
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
6323
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
6324
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
6325
-
6326
- function isValidElementType(type) {
6327
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
6328
- 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);
6329
- }
6330
-
6331
- function typeOf(object) {
6332
- if (typeof object === 'object' && object !== null) {
6333
- var $$typeof = object.$$typeof;
6334
-
6335
- switch ($$typeof) {
6336
- case REACT_ELEMENT_TYPE:
6337
- var type = object.type;
6338
-
6339
- switch (type) {
6340
- case REACT_ASYNC_MODE_TYPE:
6341
- case REACT_CONCURRENT_MODE_TYPE:
6342
- case REACT_FRAGMENT_TYPE:
6343
- case REACT_PROFILER_TYPE:
6344
- case REACT_STRICT_MODE_TYPE:
6345
- case REACT_SUSPENSE_TYPE:
6346
- return type;
6347
-
6348
- default:
6349
- var $$typeofType = type && type.$$typeof;
6350
-
6351
- switch ($$typeofType) {
6352
- case REACT_CONTEXT_TYPE:
6353
- case REACT_FORWARD_REF_TYPE:
6354
- case REACT_LAZY_TYPE:
6355
- case REACT_MEMO_TYPE:
6356
- case REACT_PROVIDER_TYPE:
6357
- return $$typeofType;
6358
-
6359
- default:
6360
- return $$typeof;
6361
- }
6362
-
6363
- }
6364
-
6365
- case REACT_PORTAL_TYPE:
6366
- return $$typeof;
6367
- }
6368
- }
6369
-
6370
- return undefined;
6371
- } // AsyncMode is deprecated along with isAsyncMode
6372
-
6373
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
6374
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
6375
- var ContextConsumer = REACT_CONTEXT_TYPE;
6376
- var ContextProvider = REACT_PROVIDER_TYPE;
6377
- var Element = REACT_ELEMENT_TYPE;
6378
- var ForwardRef = REACT_FORWARD_REF_TYPE;
6379
- var Fragment = REACT_FRAGMENT_TYPE;
6380
- var Lazy = REACT_LAZY_TYPE;
6381
- var Memo = REACT_MEMO_TYPE;
6382
- var Portal = REACT_PORTAL_TYPE;
6383
- var Profiler = REACT_PROFILER_TYPE;
6384
- var StrictMode = REACT_STRICT_MODE_TYPE;
6385
- var Suspense = REACT_SUSPENSE_TYPE;
6386
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
6387
-
6388
- function isAsyncMode(object) {
6389
- {
6390
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
6391
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
6392
-
6393
- 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.');
6394
- }
6395
- }
6396
-
6397
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
6398
- }
6399
- function isConcurrentMode(object) {
6400
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
6401
- }
6402
- function isContextConsumer(object) {
6403
- return typeOf(object) === REACT_CONTEXT_TYPE;
6404
- }
6405
- function isContextProvider(object) {
6406
- return typeOf(object) === REACT_PROVIDER_TYPE;
6407
- }
6408
- function isElement(object) {
6409
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
6410
- }
6411
- function isForwardRef(object) {
6412
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
6413
- }
6414
- function isFragment(object) {
6415
- return typeOf(object) === REACT_FRAGMENT_TYPE;
6416
- }
6417
- function isLazy(object) {
6418
- return typeOf(object) === REACT_LAZY_TYPE;
6419
- }
6420
- function isMemo(object) {
6421
- return typeOf(object) === REACT_MEMO_TYPE;
6422
- }
6423
- function isPortal(object) {
6424
- return typeOf(object) === REACT_PORTAL_TYPE;
6425
- }
6426
- function isProfiler(object) {
6427
- return typeOf(object) === REACT_PROFILER_TYPE;
6428
- }
6429
- function isStrictMode(object) {
6430
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
6431
- }
6432
- function isSuspense(object) {
6433
- return typeOf(object) === REACT_SUSPENSE_TYPE;
6434
- }
6435
-
6436
- reactIs_development.AsyncMode = AsyncMode;
6437
- reactIs_development.ConcurrentMode = ConcurrentMode;
6438
- reactIs_development.ContextConsumer = ContextConsumer;
6439
- reactIs_development.ContextProvider = ContextProvider;
6440
- reactIs_development.Element = Element;
6441
- reactIs_development.ForwardRef = ForwardRef;
6442
- reactIs_development.Fragment = Fragment;
6443
- reactIs_development.Lazy = Lazy;
6444
- reactIs_development.Memo = Memo;
6445
- reactIs_development.Portal = Portal;
6446
- reactIs_development.Profiler = Profiler;
6447
- reactIs_development.StrictMode = StrictMode;
6448
- reactIs_development.Suspense = Suspense;
6449
- reactIs_development.isAsyncMode = isAsyncMode;
6450
- reactIs_development.isConcurrentMode = isConcurrentMode;
6451
- reactIs_development.isContextConsumer = isContextConsumer;
6452
- reactIs_development.isContextProvider = isContextProvider;
6453
- reactIs_development.isElement = isElement;
6454
- reactIs_development.isForwardRef = isForwardRef;
6455
- reactIs_development.isFragment = isFragment;
6456
- reactIs_development.isLazy = isLazy;
6457
- reactIs_development.isMemo = isMemo;
6458
- reactIs_development.isPortal = isPortal;
6459
- reactIs_development.isProfiler = isProfiler;
6460
- reactIs_development.isStrictMode = isStrictMode;
6461
- reactIs_development.isSuspense = isSuspense;
6462
- reactIs_development.isValidElementType = isValidElementType;
6463
- reactIs_development.typeOf = typeOf;
6464
- })();
6465
- }
6466
- return reactIs_development;
6467
- }
6468
-
6469
- var hasRequiredReactIs;
6470
-
6471
- function requireReactIs () {
6472
- if (hasRequiredReactIs) return reactIs.exports;
6473
- hasRequiredReactIs = 1;
6474
-
6475
- if (process.env.NODE_ENV === 'production') {
6476
- reactIs.exports = requireReactIs_production_min();
6477
- } else {
6478
- reactIs.exports = requireReactIs_development();
6479
- }
6480
- return reactIs.exports;
6481
- }
6482
-
6483
- /**
6484
- * Copyright (c) 2013-present, Facebook, Inc.
6485
- *
6486
- * This source code is licensed under the MIT license found in the
6487
- * LICENSE file in the root directory of this source tree.
6488
- */
6489
-
6490
- var ReactPropTypesSecret_1;
6491
- var hasRequiredReactPropTypesSecret;
6492
-
6493
- function requireReactPropTypesSecret () {
6494
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
6495
- hasRequiredReactPropTypesSecret = 1;
6496
-
6497
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
6498
-
6499
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
6500
- return ReactPropTypesSecret_1;
6501
- }
6502
-
6503
- var has;
6504
- var hasRequiredHas;
6505
-
6506
- function requireHas () {
6507
- if (hasRequiredHas) return has;
6508
- hasRequiredHas = 1;
6509
- has = Function.call.bind(Object.prototype.hasOwnProperty);
6510
- return has;
6511
- }
6512
-
6513
- /**
6514
- * Copyright (c) 2013-present, Facebook, Inc.
6515
- *
6516
- * This source code is licensed under the MIT license found in the
6517
- * LICENSE file in the root directory of this source tree.
6518
- */
6519
-
6520
- var checkPropTypes_1;
6521
- var hasRequiredCheckPropTypes;
6522
-
6523
- function requireCheckPropTypes () {
6524
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
6525
- hasRequiredCheckPropTypes = 1;
6526
-
6527
- var printWarning = function() {};
6528
-
6529
- if (process.env.NODE_ENV !== 'production') {
6530
- var ReactPropTypesSecret = requireReactPropTypesSecret();
6531
- var loggedTypeFailures = {};
6532
- var has = requireHas();
6533
-
6534
- printWarning = function(text) {
6535
- var message = 'Warning: ' + text;
6536
- if (typeof console !== 'undefined') {
6537
- console.error(message);
6538
- }
6539
- try {
6540
- // --- Welcome to debugging React ---
6541
- // This error was thrown as a convenience so that you can use this stack
6542
- // to find the callsite that caused this warning to fire.
6543
- throw new Error(message);
6544
- } catch (x) { /**/ }
6545
- };
6546
- }
6547
-
6548
- /**
6549
- * Assert that the values match with the type specs.
6550
- * Error messages are memorized and will only be shown once.
6551
- *
6552
- * @param {object} typeSpecs Map of name to a ReactPropType
6553
- * @param {object} values Runtime values that need to be type-checked
6554
- * @param {string} location e.g. "prop", "context", "child context"
6555
- * @param {string} componentName Name of the component for error messages.
6556
- * @param {?Function} getStack Returns the component stack.
6557
- * @private
6558
- */
6559
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
6560
- if (process.env.NODE_ENV !== 'production') {
6561
- for (var typeSpecName in typeSpecs) {
6562
- if (has(typeSpecs, typeSpecName)) {
6563
- var error;
6564
- // Prop type validation may throw. In case they do, we don't want to
6565
- // fail the render phase where it didn't fail before. So we log it.
6566
- // After these have been cleaned up, we'll let them throw.
6567
- try {
6568
- // This is intentionally an invariant that gets caught. It's the same
6569
- // behavior as without this statement except with a better message.
6570
- if (typeof typeSpecs[typeSpecName] !== 'function') {
6571
- var err = Error(
6572
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
6573
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
6574
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
6575
- );
6576
- err.name = 'Invariant Violation';
6577
- throw err;
6578
- }
6579
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
6580
- } catch (ex) {
6581
- error = ex;
6582
- }
6583
- if (error && !(error instanceof Error)) {
6584
- printWarning(
6585
- (componentName || 'React class') + ': type specification of ' +
6586
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
6587
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
6588
- 'You may have forgotten to pass an argument to the type checker ' +
6589
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
6590
- 'shape all require an argument).'
6591
- );
6592
- }
6593
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
6594
- // Only monitor this failure once because there tends to be a lot of the
6595
- // same error.
6596
- loggedTypeFailures[error.message] = true;
6597
-
6598
- var stack = getStack ? getStack() : '';
6599
-
6600
- printWarning(
6601
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
6602
- );
6603
- }
6604
- }
6605
- }
6606
- }
6607
- }
6608
-
6609
- /**
6610
- * Resets warning cache when testing.
6611
- *
6612
- * @private
6613
- */
6614
- checkPropTypes.resetWarningCache = function() {
6615
- if (process.env.NODE_ENV !== 'production') {
6616
- loggedTypeFailures = {};
6617
- }
6618
- };
6619
-
6620
- checkPropTypes_1 = checkPropTypes;
6621
- return checkPropTypes_1;
6622
- }
6623
-
6624
- /**
6625
- * Copyright (c) 2013-present, Facebook, Inc.
6626
- *
6627
- * This source code is licensed under the MIT license found in the
6628
- * LICENSE file in the root directory of this source tree.
6629
- */
6630
-
6631
- var factoryWithTypeCheckers;
6632
- var hasRequiredFactoryWithTypeCheckers;
6633
-
6634
- function requireFactoryWithTypeCheckers () {
6635
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
6636
- hasRequiredFactoryWithTypeCheckers = 1;
6637
-
6638
- var ReactIs = requireReactIs();
6639
- var assign = require$$1;
6640
-
6641
- var ReactPropTypesSecret = requireReactPropTypesSecret();
6642
- var has = requireHas();
6643
- var checkPropTypes = requireCheckPropTypes();
6644
-
6645
- var printWarning = function() {};
6646
-
6647
- if (process.env.NODE_ENV !== 'production') {
6648
- printWarning = function(text) {
6649
- var message = 'Warning: ' + text;
6650
- if (typeof console !== 'undefined') {
6651
- console.error(message);
6652
- }
6653
- try {
6654
- // --- Welcome to debugging React ---
6655
- // This error was thrown as a convenience so that you can use this stack
6656
- // to find the callsite that caused this warning to fire.
6657
- throw new Error(message);
6658
- } catch (x) {}
6659
- };
6660
- }
6661
-
6662
- function emptyFunctionThatReturnsNull() {
6663
- return null;
6664
- }
6665
-
6666
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
6667
- /* global Symbol */
6668
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
6669
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
6670
-
6671
- /**
6672
- * Returns the iterator method function contained on the iterable object.
6673
- *
6674
- * Be sure to invoke the function with the iterable as context:
6675
- *
6676
- * var iteratorFn = getIteratorFn(myIterable);
6677
- * if (iteratorFn) {
6678
- * var iterator = iteratorFn.call(myIterable);
6679
- * ...
6680
- * }
6681
- *
6682
- * @param {?object} maybeIterable
6683
- * @return {?function}
6684
- */
6685
- function getIteratorFn(maybeIterable) {
6686
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
6687
- if (typeof iteratorFn === 'function') {
6688
- return iteratorFn;
6689
- }
6690
- }
6691
-
6692
- /**
6693
- * Collection of methods that allow declaration and validation of props that are
6694
- * supplied to React components. Example usage:
6695
- *
6696
- * var Props = require('ReactPropTypes');
6697
- * var MyArticle = React.createClass({
6698
- * propTypes: {
6699
- * // An optional string prop named "description".
6700
- * description: Props.string,
6701
- *
6702
- * // A required enum prop named "category".
6703
- * category: Props.oneOf(['News','Photos']).isRequired,
6704
- *
6705
- * // A prop named "dialog" that requires an instance of Dialog.
6706
- * dialog: Props.instanceOf(Dialog).isRequired
6707
- * },
6708
- * render: function() { ... }
6709
- * });
6710
- *
6711
- * A more formal specification of how these methods are used:
6712
- *
6713
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
6714
- * decl := ReactPropTypes.{type}(.isRequired)?
6715
- *
6716
- * Each and every declaration produces a function with the same signature. This
6717
- * allows the creation of custom validation functions. For example:
6718
- *
6719
- * var MyLink = React.createClass({
6720
- * propTypes: {
6721
- * // An optional string or URI prop named "href".
6722
- * href: function(props, propName, componentName) {
6723
- * var propValue = props[propName];
6724
- * if (propValue != null && typeof propValue !== 'string' &&
6725
- * !(propValue instanceof URI)) {
6726
- * return new Error(
6727
- * 'Expected a string or an URI for ' + propName + ' in ' +
6728
- * componentName
6729
- * );
6730
- * }
6731
- * }
6732
- * },
6733
- * render: function() {...}
6734
- * });
6735
- *
6736
- * @internal
6737
- */
6738
-
6739
- var ANONYMOUS = '<<anonymous>>';
6740
-
6741
- // Important!
6742
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
6743
- var ReactPropTypes = {
6744
- array: createPrimitiveTypeChecker('array'),
6745
- bigint: createPrimitiveTypeChecker('bigint'),
6746
- bool: createPrimitiveTypeChecker('boolean'),
6747
- func: createPrimitiveTypeChecker('function'),
6748
- number: createPrimitiveTypeChecker('number'),
6749
- object: createPrimitiveTypeChecker('object'),
6750
- string: createPrimitiveTypeChecker('string'),
6751
- symbol: createPrimitiveTypeChecker('symbol'),
6752
-
6753
- any: createAnyTypeChecker(),
6754
- arrayOf: createArrayOfTypeChecker,
6755
- element: createElementTypeChecker(),
6756
- elementType: createElementTypeTypeChecker(),
6757
- instanceOf: createInstanceTypeChecker,
6758
- node: createNodeChecker(),
6759
- objectOf: createObjectOfTypeChecker,
6760
- oneOf: createEnumTypeChecker,
6761
- oneOfType: createUnionTypeChecker,
6762
- shape: createShapeTypeChecker,
6763
- exact: createStrictShapeTypeChecker,
6764
- };
6765
-
6766
- /**
6767
- * inlined Object.is polyfill to avoid requiring consumers ship their own
6768
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
6769
- */
6770
- /*eslint-disable no-self-compare*/
6771
- function is(x, y) {
6772
- // SameValue algorithm
6773
- if (x === y) {
6774
- // Steps 1-5, 7-10
6775
- // Steps 6.b-6.e: +0 != -0
6776
- return x !== 0 || 1 / x === 1 / y;
6777
- } else {
6778
- // Step 6.a: NaN == NaN
6779
- return x !== x && y !== y;
6780
- }
6781
- }
6782
- /*eslint-enable no-self-compare*/
6783
-
6784
- /**
6785
- * We use an Error-like object for backward compatibility as people may call
6786
- * PropTypes directly and inspect their output. However, we don't use real
6787
- * Errors anymore. We don't inspect their stack anyway, and creating them
6788
- * is prohibitively expensive if they are created too often, such as what
6789
- * happens in oneOfType() for any type before the one that matched.
6790
- */
6791
- function PropTypeError(message, data) {
6792
- this.message = message;
6793
- this.data = data && typeof data === 'object' ? data: {};
6794
- this.stack = '';
6795
- }
6796
- // Make `instanceof Error` still work for returned errors.
6797
- PropTypeError.prototype = Error.prototype;
6798
-
6799
- function createChainableTypeChecker(validate) {
6800
- if (process.env.NODE_ENV !== 'production') {
6801
- var manualPropTypeCallCache = {};
6802
- var manualPropTypeWarningCount = 0;
6803
- }
6804
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
6805
- componentName = componentName || ANONYMOUS;
6806
- propFullName = propFullName || propName;
6807
-
6808
- if (secret !== ReactPropTypesSecret) {
6809
- if (throwOnDirectAccess) {
6810
- // New behavior only for users of `prop-types` package
6811
- var err = new Error(
6812
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
6813
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
6814
- 'Read more at http://fb.me/use-check-prop-types'
6815
- );
6816
- err.name = 'Invariant Violation';
6817
- throw err;
6818
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
6819
- // Old behavior for people using React.PropTypes
6820
- var cacheKey = componentName + ':' + propName;
6821
- if (
6822
- !manualPropTypeCallCache[cacheKey] &&
6823
- // Avoid spamming the console because they are often not actionable except for lib authors
6824
- manualPropTypeWarningCount < 3
6825
- ) {
6826
- printWarning(
6827
- 'You are manually calling a React.PropTypes validation ' +
6828
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
6829
- 'and will throw in the standalone `prop-types` package. ' +
6830
- 'You may be seeing this warning due to a third-party PropTypes ' +
6831
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
6832
- );
6833
- manualPropTypeCallCache[cacheKey] = true;
6834
- manualPropTypeWarningCount++;
6835
- }
6836
- }
6837
- }
6838
- if (props[propName] == null) {
6839
- if (isRequired) {
6840
- if (props[propName] === null) {
6841
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
6842
- }
6843
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
6844
- }
6845
- return null;
6846
- } else {
6847
- return validate(props, propName, componentName, location, propFullName);
6848
- }
6849
- }
6850
-
6851
- var chainedCheckType = checkType.bind(null, false);
6852
- chainedCheckType.isRequired = checkType.bind(null, true);
6853
-
6854
- return chainedCheckType;
6855
- }
6856
-
6857
- function createPrimitiveTypeChecker(expectedType) {
6858
- function validate(props, propName, componentName, location, propFullName, secret) {
6859
- var propValue = props[propName];
6860
- var propType = getPropType(propValue);
6861
- if (propType !== expectedType) {
6862
- // `propValue` being instance of, say, date/regexp, pass the 'object'
6863
- // check, but we can offer a more precise error message here rather than
6864
- // 'of type `object`'.
6865
- var preciseType = getPreciseType(propValue);
6866
-
6867
- return new PropTypeError(
6868
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
6869
- {expectedType: expectedType}
6870
- );
6871
- }
6872
- return null;
6873
- }
6874
- return createChainableTypeChecker(validate);
6875
- }
6876
-
6877
- function createAnyTypeChecker() {
6878
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
6879
- }
6880
-
6881
- function createArrayOfTypeChecker(typeChecker) {
6882
- function validate(props, propName, componentName, location, propFullName) {
6883
- if (typeof typeChecker !== 'function') {
6884
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
6885
- }
6886
- var propValue = props[propName];
6887
- if (!Array.isArray(propValue)) {
6888
- var propType = getPropType(propValue);
6889
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
6890
- }
6891
- for (var i = 0; i < propValue.length; i++) {
6892
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
6893
- if (error instanceof Error) {
6894
- return error;
6895
- }
6896
- }
6897
- return null;
6898
- }
6899
- return createChainableTypeChecker(validate);
6900
- }
6901
-
6902
- function createElementTypeChecker() {
6903
- function validate(props, propName, componentName, location, propFullName) {
6904
- var propValue = props[propName];
6905
- if (!isValidElement(propValue)) {
6906
- var propType = getPropType(propValue);
6907
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
6908
- }
6909
- return null;
6910
- }
6911
- return createChainableTypeChecker(validate);
6912
- }
6913
-
6914
- function createElementTypeTypeChecker() {
6915
- function validate(props, propName, componentName, location, propFullName) {
6916
- var propValue = props[propName];
6917
- if (!ReactIs.isValidElementType(propValue)) {
6918
- var propType = getPropType(propValue);
6919
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
6920
- }
6921
- return null;
6922
- }
6923
- return createChainableTypeChecker(validate);
6924
- }
6925
-
6926
- function createInstanceTypeChecker(expectedClass) {
6927
- function validate(props, propName, componentName, location, propFullName) {
6928
- if (!(props[propName] instanceof expectedClass)) {
6929
- var expectedClassName = expectedClass.name || ANONYMOUS;
6930
- var actualClassName = getClassName(props[propName]);
6931
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
6932
- }
6933
- return null;
6934
- }
6935
- return createChainableTypeChecker(validate);
6936
- }
6937
-
6938
- function createEnumTypeChecker(expectedValues) {
6939
- if (!Array.isArray(expectedValues)) {
6940
- if (process.env.NODE_ENV !== 'production') {
6941
- if (arguments.length > 1) {
6942
- printWarning(
6943
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
6944
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
6945
- );
6946
- } else {
6947
- printWarning('Invalid argument supplied to oneOf, expected an array.');
6948
- }
6949
- }
6950
- return emptyFunctionThatReturnsNull;
6951
- }
6952
-
6953
- function validate(props, propName, componentName, location, propFullName) {
6954
- var propValue = props[propName];
6955
- for (var i = 0; i < expectedValues.length; i++) {
6956
- if (is(propValue, expectedValues[i])) {
6957
- return null;
6958
- }
6959
- }
6960
-
6961
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
6962
- var type = getPreciseType(value);
6963
- if (type === 'symbol') {
6964
- return String(value);
6965
- }
6966
- return value;
6967
- });
6968
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
6969
- }
6970
- return createChainableTypeChecker(validate);
6971
- }
6972
-
6973
- function createObjectOfTypeChecker(typeChecker) {
6974
- function validate(props, propName, componentName, location, propFullName) {
6975
- if (typeof typeChecker !== 'function') {
6976
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
6977
- }
6978
- var propValue = props[propName];
6979
- var propType = getPropType(propValue);
6980
- if (propType !== 'object') {
6981
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
6982
- }
6983
- for (var key in propValue) {
6984
- if (has(propValue, key)) {
6985
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
6986
- if (error instanceof Error) {
6987
- return error;
6988
- }
6989
- }
6990
- }
6991
- return null;
6992
- }
6993
- return createChainableTypeChecker(validate);
6994
- }
6995
-
6996
- function createUnionTypeChecker(arrayOfTypeCheckers) {
6997
- if (!Array.isArray(arrayOfTypeCheckers)) {
6998
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
6999
- return emptyFunctionThatReturnsNull;
7000
- }
7001
-
7002
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
7003
- var checker = arrayOfTypeCheckers[i];
7004
- if (typeof checker !== 'function') {
7005
- printWarning(
7006
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
7007
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
7008
- );
7009
- return emptyFunctionThatReturnsNull;
7010
- }
7011
- }
7012
-
7013
- function validate(props, propName, componentName, location, propFullName) {
7014
- var expectedTypes = [];
7015
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
7016
- var checker = arrayOfTypeCheckers[i];
7017
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
7018
- if (checkerResult == null) {
7019
- return null;
7020
- }
7021
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
7022
- expectedTypes.push(checkerResult.data.expectedType);
7023
- }
7024
- }
7025
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
7026
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
7027
- }
7028
- return createChainableTypeChecker(validate);
7029
- }
7030
-
7031
- function createNodeChecker() {
7032
- function validate(props, propName, componentName, location, propFullName) {
7033
- if (!isNode(props[propName])) {
7034
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
7035
- }
7036
- return null;
7037
- }
7038
- return createChainableTypeChecker(validate);
7039
- }
7040
-
7041
- function invalidValidatorError(componentName, location, propFullName, key, type) {
7042
- return new PropTypeError(
7043
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
7044
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
7045
- );
7046
- }
7047
-
7048
- function createShapeTypeChecker(shapeTypes) {
7049
- function validate(props, propName, componentName, location, propFullName) {
7050
- var propValue = props[propName];
7051
- var propType = getPropType(propValue);
7052
- if (propType !== 'object') {
7053
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
7054
- }
7055
- for (var key in shapeTypes) {
7056
- var checker = shapeTypes[key];
7057
- if (typeof checker !== 'function') {
7058
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
7059
- }
7060
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
7061
- if (error) {
7062
- return error;
7063
- }
7064
- }
7065
- return null;
7066
- }
7067
- return createChainableTypeChecker(validate);
7068
- }
7069
-
7070
- function createStrictShapeTypeChecker(shapeTypes) {
7071
- function validate(props, propName, componentName, location, propFullName) {
7072
- var propValue = props[propName];
7073
- var propType = getPropType(propValue);
7074
- if (propType !== 'object') {
7075
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
7076
- }
7077
- // We need to check all keys in case some are required but missing from props.
7078
- var allKeys = assign({}, props[propName], shapeTypes);
7079
- for (var key in allKeys) {
7080
- var checker = shapeTypes[key];
7081
- if (has(shapeTypes, key) && typeof checker !== 'function') {
7082
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
7083
- }
7084
- if (!checker) {
7085
- return new PropTypeError(
7086
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
7087
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
7088
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
7089
- );
7090
- }
7091
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
7092
- if (error) {
7093
- return error;
7094
- }
7095
- }
7096
- return null;
7097
- }
7098
-
7099
- return createChainableTypeChecker(validate);
7100
- }
7101
-
7102
- function isNode(propValue) {
7103
- switch (typeof propValue) {
7104
- case 'number':
7105
- case 'string':
7106
- case 'undefined':
7107
- return true;
7108
- case 'boolean':
7109
- return !propValue;
7110
- case 'object':
7111
- if (Array.isArray(propValue)) {
7112
- return propValue.every(isNode);
7113
- }
7114
- if (propValue === null || isValidElement(propValue)) {
7115
- return true;
7116
- }
7117
-
7118
- var iteratorFn = getIteratorFn(propValue);
7119
- if (iteratorFn) {
7120
- var iterator = iteratorFn.call(propValue);
7121
- var step;
7122
- if (iteratorFn !== propValue.entries) {
7123
- while (!(step = iterator.next()).done) {
7124
- if (!isNode(step.value)) {
7125
- return false;
7126
- }
7127
- }
7128
- } else {
7129
- // Iterator will provide entry [k,v] tuples rather than values.
7130
- while (!(step = iterator.next()).done) {
7131
- var entry = step.value;
7132
- if (entry) {
7133
- if (!isNode(entry[1])) {
7134
- return false;
7135
- }
7136
- }
7137
- }
7138
- }
7139
- } else {
7140
- return false;
7141
- }
7142
-
7143
- return true;
7144
- default:
7145
- return false;
7146
- }
7147
- }
7148
-
7149
- function isSymbol(propType, propValue) {
7150
- // Native Symbol.
7151
- if (propType === 'symbol') {
7152
- return true;
7153
- }
7154
-
7155
- // falsy value can't be a Symbol
7156
- if (!propValue) {
7157
- return false;
7158
- }
7159
-
7160
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
7161
- if (propValue['@@toStringTag'] === 'Symbol') {
7162
- return true;
7163
- }
7164
-
7165
- // Fallback for non-spec compliant Symbols which are polyfilled.
7166
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
7167
- return true;
7168
- }
7169
-
7170
- return false;
7171
- }
7172
-
7173
- // Equivalent of `typeof` but with special handling for array and regexp.
7174
- function getPropType(propValue) {
7175
- var propType = typeof propValue;
7176
- if (Array.isArray(propValue)) {
7177
- return 'array';
7178
- }
7179
- if (propValue instanceof RegExp) {
7180
- // Old webkits (at least until Android 4.0) return 'function' rather than
7181
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
7182
- // passes PropTypes.object.
7183
- return 'object';
7184
- }
7185
- if (isSymbol(propType, propValue)) {
7186
- return 'symbol';
7187
- }
7188
- return propType;
7189
- }
7190
-
7191
- // This handles more types than `getPropType`. Only used for error messages.
7192
- // See `createPrimitiveTypeChecker`.
7193
- function getPreciseType(propValue) {
7194
- if (typeof propValue === 'undefined' || propValue === null) {
7195
- return '' + propValue;
7196
- }
7197
- var propType = getPropType(propValue);
7198
- if (propType === 'object') {
7199
- if (propValue instanceof Date) {
7200
- return 'date';
7201
- } else if (propValue instanceof RegExp) {
7202
- return 'regexp';
7203
- }
7204
- }
7205
- return propType;
7206
- }
7207
-
7208
- // Returns a string that is postfixed to a warning about an invalid type.
7209
- // For example, "undefined" or "of type array"
7210
- function getPostfixForTypeWarning(value) {
7211
- var type = getPreciseType(value);
7212
- switch (type) {
7213
- case 'array':
7214
- case 'object':
7215
- return 'an ' + type;
7216
- case 'boolean':
7217
- case 'date':
7218
- case 'regexp':
7219
- return 'a ' + type;
7220
- default:
7221
- return type;
7222
- }
7223
- }
7224
-
7225
- // Returns class name of the object, if any.
7226
- function getClassName(propValue) {
7227
- if (!propValue.constructor || !propValue.constructor.name) {
7228
- return ANONYMOUS;
7229
- }
7230
- return propValue.constructor.name;
7231
- }
7232
-
7233
- ReactPropTypes.checkPropTypes = checkPropTypes;
7234
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
7235
- ReactPropTypes.PropTypes = ReactPropTypes;
7236
-
7237
- return ReactPropTypes;
7238
- };
7239
- return factoryWithTypeCheckers;
7240
- }
7241
-
7242
- /**
7243
- * Copyright (c) 2013-present, Facebook, Inc.
7244
- *
7245
- * This source code is licensed under the MIT license found in the
7246
- * LICENSE file in the root directory of this source tree.
7247
- */
7248
-
7249
- var factoryWithThrowingShims;
7250
- var hasRequiredFactoryWithThrowingShims;
7251
-
7252
- function requireFactoryWithThrowingShims () {
7253
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
7254
- hasRequiredFactoryWithThrowingShims = 1;
7255
-
7256
- var ReactPropTypesSecret = requireReactPropTypesSecret();
7257
-
7258
- function emptyFunction() {}
7259
- function emptyFunctionWithReset() {}
7260
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
7261
-
7262
- factoryWithThrowingShims = function() {
7263
- function shim(props, propName, componentName, location, propFullName, secret) {
7264
- if (secret === ReactPropTypesSecret) {
7265
- // It is still safe when called from React.
7266
- return;
7267
- }
7268
- var err = new Error(
7269
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
7270
- 'Use PropTypes.checkPropTypes() to call them. ' +
7271
- 'Read more at http://fb.me/use-check-prop-types'
7272
- );
7273
- err.name = 'Invariant Violation';
7274
- throw err;
7275
- } shim.isRequired = shim;
7276
- function getShim() {
7277
- return shim;
7278
- } // Important!
7279
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
7280
- var ReactPropTypes = {
7281
- array: shim,
7282
- bigint: shim,
7283
- bool: shim,
7284
- func: shim,
7285
- number: shim,
7286
- object: shim,
7287
- string: shim,
7288
- symbol: shim,
7289
-
7290
- any: shim,
7291
- arrayOf: getShim,
7292
- element: shim,
7293
- elementType: shim,
7294
- instanceOf: getShim,
7295
- node: shim,
7296
- objectOf: getShim,
7297
- oneOf: getShim,
7298
- oneOfType: getShim,
7299
- shape: getShim,
7300
- exact: getShim,
7301
-
7302
- checkPropTypes: emptyFunctionWithReset,
7303
- resetWarningCache: emptyFunction
7304
- };
7305
-
7306
- ReactPropTypes.PropTypes = ReactPropTypes;
7307
-
7308
- return ReactPropTypes;
7309
- };
7310
- return factoryWithThrowingShims;
7311
- }
7312
-
7313
- /**
7314
- * Copyright (c) 2013-present, Facebook, Inc.
7315
- *
7316
- * This source code is licensed under the MIT license found in the
7317
- * LICENSE file in the root directory of this source tree.
7318
- */
7319
-
7320
- var hasRequiredPropTypes;
7321
-
7322
- function requirePropTypes () {
7323
- if (hasRequiredPropTypes) return propTypes.exports;
7324
- hasRequiredPropTypes = 1;
7325
- if (process.env.NODE_ENV !== 'production') {
7326
- var ReactIs = requireReactIs();
7327
-
7328
- // By explicitly using `prop-types` you are opting into new development behavior.
7329
- // http://fb.me/prop-types-in-prod
7330
- var throwOnDirectAccess = true;
7331
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
7332
- } else {
7333
- // By explicitly using `prop-types` you are opting into new production behavior.
7334
- // http://fb.me/prop-types-in-prod
7335
- propTypes.exports = requireFactoryWithThrowingShims()();
7336
- }
7337
- return propTypes.exports;
7338
- }
7339
-
7340
- var lottie$1 = {exports: {}};
7341
-
7342
- var lottie = lottie$1.exports;
6244
+ var lottie$1 = lottie$2.exports;
7343
6245
 
7344
6246
  var hasRequiredLottie;
7345
6247
 
7346
6248
  function requireLottie () {
7347
- if (hasRequiredLottie) return lottie$1.exports;
6249
+ if (hasRequiredLottie) return lottie$2.exports;
7348
6250
  hasRequiredLottie = 1;
7349
6251
  (function (module, exports) {
7350
6252
  (typeof navigator !== "undefined") && (function (global, factory) {
7351
6253
  module.exports = factory() ;
7352
- })(lottie, (function () {
6254
+ })(lottie$1, (function () {
7353
6255
  var svgNS = 'http://www.w3.org/2000/svg';
7354
6256
  var locationHref = '';
7355
6257
  var _useWebWorker = false;
@@ -27426,296 +26328,656 @@ function requireLottie () {
27426
26328
  return lottie;
27427
26329
 
27428
26330
  }));
27429
- } (lottie$1, lottie$1.exports));
27430
- return lottie$1.exports;
26331
+ } (lottie$2, lottie$2.exports));
26332
+ return lottie$2.exports;
27431
26333
  }
27432
26334
 
27433
- var hasRequiredDist;
27434
-
27435
- function requireDist () {
27436
- if (hasRequiredDist) return dist;
27437
- hasRequiredDist = 1;
27438
-
27439
- Object.defineProperty(dist, "__esModule", {
27440
- value: true
27441
- });
27442
-
27443
- var _extends2 = require$$0;
27444
-
27445
- var _extends3 = _interopRequireDefault(_extends2);
27446
-
27447
- var _getPrototypeOf = require$$1$1;
27448
-
27449
- var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
27450
-
27451
- var _classCallCheck2 = require$$2;
27452
-
27453
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
27454
-
27455
- var _createClass2 = require$$3;
27456
-
27457
- var _createClass3 = _interopRequireDefault(_createClass2);
27458
-
27459
- var _possibleConstructorReturn2 = require$$4;
26335
+ var lottieExports = requireLottie();
26336
+ var lottie = /*@__PURE__*/getDefaultExportFromCjs(lottieExports);
27460
26337
 
27461
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
27462
-
27463
- var _inherits2 = require$$5;
26338
+ function _arrayLikeToArray(r, a) {
26339
+ (null == a || a > r.length) && (a = r.length);
26340
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
26341
+ return n;
26342
+ }
26343
+ function _arrayWithHoles(r) {
26344
+ if (Array.isArray(r)) return r;
26345
+ }
26346
+ function _defineProperty(e, r, t) {
26347
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
26348
+ value: t,
26349
+ enumerable: true,
26350
+ configurable: true,
26351
+ writable: true
26352
+ }) : e[r] = t, e;
26353
+ }
26354
+ function _iterableToArrayLimit(r, l) {
26355
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
26356
+ if (null != t) {
26357
+ var e,
26358
+ n,
26359
+ i,
26360
+ u,
26361
+ a = [],
26362
+ f = true,
26363
+ o = false;
26364
+ try {
26365
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
26366
+ } catch (r) {
26367
+ o = true, n = r;
26368
+ } finally {
26369
+ try {
26370
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
26371
+ } finally {
26372
+ if (o) throw n;
26373
+ }
26374
+ }
26375
+ return a;
26376
+ }
26377
+ }
26378
+ function _nonIterableRest() {
26379
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
26380
+ }
26381
+ function ownKeys(e, r) {
26382
+ var t = Object.keys(e);
26383
+ if (Object.getOwnPropertySymbols) {
26384
+ var o = Object.getOwnPropertySymbols(e);
26385
+ r && (o = o.filter(function (r) {
26386
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
26387
+ })), t.push.apply(t, o);
26388
+ }
26389
+ return t;
26390
+ }
26391
+ function _objectSpread2(e) {
26392
+ for (var r = 1; r < arguments.length; r++) {
26393
+ var t = null != arguments[r] ? arguments[r] : {};
26394
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
26395
+ _defineProperty(e, r, t[r]);
26396
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
26397
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
26398
+ });
26399
+ }
26400
+ return e;
26401
+ }
26402
+ function _objectWithoutProperties(e, t) {
26403
+ if (null == e) return {};
26404
+ var o,
26405
+ r,
26406
+ i = _objectWithoutPropertiesLoose(e, t);
26407
+ if (Object.getOwnPropertySymbols) {
26408
+ var s = Object.getOwnPropertySymbols(e);
26409
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
26410
+ }
26411
+ return i;
26412
+ }
26413
+ function _objectWithoutPropertiesLoose(r, e) {
26414
+ if (null == r) return {};
26415
+ var t = {};
26416
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
26417
+ if (e.includes(n)) continue;
26418
+ t[n] = r[n];
26419
+ }
26420
+ return t;
26421
+ }
26422
+ function _slicedToArray(r, e) {
26423
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
26424
+ }
26425
+ function _toPrimitive(t, r) {
26426
+ if ("object" != typeof t || !t) return t;
26427
+ var e = t[Symbol.toPrimitive];
26428
+ if (void 0 !== e) {
26429
+ var i = e.call(t, r);
26430
+ if ("object" != typeof i) return i;
26431
+ throw new TypeError("@@toPrimitive must return a primitive value.");
26432
+ }
26433
+ return ("string" === r ? String : Number)(t);
26434
+ }
26435
+ function _toPropertyKey(t) {
26436
+ var i = _toPrimitive(t, "string");
26437
+ return "symbol" == typeof i ? i : i + "";
26438
+ }
26439
+ function _unsupportedIterableToArray(r, a) {
26440
+ if (r) {
26441
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
26442
+ var t = {}.toString.call(r).slice(8, -1);
26443
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
26444
+ }
26445
+ }
27464
26446
 
27465
- var _inherits3 = _interopRequireDefault(_inherits2);
26447
+ var _excluded$1 = ["animationData", "loop", "autoplay", "initialSegment", "onComplete", "onLoopComplete", "onEnterFrame", "onSegmentStart", "onConfigReady", "onDataReady", "onDataFailed", "onLoadedImages", "onDOMLoaded", "onDestroy", "lottieRef", "renderer", "name", "assetsPath", "rendererSettings"];
26448
+ var useLottie = function useLottie(props, style) {
26449
+ var animationData = props.animationData,
26450
+ loop = props.loop,
26451
+ autoplay = props.autoplay,
26452
+ initialSegment = props.initialSegment,
26453
+ onComplete = props.onComplete,
26454
+ onLoopComplete = props.onLoopComplete,
26455
+ onEnterFrame = props.onEnterFrame,
26456
+ onSegmentStart = props.onSegmentStart,
26457
+ onConfigReady = props.onConfigReady,
26458
+ onDataReady = props.onDataReady,
26459
+ onDataFailed = props.onDataFailed,
26460
+ onLoadedImages = props.onLoadedImages,
26461
+ onDOMLoaded = props.onDOMLoaded,
26462
+ onDestroy = props.onDestroy;
26463
+ props.lottieRef;
26464
+ props.renderer;
26465
+ props.name;
26466
+ props.assetsPath;
26467
+ props.rendererSettings;
26468
+ var rest = _objectWithoutProperties(props, _excluded$1);
26469
+ var _useState = useState(false),
26470
+ _useState2 = _slicedToArray(_useState, 2),
26471
+ animationLoaded = _useState2[0],
26472
+ setAnimationLoaded = _useState2[1];
26473
+ var animationInstanceRef = useRef();
26474
+ var animationContainer = useRef(null);
26475
+ /*
26476
+ ======================================
26477
+ INTERACTION METHODS
26478
+ ======================================
26479
+ */
26480
+ /**
26481
+ * Play
26482
+ */
26483
+ var play = function play() {
26484
+ var _a;
26485
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.play();
26486
+ };
26487
+ /**
26488
+ * Stop
26489
+ */
26490
+ var stop = function stop() {
26491
+ var _a;
26492
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.stop();
26493
+ };
26494
+ /**
26495
+ * Pause
26496
+ */
26497
+ var pause = function pause() {
26498
+ var _a;
26499
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.pause();
26500
+ };
26501
+ /**
26502
+ * Set animation speed
26503
+ * @param speed
26504
+ */
26505
+ var setSpeed = function setSpeed(speed) {
26506
+ var _a;
26507
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setSpeed(speed);
26508
+ };
26509
+ /**
26510
+ * Got to frame and play
26511
+ * @param value
26512
+ * @param isFrame
26513
+ */
26514
+ var goToAndPlay = function goToAndPlay(value, isFrame) {
26515
+ var _a;
26516
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.goToAndPlay(value, isFrame);
26517
+ };
26518
+ /**
26519
+ * Got to frame and stop
26520
+ * @param value
26521
+ * @param isFrame
26522
+ */
26523
+ var goToAndStop = function goToAndStop(value, isFrame) {
26524
+ var _a;
26525
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.goToAndStop(value, isFrame);
26526
+ };
26527
+ /**
26528
+ * Set animation direction
26529
+ * @param direction
26530
+ */
26531
+ var setDirection = function setDirection(direction) {
26532
+ var _a;
26533
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setDirection(direction);
26534
+ };
26535
+ /**
26536
+ * Play animation segments
26537
+ * @param segments
26538
+ * @param forceFlag
26539
+ */
26540
+ var playSegments = function playSegments(segments, forceFlag) {
26541
+ var _a;
26542
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.playSegments(segments, forceFlag);
26543
+ };
26544
+ /**
26545
+ * Set sub frames
26546
+ * @param useSubFrames
26547
+ */
26548
+ var setSubframe = function setSubframe(useSubFrames) {
26549
+ var _a;
26550
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setSubframe(useSubFrames);
26551
+ };
26552
+ /**
26553
+ * Get animation duration
26554
+ * @param inFrames
26555
+ */
26556
+ var getDuration = function getDuration(inFrames) {
26557
+ var _a;
26558
+ return (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.getDuration(inFrames);
26559
+ };
26560
+ /**
26561
+ * Destroy animation
26562
+ */
26563
+ var destroy = function destroy() {
26564
+ var _a;
26565
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
26566
+ // Removing the reference to the animation so separate cleanups are skipped.
26567
+ // Without it the internal `lottie-react` instance throws exceptions as it already cleared itself on destroy.
26568
+ animationInstanceRef.current = undefined;
26569
+ };
26570
+ /*
26571
+ ======================================
26572
+ LOTTIE
26573
+ ======================================
26574
+ */
26575
+ /**
26576
+ * Load a new animation, and if it's the case, destroy the previous one
26577
+ * @param {Object} forcedConfigs
26578
+ */
26579
+ var loadAnimation = function loadAnimation() {
26580
+ var forcedConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26581
+ var _a;
26582
+ // Return if the container ref is null
26583
+ if (!animationContainer.current) {
26584
+ return;
26585
+ }
26586
+ // Destroy any previous instance
26587
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
26588
+ // Build the animation configuration
26589
+ var config = _objectSpread2(_objectSpread2(_objectSpread2({}, props), forcedConfigs), {}, {
26590
+ container: animationContainer.current
26591
+ });
26592
+ // Save the animation instance
26593
+ animationInstanceRef.current = lottie.loadAnimation(config);
26594
+ setAnimationLoaded(!!animationInstanceRef.current);
26595
+ // Return a function that will clean up
26596
+ return function () {
26597
+ var _a;
26598
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
26599
+ animationInstanceRef.current = undefined;
26600
+ };
26601
+ };
26602
+ /**
26603
+ * (Re)Initialize when animation data changed
26604
+ */
26605
+ useEffect(function () {
26606
+ var onUnmount = loadAnimation();
26607
+ // Clean up on unmount
26608
+ return function () {
26609
+ return onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
26610
+ };
26611
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26612
+ }, [animationData, loop]);
26613
+ // Update the autoplay state
26614
+ useEffect(function () {
26615
+ if (!animationInstanceRef.current) {
26616
+ return;
26617
+ }
26618
+ animationInstanceRef.current.autoplay = !!autoplay;
26619
+ }, [autoplay]);
26620
+ // Update the initial segment state
26621
+ useEffect(function () {
26622
+ if (!animationInstanceRef.current) {
26623
+ return;
26624
+ }
26625
+ // When null should reset to default animation length
26626
+ if (!initialSegment) {
26627
+ animationInstanceRef.current.resetSegments(true);
26628
+ return;
26629
+ }
26630
+ // If it's not a valid segment, do nothing
26631
+ if (!Array.isArray(initialSegment) || !initialSegment.length) {
26632
+ return;
26633
+ }
26634
+ // If the current position it's not in the new segment
26635
+ // set the current position to start
26636
+ if (animationInstanceRef.current.currentRawFrame < initialSegment[0] || animationInstanceRef.current.currentRawFrame > initialSegment[1]) {
26637
+ animationInstanceRef.current.currentRawFrame = initialSegment[0];
26638
+ }
26639
+ // Update the segment
26640
+ animationInstanceRef.current.setSegment(initialSegment[0], initialSegment[1]);
26641
+ }, [initialSegment]);
26642
+ /*
26643
+ ======================================
26644
+ EVENTS
26645
+ ======================================
26646
+ */
26647
+ /**
26648
+ * Reinitialize listener on change
26649
+ */
26650
+ useEffect(function () {
26651
+ var partialListeners = [{
26652
+ name: "complete",
26653
+ handler: onComplete
26654
+ }, {
26655
+ name: "loopComplete",
26656
+ handler: onLoopComplete
26657
+ }, {
26658
+ name: "enterFrame",
26659
+ handler: onEnterFrame
26660
+ }, {
26661
+ name: "segmentStart",
26662
+ handler: onSegmentStart
26663
+ }, {
26664
+ name: "config_ready",
26665
+ handler: onConfigReady
26666
+ }, {
26667
+ name: "data_ready",
26668
+ handler: onDataReady
26669
+ }, {
26670
+ name: "data_failed",
26671
+ handler: onDataFailed
26672
+ }, {
26673
+ name: "loaded_images",
26674
+ handler: onLoadedImages
26675
+ }, {
26676
+ name: "DOMLoaded",
26677
+ handler: onDOMLoaded
26678
+ }, {
26679
+ name: "destroy",
26680
+ handler: onDestroy
26681
+ }];
26682
+ var listeners = partialListeners.filter(function (listener) {
26683
+ return listener.handler != null;
26684
+ });
26685
+ if (!listeners.length) {
26686
+ return;
26687
+ }
26688
+ var deregisterList = listeners.map(
26689
+ /**
26690
+ * Handle the process of adding an event listener
26691
+ * @param {Listener} listener
26692
+ * @return {Function} Function that deregister the listener
26693
+ */
26694
+ function (listener) {
26695
+ var _a;
26696
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener(listener.name, listener.handler);
26697
+ // Return a function to deregister this listener
26698
+ return function () {
26699
+ var _a;
26700
+ (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(listener.name, listener.handler);
26701
+ };
26702
+ });
26703
+ // Deregister listeners on unmount
26704
+ return function () {
26705
+ deregisterList.forEach(function (deregister) {
26706
+ return deregister();
26707
+ });
26708
+ };
26709
+ }, [onComplete, onLoopComplete, onEnterFrame, onSegmentStart, onConfigReady, onDataReady, onDataFailed, onLoadedImages, onDOMLoaded, onDestroy]);
26710
+ /**
26711
+ * Build the animation view
26712
+ */
26713
+ var View = /*#__PURE__*/React.createElement("div", _objectSpread2({
26714
+ style: style,
26715
+ ref: animationContainer
26716
+ }, rest));
26717
+ return {
26718
+ View: View,
26719
+ play: play,
26720
+ stop: stop,
26721
+ pause: pause,
26722
+ setSpeed: setSpeed,
26723
+ goToAndStop: goToAndStop,
26724
+ goToAndPlay: goToAndPlay,
26725
+ setDirection: setDirection,
26726
+ playSegments: playSegments,
26727
+ setSubframe: setSubframe,
26728
+ getDuration: getDuration,
26729
+ destroy: destroy,
26730
+ animationContainerRef: animationContainer,
26731
+ animationLoaded: animationLoaded,
26732
+ animationItem: animationInstanceRef.current
26733
+ };
26734
+ };
27466
26735
 
27467
- var _react = React;
27468
-
27469
- var _react2 = _interopRequireDefault(_react);
27470
-
27471
- var _propTypes = /*@__PURE__*/ requirePropTypes();
27472
-
27473
- var _propTypes2 = _interopRequireDefault(_propTypes);
27474
-
27475
- var _lottieWeb = requireLottie();
27476
-
27477
- var _lottieWeb2 = _interopRequireDefault(_lottieWeb);
27478
-
27479
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27480
-
27481
- var Lottie = function (_React$Component) {
27482
- (0, _inherits3.default)(Lottie, _React$Component);
27483
-
27484
- function Lottie() {
27485
- var _ref;
27486
-
27487
- var _temp, _this, _ret;
27488
-
27489
- (0, _classCallCheck3.default)(this, Lottie);
27490
-
27491
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
27492
- args[_key] = arguments[_key];
27493
- }
27494
-
27495
- return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Lottie.__proto__ || (0, _getPrototypeOf2.default)(Lottie)).call.apply(_ref, [this].concat(args))), _this), _this.handleClickToPause = function () {
27496
- // The pause() method is for handling pausing by passing a prop isPaused
27497
- // This method is for handling the ability to pause by clicking on the animation
27498
- if (_this.anim.isPaused) {
27499
- _this.anim.play();
27500
- } else {
27501
- _this.anim.pause();
27502
- }
27503
- }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
27504
- }
27505
-
27506
- (0, _createClass3.default)(Lottie, [{
27507
- key: 'componentDidMount',
27508
- value: function componentDidMount() {
27509
- var _props = this.props,
27510
- options = _props.options,
27511
- eventListeners = _props.eventListeners;
27512
- var loop = options.loop,
27513
- autoplay = options.autoplay,
27514
- animationData = options.animationData,
27515
- rendererSettings = options.rendererSettings,
27516
- segments = options.segments;
27517
-
27518
-
27519
- this.options = {
27520
- container: this.el,
27521
- renderer: 'svg',
27522
- loop: loop !== false,
27523
- autoplay: autoplay !== false,
27524
- segments: segments !== false,
27525
- animationData: animationData,
27526
- rendererSettings: rendererSettings
27527
- };
27528
-
27529
- this.options = (0, _extends3.default)({}, this.options, options);
27530
- this.anim = _lottieWeb2.default.loadAnimation(this.options);
27531
- this.registerEvents(eventListeners);
27532
- this.setSpeed();
27533
- }
27534
- }, {
27535
- key: 'componentWillUpdate',
27536
- value: function componentWillUpdate(nextProps /* , nextState */) {
27537
- /* Recreate the animation handle if the data is changed */
27538
- if (this.options.animationData !== nextProps.options.animationData) {
27539
- this.deRegisterEvents(this.props.eventListeners);
27540
- this.destroy();
27541
- this.options = (0, _extends3.default)({}, this.options, nextProps.options);
27542
- this.anim = _lottieWeb2.default.loadAnimation(this.options);
27543
- this.registerEvents(nextProps.eventListeners);
27544
- }
27545
- }
27546
- }, {
27547
- key: 'componentDidUpdate',
27548
- value: function componentDidUpdate() {
27549
- if (this.props.isStopped) {
27550
- this.stop();
27551
- } else if (this.props.segments) {
27552
- this.playSegments();
27553
- } else {
27554
- this.play();
27555
- }
27556
-
27557
- this.pause();
27558
- this.setSpeed();
27559
- this.setDirection();
27560
- }
27561
- }, {
27562
- key: 'componentWillUnmount',
27563
- value: function componentWillUnmount() {
27564
- this.deRegisterEvents(this.props.eventListeners);
27565
- this.destroy();
27566
- this.options.animationData = null;
27567
- this.anim = null;
27568
- }
27569
- }, {
27570
- key: 'setSpeed',
27571
- value: function setSpeed() {
27572
- this.anim.setSpeed(this.props.speed);
27573
- }
27574
- }, {
27575
- key: 'setDirection',
27576
- value: function setDirection() {
27577
- this.anim.setDirection(this.props.direction);
27578
- }
27579
- }, {
27580
- key: 'play',
27581
- value: function play() {
27582
- this.anim.play();
27583
- }
27584
- }, {
27585
- key: 'playSegments',
27586
- value: function playSegments() {
27587
- this.anim.playSegments(this.props.segments);
27588
- }
27589
- }, {
27590
- key: 'stop',
27591
- value: function stop() {
27592
- this.anim.stop();
27593
- }
27594
- }, {
27595
- key: 'pause',
27596
- value: function pause() {
27597
- if (this.props.isPaused && !this.anim.isPaused) {
27598
- this.anim.pause();
27599
- } else if (!this.props.isPaused && this.anim.isPaused) {
27600
- this.anim.pause();
27601
- }
27602
- }
27603
- }, {
27604
- key: 'destroy',
27605
- value: function destroy() {
27606
- this.anim.destroy();
27607
- }
27608
- }, {
27609
- key: 'registerEvents',
27610
- value: function registerEvents(eventListeners) {
27611
- var _this2 = this;
27612
-
27613
- eventListeners.forEach(function (eventListener) {
27614
- _this2.anim.addEventListener(eventListener.eventName, eventListener.callback);
27615
- });
27616
- }
27617
- }, {
27618
- key: 'deRegisterEvents',
27619
- value: function deRegisterEvents(eventListeners) {
27620
- var _this3 = this;
27621
-
27622
- eventListeners.forEach(function (eventListener) {
27623
- _this3.anim.removeEventListener(eventListener.eventName, eventListener.callback);
27624
- });
27625
- }
27626
- }, {
27627
- key: 'render',
27628
- value: function render() {
27629
- var _this4 = this;
27630
-
27631
- var _props2 = this.props,
27632
- width = _props2.width,
27633
- height = _props2.height,
27634
- ariaRole = _props2.ariaRole,
27635
- ariaLabel = _props2.ariaLabel,
27636
- isClickToPauseDisabled = _props2.isClickToPauseDisabled,
27637
- title = _props2.title;
27638
-
27639
-
27640
- var getSize = function getSize(initial) {
27641
- var size = void 0;
27642
-
27643
- if (typeof initial === 'number') {
27644
- size = initial + 'px';
27645
- } else {
27646
- size = initial || '100%';
27647
- }
27648
-
27649
- return size;
27650
- };
27651
-
27652
- var lottieStyles = (0, _extends3.default)({
27653
- width: getSize(width),
27654
- height: getSize(height),
27655
- overflow: 'hidden',
27656
- margin: '0 auto',
27657
- outline: 'none'
27658
- }, this.props.style);
27659
-
27660
- var onClickHandler = isClickToPauseDisabled ? function () {
27661
- return null;
27662
- } : this.handleClickToPause;
27663
-
27664
- return (
27665
- // Bug with eslint rules https://github.com/airbnb/javascript/issues/1374
27666
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
27667
- _react2.default.createElement('div', {
27668
- ref: function ref(c) {
27669
- _this4.el = c;
27670
- },
27671
- style: lottieStyles,
27672
- onClick: onClickHandler,
27673
- title: title,
27674
- role: ariaRole,
27675
- 'aria-label': ariaLabel,
27676
- tabIndex: '0'
27677
- })
27678
- );
27679
- }
27680
- }]);
27681
- return Lottie;
27682
- }(_react2.default.Component);
27683
-
27684
- dist.default = Lottie;
27685
-
27686
-
27687
- Lottie.propTypes = {
27688
- eventListeners: _propTypes2.default.arrayOf(_propTypes2.default.object),
27689
- options: _propTypes2.default.object.isRequired,
27690
- height: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
27691
- width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
27692
- isStopped: _propTypes2.default.bool,
27693
- isPaused: _propTypes2.default.bool,
27694
- speed: _propTypes2.default.number,
27695
- segments: _propTypes2.default.arrayOf(_propTypes2.default.number),
27696
- direction: _propTypes2.default.number,
27697
- ariaRole: _propTypes2.default.string,
27698
- ariaLabel: _propTypes2.default.string,
27699
- isClickToPauseDisabled: _propTypes2.default.bool,
27700
- title: _propTypes2.default.string,
27701
- style: _propTypes2.default.object
27702
- };
27703
-
27704
- Lottie.defaultProps = {
27705
- eventListeners: [],
27706
- isStopped: false,
27707
- isPaused: false,
27708
- speed: 1,
27709
- ariaRole: 'button',
27710
- ariaLabel: 'animation',
27711
- isClickToPauseDisabled: false,
27712
- title: ''
27713
- };
27714
- return dist;
26736
+ // helpers
26737
+ function getContainerVisibility(container) {
26738
+ var _container$getBoundin = container.getBoundingClientRect(),
26739
+ top = _container$getBoundin.top,
26740
+ height = _container$getBoundin.height;
26741
+ var current = window.innerHeight - top;
26742
+ var max = window.innerHeight + height;
26743
+ return current / max;
27715
26744
  }
26745
+ function getContainerCursorPosition(container, cursorX, cursorY) {
26746
+ var _container$getBoundin2 = container.getBoundingClientRect(),
26747
+ top = _container$getBoundin2.top,
26748
+ left = _container$getBoundin2.left,
26749
+ width = _container$getBoundin2.width,
26750
+ height = _container$getBoundin2.height;
26751
+ var x = (cursorX - left) / width;
26752
+ var y = (cursorY - top) / height;
26753
+ return {
26754
+ x: x,
26755
+ y: y
26756
+ };
26757
+ }
26758
+ var useInitInteractivity = function useInitInteractivity(_ref) {
26759
+ var wrapperRef = _ref.wrapperRef,
26760
+ animationItem = _ref.animationItem,
26761
+ mode = _ref.mode,
26762
+ actions = _ref.actions;
26763
+ useEffect(function () {
26764
+ var wrapper = wrapperRef.current;
26765
+ if (!wrapper || !animationItem || !actions.length) {
26766
+ return;
26767
+ }
26768
+ animationItem.stop();
26769
+ var scrollModeHandler = function scrollModeHandler() {
26770
+ var assignedSegment = null;
26771
+ var scrollHandler = function scrollHandler() {
26772
+ var currentPercent = getContainerVisibility(wrapper);
26773
+ // Find the first action that satisfies the current position conditions
26774
+ var action = actions.find(function (_ref2) {
26775
+ var visibility = _ref2.visibility;
26776
+ return visibility && currentPercent >= visibility[0] && currentPercent <= visibility[1];
26777
+ });
26778
+ // Skip if no matching action was found!
26779
+ if (!action) {
26780
+ return;
26781
+ }
26782
+ if (action.type === "seek" && action.visibility && action.frames.length === 2) {
26783
+ // Seek: Go to a frame based on player scroll position action
26784
+ var frameToGo = action.frames[0] + Math.ceil((currentPercent - action.visibility[0]) / (action.visibility[1] - action.visibility[0]) * action.frames[1]);
26785
+ //! goToAndStop must be relative to the start of the current segment
26786
+ animationItem.goToAndStop(frameToGo - animationItem.firstFrame - 1, true);
26787
+ }
26788
+ if (action.type === "loop") {
26789
+ // Loop: Loop a given frames
26790
+ if (assignedSegment === null) {
26791
+ // if not playing any segments currently. play those segments and save to state
26792
+ animationItem.playSegments(action.frames, true);
26793
+ assignedSegment = action.frames;
26794
+ } else {
26795
+ // if playing any segments currently.
26796
+ //check if segments in state are equal to the frames selected by action
26797
+ if (assignedSegment !== action.frames) {
26798
+ // if they are not equal. new segments are to be loaded
26799
+ animationItem.playSegments(action.frames, true);
26800
+ assignedSegment = action.frames;
26801
+ } else if (animationItem.isPaused) {
26802
+ // if they are equal the play method must be called only if lottie is paused
26803
+ animationItem.playSegments(action.frames, true);
26804
+ assignedSegment = action.frames;
26805
+ }
26806
+ }
26807
+ }
26808
+ if (action.type === "play" && animationItem.isPaused) {
26809
+ // Play: Reset segments and continue playing full animation from current position
26810
+ animationItem.resetSegments(true);
26811
+ animationItem.play();
26812
+ }
26813
+ if (action.type === "stop") {
26814
+ // Stop: Stop playback
26815
+ animationItem.goToAndStop(action.frames[0] - animationItem.firstFrame - 1, true);
26816
+ }
26817
+ };
26818
+ document.addEventListener("scroll", scrollHandler);
26819
+ return function () {
26820
+ document.removeEventListener("scroll", scrollHandler);
26821
+ };
26822
+ };
26823
+ var cursorModeHandler = function cursorModeHandler() {
26824
+ var handleCursor = function handleCursor(_x, _y) {
26825
+ var x = _x;
26826
+ var y = _y;
26827
+ // Resolve cursor position if cursor is inside container
26828
+ if (x !== -1 && y !== -1) {
26829
+ // Get container cursor position
26830
+ var pos = getContainerCursorPosition(wrapper, x, y);
26831
+ // Use the resolved position
26832
+ x = pos.x;
26833
+ y = pos.y;
26834
+ }
26835
+ // Find the first action that satisfies the current position conditions
26836
+ var action = actions.find(function (_ref3) {
26837
+ var position = _ref3.position;
26838
+ if (position && Array.isArray(position.x) && Array.isArray(position.y)) {
26839
+ return x >= position.x[0] && x <= position.x[1] && y >= position.y[0] && y <= position.y[1];
26840
+ }
26841
+ if (position && !Number.isNaN(position.x) && !Number.isNaN(position.y)) {
26842
+ return x === position.x && y === position.y;
26843
+ }
26844
+ return false;
26845
+ });
26846
+ // Skip if no matching action was found!
26847
+ if (!action) {
26848
+ return;
26849
+ }
26850
+ // Process action types:
26851
+ if (action.type === "seek" && action.position && Array.isArray(action.position.x) && Array.isArray(action.position.y) && action.frames.length === 2) {
26852
+ // Seek: Go to a frame based on player scroll position action
26853
+ var xPercent = (x - action.position.x[0]) / (action.position.x[1] - action.position.x[0]);
26854
+ var yPercent = (y - action.position.y[0]) / (action.position.y[1] - action.position.y[0]);
26855
+ animationItem.playSegments(action.frames, true);
26856
+ animationItem.goToAndStop(Math.ceil((xPercent + yPercent) / 2 * (action.frames[1] - action.frames[0])), true);
26857
+ }
26858
+ if (action.type === "loop") {
26859
+ animationItem.playSegments(action.frames, true);
26860
+ }
26861
+ if (action.type === "play") {
26862
+ // Play: Reset segments and continue playing full animation from current position
26863
+ if (animationItem.isPaused) {
26864
+ animationItem.resetSegments(false);
26865
+ }
26866
+ animationItem.playSegments(action.frames);
26867
+ }
26868
+ if (action.type === "stop") {
26869
+ animationItem.goToAndStop(action.frames[0], true);
26870
+ }
26871
+ };
26872
+ var mouseMoveHandler = function mouseMoveHandler(ev) {
26873
+ handleCursor(ev.clientX, ev.clientY);
26874
+ };
26875
+ var mouseOutHandler = function mouseOutHandler() {
26876
+ handleCursor(-1, -1);
26877
+ };
26878
+ wrapper.addEventListener("mousemove", mouseMoveHandler);
26879
+ wrapper.addEventListener("mouseout", mouseOutHandler);
26880
+ return function () {
26881
+ wrapper.removeEventListener("mousemove", mouseMoveHandler);
26882
+ wrapper.removeEventListener("mouseout", mouseOutHandler);
26883
+ };
26884
+ };
26885
+ switch (mode) {
26886
+ case "scroll":
26887
+ return scrollModeHandler();
26888
+ case "cursor":
26889
+ return cursorModeHandler();
26890
+ }
26891
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26892
+ }, [mode, animationItem]);
26893
+ };
26894
+ var useLottieInteractivity = function useLottieInteractivity(_ref4) {
26895
+ var actions = _ref4.actions,
26896
+ mode = _ref4.mode,
26897
+ lottieObj = _ref4.lottieObj;
26898
+ var animationItem = lottieObj.animationItem,
26899
+ View = lottieObj.View,
26900
+ animationContainerRef = lottieObj.animationContainerRef;
26901
+ useInitInteractivity({
26902
+ actions: actions,
26903
+ animationItem: animationItem,
26904
+ mode: mode,
26905
+ wrapperRef: animationContainerRef
26906
+ });
26907
+ return View;
26908
+ };
27716
26909
 
27717
- var distExports = requireDist();
27718
- var Lottie = /*@__PURE__*/getDefaultExportFromCjs(distExports);
26910
+ var _excluded = ["style", "interactivity"];
26911
+ var Lottie = function Lottie(props) {
26912
+ var _a, _b, _c;
26913
+ var style = props.style,
26914
+ interactivity = props.interactivity,
26915
+ lottieProps = _objectWithoutProperties(props, _excluded);
26916
+ /**
26917
+ * Initialize the 'useLottie' hook
26918
+ */
26919
+ var _useLottie = useLottie(lottieProps, style),
26920
+ View = _useLottie.View,
26921
+ play = _useLottie.play,
26922
+ stop = _useLottie.stop,
26923
+ pause = _useLottie.pause,
26924
+ setSpeed = _useLottie.setSpeed,
26925
+ goToAndStop = _useLottie.goToAndStop,
26926
+ goToAndPlay = _useLottie.goToAndPlay,
26927
+ setDirection = _useLottie.setDirection,
26928
+ playSegments = _useLottie.playSegments,
26929
+ setSubframe = _useLottie.setSubframe,
26930
+ getDuration = _useLottie.getDuration,
26931
+ destroy = _useLottie.destroy,
26932
+ animationContainerRef = _useLottie.animationContainerRef,
26933
+ animationLoaded = _useLottie.animationLoaded,
26934
+ animationItem = _useLottie.animationItem;
26935
+ /**
26936
+ * Make the hook variables/methods available through the provided 'lottieRef'
26937
+ */
26938
+ useEffect(function () {
26939
+ if (props.lottieRef) {
26940
+ props.lottieRef.current = {
26941
+ play: play,
26942
+ stop: stop,
26943
+ pause: pause,
26944
+ setSpeed: setSpeed,
26945
+ goToAndPlay: goToAndPlay,
26946
+ goToAndStop: goToAndStop,
26947
+ setDirection: setDirection,
26948
+ playSegments: playSegments,
26949
+ setSubframe: setSubframe,
26950
+ getDuration: getDuration,
26951
+ destroy: destroy,
26952
+ animationContainerRef: animationContainerRef,
26953
+ animationLoaded: animationLoaded,
26954
+ animationItem: animationItem
26955
+ };
26956
+ }
26957
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26958
+ }, [(_a = props.lottieRef) === null || _a === void 0 ? void 0 : _a.current]);
26959
+ return useLottieInteractivity({
26960
+ lottieObj: {
26961
+ View: View,
26962
+ play: play,
26963
+ stop: stop,
26964
+ pause: pause,
26965
+ setSpeed: setSpeed,
26966
+ goToAndStop: goToAndStop,
26967
+ goToAndPlay: goToAndPlay,
26968
+ setDirection: setDirection,
26969
+ playSegments: playSegments,
26970
+ setSubframe: setSubframe,
26971
+ getDuration: getDuration,
26972
+ destroy: destroy,
26973
+ animationContainerRef: animationContainerRef,
26974
+ animationLoaded: animationLoaded,
26975
+ animationItem: animationItem
26976
+ },
26977
+ actions: (_b = interactivity === null || interactivity === void 0 ? void 0 : interactivity.actions) !== null && _b !== void 0 ? _b : [],
26978
+ mode: (_c = interactivity === null || interactivity === void 0 ? void 0 : interactivity.mode) !== null && _c !== void 0 ? _c : "scroll"
26979
+ });
26980
+ };
27719
26981
 
27720
26982
  var v = "5.12.1";
27721
26983
  var fr = 60;
@@ -29551,11 +28813,9 @@ const TraceLoader = ({ width: w = 620 }) => {
29551
28813
  return (
29552
28814
  // Note: The container width and height are swapped because the animation is rotated
29553
28815
  React.createElement(Container$1, { "$width": height, "$height": width },
29554
- React.createElement(Lottie, { width: width, height: height, isClickToPauseDisabled: true, options: {
29555
- loop: true,
29556
- autoplay: true,
29557
- animationData: animationData,
29558
- }, style: {
28816
+ React.createElement(Lottie, { autoplay: true, loop: true, animationData: animationData, style: {
28817
+ width,
28818
+ height,
29559
28819
  transform: 'rotate(-90deg)',
29560
28820
  position: 'absolute',
29561
28821
  top: -(width - width / 10),