UNPKG

41.4 kBJavaScriptView Raw
1'use strict';
2
3var _commonjsHelpers = require('./_commonjsHelpers-72d386ba.js');
4
5/** @license React v16.13.1
6 * react-is.production.min.js
7 *
8 * Copyright (c) Facebook, Inc. and its affiliates.
9 *
10 * This source code is licensed under the MIT license found in the
11 * LICENSE file in the root directory of this source tree.
12 */
13var 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?
14Symbol.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;
15function 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}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
16var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
17var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
18var 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)};var typeOf=z;
19
20var reactIs_production_min = {
21 AsyncMode: AsyncMode,
22 ConcurrentMode: ConcurrentMode,
23 ContextConsumer: ContextConsumer,
24 ContextProvider: ContextProvider,
25 Element: Element,
26 ForwardRef: ForwardRef,
27 Fragment: Fragment,
28 Lazy: Lazy,
29 Memo: Memo,
30 Portal: Portal,
31 Profiler: Profiler,
32 StrictMode: StrictMode,
33 Suspense: Suspense,
34 isAsyncMode: isAsyncMode,
35 isConcurrentMode: isConcurrentMode,
36 isContextConsumer: isContextConsumer,
37 isContextProvider: isContextProvider,
38 isElement: isElement,
39 isForwardRef: isForwardRef,
40 isFragment: isFragment,
41 isLazy: isLazy,
42 isMemo: isMemo,
43 isPortal: isPortal,
44 isProfiler: isProfiler,
45 isStrictMode: isStrictMode,
46 isSuspense: isSuspense,
47 isValidElementType: isValidElementType,
48 typeOf: typeOf
49};
50
51var reactIs_development = _commonjsHelpers.createCommonjsModule(function (module, exports) {
52
53
54
55if (process.env.NODE_ENV !== "production") {
56 (function() {
57
58// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
59// nor polyfill, then a plain number is used for performance.
60var hasSymbol = typeof Symbol === 'function' && Symbol.for;
61var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
62var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
63var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
64var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
65var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
66var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
67var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
68// (unstable) APIs that have been removed. Can we remove the symbols?
69
70var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
71var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
72var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
73var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
74var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
75var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
76var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
77var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
78var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
79var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
80var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
81
82function isValidElementType(type) {
83 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
84 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);
85}
86
87function typeOf(object) {
88 if (typeof object === 'object' && object !== null) {
89 var $$typeof = object.$$typeof;
90
91 switch ($$typeof) {
92 case REACT_ELEMENT_TYPE:
93 var type = object.type;
94
95 switch (type) {
96 case REACT_ASYNC_MODE_TYPE:
97 case REACT_CONCURRENT_MODE_TYPE:
98 case REACT_FRAGMENT_TYPE:
99 case REACT_PROFILER_TYPE:
100 case REACT_STRICT_MODE_TYPE:
101 case REACT_SUSPENSE_TYPE:
102 return type;
103
104 default:
105 var $$typeofType = type && type.$$typeof;
106
107 switch ($$typeofType) {
108 case REACT_CONTEXT_TYPE:
109 case REACT_FORWARD_REF_TYPE:
110 case REACT_LAZY_TYPE:
111 case REACT_MEMO_TYPE:
112 case REACT_PROVIDER_TYPE:
113 return $$typeofType;
114
115 default:
116 return $$typeof;
117 }
118
119 }
120
121 case REACT_PORTAL_TYPE:
122 return $$typeof;
123 }
124 }
125
126 return undefined;
127} // AsyncMode is deprecated along with isAsyncMode
128
129var AsyncMode = REACT_ASYNC_MODE_TYPE;
130var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
131var ContextConsumer = REACT_CONTEXT_TYPE;
132var ContextProvider = REACT_PROVIDER_TYPE;
133var Element = REACT_ELEMENT_TYPE;
134var ForwardRef = REACT_FORWARD_REF_TYPE;
135var Fragment = REACT_FRAGMENT_TYPE;
136var Lazy = REACT_LAZY_TYPE;
137var Memo = REACT_MEMO_TYPE;
138var Portal = REACT_PORTAL_TYPE;
139var Profiler = REACT_PROFILER_TYPE;
140var StrictMode = REACT_STRICT_MODE_TYPE;
141var Suspense = REACT_SUSPENSE_TYPE;
142var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
143
144function isAsyncMode(object) {
145 {
146 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
147 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
148
149 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.');
150 }
151 }
152
153 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
154}
155function isConcurrentMode(object) {
156 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
157}
158function isContextConsumer(object) {
159 return typeOf(object) === REACT_CONTEXT_TYPE;
160}
161function isContextProvider(object) {
162 return typeOf(object) === REACT_PROVIDER_TYPE;
163}
164function isElement(object) {
165 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
166}
167function isForwardRef(object) {
168 return typeOf(object) === REACT_FORWARD_REF_TYPE;
169}
170function isFragment(object) {
171 return typeOf(object) === REACT_FRAGMENT_TYPE;
172}
173function isLazy(object) {
174 return typeOf(object) === REACT_LAZY_TYPE;
175}
176function isMemo(object) {
177 return typeOf(object) === REACT_MEMO_TYPE;
178}
179function isPortal(object) {
180 return typeOf(object) === REACT_PORTAL_TYPE;
181}
182function isProfiler(object) {
183 return typeOf(object) === REACT_PROFILER_TYPE;
184}
185function isStrictMode(object) {
186 return typeOf(object) === REACT_STRICT_MODE_TYPE;
187}
188function isSuspense(object) {
189 return typeOf(object) === REACT_SUSPENSE_TYPE;
190}
191
192exports.AsyncMode = AsyncMode;
193exports.ConcurrentMode = ConcurrentMode;
194exports.ContextConsumer = ContextConsumer;
195exports.ContextProvider = ContextProvider;
196exports.Element = Element;
197exports.ForwardRef = ForwardRef;
198exports.Fragment = Fragment;
199exports.Lazy = Lazy;
200exports.Memo = Memo;
201exports.Portal = Portal;
202exports.Profiler = Profiler;
203exports.StrictMode = StrictMode;
204exports.Suspense = Suspense;
205exports.isAsyncMode = isAsyncMode;
206exports.isConcurrentMode = isConcurrentMode;
207exports.isContextConsumer = isContextConsumer;
208exports.isContextProvider = isContextProvider;
209exports.isElement = isElement;
210exports.isForwardRef = isForwardRef;
211exports.isFragment = isFragment;
212exports.isLazy = isLazy;
213exports.isMemo = isMemo;
214exports.isPortal = isPortal;
215exports.isProfiler = isProfiler;
216exports.isStrictMode = isStrictMode;
217exports.isSuspense = isSuspense;
218exports.isValidElementType = isValidElementType;
219exports.typeOf = typeOf;
220 })();
221}
222});
223var reactIs_development_1 = reactIs_development.AsyncMode;
224var reactIs_development_2 = reactIs_development.ConcurrentMode;
225var reactIs_development_3 = reactIs_development.ContextConsumer;
226var reactIs_development_4 = reactIs_development.ContextProvider;
227var reactIs_development_5 = reactIs_development.Element;
228var reactIs_development_6 = reactIs_development.ForwardRef;
229var reactIs_development_7 = reactIs_development.Fragment;
230var reactIs_development_8 = reactIs_development.Lazy;
231var reactIs_development_9 = reactIs_development.Memo;
232var reactIs_development_10 = reactIs_development.Portal;
233var reactIs_development_11 = reactIs_development.Profiler;
234var reactIs_development_12 = reactIs_development.StrictMode;
235var reactIs_development_13 = reactIs_development.Suspense;
236var reactIs_development_14 = reactIs_development.isAsyncMode;
237var reactIs_development_15 = reactIs_development.isConcurrentMode;
238var reactIs_development_16 = reactIs_development.isContextConsumer;
239var reactIs_development_17 = reactIs_development.isContextProvider;
240var reactIs_development_18 = reactIs_development.isElement;
241var reactIs_development_19 = reactIs_development.isForwardRef;
242var reactIs_development_20 = reactIs_development.isFragment;
243var reactIs_development_21 = reactIs_development.isLazy;
244var reactIs_development_22 = reactIs_development.isMemo;
245var reactIs_development_23 = reactIs_development.isPortal;
246var reactIs_development_24 = reactIs_development.isProfiler;
247var reactIs_development_25 = reactIs_development.isStrictMode;
248var reactIs_development_26 = reactIs_development.isSuspense;
249var reactIs_development_27 = reactIs_development.isValidElementType;
250var reactIs_development_28 = reactIs_development.typeOf;
251
252var reactIs = _commonjsHelpers.createCommonjsModule(function (module) {
253
254if (process.env.NODE_ENV === 'production') {
255 module.exports = reactIs_production_min;
256} else {
257 module.exports = reactIs_development;
258}
259});
260
261/*
262object-assign
263(c) Sindre Sorhus
264@license MIT
265*/
266/* eslint-disable no-unused-vars */
267var getOwnPropertySymbols = Object.getOwnPropertySymbols;
268var hasOwnProperty = Object.prototype.hasOwnProperty;
269var propIsEnumerable = Object.prototype.propertyIsEnumerable;
270
271function toObject(val) {
272 if (val === null || val === undefined) {
273 throw new TypeError('Object.assign cannot be called with null or undefined');
274 }
275
276 return Object(val);
277}
278
279function shouldUseNative() {
280 try {
281 if (!Object.assign) {
282 return false;
283 }
284
285 // Detect buggy property enumeration order in older V8 versions.
286
287 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
288 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
289 test1[5] = 'de';
290 if (Object.getOwnPropertyNames(test1)[0] === '5') {
291 return false;
292 }
293
294 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
295 var test2 = {};
296 for (var i = 0; i < 10; i++) {
297 test2['_' + String.fromCharCode(i)] = i;
298 }
299 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
300 return test2[n];
301 });
302 if (order2.join('') !== '0123456789') {
303 return false;
304 }
305
306 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
307 var test3 = {};
308 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
309 test3[letter] = letter;
310 });
311 if (Object.keys(Object.assign({}, test3)).join('') !==
312 'abcdefghijklmnopqrst') {
313 return false;
314 }
315
316 return true;
317 } catch (err) {
318 // We don't expect any of the above to throw, but better to be safe.
319 return false;
320 }
321}
322
323var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
324 var from;
325 var to = toObject(target);
326 var symbols;
327
328 for (var s = 1; s < arguments.length; s++) {
329 from = Object(arguments[s]);
330
331 for (var key in from) {
332 if (hasOwnProperty.call(from, key)) {
333 to[key] = from[key];
334 }
335 }
336
337 if (getOwnPropertySymbols) {
338 symbols = getOwnPropertySymbols(from);
339 for (var i = 0; i < symbols.length; i++) {
340 if (propIsEnumerable.call(from, symbols[i])) {
341 to[symbols[i]] = from[symbols[i]];
342 }
343 }
344 }
345 }
346
347 return to;
348};
349
350/**
351 * Copyright (c) 2013-present, Facebook, Inc.
352 *
353 * This source code is licensed under the MIT license found in the
354 * LICENSE file in the root directory of this source tree.
355 */
356
357var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
358
359var ReactPropTypesSecret_1 = ReactPropTypesSecret;
360
361var printWarning = function() {};
362
363if (process.env.NODE_ENV !== 'production') {
364 var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
365 var loggedTypeFailures = {};
366 var has = Function.call.bind(Object.prototype.hasOwnProperty);
367
368 printWarning = function(text) {
369 var message = 'Warning: ' + text;
370 if (typeof console !== 'undefined') {
371 console.error(message);
372 }
373 try {
374 // --- Welcome to debugging React ---
375 // This error was thrown as a convenience so that you can use this stack
376 // to find the callsite that caused this warning to fire.
377 throw new Error(message);
378 } catch (x) {}
379 };
380}
381
382/**
383 * Assert that the values match with the type specs.
384 * Error messages are memorized and will only be shown once.
385 *
386 * @param {object} typeSpecs Map of name to a ReactPropType
387 * @param {object} values Runtime values that need to be type-checked
388 * @param {string} location e.g. "prop", "context", "child context"
389 * @param {string} componentName Name of the component for error messages.
390 * @param {?Function} getStack Returns the component stack.
391 * @private
392 */
393function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
394 if (process.env.NODE_ENV !== 'production') {
395 for (var typeSpecName in typeSpecs) {
396 if (has(typeSpecs, typeSpecName)) {
397 var error;
398 // Prop type validation may throw. In case they do, we don't want to
399 // fail the render phase where it didn't fail before. So we log it.
400 // After these have been cleaned up, we'll let them throw.
401 try {
402 // This is intentionally an invariant that gets caught. It's the same
403 // behavior as without this statement except with a better message.
404 if (typeof typeSpecs[typeSpecName] !== 'function') {
405 var err = Error(
406 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
407 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
408 );
409 err.name = 'Invariant Violation';
410 throw err;
411 }
412 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
413 } catch (ex) {
414 error = ex;
415 }
416 if (error && !(error instanceof Error)) {
417 printWarning(
418 (componentName || 'React class') + ': type specification of ' +
419 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
420 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
421 'You may have forgotten to pass an argument to the type checker ' +
422 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
423 'shape all require an argument).'
424 );
425 }
426 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
427 // Only monitor this failure once because there tends to be a lot of the
428 // same error.
429 loggedTypeFailures[error.message] = true;
430
431 var stack = getStack ? getStack() : '';
432
433 printWarning(
434 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
435 );
436 }
437 }
438 }
439 }
440}
441
442/**
443 * Resets warning cache when testing.
444 *
445 * @private
446 */
447checkPropTypes.resetWarningCache = function() {
448 if (process.env.NODE_ENV !== 'production') {
449 loggedTypeFailures = {};
450 }
451};
452
453var checkPropTypes_1 = checkPropTypes;
454
455var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
456var printWarning$1 = function() {};
457
458if (process.env.NODE_ENV !== 'production') {
459 printWarning$1 = function(text) {
460 var message = 'Warning: ' + text;
461 if (typeof console !== 'undefined') {
462 console.error(message);
463 }
464 try {
465 // --- Welcome to debugging React ---
466 // This error was thrown as a convenience so that you can use this stack
467 // to find the callsite that caused this warning to fire.
468 throw new Error(message);
469 } catch (x) {}
470 };
471}
472
473function emptyFunctionThatReturnsNull() {
474 return null;
475}
476
477var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
478 /* global Symbol */
479 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
480 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
481
482 /**
483 * Returns the iterator method function contained on the iterable object.
484 *
485 * Be sure to invoke the function with the iterable as context:
486 *
487 * var iteratorFn = getIteratorFn(myIterable);
488 * if (iteratorFn) {
489 * var iterator = iteratorFn.call(myIterable);
490 * ...
491 * }
492 *
493 * @param {?object} maybeIterable
494 * @return {?function}
495 */
496 function getIteratorFn(maybeIterable) {
497 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
498 if (typeof iteratorFn === 'function') {
499 return iteratorFn;
500 }
501 }
502
503 /**
504 * Collection of methods that allow declaration and validation of props that are
505 * supplied to React components. Example usage:
506 *
507 * var Props = require('ReactPropTypes');
508 * var MyArticle = React.createClass({
509 * propTypes: {
510 * // An optional string prop named "description".
511 * description: Props.string,
512 *
513 * // A required enum prop named "category".
514 * category: Props.oneOf(['News','Photos']).isRequired,
515 *
516 * // A prop named "dialog" that requires an instance of Dialog.
517 * dialog: Props.instanceOf(Dialog).isRequired
518 * },
519 * render: function() { ... }
520 * });
521 *
522 * A more formal specification of how these methods are used:
523 *
524 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
525 * decl := ReactPropTypes.{type}(.isRequired)?
526 *
527 * Each and every declaration produces a function with the same signature. This
528 * allows the creation of custom validation functions. For example:
529 *
530 * var MyLink = React.createClass({
531 * propTypes: {
532 * // An optional string or URI prop named "href".
533 * href: function(props, propName, componentName) {
534 * var propValue = props[propName];
535 * if (propValue != null && typeof propValue !== 'string' &&
536 * !(propValue instanceof URI)) {
537 * return new Error(
538 * 'Expected a string or an URI for ' + propName + ' in ' +
539 * componentName
540 * );
541 * }
542 * }
543 * },
544 * render: function() {...}
545 * });
546 *
547 * @internal
548 */
549
550 var ANONYMOUS = '<<anonymous>>';
551
552 // Important!
553 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
554 var ReactPropTypes = {
555 array: createPrimitiveTypeChecker('array'),
556 bool: createPrimitiveTypeChecker('boolean'),
557 func: createPrimitiveTypeChecker('function'),
558 number: createPrimitiveTypeChecker('number'),
559 object: createPrimitiveTypeChecker('object'),
560 string: createPrimitiveTypeChecker('string'),
561 symbol: createPrimitiveTypeChecker('symbol'),
562
563 any: createAnyTypeChecker(),
564 arrayOf: createArrayOfTypeChecker,
565 element: createElementTypeChecker(),
566 elementType: createElementTypeTypeChecker(),
567 instanceOf: createInstanceTypeChecker,
568 node: createNodeChecker(),
569 objectOf: createObjectOfTypeChecker,
570 oneOf: createEnumTypeChecker,
571 oneOfType: createUnionTypeChecker,
572 shape: createShapeTypeChecker,
573 exact: createStrictShapeTypeChecker,
574 };
575
576 /**
577 * inlined Object.is polyfill to avoid requiring consumers ship their own
578 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
579 */
580 /*eslint-disable no-self-compare*/
581 function is(x, y) {
582 // SameValue algorithm
583 if (x === y) {
584 // Steps 1-5, 7-10
585 // Steps 6.b-6.e: +0 != -0
586 return x !== 0 || 1 / x === 1 / y;
587 } else {
588 // Step 6.a: NaN == NaN
589 return x !== x && y !== y;
590 }
591 }
592 /*eslint-enable no-self-compare*/
593
594 /**
595 * We use an Error-like object for backward compatibility as people may call
596 * PropTypes directly and inspect their output. However, we don't use real
597 * Errors anymore. We don't inspect their stack anyway, and creating them
598 * is prohibitively expensive if they are created too often, such as what
599 * happens in oneOfType() for any type before the one that matched.
600 */
601 function PropTypeError(message) {
602 this.message = message;
603 this.stack = '';
604 }
605 // Make `instanceof Error` still work for returned errors.
606 PropTypeError.prototype = Error.prototype;
607
608 function createChainableTypeChecker(validate) {
609 if (process.env.NODE_ENV !== 'production') {
610 var manualPropTypeCallCache = {};
611 var manualPropTypeWarningCount = 0;
612 }
613 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
614 componentName = componentName || ANONYMOUS;
615 propFullName = propFullName || propName;
616
617 if (secret !== ReactPropTypesSecret_1) {
618 if (throwOnDirectAccess) {
619 // New behavior only for users of `prop-types` package
620 var err = new Error(
621 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
622 'Use `PropTypes.checkPropTypes()` to call them. ' +
623 'Read more at http://fb.me/use-check-prop-types'
624 );
625 err.name = 'Invariant Violation';
626 throw err;
627 } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
628 // Old behavior for people using React.PropTypes
629 var cacheKey = componentName + ':' + propName;
630 if (
631 !manualPropTypeCallCache[cacheKey] &&
632 // Avoid spamming the console because they are often not actionable except for lib authors
633 manualPropTypeWarningCount < 3
634 ) {
635 printWarning$1(
636 'You are manually calling a React.PropTypes validation ' +
637 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
638 'and will throw in the standalone `prop-types` package. ' +
639 'You may be seeing this warning due to a third-party PropTypes ' +
640 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
641 );
642 manualPropTypeCallCache[cacheKey] = true;
643 manualPropTypeWarningCount++;
644 }
645 }
646 }
647 if (props[propName] == null) {
648 if (isRequired) {
649 if (props[propName] === null) {
650 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
651 }
652 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
653 }
654 return null;
655 } else {
656 return validate(props, propName, componentName, location, propFullName);
657 }
658 }
659
660 var chainedCheckType = checkType.bind(null, false);
661 chainedCheckType.isRequired = checkType.bind(null, true);
662
663 return chainedCheckType;
664 }
665
666 function createPrimitiveTypeChecker(expectedType) {
667 function validate(props, propName, componentName, location, propFullName, secret) {
668 var propValue = props[propName];
669 var propType = getPropType(propValue);
670 if (propType !== expectedType) {
671 // `propValue` being instance of, say, date/regexp, pass the 'object'
672 // check, but we can offer a more precise error message here rather than
673 // 'of type `object`'.
674 var preciseType = getPreciseType(propValue);
675
676 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
677 }
678 return null;
679 }
680 return createChainableTypeChecker(validate);
681 }
682
683 function createAnyTypeChecker() {
684 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
685 }
686
687 function createArrayOfTypeChecker(typeChecker) {
688 function validate(props, propName, componentName, location, propFullName) {
689 if (typeof typeChecker !== 'function') {
690 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
691 }
692 var propValue = props[propName];
693 if (!Array.isArray(propValue)) {
694 var propType = getPropType(propValue);
695 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
696 }
697 for (var i = 0; i < propValue.length; i++) {
698 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
699 if (error instanceof Error) {
700 return error;
701 }
702 }
703 return null;
704 }
705 return createChainableTypeChecker(validate);
706 }
707
708 function createElementTypeChecker() {
709 function validate(props, propName, componentName, location, propFullName) {
710 var propValue = props[propName];
711 if (!isValidElement(propValue)) {
712 var propType = getPropType(propValue);
713 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
714 }
715 return null;
716 }
717 return createChainableTypeChecker(validate);
718 }
719
720 function createElementTypeTypeChecker() {
721 function validate(props, propName, componentName, location, propFullName) {
722 var propValue = props[propName];
723 if (!reactIs.isValidElementType(propValue)) {
724 var propType = getPropType(propValue);
725 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
726 }
727 return null;
728 }
729 return createChainableTypeChecker(validate);
730 }
731
732 function createInstanceTypeChecker(expectedClass) {
733 function validate(props, propName, componentName, location, propFullName) {
734 if (!(props[propName] instanceof expectedClass)) {
735 var expectedClassName = expectedClass.name || ANONYMOUS;
736 var actualClassName = getClassName(props[propName]);
737 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
738 }
739 return null;
740 }
741 return createChainableTypeChecker(validate);
742 }
743
744 function createEnumTypeChecker(expectedValues) {
745 if (!Array.isArray(expectedValues)) {
746 if (process.env.NODE_ENV !== 'production') {
747 if (arguments.length > 1) {
748 printWarning$1(
749 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
750 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
751 );
752 } else {
753 printWarning$1('Invalid argument supplied to oneOf, expected an array.');
754 }
755 }
756 return emptyFunctionThatReturnsNull;
757 }
758
759 function validate(props, propName, componentName, location, propFullName) {
760 var propValue = props[propName];
761 for (var i = 0; i < expectedValues.length; i++) {
762 if (is(propValue, expectedValues[i])) {
763 return null;
764 }
765 }
766
767 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
768 var type = getPreciseType(value);
769 if (type === 'symbol') {
770 return String(value);
771 }
772 return value;
773 });
774 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
775 }
776 return createChainableTypeChecker(validate);
777 }
778
779 function createObjectOfTypeChecker(typeChecker) {
780 function validate(props, propName, componentName, location, propFullName) {
781 if (typeof typeChecker !== 'function') {
782 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
783 }
784 var propValue = props[propName];
785 var propType = getPropType(propValue);
786 if (propType !== 'object') {
787 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
788 }
789 for (var key in propValue) {
790 if (has$1(propValue, key)) {
791 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
792 if (error instanceof Error) {
793 return error;
794 }
795 }
796 }
797 return null;
798 }
799 return createChainableTypeChecker(validate);
800 }
801
802 function createUnionTypeChecker(arrayOfTypeCheckers) {
803 if (!Array.isArray(arrayOfTypeCheckers)) {
804 process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
805 return emptyFunctionThatReturnsNull;
806 }
807
808 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
809 var checker = arrayOfTypeCheckers[i];
810 if (typeof checker !== 'function') {
811 printWarning$1(
812 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
813 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
814 );
815 return emptyFunctionThatReturnsNull;
816 }
817 }
818
819 function validate(props, propName, componentName, location, propFullName) {
820 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
821 var checker = arrayOfTypeCheckers[i];
822 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
823 return null;
824 }
825 }
826
827 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
828 }
829 return createChainableTypeChecker(validate);
830 }
831
832 function createNodeChecker() {
833 function validate(props, propName, componentName, location, propFullName) {
834 if (!isNode(props[propName])) {
835 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
836 }
837 return null;
838 }
839 return createChainableTypeChecker(validate);
840 }
841
842 function createShapeTypeChecker(shapeTypes) {
843 function validate(props, propName, componentName, location, propFullName) {
844 var propValue = props[propName];
845 var propType = getPropType(propValue);
846 if (propType !== 'object') {
847 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
848 }
849 for (var key in shapeTypes) {
850 var checker = shapeTypes[key];
851 if (!checker) {
852 continue;
853 }
854 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
855 if (error) {
856 return error;
857 }
858 }
859 return null;
860 }
861 return createChainableTypeChecker(validate);
862 }
863
864 function createStrictShapeTypeChecker(shapeTypes) {
865 function validate(props, propName, componentName, location, propFullName) {
866 var propValue = props[propName];
867 var propType = getPropType(propValue);
868 if (propType !== 'object') {
869 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
870 }
871 // We need to check all keys in case some are required but missing from
872 // props.
873 var allKeys = objectAssign({}, props[propName], shapeTypes);
874 for (var key in allKeys) {
875 var checker = shapeTypes[key];
876 if (!checker) {
877 return new PropTypeError(
878 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
879 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
880 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
881 );
882 }
883 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
884 if (error) {
885 return error;
886 }
887 }
888 return null;
889 }
890
891 return createChainableTypeChecker(validate);
892 }
893
894 function isNode(propValue) {
895 switch (typeof propValue) {
896 case 'number':
897 case 'string':
898 case 'undefined':
899 return true;
900 case 'boolean':
901 return !propValue;
902 case 'object':
903 if (Array.isArray(propValue)) {
904 return propValue.every(isNode);
905 }
906 if (propValue === null || isValidElement(propValue)) {
907 return true;
908 }
909
910 var iteratorFn = getIteratorFn(propValue);
911 if (iteratorFn) {
912 var iterator = iteratorFn.call(propValue);
913 var step;
914 if (iteratorFn !== propValue.entries) {
915 while (!(step = iterator.next()).done) {
916 if (!isNode(step.value)) {
917 return false;
918 }
919 }
920 } else {
921 // Iterator will provide entry [k,v] tuples rather than values.
922 while (!(step = iterator.next()).done) {
923 var entry = step.value;
924 if (entry) {
925 if (!isNode(entry[1])) {
926 return false;
927 }
928 }
929 }
930 }
931 } else {
932 return false;
933 }
934
935 return true;
936 default:
937 return false;
938 }
939 }
940
941 function isSymbol(propType, propValue) {
942 // Native Symbol.
943 if (propType === 'symbol') {
944 return true;
945 }
946
947 // falsy value can't be a Symbol
948 if (!propValue) {
949 return false;
950 }
951
952 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
953 if (propValue['@@toStringTag'] === 'Symbol') {
954 return true;
955 }
956
957 // Fallback for non-spec compliant Symbols which are polyfilled.
958 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
959 return true;
960 }
961
962 return false;
963 }
964
965 // Equivalent of `typeof` but with special handling for array and regexp.
966 function getPropType(propValue) {
967 var propType = typeof propValue;
968 if (Array.isArray(propValue)) {
969 return 'array';
970 }
971 if (propValue instanceof RegExp) {
972 // Old webkits (at least until Android 4.0) return 'function' rather than
973 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
974 // passes PropTypes.object.
975 return 'object';
976 }
977 if (isSymbol(propType, propValue)) {
978 return 'symbol';
979 }
980 return propType;
981 }
982
983 // This handles more types than `getPropType`. Only used for error messages.
984 // See `createPrimitiveTypeChecker`.
985 function getPreciseType(propValue) {
986 if (typeof propValue === 'undefined' || propValue === null) {
987 return '' + propValue;
988 }
989 var propType = getPropType(propValue);
990 if (propType === 'object') {
991 if (propValue instanceof Date) {
992 return 'date';
993 } else if (propValue instanceof RegExp) {
994 return 'regexp';
995 }
996 }
997 return propType;
998 }
999
1000 // Returns a string that is postfixed to a warning about an invalid type.
1001 // For example, "undefined" or "of type array"
1002 function getPostfixForTypeWarning(value) {
1003 var type = getPreciseType(value);
1004 switch (type) {
1005 case 'array':
1006 case 'object':
1007 return 'an ' + type;
1008 case 'boolean':
1009 case 'date':
1010 case 'regexp':
1011 return 'a ' + type;
1012 default:
1013 return type;
1014 }
1015 }
1016
1017 // Returns class name of the object, if any.
1018 function getClassName(propValue) {
1019 if (!propValue.constructor || !propValue.constructor.name) {
1020 return ANONYMOUS;
1021 }
1022 return propValue.constructor.name;
1023 }
1024
1025 ReactPropTypes.checkPropTypes = checkPropTypes_1;
1026 ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
1027 ReactPropTypes.PropTypes = ReactPropTypes;
1028
1029 return ReactPropTypes;
1030};
1031
1032function emptyFunction() {}
1033function emptyFunctionWithReset() {}
1034emptyFunctionWithReset.resetWarningCache = emptyFunction;
1035
1036var factoryWithThrowingShims = function() {
1037 function shim(props, propName, componentName, location, propFullName, secret) {
1038 if (secret === ReactPropTypesSecret_1) {
1039 // It is still safe when called from React.
1040 return;
1041 }
1042 var err = new Error(
1043 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1044 'Use PropTypes.checkPropTypes() to call them. ' +
1045 'Read more at http://fb.me/use-check-prop-types'
1046 );
1047 err.name = 'Invariant Violation';
1048 throw err;
1049 } shim.isRequired = shim;
1050 function getShim() {
1051 return shim;
1052 } // Important!
1053 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1054 var ReactPropTypes = {
1055 array: shim,
1056 bool: shim,
1057 func: shim,
1058 number: shim,
1059 object: shim,
1060 string: shim,
1061 symbol: shim,
1062
1063 any: shim,
1064 arrayOf: getShim,
1065 element: shim,
1066 elementType: shim,
1067 instanceOf: getShim,
1068 node: shim,
1069 objectOf: getShim,
1070 oneOf: getShim,
1071 oneOfType: getShim,
1072 shape: getShim,
1073 exact: getShim,
1074
1075 checkPropTypes: emptyFunctionWithReset,
1076 resetWarningCache: emptyFunction
1077 };
1078
1079 ReactPropTypes.PropTypes = ReactPropTypes;
1080
1081 return ReactPropTypes;
1082};
1083
1084var propTypes = _commonjsHelpers.createCommonjsModule(function (module) {
1085/**
1086 * Copyright (c) 2013-present, Facebook, Inc.
1087 *
1088 * This source code is licensed under the MIT license found in the
1089 * LICENSE file in the root directory of this source tree.
1090 */
1091
1092if (process.env.NODE_ENV !== 'production') {
1093 var ReactIs = reactIs;
1094
1095 // By explicitly using `prop-types` you are opting into new development behavior.
1096 // http://fb.me/prop-types-in-prod
1097 var throwOnDirectAccess = true;
1098 module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
1099} else {
1100 // By explicitly using `prop-types` you are opting into new production behavior.
1101 // http://fb.me/prop-types-in-prod
1102 module.exports = factoryWithThrowingShims();
1103}
1104});
1105
1106exports.PropTypes = propTypes;
1107exports.propTypes = propTypes;
1108//# sourceMappingURL=index-b0606964.js.map