1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 | (function (global, factory) {
|
13 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
14 | typeof define === 'function' && define.amd ? define(factory) :
|
15 | (global.React = factory());
|
16 | }(this, (function () { 'use strict';
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
27 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
28 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
29 |
|
30 | function toObject(val) {
|
31 | if (val === null || val === undefined) {
|
32 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
33 | }
|
34 |
|
35 | return Object(val);
|
36 | }
|
37 |
|
38 | function shouldUseNative() {
|
39 | try {
|
40 | if (!Object.assign) {
|
41 | return false;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | var test1 = new String('abc');
|
48 | test1[5] = 'de';
|
49 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
50 | return false;
|
51 | }
|
52 |
|
53 |
|
54 | var test2 = {};
|
55 | for (var i = 0; i < 10; i++) {
|
56 | test2['_' + String.fromCharCode(i)] = i;
|
57 | }
|
58 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
59 | return test2[n];
|
60 | });
|
61 | if (order2.join('') !== '0123456789') {
|
62 | return false;
|
63 | }
|
64 |
|
65 |
|
66 | var test3 = {};
|
67 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
68 | test3[letter] = letter;
|
69 | });
|
70 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
71 | 'abcdefghijklmnopqrst') {
|
72 | return false;
|
73 | }
|
74 |
|
75 | return true;
|
76 | } catch (err) {
|
77 |
|
78 | return false;
|
79 | }
|
80 | }
|
81 |
|
82 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
83 | var from;
|
84 | var to = toObject(target);
|
85 | var symbols;
|
86 |
|
87 | for (var s = 1; s < arguments.length; s++) {
|
88 | from = Object(arguments[s]);
|
89 |
|
90 | for (var key in from) {
|
91 | if (hasOwnProperty.call(from, key)) {
|
92 | to[key] = from[key];
|
93 | }
|
94 | }
|
95 |
|
96 | if (getOwnPropertySymbols) {
|
97 | symbols = getOwnPropertySymbols(from);
|
98 | for (var i = 0; i < symbols.length; i++) {
|
99 | if (propIsEnumerable.call(from, symbols[i])) {
|
100 | to[symbols[i]] = from[symbols[i]];
|
101 | }
|
102 | }
|
103 | }
|
104 | }
|
105 |
|
106 | return to;
|
107 | };
|
108 |
|
109 |
|
110 |
|
111 | var ReactVersion = '16.3.2';
|
112 |
|
113 |
|
114 |
|
115 | var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
|
116 |
|
117 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
|
118 | var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
|
119 | var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
|
120 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
|
121 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
|
122 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
|
123 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
|
124 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
|
125 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
|
126 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol['for']('react.forward_ref') : 0xead0;
|
127 |
|
128 | var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
129 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
130 |
|
131 | function getIteratorFn(maybeIterable) {
|
132 | if (maybeIterable === null || typeof maybeIterable === 'undefined') {
|
133 | return null;
|
134 | }
|
135 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
136 | if (typeof maybeIterator === 'function') {
|
137 | return maybeIterator;
|
138 | }
|
139 | return null;
|
140 | }
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | var validateFormat = function validateFormat(format) {};
|
164 |
|
165 | {
|
166 | validateFormat = function validateFormat(format) {
|
167 | if (format === undefined) {
|
168 | throw new Error('invariant requires an error message argument');
|
169 | }
|
170 | };
|
171 | }
|
172 |
|
173 | function invariant(condition, format, a, b, c, d, e, f) {
|
174 | validateFormat(format);
|
175 |
|
176 | if (!condition) {
|
177 | var error;
|
178 | if (format === undefined) {
|
179 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
180 | } else {
|
181 | var args = [a, b, c, d, e, f];
|
182 | var argIndex = 0;
|
183 | error = new Error(format.replace(/%s/g, function () {
|
184 | return args[argIndex++];
|
185 | }));
|
186 | error.name = 'Invariant Violation';
|
187 | }
|
188 |
|
189 | error.framesToPop = 1;
|
190 | throw error;
|
191 | }
|
192 | }
|
193 |
|
194 | var invariant_1 = invariant;
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 | var emptyObject = {};
|
210 |
|
211 | {
|
212 | Object.freeze(emptyObject);
|
213 | }
|
214 |
|
215 | var emptyObject_1 = emptyObject;
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 | var lowPriorityWarning = function () {};
|
232 |
|
233 | {
|
234 | var printWarning = function (format) {
|
235 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
236 | args[_key - 1] = arguments[_key];
|
237 | }
|
238 |
|
239 | var argIndex = 0;
|
240 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
241 | return args[argIndex++];
|
242 | });
|
243 | if (typeof console !== 'undefined') {
|
244 | console.warn(message);
|
245 | }
|
246 | try {
|
247 |
|
248 |
|
249 |
|
250 | throw new Error(message);
|
251 | } catch (x) {}
|
252 | };
|
253 |
|
254 | lowPriorityWarning = function (condition, format) {
|
255 | if (format === undefined) {
|
256 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
257 | }
|
258 | if (!condition) {
|
259 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
260 | args[_key2 - 2] = arguments[_key2];
|
261 | }
|
262 |
|
263 | printWarning.apply(undefined, [format].concat(args));
|
264 | }
|
265 | };
|
266 | }
|
267 |
|
268 | var lowPriorityWarning$1 = lowPriorityWarning;
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | function makeEmptyFunction(arg) {
|
280 | return function () {
|
281 | return arg;
|
282 | };
|
283 | }
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | var emptyFunction = function emptyFunction() {};
|
291 |
|
292 | emptyFunction.thatReturns = makeEmptyFunction;
|
293 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
294 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
295 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
296 | emptyFunction.thatReturnsThis = function () {
|
297 | return this;
|
298 | };
|
299 | emptyFunction.thatReturnsArgument = function (arg) {
|
300 | return arg;
|
301 | };
|
302 |
|
303 | var emptyFunction_1 = emptyFunction;
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | var warning = emptyFunction_1;
|
325 |
|
326 | {
|
327 | var printWarning$1 = function printWarning(format) {
|
328 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
329 | args[_key - 1] = arguments[_key];
|
330 | }
|
331 |
|
332 | var argIndex = 0;
|
333 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
334 | return args[argIndex++];
|
335 | });
|
336 | if (typeof console !== 'undefined') {
|
337 | console.error(message);
|
338 | }
|
339 | try {
|
340 |
|
341 |
|
342 |
|
343 | throw new Error(message);
|
344 | } catch (x) {}
|
345 | };
|
346 |
|
347 | warning = function warning(condition, format) {
|
348 | if (format === undefined) {
|
349 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
350 | }
|
351 |
|
352 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
353 | return;
|
354 | }
|
355 |
|
356 | if (!condition) {
|
357 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
358 | args[_key2 - 2] = arguments[_key2];
|
359 | }
|
360 |
|
361 | printWarning$1.apply(undefined, [format].concat(args));
|
362 | }
|
363 | };
|
364 | }
|
365 |
|
366 | var warning_1 = warning;
|
367 |
|
368 | var didWarnStateUpdateForUnmountedComponent = {};
|
369 |
|
370 | function warnNoop(publicInstance, callerName) {
|
371 | {
|
372 | var _constructor = publicInstance.constructor;
|
373 | var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
374 | var warningKey = componentName + '.' + callerName;
|
375 | if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
376 | return;
|
377 | }
|
378 | warning_1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
379 | didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
380 | }
|
381 | }
|
382 |
|
383 |
|
384 |
|
385 |
|
386 | var ReactNoopUpdateQueue = {
|
387 | |
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 | isMounted: function (publicInstance) {
|
395 | return false;
|
396 | },
|
397 |
|
398 | |
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 | enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
414 | warnNoop(publicInstance, 'forceUpdate');
|
415 | },
|
416 |
|
417 | |
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 | enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
431 | warnNoop(publicInstance, 'replaceState');
|
432 | },
|
433 |
|
434 | |
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 | enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
447 | warnNoop(publicInstance, 'setState');
|
448 | }
|
449 | };
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | function Component(props, context, updater) {
|
455 | this.props = props;
|
456 | this.context = context;
|
457 | this.refs = emptyObject_1;
|
458 |
|
459 |
|
460 | this.updater = updater || ReactNoopUpdateQueue;
|
461 | }
|
462 |
|
463 | Component.prototype.isReactComponent = {};
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | Component.prototype.setState = function (partialState, callback) {
|
491 | !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant_1(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
492 | this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
493 | };
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 | Component.prototype.forceUpdate = function (callback) {
|
510 | this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
511 | };
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 | {
|
519 | var deprecatedAPIs = {
|
520 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
521 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
522 | };
|
523 | var defineDeprecationWarning = function (methodName, info) {
|
524 | Object.defineProperty(Component.prototype, methodName, {
|
525 | get: function () {
|
526 | lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
527 | return undefined;
|
528 | }
|
529 | });
|
530 | };
|
531 | for (var fnName in deprecatedAPIs) {
|
532 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
533 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
534 | }
|
535 | }
|
536 | }
|
537 |
|
538 | function ComponentDummy() {}
|
539 | ComponentDummy.prototype = Component.prototype;
|
540 |
|
541 |
|
542 |
|
543 |
|
544 | function PureComponent(props, context, updater) {
|
545 | this.props = props;
|
546 | this.context = context;
|
547 | this.refs = emptyObject_1;
|
548 | this.updater = updater || ReactNoopUpdateQueue;
|
549 | }
|
550 |
|
551 | var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
552 | pureComponentPrototype.constructor = PureComponent;
|
553 |
|
554 | objectAssign(pureComponentPrototype, Component.prototype);
|
555 | pureComponentPrototype.isPureReactComponent = true;
|
556 |
|
557 |
|
558 | function createRef() {
|
559 | var refObject = {
|
560 | current: null
|
561 | };
|
562 | {
|
563 | Object.seal(refObject);
|
564 | }
|
565 | return refObject;
|
566 | }
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 | var ReactCurrentOwner = {
|
575 | |
576 |
|
577 |
|
578 |
|
579 | current: null
|
580 | };
|
581 |
|
582 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
583 |
|
584 | var RESERVED_PROPS = {
|
585 | key: true,
|
586 | ref: true,
|
587 | __self: true,
|
588 | __source: true
|
589 | };
|
590 |
|
591 | var specialPropKeyWarningShown = void 0;
|
592 | var specialPropRefWarningShown = void 0;
|
593 |
|
594 | function hasValidRef(config) {
|
595 | {
|
596 | if (hasOwnProperty$1.call(config, 'ref')) {
|
597 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
598 | if (getter && getter.isReactWarning) {
|
599 | return false;
|
600 | }
|
601 | }
|
602 | }
|
603 | return config.ref !== undefined;
|
604 | }
|
605 |
|
606 | function hasValidKey(config) {
|
607 | {
|
608 | if (hasOwnProperty$1.call(config, 'key')) {
|
609 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
610 | if (getter && getter.isReactWarning) {
|
611 | return false;
|
612 | }
|
613 | }
|
614 | }
|
615 | return config.key !== undefined;
|
616 | }
|
617 |
|
618 | function defineKeyPropWarningGetter(props, displayName) {
|
619 | var warnAboutAccessingKey = function () {
|
620 | if (!specialPropKeyWarningShown) {
|
621 | specialPropKeyWarningShown = true;
|
622 | warning_1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
623 | }
|
624 | };
|
625 | warnAboutAccessingKey.isReactWarning = true;
|
626 | Object.defineProperty(props, 'key', {
|
627 | get: warnAboutAccessingKey,
|
628 | configurable: true
|
629 | });
|
630 | }
|
631 |
|
632 | function defineRefPropWarningGetter(props, displayName) {
|
633 | var warnAboutAccessingRef = function () {
|
634 | if (!specialPropRefWarningShown) {
|
635 | specialPropRefWarningShown = true;
|
636 | warning_1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
637 | }
|
638 | };
|
639 | warnAboutAccessingRef.isReactWarning = true;
|
640 | Object.defineProperty(props, 'ref', {
|
641 | get: warnAboutAccessingRef,
|
642 | configurable: true
|
643 | });
|
644 | }
|
645 |
|
646 | /**
|
647 | * Factory method to create a new React element. This no longer adheres to
|
648 | * the class pattern, so do not use new to call it. Also, no instanceof check
|
649 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
650 | * if something is a React Element.
|
651 | *
|
652 | * @param {*} type
|
653 | * @param {*} key
|
654 | * @param {string|object} ref
|
655 | * @param {*} self A *temporary* helper to detect places where `this` is
|
656 | * different from the `owner` when React.createElement is called, so that we
|
657 | * can warn. We want to get rid of owner and replace string `ref`s with arrow
|
658 | * functions, and as long as `this` and owner are the same, there will be no
|
659 | * change in behavior.
|
660 | * @param {*} source An annotation object (added by a transpiler or otherwise)
|
661 | * indicating filename, line number, and/or other information.
|
662 | * @param {*} owner
|
663 | * @param {*} props
|
664 | * @internal
|
665 | */
|
666 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
667 | var element = {
|
668 |
|
669 | $$typeof: REACT_ELEMENT_TYPE,
|
670 |
|
671 |
|
672 | type: type,
|
673 | key: key,
|
674 | ref: ref,
|
675 | props: props,
|
676 |
|
677 |
|
678 | _owner: owner
|
679 | };
|
680 |
|
681 | {
|
682 |
|
683 |
|
684 |
|
685 |
|
686 | element._store = {};
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 | Object.defineProperty(element._store, 'validated', {
|
693 | configurable: false,
|
694 | enumerable: false,
|
695 | writable: true,
|
696 | value: false
|
697 | });
|
698 |
|
699 | Object.defineProperty(element, '_self', {
|
700 | configurable: false,
|
701 | enumerable: false,
|
702 | writable: false,
|
703 | value: self
|
704 | });
|
705 |
|
706 |
|
707 | Object.defineProperty(element, '_source', {
|
708 | configurable: false,
|
709 | enumerable: false,
|
710 | writable: false,
|
711 | value: source
|
712 | });
|
713 | if (Object.freeze) {
|
714 | Object.freeze(element.props);
|
715 | Object.freeze(element);
|
716 | }
|
717 | }
|
718 |
|
719 | return element;
|
720 | };
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 | function createElement(type, config, children) {
|
727 | var propName = void 0;
|
728 |
|
729 |
|
730 | var props = {};
|
731 |
|
732 | var key = null;
|
733 | var ref = null;
|
734 | var self = null;
|
735 | var source = null;
|
736 |
|
737 | if (config != null) {
|
738 | if (hasValidRef(config)) {
|
739 | ref = config.ref;
|
740 | }
|
741 | if (hasValidKey(config)) {
|
742 | key = '' + config.key;
|
743 | }
|
744 |
|
745 | self = config.__self === undefined ? null : config.__self;
|
746 | source = config.__source === undefined ? null : config.__source;
|
747 |
|
748 | for (propName in config) {
|
749 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
750 | props[propName] = config[propName];
|
751 | }
|
752 | }
|
753 | }
|
754 |
|
755 |
|
756 |
|
757 | var childrenLength = arguments.length - 2;
|
758 | if (childrenLength === 1) {
|
759 | props.children = children;
|
760 | } else if (childrenLength > 1) {
|
761 | var childArray = Array(childrenLength);
|
762 | for (var i = 0; i < childrenLength; i++) {
|
763 | childArray[i] = arguments[i + 2];
|
764 | }
|
765 | {
|
766 | if (Object.freeze) {
|
767 | Object.freeze(childArray);
|
768 | }
|
769 | }
|
770 | props.children = childArray;
|
771 | }
|
772 |
|
773 |
|
774 | if (type && type.defaultProps) {
|
775 | var defaultProps = type.defaultProps;
|
776 | for (propName in defaultProps) {
|
777 | if (props[propName] === undefined) {
|
778 | props[propName] = defaultProps[propName];
|
779 | }
|
780 | }
|
781 | }
|
782 | {
|
783 | if (key || ref) {
|
784 | if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
785 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
786 | if (key) {
|
787 | defineKeyPropWarningGetter(props, displayName);
|
788 | }
|
789 | if (ref) {
|
790 | defineRefPropWarningGetter(props, displayName);
|
791 | }
|
792 | }
|
793 | }
|
794 | }
|
795 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
796 | }
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 | function cloneAndReplaceKey(oldElement, newKey) {
|
805 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
806 |
|
807 | return newElement;
|
808 | }
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 | function cloneElement(element, config, children) {
|
815 | !!(element === null || element === undefined) ? invariant_1(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
816 |
|
817 | var propName = void 0;
|
818 |
|
819 |
|
820 | var props = objectAssign({}, element.props);
|
821 |
|
822 |
|
823 | var key = element.key;
|
824 | var ref = element.ref;
|
825 |
|
826 | var self = element._self;
|
827 |
|
828 |
|
829 |
|
830 | var source = element._source;
|
831 |
|
832 |
|
833 | var owner = element._owner;
|
834 |
|
835 | if (config != null) {
|
836 | if (hasValidRef(config)) {
|
837 |
|
838 | ref = config.ref;
|
839 | owner = ReactCurrentOwner.current;
|
840 | }
|
841 | if (hasValidKey(config)) {
|
842 | key = '' + config.key;
|
843 | }
|
844 |
|
845 |
|
846 | var defaultProps = void 0;
|
847 | if (element.type && element.type.defaultProps) {
|
848 | defaultProps = element.type.defaultProps;
|
849 | }
|
850 | for (propName in config) {
|
851 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
852 | if (config[propName] === undefined && defaultProps !== undefined) {
|
853 |
|
854 | props[propName] = defaultProps[propName];
|
855 | } else {
|
856 | props[propName] = config[propName];
|
857 | }
|
858 | }
|
859 | }
|
860 | }
|
861 |
|
862 |
|
863 |
|
864 | var childrenLength = arguments.length - 2;
|
865 | if (childrenLength === 1) {
|
866 | props.children = children;
|
867 | } else if (childrenLength > 1) {
|
868 | var childArray = Array(childrenLength);
|
869 | for (var i = 0; i < childrenLength; i++) {
|
870 | childArray[i] = arguments[i + 2];
|
871 | }
|
872 | props.children = childArray;
|
873 | }
|
874 |
|
875 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
876 | }
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 | function isValidElement(object) {
|
886 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
887 | }
|
888 |
|
889 | var ReactDebugCurrentFrame = {};
|
890 |
|
891 | {
|
892 |
|
893 | ReactDebugCurrentFrame.getCurrentStack = null;
|
894 |
|
895 | ReactDebugCurrentFrame.getStackAddendum = function () {
|
896 | var impl = ReactDebugCurrentFrame.getCurrentStack;
|
897 | if (impl) {
|
898 | return impl();
|
899 | }
|
900 | return null;
|
901 | };
|
902 | }
|
903 |
|
904 | var SEPARATOR = '.';
|
905 | var SUBSEPARATOR = ':';
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 | function escape(key) {
|
914 | var escapeRegex = /[=:]/g;
|
915 | var escaperLookup = {
|
916 | '=': '=0',
|
917 | ':': '=2'
|
918 | };
|
919 | var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
920 | return escaperLookup[match];
|
921 | });
|
922 |
|
923 | return '$' + escapedString;
|
924 | }
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | var didWarnAboutMaps = false;
|
932 |
|
933 | var userProvidedKeyEscapeRegex = /\/+/g;
|
934 | function escapeUserProvidedKey(text) {
|
935 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
936 | }
|
937 |
|
938 | var POOL_SIZE = 10;
|
939 | var traverseContextPool = [];
|
940 | function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
941 | if (traverseContextPool.length) {
|
942 | var traverseContext = traverseContextPool.pop();
|
943 | traverseContext.result = mapResult;
|
944 | traverseContext.keyPrefix = keyPrefix;
|
945 | traverseContext.func = mapFunction;
|
946 | traverseContext.context = mapContext;
|
947 | traverseContext.count = 0;
|
948 | return traverseContext;
|
949 | } else {
|
950 | return {
|
951 | result: mapResult,
|
952 | keyPrefix: keyPrefix,
|
953 | func: mapFunction,
|
954 | context: mapContext,
|
955 | count: 0
|
956 | };
|
957 | }
|
958 | }
|
959 |
|
960 | function releaseTraverseContext(traverseContext) {
|
961 | traverseContext.result = null;
|
962 | traverseContext.keyPrefix = null;
|
963 | traverseContext.func = null;
|
964 | traverseContext.context = null;
|
965 | traverseContext.count = 0;
|
966 | if (traverseContextPool.length < POOL_SIZE) {
|
967 | traverseContextPool.push(traverseContext);
|
968 | }
|
969 | }
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
980 | var type = typeof children;
|
981 |
|
982 | if (type === 'undefined' || type === 'boolean') {
|
983 |
|
984 | children = null;
|
985 | }
|
986 |
|
987 | var invokeCallback = false;
|
988 |
|
989 | if (children === null) {
|
990 | invokeCallback = true;
|
991 | } else {
|
992 | switch (type) {
|
993 | case 'string':
|
994 | case 'number':
|
995 | invokeCallback = true;
|
996 | break;
|
997 | case 'object':
|
998 | switch (children.$$typeof) {
|
999 | case REACT_ELEMENT_TYPE:
|
1000 | case REACT_PORTAL_TYPE:
|
1001 | invokeCallback = true;
|
1002 | }
|
1003 | }
|
1004 | }
|
1005 |
|
1006 | if (invokeCallback) {
|
1007 | callback(traverseContext, children,
|
1008 |
|
1009 |
|
1010 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
1011 | return 1;
|
1012 | }
|
1013 |
|
1014 | var child = void 0;
|
1015 | var nextName = void 0;
|
1016 | var subtreeCount = 0;
|
1017 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1018 |
|
1019 | if (Array.isArray(children)) {
|
1020 | for (var i = 0; i < children.length; i++) {
|
1021 | child = children[i];
|
1022 | nextName = nextNamePrefix + getComponentKey(child, i);
|
1023 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1024 | }
|
1025 | } else {
|
1026 | var iteratorFn = getIteratorFn(children);
|
1027 | if (typeof iteratorFn === 'function') {
|
1028 | {
|
1029 |
|
1030 | if (iteratorFn === children.entries) {
|
1031 | !didWarnAboutMaps ? warning_1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum()) : void 0;
|
1032 | didWarnAboutMaps = true;
|
1033 | }
|
1034 | }
|
1035 |
|
1036 | var iterator = iteratorFn.call(children);
|
1037 | var step = void 0;
|
1038 | var ii = 0;
|
1039 | while (!(step = iterator.next()).done) {
|
1040 | child = step.value;
|
1041 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
1042 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1043 | }
|
1044 | } else if (type === 'object') {
|
1045 | var addendum = '';
|
1046 | {
|
1047 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
1048 | }
|
1049 | var childrenString = '' + children;
|
1050 | invariant_1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
1051 | }
|
1052 | }
|
1053 |
|
1054 | return subtreeCount;
|
1055 | }
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | function traverseAllChildren(children, callback, traverseContext) {
|
1074 | if (children == null) {
|
1075 | return 0;
|
1076 | }
|
1077 |
|
1078 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
1079 | }
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 | function getComponentKey(component, index) {
|
1089 |
|
1090 |
|
1091 | if (typeof component === 'object' && component !== null && component.key != null) {
|
1092 |
|
1093 | return escape(component.key);
|
1094 | }
|
1095 |
|
1096 | return index.toString(36);
|
1097 | }
|
1098 |
|
1099 | function forEachSingleChild(bookKeeping, child, name) {
|
1100 | var func = bookKeeping.func,
|
1101 | context = bookKeeping.context;
|
1102 |
|
1103 | func.call(context, child, bookKeeping.count++);
|
1104 | }
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 | function forEachChildren(children, forEachFunc, forEachContext) {
|
1119 | if (children == null) {
|
1120 | return children;
|
1121 | }
|
1122 | var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
1123 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
1124 | releaseTraverseContext(traverseContext);
|
1125 | }
|
1126 |
|
1127 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
1128 | var result = bookKeeping.result,
|
1129 | keyPrefix = bookKeeping.keyPrefix,
|
1130 | func = bookKeeping.func,
|
1131 | context = bookKeeping.context;
|
1132 |
|
1133 |
|
1134 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
1135 | if (Array.isArray(mappedChild)) {
|
1136 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction_1.thatReturnsArgument);
|
1137 | } else if (mappedChild != null) {
|
1138 | if (isValidElement(mappedChild)) {
|
1139 | mappedChild = cloneAndReplaceKey(mappedChild,
|
1140 |
|
1141 |
|
1142 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
1143 | }
|
1144 | result.push(mappedChild);
|
1145 | }
|
1146 | }
|
1147 |
|
1148 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
1149 | var escapedPrefix = '';
|
1150 | if (prefix != null) {
|
1151 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
1152 | }
|
1153 | var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
1154 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
1155 | releaseTraverseContext(traverseContext);
|
1156 | }
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 | function mapChildren(children, func, context) {
|
1172 | if (children == null) {
|
1173 | return children;
|
1174 | }
|
1175 | var result = [];
|
1176 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
1177 | return result;
|
1178 | }
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 | function countChildren(children, context) {
|
1190 | return traverseAllChildren(children, emptyFunction_1.thatReturnsNull, null);
|
1191 | }
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | function toArray(children) {
|
1200 | var result = [];
|
1201 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction_1.thatReturnsArgument);
|
1202 | return result;
|
1203 | }
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 | function onlyChild(children) {
|
1220 | !isValidElement(children) ? invariant_1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
1221 | return children;
|
1222 | }
|
1223 |
|
1224 | function createContext(defaultValue, calculateChangedBits) {
|
1225 | if (calculateChangedBits === undefined) {
|
1226 | calculateChangedBits = null;
|
1227 | } else {
|
1228 | {
|
1229 | !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warning_1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
1230 | }
|
1231 | }
|
1232 |
|
1233 | var context = {
|
1234 | $$typeof: REACT_CONTEXT_TYPE,
|
1235 | _calculateChangedBits: calculateChangedBits,
|
1236 | _defaultValue: defaultValue,
|
1237 | _currentValue: defaultValue,
|
1238 | _changedBits: 0,
|
1239 |
|
1240 | Provider: null,
|
1241 | Consumer: null
|
1242 | };
|
1243 |
|
1244 | context.Provider = {
|
1245 | $$typeof: REACT_PROVIDER_TYPE,
|
1246 | _context: context
|
1247 | };
|
1248 | context.Consumer = context;
|
1249 |
|
1250 | {
|
1251 | context._currentRenderer = null;
|
1252 | }
|
1253 |
|
1254 | return context;
|
1255 | }
|
1256 |
|
1257 | function forwardRef(render) {
|
1258 | {
|
1259 | !(typeof render === 'function') ? warning_1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render) : void 0;
|
1260 | }
|
1261 |
|
1262 | return {
|
1263 | $$typeof: REACT_FORWARD_REF_TYPE,
|
1264 | render: render
|
1265 | };
|
1266 | }
|
1267 |
|
1268 | var describeComponentFrame = function (name, source, ownerName) {
|
1269 | return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
1270 | };
|
1271 |
|
1272 | function isValidElementType(type) {
|
1273 | return typeof type === 'string' || typeof type === 'function' ||
|
1274 |
|
1275 | type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
1276 | }
|
1277 |
|
1278 | function getComponentName(fiber) {
|
1279 | var type = fiber.type;
|
1280 |
|
1281 | if (typeof type === 'function') {
|
1282 | return type.displayName || type.name;
|
1283 | }
|
1284 | if (typeof type === 'string') {
|
1285 | return type;
|
1286 | }
|
1287 | switch (type) {
|
1288 | case REACT_FRAGMENT_TYPE:
|
1289 | return 'ReactFragment';
|
1290 | case REACT_PORTAL_TYPE:
|
1291 | return 'ReactPortal';
|
1292 | case REACT_CALL_TYPE:
|
1293 | return 'ReactCall';
|
1294 | case REACT_RETURN_TYPE:
|
1295 | return 'ReactReturn';
|
1296 | }
|
1297 | if (typeof type === 'object' && type !== null) {
|
1298 | switch (type.$$typeof) {
|
1299 | case REACT_FORWARD_REF_TYPE:
|
1300 | var functionName = type.render.displayName || type.render.name || '';
|
1301 | return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
1302 | }
|
1303 | }
|
1304 | return null;
|
1305 | }
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 | var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
1317 |
|
1318 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 | {
|
1330 | var invariant$2 = invariant_1;
|
1331 | var warning$2 = warning_1;
|
1332 | var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
1333 | var loggedTypeFailures = {};
|
1334 | }
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
1348 | {
|
1349 | for (var typeSpecName in typeSpecs) {
|
1350 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
1351 | var error;
|
1352 |
|
1353 |
|
1354 |
|
1355 | try {
|
1356 |
|
1357 |
|
1358 | invariant$2(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
|
1359 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
1360 | } catch (ex) {
|
1361 | error = ex;
|
1362 | }
|
1363 | warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
1364 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
1365 |
|
1366 |
|
1367 | loggedTypeFailures[error.message] = true;
|
1368 |
|
1369 | var stack = getStack ? getStack() : '';
|
1370 |
|
1371 | warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
1372 | }
|
1373 | }
|
1374 | }
|
1375 | }
|
1376 | }
|
1377 |
|
1378 | var checkPropTypes_1 = checkPropTypes;
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 | var currentlyValidatingElement = void 0;
|
1388 | var propTypesMisspellWarningShown = void 0;
|
1389 |
|
1390 | var getDisplayName = function () {};
|
1391 | var getStackAddendum = function () {};
|
1392 |
|
1393 | {
|
1394 | currentlyValidatingElement = null;
|
1395 |
|
1396 | propTypesMisspellWarningShown = false;
|
1397 |
|
1398 | getDisplayName = function (element) {
|
1399 | if (element == null) {
|
1400 | return '#empty';
|
1401 | } else if (typeof element === 'string' || typeof element === 'number') {
|
1402 | return '#text';
|
1403 | } else if (typeof element.type === 'string') {
|
1404 | return element.type;
|
1405 | } else if (element.type === REACT_FRAGMENT_TYPE) {
|
1406 | return 'React.Fragment';
|
1407 | } else {
|
1408 | return element.type.displayName || element.type.name || 'Unknown';
|
1409 | }
|
1410 | };
|
1411 |
|
1412 | getStackAddendum = function () {
|
1413 | var stack = '';
|
1414 | if (currentlyValidatingElement) {
|
1415 | var name = getDisplayName(currentlyValidatingElement);
|
1416 | var owner = currentlyValidatingElement._owner;
|
1417 | stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
1418 | }
|
1419 | stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
1420 | return stack;
|
1421 | };
|
1422 | }
|
1423 |
|
1424 | function getDeclarationErrorAddendum() {
|
1425 | if (ReactCurrentOwner.current) {
|
1426 | var name = getComponentName(ReactCurrentOwner.current);
|
1427 | if (name) {
|
1428 | return '\n\nCheck the render method of `' + name + '`.';
|
1429 | }
|
1430 | }
|
1431 | return '';
|
1432 | }
|
1433 |
|
1434 | function getSourceInfoErrorAddendum(elementProps) {
|
1435 | if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
1436 | var source = elementProps.__source;
|
1437 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
1438 | var lineNumber = source.lineNumber;
|
1439 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
1440 | }
|
1441 | return '';
|
1442 | }
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 | var ownerHasKeyUseWarning = {};
|
1450 |
|
1451 | function getCurrentComponentErrorInfo(parentType) {
|
1452 | var info = getDeclarationErrorAddendum();
|
1453 |
|
1454 | if (!info) {
|
1455 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
1456 | if (parentName) {
|
1457 | info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
1458 | }
|
1459 | }
|
1460 | return info;
|
1461 | }
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 | function validateExplicitKey(element, parentType) {
|
1475 | if (!element._store || element._store.validated || element.key != null) {
|
1476 | return;
|
1477 | }
|
1478 | element._store.validated = true;
|
1479 |
|
1480 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1481 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1482 | return;
|
1483 | }
|
1484 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 | var childOwner = '';
|
1490 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
1491 |
|
1492 | childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
1493 | }
|
1494 |
|
1495 | currentlyValidatingElement = element;
|
1496 | {
|
1497 | warning_1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum());
|
1498 | }
|
1499 | currentlyValidatingElement = null;
|
1500 | }
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 | function validateChildKeys(node, parentType) {
|
1512 | if (typeof node !== 'object') {
|
1513 | return;
|
1514 | }
|
1515 | if (Array.isArray(node)) {
|
1516 | for (var i = 0; i < node.length; i++) {
|
1517 | var child = node[i];
|
1518 | if (isValidElement(child)) {
|
1519 | validateExplicitKey(child, parentType);
|
1520 | }
|
1521 | }
|
1522 | } else if (isValidElement(node)) {
|
1523 |
|
1524 | if (node._store) {
|
1525 | node._store.validated = true;
|
1526 | }
|
1527 | } else if (node) {
|
1528 | var iteratorFn = getIteratorFn(node);
|
1529 | if (typeof iteratorFn === 'function') {
|
1530 |
|
1531 |
|
1532 | if (iteratorFn !== node.entries) {
|
1533 | var iterator = iteratorFn.call(node);
|
1534 | var step = void 0;
|
1535 | while (!(step = iterator.next()).done) {
|
1536 | if (isValidElement(step.value)) {
|
1537 | validateExplicitKey(step.value, parentType);
|
1538 | }
|
1539 | }
|
1540 | }
|
1541 | }
|
1542 | }
|
1543 | }
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 | function validatePropTypes(element) {
|
1552 | var componentClass = element.type;
|
1553 | if (typeof componentClass !== 'function') {
|
1554 | return;
|
1555 | }
|
1556 | var name = componentClass.displayName || componentClass.name;
|
1557 | var propTypes = componentClass.propTypes;
|
1558 | if (propTypes) {
|
1559 | currentlyValidatingElement = element;
|
1560 | checkPropTypes_1(propTypes, element.props, 'prop', name, getStackAddendum);
|
1561 | currentlyValidatingElement = null;
|
1562 | } else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
1563 | propTypesMisspellWarningShown = true;
|
1564 | warning_1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
1565 | }
|
1566 | if (typeof componentClass.getDefaultProps === 'function') {
|
1567 | !componentClass.getDefaultProps.isReactClassApproved ? warning_1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
1568 | }
|
1569 | }
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 | function validateFragmentProps(fragment) {
|
1576 | currentlyValidatingElement = fragment;
|
1577 |
|
1578 | var keys = Object.keys(fragment.props);
|
1579 | for (var i = 0; i < keys.length; i++) {
|
1580 | var key = keys[i];
|
1581 | if (key !== 'children' && key !== 'key') {
|
1582 | warning_1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
|
1583 | break;
|
1584 | }
|
1585 | }
|
1586 |
|
1587 | if (fragment.ref !== null) {
|
1588 | warning_1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
|
1589 | }
|
1590 |
|
1591 | currentlyValidatingElement = null;
|
1592 | }
|
1593 |
|
1594 | function createElementWithValidation(type, props, children) {
|
1595 | var validType = isValidElementType(type);
|
1596 |
|
1597 |
|
1598 |
|
1599 | if (!validType) {
|
1600 | var info = '';
|
1601 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
1602 | info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
1603 | }
|
1604 |
|
1605 | var sourceInfo = getSourceInfoErrorAddendum(props);
|
1606 | if (sourceInfo) {
|
1607 | info += sourceInfo;
|
1608 | } else {
|
1609 | info += getDeclarationErrorAddendum();
|
1610 | }
|
1611 |
|
1612 | info += getStackAddendum() || '';
|
1613 |
|
1614 | var typeString = void 0;
|
1615 | if (type === null) {
|
1616 | typeString = 'null';
|
1617 | } else if (Array.isArray(type)) {
|
1618 | typeString = 'array';
|
1619 | } else {
|
1620 | typeString = typeof type;
|
1621 | }
|
1622 |
|
1623 | warning_1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
1624 | }
|
1625 |
|
1626 | var element = createElement.apply(this, arguments);
|
1627 |
|
1628 |
|
1629 |
|
1630 | if (element == null) {
|
1631 | return element;
|
1632 | }
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 | if (validType) {
|
1640 | for (var i = 2; i < arguments.length; i++) {
|
1641 | validateChildKeys(arguments[i], type);
|
1642 | }
|
1643 | }
|
1644 |
|
1645 | if (type === REACT_FRAGMENT_TYPE) {
|
1646 | validateFragmentProps(element);
|
1647 | } else {
|
1648 | validatePropTypes(element);
|
1649 | }
|
1650 |
|
1651 | return element;
|
1652 | }
|
1653 |
|
1654 | function createFactoryWithValidation(type) {
|
1655 | var validatedFactory = createElementWithValidation.bind(null, type);
|
1656 | validatedFactory.type = type;
|
1657 |
|
1658 | {
|
1659 | Object.defineProperty(validatedFactory, 'type', {
|
1660 | enumerable: false,
|
1661 | get: function () {
|
1662 | lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
1663 | Object.defineProperty(this, 'type', {
|
1664 | value: type
|
1665 | });
|
1666 | return type;
|
1667 | }
|
1668 | });
|
1669 | }
|
1670 |
|
1671 | return validatedFactory;
|
1672 | }
|
1673 |
|
1674 | function cloneElementWithValidation(element, props, children) {
|
1675 | var newElement = cloneElement.apply(this, arguments);
|
1676 | for (var i = 2; i < arguments.length; i++) {
|
1677 | validateChildKeys(arguments[i], newElement.type);
|
1678 | }
|
1679 | validatePropTypes(newElement);
|
1680 | return newElement;
|
1681 | }
|
1682 |
|
1683 | var React = {
|
1684 | Children: {
|
1685 | map: mapChildren,
|
1686 | forEach: forEachChildren,
|
1687 | count: countChildren,
|
1688 | toArray: toArray,
|
1689 | only: onlyChild
|
1690 | },
|
1691 |
|
1692 | createRef: createRef,
|
1693 | Component: Component,
|
1694 | PureComponent: PureComponent,
|
1695 |
|
1696 | createContext: createContext,
|
1697 | forwardRef: forwardRef,
|
1698 |
|
1699 | Fragment: REACT_FRAGMENT_TYPE,
|
1700 | StrictMode: REACT_STRICT_MODE_TYPE,
|
1701 | unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
|
1702 |
|
1703 | createElement: createElementWithValidation,
|
1704 | cloneElement: cloneElementWithValidation,
|
1705 | createFactory: createFactoryWithValidation,
|
1706 | isValidElement: isValidElement,
|
1707 |
|
1708 | version: ReactVersion,
|
1709 |
|
1710 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
1711 | ReactCurrentOwner: ReactCurrentOwner,
|
1712 |
|
1713 | assign: objectAssign
|
1714 | }
|
1715 | };
|
1716 |
|
1717 | {
|
1718 | objectAssign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
1719 |
|
1720 | ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
1721 |
|
1722 |
|
1723 | ReactComponentTreeHook: {}
|
1724 | });
|
1725 | }
|
1726 |
|
1727 |
|
1728 |
|
1729 | var React$2 = Object.freeze({
|
1730 | default: React
|
1731 | });
|
1732 |
|
1733 | var React$3 = ( React$2 && React ) || React$2;
|
1734 |
|
1735 |
|
1736 |
|
1737 | var react = React$3['default'] ? React$3['default'] : React$3;
|
1738 |
|
1739 | return react;
|
1740 |
|
1741 | })));
|