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