1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | (function (global, factory) {
|
11 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
12 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
13 | (global = global || self, factory(global.React = {}));
|
14 | }(this, (function (exports) { 'use strict';
|
15 |
|
16 | var ReactVersion = '18.1.0';
|
17 |
|
18 |
|
19 |
|
20 | var enableScopeAPI = false;
|
21 | var enableCacheElement = false;
|
22 | var enableTransitionTracing = false;
|
23 |
|
24 | var enableLegacyHidden = false;
|
25 |
|
26 |
|
27 |
|
28 | var enableDebugTracing = false;
|
29 |
|
30 |
|
31 |
|
32 | var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
33 | var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
34 | var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
35 | var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
36 | var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
37 | var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
38 | var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
39 | var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
40 | var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
41 | var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
42 | var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
43 | var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
44 | var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
45 | var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
46 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
47 | function getIteratorFn(maybeIterable) {
|
48 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
49 | return null;
|
50 | }
|
51 |
|
52 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
53 |
|
54 | if (typeof maybeIterator === 'function') {
|
55 | return maybeIterator;
|
56 | }
|
57 |
|
58 | return null;
|
59 | }
|
60 |
|
61 | |
62 |
|
63 |
|
64 | var ReactCurrentDispatcher = {
|
65 | |
66 |
|
67 |
|
68 |
|
69 | current: null
|
70 | };
|
71 |
|
72 | |
73 |
|
74 |
|
75 |
|
76 | var ReactCurrentBatchConfig = {
|
77 | transition: null
|
78 | };
|
79 |
|
80 | var ReactCurrentActQueue = {
|
81 | current: null,
|
82 |
|
83 | isBatchingLegacy: false,
|
84 | didScheduleLegacyUpdate: false
|
85 | };
|
86 |
|
87 | |
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | var ReactCurrentOwner = {
|
94 | |
95 |
|
96 |
|
97 |
|
98 | current: null
|
99 | };
|
100 |
|
101 | var ReactDebugCurrentFrame = {};
|
102 | var currentExtraStackFrame = null;
|
103 | function setExtraStackFrame(stack) {
|
104 | {
|
105 | currentExtraStackFrame = stack;
|
106 | }
|
107 | }
|
108 |
|
109 | {
|
110 | ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
111 | {
|
112 | currentExtraStackFrame = stack;
|
113 | }
|
114 | };
|
115 |
|
116 |
|
117 | ReactDebugCurrentFrame.getCurrentStack = null;
|
118 |
|
119 | ReactDebugCurrentFrame.getStackAddendum = function () {
|
120 | var stack = '';
|
121 |
|
122 | if (currentExtraStackFrame) {
|
123 | stack += currentExtraStackFrame;
|
124 | }
|
125 |
|
126 |
|
127 | var impl = ReactDebugCurrentFrame.getCurrentStack;
|
128 |
|
129 | if (impl) {
|
130 | stack += impl() || '';
|
131 | }
|
132 |
|
133 | return stack;
|
134 | };
|
135 | }
|
136 |
|
137 | var ReactSharedInternals = {
|
138 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
139 | ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
140 | ReactCurrentOwner: ReactCurrentOwner
|
141 | };
|
142 |
|
143 | {
|
144 | ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
145 | ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
146 | }
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 | function warn(format) {
|
154 | {
|
155 | {
|
156 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
157 | args[_key - 1] = arguments[_key];
|
158 | }
|
159 |
|
160 | printWarning('warn', format, args);
|
161 | }
|
162 | }
|
163 | }
|
164 | function error(format) {
|
165 | {
|
166 | {
|
167 | for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
168 | args[_key2 - 1] = arguments[_key2];
|
169 | }
|
170 |
|
171 | printWarning('error', format, args);
|
172 | }
|
173 | }
|
174 | }
|
175 |
|
176 | function printWarning(level, format, args) {
|
177 |
|
178 |
|
179 | {
|
180 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
181 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
182 |
|
183 | if (stack !== '') {
|
184 | format += '%s';
|
185 | args = args.concat([stack]);
|
186 | }
|
187 |
|
188 |
|
189 | var argsWithFormat = args.map(function (item) {
|
190 | return String(item);
|
191 | });
|
192 |
|
193 | argsWithFormat.unshift('Warning: ' + format);
|
194 |
|
195 |
|
196 |
|
197 | Function.prototype.apply.call(console[level], console, argsWithFormat);
|
198 | }
|
199 | }
|
200 |
|
201 | var didWarnStateUpdateForUnmountedComponent = {};
|
202 |
|
203 | function warnNoop(publicInstance, callerName) {
|
204 | {
|
205 | var _constructor = publicInstance.constructor;
|
206 | var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
207 | var warningKey = componentName + "." + callerName;
|
208 |
|
209 | if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
210 | return;
|
211 | }
|
212 |
|
213 | error("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);
|
214 |
|
215 | didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
216 | }
|
217 | }
|
218 | |
219 |
|
220 |
|
221 |
|
222 |
|
223 | var ReactNoopUpdateQueue = {
|
224 | |
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 | isMounted: function (publicInstance) {
|
232 | return false;
|
233 | },
|
234 |
|
235 | |
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 | enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
251 | warnNoop(publicInstance, 'forceUpdate');
|
252 | },
|
253 |
|
254 | |
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 | enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
268 | warnNoop(publicInstance, 'replaceState');
|
269 | },
|
270 |
|
271 | |
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 | enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
284 | warnNoop(publicInstance, 'setState');
|
285 | }
|
286 | };
|
287 |
|
288 | var assign = Object.assign;
|
289 |
|
290 | var emptyObject = {};
|
291 |
|
292 | {
|
293 | Object.freeze(emptyObject);
|
294 | }
|
295 | |
296 |
|
297 |
|
298 |
|
299 |
|
300 | function Component(props, context, updater) {
|
301 | this.props = props;
|
302 | this.context = context;
|
303 |
|
304 | this.refs = emptyObject;
|
305 |
|
306 |
|
307 | this.updater = updater || ReactNoopUpdateQueue;
|
308 | }
|
309 |
|
310 | Component.prototype.isReactComponent = {};
|
311 | |
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 | Component.prototype.setState = function (partialState, callback) {
|
338 | if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
339 | throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
340 | }
|
341 |
|
342 | this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
343 | };
|
344 | |
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 | Component.prototype.forceUpdate = function (callback) {
|
361 | this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
362 | };
|
363 | |
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 | {
|
371 | var deprecatedAPIs = {
|
372 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
373 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
374 | };
|
375 |
|
376 | var defineDeprecationWarning = function (methodName, info) {
|
377 | Object.defineProperty(Component.prototype, methodName, {
|
378 | get: function () {
|
379 | warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
380 |
|
381 | return undefined;
|
382 | }
|
383 | });
|
384 | };
|
385 |
|
386 | for (var fnName in deprecatedAPIs) {
|
387 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
388 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
389 | }
|
390 | }
|
391 | }
|
392 |
|
393 | function ComponentDummy() {}
|
394 |
|
395 | ComponentDummy.prototype = Component.prototype;
|
396 | |
397 |
|
398 |
|
399 |
|
400 | function PureComponent(props, context, updater) {
|
401 | this.props = props;
|
402 | this.context = context;
|
403 |
|
404 | this.refs = emptyObject;
|
405 | this.updater = updater || ReactNoopUpdateQueue;
|
406 | }
|
407 |
|
408 | var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
409 | pureComponentPrototype.constructor = PureComponent;
|
410 |
|
411 | assign(pureComponentPrototype, Component.prototype);
|
412 | pureComponentPrototype.isPureReactComponent = true;
|
413 |
|
414 |
|
415 | function createRef() {
|
416 | var refObject = {
|
417 | current: null
|
418 | };
|
419 |
|
420 | {
|
421 | Object.seal(refObject);
|
422 | }
|
423 |
|
424 | return refObject;
|
425 | }
|
426 |
|
427 | var isArrayImpl = Array.isArray;
|
428 |
|
429 | function isArray(a) {
|
430 | return isArrayImpl(a);
|
431 | }
|
432 |
|
433 | |
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 | function typeName(value) {
|
444 | {
|
445 |
|
446 | var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
447 | var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
448 | return type;
|
449 | }
|
450 | }
|
451 |
|
452 |
|
453 | function willCoercionThrow(value) {
|
454 | {
|
455 | try {
|
456 | testStringCoercion(value);
|
457 | return false;
|
458 | } catch (e) {
|
459 | return true;
|
460 | }
|
461 | }
|
462 | }
|
463 |
|
464 | function testStringCoercion(value) {
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 | return '' + value;
|
489 | }
|
490 | function checkKeyStringCoercion(value) {
|
491 | {
|
492 | if (willCoercionThrow(value)) {
|
493 | error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
494 |
|
495 | return testStringCoercion(value);
|
496 | }
|
497 | }
|
498 | }
|
499 |
|
500 | function getWrappedName(outerType, innerType, wrapperName) {
|
501 | var displayName = outerType.displayName;
|
502 |
|
503 | if (displayName) {
|
504 | return displayName;
|
505 | }
|
506 |
|
507 | var functionName = innerType.displayName || innerType.name || '';
|
508 | return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
509 | }
|
510 |
|
511 |
|
512 | function getContextName(type) {
|
513 | return type.displayName || 'Context';
|
514 | }
|
515 |
|
516 |
|
517 | function getComponentNameFromType(type) {
|
518 | if (type == null) {
|
519 |
|
520 | return null;
|
521 | }
|
522 |
|
523 | {
|
524 | if (typeof type.tag === 'number') {
|
525 | error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
526 | }
|
527 | }
|
528 |
|
529 | if (typeof type === 'function') {
|
530 | return type.displayName || type.name || null;
|
531 | }
|
532 |
|
533 | if (typeof type === 'string') {
|
534 | return type;
|
535 | }
|
536 |
|
537 | switch (type) {
|
538 | case REACT_FRAGMENT_TYPE:
|
539 | return 'Fragment';
|
540 |
|
541 | case REACT_PORTAL_TYPE:
|
542 | return 'Portal';
|
543 |
|
544 | case REACT_PROFILER_TYPE:
|
545 | return 'Profiler';
|
546 |
|
547 | case REACT_STRICT_MODE_TYPE:
|
548 | return 'StrictMode';
|
549 |
|
550 | case REACT_SUSPENSE_TYPE:
|
551 | return 'Suspense';
|
552 |
|
553 | case REACT_SUSPENSE_LIST_TYPE:
|
554 | return 'SuspenseList';
|
555 |
|
556 | }
|
557 |
|
558 | if (typeof type === 'object') {
|
559 | switch (type.$$typeof) {
|
560 | case REACT_CONTEXT_TYPE:
|
561 | var context = type;
|
562 | return getContextName(context) + '.Consumer';
|
563 |
|
564 | case REACT_PROVIDER_TYPE:
|
565 | var provider = type;
|
566 | return getContextName(provider._context) + '.Provider';
|
567 |
|
568 | case REACT_FORWARD_REF_TYPE:
|
569 | return getWrappedName(type, type.render, 'ForwardRef');
|
570 |
|
571 | case REACT_MEMO_TYPE:
|
572 | var outerName = type.displayName || null;
|
573 |
|
574 | if (outerName !== null) {
|
575 | return outerName;
|
576 | }
|
577 |
|
578 | return getComponentNameFromType(type.type) || 'Memo';
|
579 |
|
580 | case REACT_LAZY_TYPE:
|
581 | {
|
582 | var lazyComponent = type;
|
583 | var payload = lazyComponent._payload;
|
584 | var init = lazyComponent._init;
|
585 |
|
586 | try {
|
587 | return getComponentNameFromType(init(payload));
|
588 | } catch (x) {
|
589 | return null;
|
590 | }
|
591 | }
|
592 |
|
593 |
|
594 | }
|
595 | }
|
596 |
|
597 | return null;
|
598 | }
|
599 |
|
600 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
601 |
|
602 | var RESERVED_PROPS = {
|
603 | key: true,
|
604 | ref: true,
|
605 | __self: true,
|
606 | __source: true
|
607 | };
|
608 | var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
609 |
|
610 | {
|
611 | didWarnAboutStringRefs = {};
|
612 | }
|
613 |
|
614 | function hasValidRef(config) {
|
615 | {
|
616 | if (hasOwnProperty.call(config, 'ref')) {
|
617 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
618 |
|
619 | if (getter && getter.isReactWarning) {
|
620 | return false;
|
621 | }
|
622 | }
|
623 | }
|
624 |
|
625 | return config.ref !== undefined;
|
626 | }
|
627 |
|
628 | function hasValidKey(config) {
|
629 | {
|
630 | if (hasOwnProperty.call(config, 'key')) {
|
631 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
632 |
|
633 | if (getter && getter.isReactWarning) {
|
634 | return false;
|
635 | }
|
636 | }
|
637 | }
|
638 |
|
639 | return config.key !== undefined;
|
640 | }
|
641 |
|
642 | function defineKeyPropWarningGetter(props, displayName) {
|
643 | var warnAboutAccessingKey = function () {
|
644 | {
|
645 | if (!specialPropKeyWarningShown) {
|
646 | specialPropKeyWarningShown = true;
|
647 |
|
648 | error('%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://reactjs.org/link/special-props)', displayName);
|
649 | }
|
650 | }
|
651 | };
|
652 |
|
653 | warnAboutAccessingKey.isReactWarning = true;
|
654 | Object.defineProperty(props, 'key', {
|
655 | get: warnAboutAccessingKey,
|
656 | configurable: true
|
657 | });
|
658 | }
|
659 |
|
660 | function defineRefPropWarningGetter(props, displayName) {
|
661 | var warnAboutAccessingRef = function () {
|
662 | {
|
663 | if (!specialPropRefWarningShown) {
|
664 | specialPropRefWarningShown = true;
|
665 |
|
666 | error('%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://reactjs.org/link/special-props)', displayName);
|
667 | }
|
668 | }
|
669 | };
|
670 |
|
671 | warnAboutAccessingRef.isReactWarning = true;
|
672 | Object.defineProperty(props, 'ref', {
|
673 | get: warnAboutAccessingRef,
|
674 | configurable: true
|
675 | });
|
676 | }
|
677 |
|
678 | function warnIfStringRefCannotBeAutoConverted(config) {
|
679 | {
|
680 | if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
681 | var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
682 |
|
683 | if (!didWarnAboutStringRefs[componentName]) {
|
684 | error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
|
685 |
|
686 | didWarnAboutStringRefs[componentName] = true;
|
687 | }
|
688 | }
|
689 | }
|
690 | }
|
691 | |
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
714 | var element = {
|
715 |
|
716 | $$typeof: REACT_ELEMENT_TYPE,
|
717 |
|
718 | type: type,
|
719 | key: key,
|
720 | ref: ref,
|
721 | props: props,
|
722 |
|
723 | _owner: owner
|
724 | };
|
725 |
|
726 | {
|
727 |
|
728 |
|
729 |
|
730 |
|
731 | element._store = {};
|
732 |
|
733 |
|
734 |
|
735 |
|
736 | Object.defineProperty(element._store, 'validated', {
|
737 | configurable: false,
|
738 | enumerable: false,
|
739 | writable: true,
|
740 | value: false
|
741 | });
|
742 |
|
743 | Object.defineProperty(element, '_self', {
|
744 | configurable: false,
|
745 | enumerable: false,
|
746 | writable: false,
|
747 | value: self
|
748 | });
|
749 |
|
750 |
|
751 | Object.defineProperty(element, '_source', {
|
752 | configurable: false,
|
753 | enumerable: false,
|
754 | writable: false,
|
755 | value: source
|
756 | });
|
757 |
|
758 | if (Object.freeze) {
|
759 | Object.freeze(element.props);
|
760 | Object.freeze(element);
|
761 | }
|
762 | }
|
763 |
|
764 | return element;
|
765 | };
|
766 | |
767 |
|
768 |
|
769 |
|
770 |
|
771 | function createElement(type, config, children) {
|
772 | var propName;
|
773 |
|
774 | var props = {};
|
775 | var key = null;
|
776 | var ref = null;
|
777 | var self = null;
|
778 | var source = null;
|
779 |
|
780 | if (config != null) {
|
781 | if (hasValidRef(config)) {
|
782 | ref = config.ref;
|
783 |
|
784 | {
|
785 | warnIfStringRefCannotBeAutoConverted(config);
|
786 | }
|
787 | }
|
788 |
|
789 | if (hasValidKey(config)) {
|
790 | {
|
791 | checkKeyStringCoercion(config.key);
|
792 | }
|
793 |
|
794 | key = '' + config.key;
|
795 | }
|
796 |
|
797 | self = config.__self === undefined ? null : config.__self;
|
798 | source = config.__source === undefined ? null : config.__source;
|
799 |
|
800 | for (propName in config) {
|
801 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
802 | props[propName] = config[propName];
|
803 | }
|
804 | }
|
805 | }
|
806 |
|
807 |
|
808 |
|
809 | var childrenLength = arguments.length - 2;
|
810 |
|
811 | if (childrenLength === 1) {
|
812 | props.children = children;
|
813 | } else if (childrenLength > 1) {
|
814 | var childArray = Array(childrenLength);
|
815 |
|
816 | for (var i = 0; i < childrenLength; i++) {
|
817 | childArray[i] = arguments[i + 2];
|
818 | }
|
819 |
|
820 | {
|
821 | if (Object.freeze) {
|
822 | Object.freeze(childArray);
|
823 | }
|
824 | }
|
825 |
|
826 | props.children = childArray;
|
827 | }
|
828 |
|
829 |
|
830 | if (type && type.defaultProps) {
|
831 | var defaultProps = type.defaultProps;
|
832 |
|
833 | for (propName in defaultProps) {
|
834 | if (props[propName] === undefined) {
|
835 | props[propName] = defaultProps[propName];
|
836 | }
|
837 | }
|
838 | }
|
839 |
|
840 | {
|
841 | if (key || ref) {
|
842 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
843 |
|
844 | if (key) {
|
845 | defineKeyPropWarningGetter(props, displayName);
|
846 | }
|
847 |
|
848 | if (ref) {
|
849 | defineRefPropWarningGetter(props, displayName);
|
850 | }
|
851 | }
|
852 | }
|
853 |
|
854 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
855 | }
|
856 | function cloneAndReplaceKey(oldElement, newKey) {
|
857 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
858 | return newElement;
|
859 | }
|
860 | |
861 |
|
862 |
|
863 |
|
864 |
|
865 | function cloneElement(element, config, children) {
|
866 | if (element === null || element === undefined) {
|
867 | throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
868 | }
|
869 |
|
870 | var propName;
|
871 |
|
872 | var props = assign({}, element.props);
|
873 |
|
874 | var key = element.key;
|
875 | var ref = element.ref;
|
876 |
|
877 | var self = element._self;
|
878 |
|
879 |
|
880 |
|
881 | var source = element._source;
|
882 |
|
883 | var owner = element._owner;
|
884 |
|
885 | if (config != null) {
|
886 | if (hasValidRef(config)) {
|
887 |
|
888 | ref = config.ref;
|
889 | owner = ReactCurrentOwner.current;
|
890 | }
|
891 |
|
892 | if (hasValidKey(config)) {
|
893 | {
|
894 | checkKeyStringCoercion(config.key);
|
895 | }
|
896 |
|
897 | key = '' + config.key;
|
898 | }
|
899 |
|
900 |
|
901 | var defaultProps;
|
902 |
|
903 | if (element.type && element.type.defaultProps) {
|
904 | defaultProps = element.type.defaultProps;
|
905 | }
|
906 |
|
907 | for (propName in config) {
|
908 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
909 | if (config[propName] === undefined && defaultProps !== undefined) {
|
910 |
|
911 | props[propName] = defaultProps[propName];
|
912 | } else {
|
913 | props[propName] = config[propName];
|
914 | }
|
915 | }
|
916 | }
|
917 | }
|
918 |
|
919 |
|
920 |
|
921 | var childrenLength = arguments.length - 2;
|
922 |
|
923 | if (childrenLength === 1) {
|
924 | props.children = children;
|
925 | } else if (childrenLength > 1) {
|
926 | var childArray = Array(childrenLength);
|
927 |
|
928 | for (var i = 0; i < childrenLength; i++) {
|
929 | childArray[i] = arguments[i + 2];
|
930 | }
|
931 |
|
932 | props.children = childArray;
|
933 | }
|
934 |
|
935 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
936 | }
|
937 | |
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 | function isValidElement(object) {
|
946 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
947 | }
|
948 |
|
949 | var SEPARATOR = '.';
|
950 | var SUBSEPARATOR = ':';
|
951 | |
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 | function escape(key) {
|
959 | var escapeRegex = /[=:]/g;
|
960 | var escaperLookup = {
|
961 | '=': '=0',
|
962 | ':': '=2'
|
963 | };
|
964 | var escapedString = key.replace(escapeRegex, function (match) {
|
965 | return escaperLookup[match];
|
966 | });
|
967 | return '$' + escapedString;
|
968 | }
|
969 | |
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 | var didWarnAboutMaps = false;
|
976 | var userProvidedKeyEscapeRegex = /\/+/g;
|
977 |
|
978 | function escapeUserProvidedKey(text) {
|
979 | return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
980 | }
|
981 | |
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 | function getElementKey(element, index) {
|
991 |
|
992 |
|
993 | if (typeof element === 'object' && element !== null && element.key != null) {
|
994 |
|
995 | {
|
996 | checkKeyStringCoercion(element.key);
|
997 | }
|
998 |
|
999 | return escape('' + element.key);
|
1000 | }
|
1001 |
|
1002 |
|
1003 | return index.toString(36);
|
1004 | }
|
1005 |
|
1006 | function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
1007 | var type = typeof children;
|
1008 |
|
1009 | if (type === 'undefined' || type === 'boolean') {
|
1010 |
|
1011 | children = null;
|
1012 | }
|
1013 |
|
1014 | var invokeCallback = false;
|
1015 |
|
1016 | if (children === null) {
|
1017 | invokeCallback = true;
|
1018 | } else {
|
1019 | switch (type) {
|
1020 | case 'string':
|
1021 | case 'number':
|
1022 | invokeCallback = true;
|
1023 | break;
|
1024 |
|
1025 | case 'object':
|
1026 | switch (children.$$typeof) {
|
1027 | case REACT_ELEMENT_TYPE:
|
1028 | case REACT_PORTAL_TYPE:
|
1029 | invokeCallback = true;
|
1030 | }
|
1031 |
|
1032 | }
|
1033 | }
|
1034 |
|
1035 | if (invokeCallback) {
|
1036 | var _child = children;
|
1037 | var mappedChild = callback(_child);
|
1038 |
|
1039 |
|
1040 | var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
1041 |
|
1042 | if (isArray(mappedChild)) {
|
1043 | var escapedChildKey = '';
|
1044 |
|
1045 | if (childKey != null) {
|
1046 | escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
1047 | }
|
1048 |
|
1049 | mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
1050 | return c;
|
1051 | });
|
1052 | } else if (mappedChild != null) {
|
1053 | if (isValidElement(mappedChild)) {
|
1054 | {
|
1055 |
|
1056 |
|
1057 |
|
1058 | if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
1059 | checkKeyStringCoercion(mappedChild.key);
|
1060 | }
|
1061 | }
|
1062 |
|
1063 | mappedChild = cloneAndReplaceKey(mappedChild,
|
1064 |
|
1065 | escapedPrefix + (
|
1066 | mappedChild.key && (!_child || _child.key !== mappedChild.key) ?
|
1067 |
|
1068 | escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
1069 | }
|
1070 |
|
1071 | array.push(mappedChild);
|
1072 | }
|
1073 |
|
1074 | return 1;
|
1075 | }
|
1076 |
|
1077 | var child;
|
1078 | var nextName;
|
1079 | var subtreeCount = 0;
|
1080 |
|
1081 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1082 |
|
1083 | if (isArray(children)) {
|
1084 | for (var i = 0; i < children.length; i++) {
|
1085 | child = children[i];
|
1086 | nextName = nextNamePrefix + getElementKey(child, i);
|
1087 | subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1088 | }
|
1089 | } else {
|
1090 | var iteratorFn = getIteratorFn(children);
|
1091 |
|
1092 | if (typeof iteratorFn === 'function') {
|
1093 | var iterableChildren = children;
|
1094 |
|
1095 | {
|
1096 |
|
1097 | if (iteratorFn === iterableChildren.entries) {
|
1098 | if (!didWarnAboutMaps) {
|
1099 | warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
1100 | }
|
1101 |
|
1102 | didWarnAboutMaps = true;
|
1103 | }
|
1104 | }
|
1105 |
|
1106 | var iterator = iteratorFn.call(iterableChildren);
|
1107 | var step;
|
1108 | var ii = 0;
|
1109 |
|
1110 | while (!(step = iterator.next()).done) {
|
1111 | child = step.value;
|
1112 | nextName = nextNamePrefix + getElementKey(child, ii++);
|
1113 | subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1114 | }
|
1115 | } else if (type === 'object') {
|
1116 |
|
1117 | var childrenString = String(children);
|
1118 | throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
|
1119 | }
|
1120 | }
|
1121 |
|
1122 | return subtreeCount;
|
1123 | }
|
1124 |
|
1125 | |
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 | function mapChildren(children, func, context) {
|
1139 | if (children == null) {
|
1140 | return children;
|
1141 | }
|
1142 |
|
1143 | var result = [];
|
1144 | var count = 0;
|
1145 | mapIntoArray(children, result, '', '', function (child) {
|
1146 | return func.call(context, child, count++);
|
1147 | });
|
1148 | return result;
|
1149 | }
|
1150 | |
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 | function countChildren(children) {
|
1162 | var n = 0;
|
1163 | mapChildren(children, function () {
|
1164 | n++;
|
1165 | });
|
1166 | return n;
|
1167 | }
|
1168 |
|
1169 | |
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 | function forEachChildren(children, forEachFunc, forEachContext) {
|
1182 | mapChildren(children, function () {
|
1183 | forEachFunc.apply(this, arguments);
|
1184 | }, forEachContext);
|
1185 | }
|
1186 | |
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 | function toArray(children) {
|
1195 | return mapChildren(children, function (child) {
|
1196 | return child;
|
1197 | }) || [];
|
1198 | }
|
1199 | |
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 | function onlyChild(children) {
|
1216 | if (!isValidElement(children)) {
|
1217 | throw new Error('React.Children.only expected to receive a single React element child.');
|
1218 | }
|
1219 |
|
1220 | return children;
|
1221 | }
|
1222 |
|
1223 | function createContext(defaultValue) {
|
1224 |
|
1225 |
|
1226 | var context = {
|
1227 | $$typeof: REACT_CONTEXT_TYPE,
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 | _currentValue: defaultValue,
|
1234 | _currentValue2: defaultValue,
|
1235 |
|
1236 |
|
1237 | _threadCount: 0,
|
1238 |
|
1239 | Provider: null,
|
1240 | Consumer: null,
|
1241 |
|
1242 | _defaultValue: null,
|
1243 | _globalName: null
|
1244 | };
|
1245 | context.Provider = {
|
1246 | $$typeof: REACT_PROVIDER_TYPE,
|
1247 | _context: context
|
1248 | };
|
1249 | var hasWarnedAboutUsingNestedContextConsumers = false;
|
1250 | var hasWarnedAboutUsingConsumerProvider = false;
|
1251 | var hasWarnedAboutDisplayNameOnConsumer = false;
|
1252 |
|
1253 | {
|
1254 |
|
1255 |
|
1256 |
|
1257 | var Consumer = {
|
1258 | $$typeof: REACT_CONTEXT_TYPE,
|
1259 | _context: context
|
1260 | };
|
1261 |
|
1262 | Object.defineProperties(Consumer, {
|
1263 | Provider: {
|
1264 | get: function () {
|
1265 | if (!hasWarnedAboutUsingConsumerProvider) {
|
1266 | hasWarnedAboutUsingConsumerProvider = true;
|
1267 |
|
1268 | error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
1269 | }
|
1270 |
|
1271 | return context.Provider;
|
1272 | },
|
1273 | set: function (_Provider) {
|
1274 | context.Provider = _Provider;
|
1275 | }
|
1276 | },
|
1277 | _currentValue: {
|
1278 | get: function () {
|
1279 | return context._currentValue;
|
1280 | },
|
1281 | set: function (_currentValue) {
|
1282 | context._currentValue = _currentValue;
|
1283 | }
|
1284 | },
|
1285 | _currentValue2: {
|
1286 | get: function () {
|
1287 | return context._currentValue2;
|
1288 | },
|
1289 | set: function (_currentValue2) {
|
1290 | context._currentValue2 = _currentValue2;
|
1291 | }
|
1292 | },
|
1293 | _threadCount: {
|
1294 | get: function () {
|
1295 | return context._threadCount;
|
1296 | },
|
1297 | set: function (_threadCount) {
|
1298 | context._threadCount = _threadCount;
|
1299 | }
|
1300 | },
|
1301 | Consumer: {
|
1302 | get: function () {
|
1303 | if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1304 | hasWarnedAboutUsingNestedContextConsumers = true;
|
1305 |
|
1306 | error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
1307 | }
|
1308 |
|
1309 | return context.Consumer;
|
1310 | }
|
1311 | },
|
1312 | displayName: {
|
1313 | get: function () {
|
1314 | return context.displayName;
|
1315 | },
|
1316 | set: function (displayName) {
|
1317 | if (!hasWarnedAboutDisplayNameOnConsumer) {
|
1318 | warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
1319 |
|
1320 | hasWarnedAboutDisplayNameOnConsumer = true;
|
1321 | }
|
1322 | }
|
1323 | }
|
1324 | });
|
1325 |
|
1326 | context.Consumer = Consumer;
|
1327 | }
|
1328 |
|
1329 | {
|
1330 | context._currentRenderer = null;
|
1331 | context._currentRenderer2 = null;
|
1332 | }
|
1333 |
|
1334 | return context;
|
1335 | }
|
1336 |
|
1337 | var Uninitialized = -1;
|
1338 | var Pending = 0;
|
1339 | var Resolved = 1;
|
1340 | var Rejected = 2;
|
1341 |
|
1342 | function lazyInitializer(payload) {
|
1343 | if (payload._status === Uninitialized) {
|
1344 | var ctor = payload._result;
|
1345 | var thenable = ctor();
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 | thenable.then(function (moduleObject) {
|
1352 | if (payload._status === Pending || payload._status === Uninitialized) {
|
1353 |
|
1354 | var resolved = payload;
|
1355 | resolved._status = Resolved;
|
1356 | resolved._result = moduleObject;
|
1357 | }
|
1358 | }, function (error) {
|
1359 | if (payload._status === Pending || payload._status === Uninitialized) {
|
1360 |
|
1361 | var rejected = payload;
|
1362 | rejected._status = Rejected;
|
1363 | rejected._result = error;
|
1364 | }
|
1365 | });
|
1366 |
|
1367 | if (payload._status === Uninitialized) {
|
1368 |
|
1369 |
|
1370 | var pending = payload;
|
1371 | pending._status = Pending;
|
1372 | pending._result = thenable;
|
1373 | }
|
1374 | }
|
1375 |
|
1376 | if (payload._status === Resolved) {
|
1377 | var moduleObject = payload._result;
|
1378 |
|
1379 | {
|
1380 | if (moduleObject === undefined) {
|
1381 | error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' +
|
1382 | 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
1383 | }
|
1384 | }
|
1385 |
|
1386 | {
|
1387 | if (!('default' in moduleObject)) {
|
1388 | error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' +
|
1389 | 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
1390 | }
|
1391 | }
|
1392 |
|
1393 | return moduleObject.default;
|
1394 | } else {
|
1395 | throw payload._result;
|
1396 | }
|
1397 | }
|
1398 |
|
1399 | function lazy(ctor) {
|
1400 | var payload = {
|
1401 |
|
1402 | _status: Uninitialized,
|
1403 | _result: ctor
|
1404 | };
|
1405 | var lazyType = {
|
1406 | $$typeof: REACT_LAZY_TYPE,
|
1407 | _payload: payload,
|
1408 | _init: lazyInitializer
|
1409 | };
|
1410 |
|
1411 | {
|
1412 |
|
1413 | var defaultProps;
|
1414 | var propTypes;
|
1415 |
|
1416 | Object.defineProperties(lazyType, {
|
1417 | defaultProps: {
|
1418 | configurable: true,
|
1419 | get: function () {
|
1420 | return defaultProps;
|
1421 | },
|
1422 | set: function (newDefaultProps) {
|
1423 | error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1424 |
|
1425 | defaultProps = newDefaultProps;
|
1426 |
|
1427 |
|
1428 | Object.defineProperty(lazyType, 'defaultProps', {
|
1429 | enumerable: true
|
1430 | });
|
1431 | }
|
1432 | },
|
1433 | propTypes: {
|
1434 | configurable: true,
|
1435 | get: function () {
|
1436 | return propTypes;
|
1437 | },
|
1438 | set: function (newPropTypes) {
|
1439 | error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1440 |
|
1441 | propTypes = newPropTypes;
|
1442 |
|
1443 |
|
1444 | Object.defineProperty(lazyType, 'propTypes', {
|
1445 | enumerable: true
|
1446 | });
|
1447 | }
|
1448 | }
|
1449 | });
|
1450 | }
|
1451 |
|
1452 | return lazyType;
|
1453 | }
|
1454 |
|
1455 | function forwardRef(render) {
|
1456 | {
|
1457 | if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1458 | error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
1459 | } else if (typeof render !== 'function') {
|
1460 | error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
1461 | } else {
|
1462 | if (render.length !== 0 && render.length !== 2) {
|
1463 | error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
1464 | }
|
1465 | }
|
1466 |
|
1467 | if (render != null) {
|
1468 | if (render.defaultProps != null || render.propTypes != null) {
|
1469 | error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
1470 | }
|
1471 | }
|
1472 | }
|
1473 |
|
1474 | var elementType = {
|
1475 | $$typeof: REACT_FORWARD_REF_TYPE,
|
1476 | render: render
|
1477 | };
|
1478 |
|
1479 | {
|
1480 | var ownName;
|
1481 | Object.defineProperty(elementType, 'displayName', {
|
1482 | enumerable: false,
|
1483 | configurable: true,
|
1484 | get: function () {
|
1485 | return ownName;
|
1486 | },
|
1487 | set: function (name) {
|
1488 | ownName = name;
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 | if (!render.name && !render.displayName) {
|
1497 | render.displayName = name;
|
1498 | }
|
1499 | }
|
1500 | });
|
1501 | }
|
1502 |
|
1503 | return elementType;
|
1504 | }
|
1505 |
|
1506 | var REACT_MODULE_REFERENCE;
|
1507 |
|
1508 | {
|
1509 | REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
1510 | }
|
1511 |
|
1512 | function isValidElementType(type) {
|
1513 | if (typeof type === 'string' || typeof type === 'function') {
|
1514 | return true;
|
1515 | }
|
1516 |
|
1517 |
|
1518 | if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
1519 | return true;
|
1520 | }
|
1521 |
|
1522 | if (typeof type === 'object' && type !== null) {
|
1523 | if (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 ||
|
1524 |
|
1525 |
|
1526 |
|
1527 | type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
1528 | return true;
|
1529 | }
|
1530 | }
|
1531 |
|
1532 | return false;
|
1533 | }
|
1534 |
|
1535 | function memo(type, compare) {
|
1536 | {
|
1537 | if (!isValidElementType(type)) {
|
1538 | error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
1539 | }
|
1540 | }
|
1541 |
|
1542 | var elementType = {
|
1543 | $$typeof: REACT_MEMO_TYPE,
|
1544 | type: type,
|
1545 | compare: compare === undefined ? null : compare
|
1546 | };
|
1547 |
|
1548 | {
|
1549 | var ownName;
|
1550 | Object.defineProperty(elementType, 'displayName', {
|
1551 | enumerable: false,
|
1552 | configurable: true,
|
1553 | get: function () {
|
1554 | return ownName;
|
1555 | },
|
1556 | set: function (name) {
|
1557 | ownName = name;
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 | if (!type.name && !type.displayName) {
|
1566 | type.displayName = name;
|
1567 | }
|
1568 | }
|
1569 | });
|
1570 | }
|
1571 |
|
1572 | return elementType;
|
1573 | }
|
1574 |
|
1575 | function resolveDispatcher() {
|
1576 | var dispatcher = ReactCurrentDispatcher.current;
|
1577 |
|
1578 | {
|
1579 | if (dispatcher === null) {
|
1580 | error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
1581 | }
|
1582 | }
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 | return dispatcher;
|
1588 | }
|
1589 | function useContext(Context) {
|
1590 | var dispatcher = resolveDispatcher();
|
1591 |
|
1592 | {
|
1593 |
|
1594 | if (Context._context !== undefined) {
|
1595 | var realContext = Context._context;
|
1596 |
|
1597 |
|
1598 | if (realContext.Consumer === Context) {
|
1599 | error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
1600 | } else if (realContext.Provider === Context) {
|
1601 | error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
1602 | }
|
1603 | }
|
1604 | }
|
1605 |
|
1606 | return dispatcher.useContext(Context);
|
1607 | }
|
1608 | function useState(initialState) {
|
1609 | var dispatcher = resolveDispatcher();
|
1610 | return dispatcher.useState(initialState);
|
1611 | }
|
1612 | function useReducer(reducer, initialArg, init) {
|
1613 | var dispatcher = resolveDispatcher();
|
1614 | return dispatcher.useReducer(reducer, initialArg, init);
|
1615 | }
|
1616 | function useRef(initialValue) {
|
1617 | var dispatcher = resolveDispatcher();
|
1618 | return dispatcher.useRef(initialValue);
|
1619 | }
|
1620 | function useEffect(create, deps) {
|
1621 | var dispatcher = resolveDispatcher();
|
1622 | return dispatcher.useEffect(create, deps);
|
1623 | }
|
1624 | function useInsertionEffect(create, deps) {
|
1625 | var dispatcher = resolveDispatcher();
|
1626 | return dispatcher.useInsertionEffect(create, deps);
|
1627 | }
|
1628 | function useLayoutEffect(create, deps) {
|
1629 | var dispatcher = resolveDispatcher();
|
1630 | return dispatcher.useLayoutEffect(create, deps);
|
1631 | }
|
1632 | function useCallback(callback, deps) {
|
1633 | var dispatcher = resolveDispatcher();
|
1634 | return dispatcher.useCallback(callback, deps);
|
1635 | }
|
1636 | function useMemo(create, deps) {
|
1637 | var dispatcher = resolveDispatcher();
|
1638 | return dispatcher.useMemo(create, deps);
|
1639 | }
|
1640 | function useImperativeHandle(ref, create, deps) {
|
1641 | var dispatcher = resolveDispatcher();
|
1642 | return dispatcher.useImperativeHandle(ref, create, deps);
|
1643 | }
|
1644 | function useDebugValue(value, formatterFn) {
|
1645 | {
|
1646 | var dispatcher = resolveDispatcher();
|
1647 | return dispatcher.useDebugValue(value, formatterFn);
|
1648 | }
|
1649 | }
|
1650 | function useTransition() {
|
1651 | var dispatcher = resolveDispatcher();
|
1652 | return dispatcher.useTransition();
|
1653 | }
|
1654 | function useDeferredValue(value) {
|
1655 | var dispatcher = resolveDispatcher();
|
1656 | return dispatcher.useDeferredValue(value);
|
1657 | }
|
1658 | function useId() {
|
1659 | var dispatcher = resolveDispatcher();
|
1660 | return dispatcher.useId();
|
1661 | }
|
1662 | function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
1663 | var dispatcher = resolveDispatcher();
|
1664 | return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
1665 | }
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 |
|
1671 | var disabledDepth = 0;
|
1672 | var prevLog;
|
1673 | var prevInfo;
|
1674 | var prevWarn;
|
1675 | var prevError;
|
1676 | var prevGroup;
|
1677 | var prevGroupCollapsed;
|
1678 | var prevGroupEnd;
|
1679 |
|
1680 | function disabledLog() {}
|
1681 |
|
1682 | disabledLog.__reactDisabledLog = true;
|
1683 | function disableLogs() {
|
1684 | {
|
1685 | if (disabledDepth === 0) {
|
1686 |
|
1687 | prevLog = console.log;
|
1688 | prevInfo = console.info;
|
1689 | prevWarn = console.warn;
|
1690 | prevError = console.error;
|
1691 | prevGroup = console.group;
|
1692 | prevGroupCollapsed = console.groupCollapsed;
|
1693 | prevGroupEnd = console.groupEnd;
|
1694 |
|
1695 | var props = {
|
1696 | configurable: true,
|
1697 | enumerable: true,
|
1698 | value: disabledLog,
|
1699 | writable: true
|
1700 | };
|
1701 |
|
1702 | Object.defineProperties(console, {
|
1703 | info: props,
|
1704 | log: props,
|
1705 | warn: props,
|
1706 | error: props,
|
1707 | group: props,
|
1708 | groupCollapsed: props,
|
1709 | groupEnd: props
|
1710 | });
|
1711 |
|
1712 | }
|
1713 |
|
1714 | disabledDepth++;
|
1715 | }
|
1716 | }
|
1717 | function reenableLogs() {
|
1718 | {
|
1719 | disabledDepth--;
|
1720 |
|
1721 | if (disabledDepth === 0) {
|
1722 |
|
1723 | var props = {
|
1724 | configurable: true,
|
1725 | enumerable: true,
|
1726 | writable: true
|
1727 | };
|
1728 |
|
1729 | Object.defineProperties(console, {
|
1730 | log: assign({}, props, {
|
1731 | value: prevLog
|
1732 | }),
|
1733 | info: assign({}, props, {
|
1734 | value: prevInfo
|
1735 | }),
|
1736 | warn: assign({}, props, {
|
1737 | value: prevWarn
|
1738 | }),
|
1739 | error: assign({}, props, {
|
1740 | value: prevError
|
1741 | }),
|
1742 | group: assign({}, props, {
|
1743 | value: prevGroup
|
1744 | }),
|
1745 | groupCollapsed: assign({}, props, {
|
1746 | value: prevGroupCollapsed
|
1747 | }),
|
1748 | groupEnd: assign({}, props, {
|
1749 | value: prevGroupEnd
|
1750 | })
|
1751 | });
|
1752 |
|
1753 | }
|
1754 |
|
1755 | if (disabledDepth < 0) {
|
1756 | error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
1757 | }
|
1758 | }
|
1759 | }
|
1760 |
|
1761 | var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
1762 | var prefix;
|
1763 | function describeBuiltInComponentFrame(name, source, ownerFn) {
|
1764 | {
|
1765 | if (prefix === undefined) {
|
1766 |
|
1767 | try {
|
1768 | throw Error();
|
1769 | } catch (x) {
|
1770 | var match = x.stack.trim().match(/\n( *(at )?)/);
|
1771 | prefix = match && match[1] || '';
|
1772 | }
|
1773 | }
|
1774 |
|
1775 |
|
1776 | return '\n' + prefix + name;
|
1777 | }
|
1778 | }
|
1779 | var reentry = false;
|
1780 | var componentFrameCache;
|
1781 |
|
1782 | {
|
1783 | var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
1784 | componentFrameCache = new PossiblyWeakMap();
|
1785 | }
|
1786 |
|
1787 | function describeNativeComponentFrame(fn, construct) {
|
1788 |
|
1789 | if ( !fn || reentry) {
|
1790 | return '';
|
1791 | }
|
1792 |
|
1793 | {
|
1794 | var frame = componentFrameCache.get(fn);
|
1795 |
|
1796 | if (frame !== undefined) {
|
1797 | return frame;
|
1798 | }
|
1799 | }
|
1800 |
|
1801 | var control;
|
1802 | reentry = true;
|
1803 | var previousPrepareStackTrace = Error.prepareStackTrace;
|
1804 |
|
1805 | Error.prepareStackTrace = undefined;
|
1806 | var previousDispatcher;
|
1807 |
|
1808 | {
|
1809 | previousDispatcher = ReactCurrentDispatcher$1.current;
|
1810 |
|
1811 |
|
1812 | ReactCurrentDispatcher$1.current = null;
|
1813 | disableLogs();
|
1814 | }
|
1815 |
|
1816 | try {
|
1817 |
|
1818 | if (construct) {
|
1819 |
|
1820 | var Fake = function () {
|
1821 | throw Error();
|
1822 | };
|
1823 |
|
1824 |
|
1825 | Object.defineProperty(Fake.prototype, 'props', {
|
1826 | set: function () {
|
1827 |
|
1828 |
|
1829 | throw Error();
|
1830 | }
|
1831 | });
|
1832 |
|
1833 | if (typeof Reflect === 'object' && Reflect.construct) {
|
1834 |
|
1835 |
|
1836 | try {
|
1837 | Reflect.construct(Fake, []);
|
1838 | } catch (x) {
|
1839 | control = x;
|
1840 | }
|
1841 |
|
1842 | Reflect.construct(fn, [], Fake);
|
1843 | } else {
|
1844 | try {
|
1845 | Fake.call();
|
1846 | } catch (x) {
|
1847 | control = x;
|
1848 | }
|
1849 |
|
1850 | fn.call(Fake.prototype);
|
1851 | }
|
1852 | } else {
|
1853 | try {
|
1854 | throw Error();
|
1855 | } catch (x) {
|
1856 | control = x;
|
1857 | }
|
1858 |
|
1859 | fn();
|
1860 | }
|
1861 | } catch (sample) {
|
1862 |
|
1863 | if (sample && control && typeof sample.stack === 'string') {
|
1864 |
|
1865 |
|
1866 | var sampleLines = sample.stack.split('\n');
|
1867 | var controlLines = control.stack.split('\n');
|
1868 | var s = sampleLines.length - 1;
|
1869 | var c = controlLines.length - 1;
|
1870 |
|
1871 | while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 | c--;
|
1879 | }
|
1880 |
|
1881 | for (; s >= 1 && c >= 0; s--, c--) {
|
1882 |
|
1883 |
|
1884 | if (sampleLines[s] !== controlLines[c]) {
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 | if (s !== 1 || c !== 1) {
|
1891 | do {
|
1892 | s--;
|
1893 | c--;
|
1894 |
|
1895 |
|
1896 | if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
1897 |
|
1898 | var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 | if (fn.displayName && _frame.includes('<anonymous>')) {
|
1904 | _frame = _frame.replace('<anonymous>', fn.displayName);
|
1905 | }
|
1906 |
|
1907 | {
|
1908 | if (typeof fn === 'function') {
|
1909 | componentFrameCache.set(fn, _frame);
|
1910 | }
|
1911 | }
|
1912 |
|
1913 |
|
1914 | return _frame;
|
1915 | }
|
1916 | } while (s >= 1 && c >= 0);
|
1917 | }
|
1918 |
|
1919 | break;
|
1920 | }
|
1921 | }
|
1922 | }
|
1923 | } finally {
|
1924 | reentry = false;
|
1925 |
|
1926 | {
|
1927 | ReactCurrentDispatcher$1.current = previousDispatcher;
|
1928 | reenableLogs();
|
1929 | }
|
1930 |
|
1931 | Error.prepareStackTrace = previousPrepareStackTrace;
|
1932 | }
|
1933 |
|
1934 |
|
1935 | var name = fn ? fn.displayName || fn.name : '';
|
1936 | var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
1937 |
|
1938 | {
|
1939 | if (typeof fn === 'function') {
|
1940 | componentFrameCache.set(fn, syntheticFrame);
|
1941 | }
|
1942 | }
|
1943 |
|
1944 | return syntheticFrame;
|
1945 | }
|
1946 | function describeFunctionComponentFrame(fn, source, ownerFn) {
|
1947 | {
|
1948 | return describeNativeComponentFrame(fn, false);
|
1949 | }
|
1950 | }
|
1951 |
|
1952 | function shouldConstruct(Component) {
|
1953 | var prototype = Component.prototype;
|
1954 | return !!(prototype && prototype.isReactComponent);
|
1955 | }
|
1956 |
|
1957 | function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
1958 |
|
1959 | if (type == null) {
|
1960 | return '';
|
1961 | }
|
1962 |
|
1963 | if (typeof type === 'function') {
|
1964 | {
|
1965 | return describeNativeComponentFrame(type, shouldConstruct(type));
|
1966 | }
|
1967 | }
|
1968 |
|
1969 | if (typeof type === 'string') {
|
1970 | return describeBuiltInComponentFrame(type);
|
1971 | }
|
1972 |
|
1973 | switch (type) {
|
1974 | case REACT_SUSPENSE_TYPE:
|
1975 | return describeBuiltInComponentFrame('Suspense');
|
1976 |
|
1977 | case REACT_SUSPENSE_LIST_TYPE:
|
1978 | return describeBuiltInComponentFrame('SuspenseList');
|
1979 | }
|
1980 |
|
1981 | if (typeof type === 'object') {
|
1982 | switch (type.$$typeof) {
|
1983 | case REACT_FORWARD_REF_TYPE:
|
1984 | return describeFunctionComponentFrame(type.render);
|
1985 |
|
1986 | case REACT_MEMO_TYPE:
|
1987 |
|
1988 | return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
1989 |
|
1990 | case REACT_LAZY_TYPE:
|
1991 | {
|
1992 | var lazyComponent = type;
|
1993 | var payload = lazyComponent._payload;
|
1994 | var init = lazyComponent._init;
|
1995 |
|
1996 | try {
|
1997 |
|
1998 | return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
1999 | } catch (x) {}
|
2000 | }
|
2001 | }
|
2002 | }
|
2003 |
|
2004 | return '';
|
2005 | }
|
2006 |
|
2007 | var loggedTypeFailures = {};
|
2008 | var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2009 |
|
2010 | function setCurrentlyValidatingElement(element) {
|
2011 | {
|
2012 | if (element) {
|
2013 | var owner = element._owner;
|
2014 | var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2015 | ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
2016 | } else {
|
2017 | ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
2018 | }
|
2019 | }
|
2020 | }
|
2021 |
|
2022 | function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
2023 | {
|
2024 |
|
2025 | var has = Function.call.bind(hasOwnProperty);
|
2026 |
|
2027 | for (var typeSpecName in typeSpecs) {
|
2028 | if (has(typeSpecs, typeSpecName)) {
|
2029 | var error$1 = void 0;
|
2030 |
|
2031 |
|
2032 |
|
2033 | try {
|
2034 |
|
2035 |
|
2036 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2037 |
|
2038 | var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
2039 | err.name = 'Invariant Violation';
|
2040 | throw err;
|
2041 | }
|
2042 |
|
2043 | error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
2044 | } catch (ex) {
|
2045 | error$1 = ex;
|
2046 | }
|
2047 |
|
2048 | if (error$1 && !(error$1 instanceof Error)) {
|
2049 | setCurrentlyValidatingElement(element);
|
2050 |
|
2051 | 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$1);
|
2052 |
|
2053 | setCurrentlyValidatingElement(null);
|
2054 | }
|
2055 |
|
2056 | if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
2057 |
|
2058 |
|
2059 | loggedTypeFailures[error$1.message] = true;
|
2060 | setCurrentlyValidatingElement(element);
|
2061 |
|
2062 | error('Failed %s type: %s', location, error$1.message);
|
2063 |
|
2064 | setCurrentlyValidatingElement(null);
|
2065 | }
|
2066 | }
|
2067 | }
|
2068 | }
|
2069 | }
|
2070 |
|
2071 | function setCurrentlyValidatingElement$1(element) {
|
2072 | {
|
2073 | if (element) {
|
2074 | var owner = element._owner;
|
2075 | var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2076 | setExtraStackFrame(stack);
|
2077 | } else {
|
2078 | setExtraStackFrame(null);
|
2079 | }
|
2080 | }
|
2081 | }
|
2082 |
|
2083 | var propTypesMisspellWarningShown;
|
2084 |
|
2085 | {
|
2086 | propTypesMisspellWarningShown = false;
|
2087 | }
|
2088 |
|
2089 | function getDeclarationErrorAddendum() {
|
2090 | if (ReactCurrentOwner.current) {
|
2091 | var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
2092 |
|
2093 | if (name) {
|
2094 | return '\n\nCheck the render method of `' + name + '`.';
|
2095 | }
|
2096 | }
|
2097 |
|
2098 | return '';
|
2099 | }
|
2100 |
|
2101 | function getSourceInfoErrorAddendum(source) {
|
2102 | if (source !== undefined) {
|
2103 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
2104 | var lineNumber = source.lineNumber;
|
2105 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
2106 | }
|
2107 |
|
2108 | return '';
|
2109 | }
|
2110 |
|
2111 | function getSourceInfoErrorAddendumForProps(elementProps) {
|
2112 | if (elementProps !== null && elementProps !== undefined) {
|
2113 | return getSourceInfoErrorAddendum(elementProps.__source);
|
2114 | }
|
2115 |
|
2116 | return '';
|
2117 | }
|
2118 | |
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 | var ownerHasKeyUseWarning = {};
|
2126 |
|
2127 | function getCurrentComponentErrorInfo(parentType) {
|
2128 | var info = getDeclarationErrorAddendum();
|
2129 |
|
2130 | if (!info) {
|
2131 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2132 |
|
2133 | if (parentName) {
|
2134 | info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
2135 | }
|
2136 | }
|
2137 |
|
2138 | return info;
|
2139 | }
|
2140 | |
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 | function validateExplicitKey(element, parentType) {
|
2154 | if (!element._store || element._store.validated || element.key != null) {
|
2155 | return;
|
2156 | }
|
2157 |
|
2158 | element._store.validated = true;
|
2159 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2160 |
|
2161 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2162 | return;
|
2163 | }
|
2164 |
|
2165 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
2166 |
|
2167 |
|
2168 |
|
2169 | var childOwner = '';
|
2170 |
|
2171 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2172 |
|
2173 | childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
2174 | }
|
2175 |
|
2176 | {
|
2177 | setCurrentlyValidatingElement$1(element);
|
2178 |
|
2179 | error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
2180 |
|
2181 | setCurrentlyValidatingElement$1(null);
|
2182 | }
|
2183 | }
|
2184 | |
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 | function validateChildKeys(node, parentType) {
|
2196 | if (typeof node !== 'object') {
|
2197 | return;
|
2198 | }
|
2199 |
|
2200 | if (isArray(node)) {
|
2201 | for (var i = 0; i < node.length; i++) {
|
2202 | var child = node[i];
|
2203 |
|
2204 | if (isValidElement(child)) {
|
2205 | validateExplicitKey(child, parentType);
|
2206 | }
|
2207 | }
|
2208 | } else if (isValidElement(node)) {
|
2209 |
|
2210 | if (node._store) {
|
2211 | node._store.validated = true;
|
2212 | }
|
2213 | } else if (node) {
|
2214 | var iteratorFn = getIteratorFn(node);
|
2215 |
|
2216 | if (typeof iteratorFn === 'function') {
|
2217 |
|
2218 |
|
2219 | if (iteratorFn !== node.entries) {
|
2220 | var iterator = iteratorFn.call(node);
|
2221 | var step;
|
2222 |
|
2223 | while (!(step = iterator.next()).done) {
|
2224 | if (isValidElement(step.value)) {
|
2225 | validateExplicitKey(step.value, parentType);
|
2226 | }
|
2227 | }
|
2228 | }
|
2229 | }
|
2230 | }
|
2231 | }
|
2232 | |
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 | function validatePropTypes(element) {
|
2241 | {
|
2242 | var type = element.type;
|
2243 |
|
2244 | if (type === null || type === undefined || typeof type === 'string') {
|
2245 | return;
|
2246 | }
|
2247 |
|
2248 | var propTypes;
|
2249 |
|
2250 | if (typeof type === 'function') {
|
2251 | propTypes = type.propTypes;
|
2252 | } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
2253 |
|
2254 | type.$$typeof === REACT_MEMO_TYPE)) {
|
2255 | propTypes = type.propTypes;
|
2256 | } else {
|
2257 | return;
|
2258 | }
|
2259 |
|
2260 | if (propTypes) {
|
2261 |
|
2262 | var name = getComponentNameFromType(type);
|
2263 | checkPropTypes(propTypes, element.props, 'prop', name, element);
|
2264 | } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
2265 | propTypesMisspellWarningShown = true;
|
2266 |
|
2267 | var _name = getComponentNameFromType(type);
|
2268 |
|
2269 | error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
2270 | }
|
2271 |
|
2272 | if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
2273 | error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
2274 | }
|
2275 | }
|
2276 | }
|
2277 | |
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 | function validateFragmentProps(fragment) {
|
2284 | {
|
2285 | var keys = Object.keys(fragment.props);
|
2286 |
|
2287 | for (var i = 0; i < keys.length; i++) {
|
2288 | var key = keys[i];
|
2289 |
|
2290 | if (key !== 'children' && key !== 'key') {
|
2291 | setCurrentlyValidatingElement$1(fragment);
|
2292 |
|
2293 | error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2294 |
|
2295 | setCurrentlyValidatingElement$1(null);
|
2296 | break;
|
2297 | }
|
2298 | }
|
2299 |
|
2300 | if (fragment.ref !== null) {
|
2301 | setCurrentlyValidatingElement$1(fragment);
|
2302 |
|
2303 | error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
2304 |
|
2305 | setCurrentlyValidatingElement$1(null);
|
2306 | }
|
2307 | }
|
2308 | }
|
2309 | function createElementWithValidation(type, props, children) {
|
2310 | var validType = isValidElementType(type);
|
2311 |
|
2312 |
|
2313 | if (!validType) {
|
2314 | var info = '';
|
2315 |
|
2316 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2317 | 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.";
|
2318 | }
|
2319 |
|
2320 | var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
2321 |
|
2322 | if (sourceInfo) {
|
2323 | info += sourceInfo;
|
2324 | } else {
|
2325 | info += getDeclarationErrorAddendum();
|
2326 | }
|
2327 |
|
2328 | var typeString;
|
2329 |
|
2330 | if (type === null) {
|
2331 | typeString = 'null';
|
2332 | } else if (isArray(type)) {
|
2333 | typeString = 'array';
|
2334 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2335 | typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
2336 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
2337 | } else {
|
2338 | typeString = typeof type;
|
2339 | }
|
2340 |
|
2341 | {
|
2342 | error('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);
|
2343 | }
|
2344 | }
|
2345 |
|
2346 | var element = createElement.apply(this, arguments);
|
2347 |
|
2348 |
|
2349 | if (element == null) {
|
2350 | return element;
|
2351 | }
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 | if (validType) {
|
2359 | for (var i = 2; i < arguments.length; i++) {
|
2360 | validateChildKeys(arguments[i], type);
|
2361 | }
|
2362 | }
|
2363 |
|
2364 | if (type === REACT_FRAGMENT_TYPE) {
|
2365 | validateFragmentProps(element);
|
2366 | } else {
|
2367 | validatePropTypes(element);
|
2368 | }
|
2369 |
|
2370 | return element;
|
2371 | }
|
2372 | var didWarnAboutDeprecatedCreateFactory = false;
|
2373 | function createFactoryWithValidation(type) {
|
2374 | var validatedFactory = createElementWithValidation.bind(null, type);
|
2375 | validatedFactory.type = type;
|
2376 |
|
2377 | {
|
2378 | if (!didWarnAboutDeprecatedCreateFactory) {
|
2379 | didWarnAboutDeprecatedCreateFactory = true;
|
2380 |
|
2381 | warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
2382 | }
|
2383 |
|
2384 |
|
2385 | Object.defineProperty(validatedFactory, 'type', {
|
2386 | enumerable: false,
|
2387 | get: function () {
|
2388 | warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
2389 |
|
2390 | Object.defineProperty(this, 'type', {
|
2391 | value: type
|
2392 | });
|
2393 | return type;
|
2394 | }
|
2395 | });
|
2396 | }
|
2397 |
|
2398 | return validatedFactory;
|
2399 | }
|
2400 | function cloneElementWithValidation(element, props, children) {
|
2401 | var newElement = cloneElement.apply(this, arguments);
|
2402 |
|
2403 | for (var i = 2; i < arguments.length; i++) {
|
2404 | validateChildKeys(arguments[i], newElement.type);
|
2405 | }
|
2406 |
|
2407 | validatePropTypes(newElement);
|
2408 | return newElement;
|
2409 | }
|
2410 |
|
2411 | var enableSchedulerDebugging = false;
|
2412 | var enableProfiling = false;
|
2413 | var frameYieldMs = 5;
|
2414 |
|
2415 | function push(heap, node) {
|
2416 | var index = heap.length;
|
2417 | heap.push(node);
|
2418 | siftUp(heap, node, index);
|
2419 | }
|
2420 | function peek(heap) {
|
2421 | return heap.length === 0 ? null : heap[0];
|
2422 | }
|
2423 | function pop(heap) {
|
2424 | if (heap.length === 0) {
|
2425 | return null;
|
2426 | }
|
2427 |
|
2428 | var first = heap[0];
|
2429 | var last = heap.pop();
|
2430 |
|
2431 | if (last !== first) {
|
2432 | heap[0] = last;
|
2433 | siftDown(heap, last, 0);
|
2434 | }
|
2435 |
|
2436 | return first;
|
2437 | }
|
2438 |
|
2439 | function siftUp(heap, node, i) {
|
2440 | var index = i;
|
2441 |
|
2442 | while (index > 0) {
|
2443 | var parentIndex = index - 1 >>> 1;
|
2444 | var parent = heap[parentIndex];
|
2445 |
|
2446 | if (compare(parent, node) > 0) {
|
2447 |
|
2448 | heap[parentIndex] = node;
|
2449 | heap[index] = parent;
|
2450 | index = parentIndex;
|
2451 | } else {
|
2452 |
|
2453 | return;
|
2454 | }
|
2455 | }
|
2456 | }
|
2457 |
|
2458 | function siftDown(heap, node, i) {
|
2459 | var index = i;
|
2460 | var length = heap.length;
|
2461 | var halfLength = length >>> 1;
|
2462 |
|
2463 | while (index < halfLength) {
|
2464 | var leftIndex = (index + 1) * 2 - 1;
|
2465 | var left = heap[leftIndex];
|
2466 | var rightIndex = leftIndex + 1;
|
2467 | var right = heap[rightIndex];
|
2468 |
|
2469 | if (compare(left, node) < 0) {
|
2470 | if (rightIndex < length && compare(right, left) < 0) {
|
2471 | heap[index] = right;
|
2472 | heap[rightIndex] = node;
|
2473 | index = rightIndex;
|
2474 | } else {
|
2475 | heap[index] = left;
|
2476 | heap[leftIndex] = node;
|
2477 | index = leftIndex;
|
2478 | }
|
2479 | } else if (rightIndex < length && compare(right, node) < 0) {
|
2480 | heap[index] = right;
|
2481 | heap[rightIndex] = node;
|
2482 | index = rightIndex;
|
2483 | } else {
|
2484 |
|
2485 | return;
|
2486 | }
|
2487 | }
|
2488 | }
|
2489 |
|
2490 | function compare(a, b) {
|
2491 |
|
2492 | var diff = a.sortIndex - b.sortIndex;
|
2493 | return diff !== 0 ? diff : a.id - b.id;
|
2494 | }
|
2495 |
|
2496 |
|
2497 | var ImmediatePriority = 1;
|
2498 | var UserBlockingPriority = 2;
|
2499 | var NormalPriority = 3;
|
2500 | var LowPriority = 4;
|
2501 | var IdlePriority = 5;
|
2502 |
|
2503 | function markTaskErrored(task, ms) {
|
2504 | }
|
2505 |
|
2506 |
|
2507 | var getCurrentTime;
|
2508 | var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
2509 |
|
2510 | if (hasPerformanceNow) {
|
2511 | var localPerformance = performance;
|
2512 |
|
2513 | getCurrentTime = function () {
|
2514 | return localPerformance.now();
|
2515 | };
|
2516 | } else {
|
2517 | var localDate = Date;
|
2518 | var initialTime = localDate.now();
|
2519 |
|
2520 | getCurrentTime = function () {
|
2521 | return localDate.now() - initialTime;
|
2522 | };
|
2523 | }
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 | var maxSigned31BitInt = 1073741823;
|
2529 |
|
2530 | var IMMEDIATE_PRIORITY_TIMEOUT = -1;
|
2531 |
|
2532 | var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
|
2533 | var NORMAL_PRIORITY_TIMEOUT = 5000;
|
2534 | var LOW_PRIORITY_TIMEOUT = 10000;
|
2535 |
|
2536 | var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt;
|
2537 |
|
2538 | var taskQueue = [];
|
2539 | var timerQueue = [];
|
2540 |
|
2541 | var taskIdCounter = 1;
|
2542 | var currentTask = null;
|
2543 | var currentPriorityLevel = NormalPriority;
|
2544 |
|
2545 | var isPerformingWork = false;
|
2546 | var isHostCallbackScheduled = false;
|
2547 | var isHostTimeoutScheduled = false;
|
2548 |
|
2549 | var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;
|
2550 | var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null;
|
2551 | var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null;
|
2552 |
|
2553 | var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
|
2554 |
|
2555 | function advanceTimers(currentTime) {
|
2556 |
|
2557 | var timer = peek(timerQueue);
|
2558 |
|
2559 | while (timer !== null) {
|
2560 | if (timer.callback === null) {
|
2561 |
|
2562 | pop(timerQueue);
|
2563 | } else if (timer.startTime <= currentTime) {
|
2564 |
|
2565 | pop(timerQueue);
|
2566 | timer.sortIndex = timer.expirationTime;
|
2567 | push(taskQueue, timer);
|
2568 | } else {
|
2569 |
|
2570 | return;
|
2571 | }
|
2572 |
|
2573 | timer = peek(timerQueue);
|
2574 | }
|
2575 | }
|
2576 |
|
2577 | function handleTimeout(currentTime) {
|
2578 | isHostTimeoutScheduled = false;
|
2579 | advanceTimers(currentTime);
|
2580 |
|
2581 | if (!isHostCallbackScheduled) {
|
2582 | if (peek(taskQueue) !== null) {
|
2583 | isHostCallbackScheduled = true;
|
2584 | requestHostCallback(flushWork);
|
2585 | } else {
|
2586 | var firstTimer = peek(timerQueue);
|
2587 |
|
2588 | if (firstTimer !== null) {
|
2589 | requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
2590 | }
|
2591 | }
|
2592 | }
|
2593 | }
|
2594 |
|
2595 | function flushWork(hasTimeRemaining, initialTime) {
|
2596 |
|
2597 |
|
2598 | isHostCallbackScheduled = false;
|
2599 |
|
2600 | if (isHostTimeoutScheduled) {
|
2601 |
|
2602 | isHostTimeoutScheduled = false;
|
2603 | cancelHostTimeout();
|
2604 | }
|
2605 |
|
2606 | isPerformingWork = true;
|
2607 | var previousPriorityLevel = currentPriorityLevel;
|
2608 |
|
2609 | try {
|
2610 | if (enableProfiling) {
|
2611 | try {
|
2612 | return workLoop(hasTimeRemaining, initialTime);
|
2613 | } catch (error) {
|
2614 | if (currentTask !== null) {
|
2615 | var currentTime = getCurrentTime();
|
2616 | markTaskErrored(currentTask, currentTime);
|
2617 | currentTask.isQueued = false;
|
2618 | }
|
2619 |
|
2620 | throw error;
|
2621 | }
|
2622 | } else {
|
2623 |
|
2624 | return workLoop(hasTimeRemaining, initialTime);
|
2625 | }
|
2626 | } finally {
|
2627 | currentTask = null;
|
2628 | currentPriorityLevel = previousPriorityLevel;
|
2629 | isPerformingWork = false;
|
2630 | }
|
2631 | }
|
2632 |
|
2633 | function workLoop(hasTimeRemaining, initialTime) {
|
2634 | var currentTime = initialTime;
|
2635 | advanceTimers(currentTime);
|
2636 | currentTask = peek(taskQueue);
|
2637 |
|
2638 | while (currentTask !== null && !(enableSchedulerDebugging )) {
|
2639 | if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
|
2640 |
|
2641 | break;
|
2642 | }
|
2643 |
|
2644 | var callback = currentTask.callback;
|
2645 |
|
2646 | if (typeof callback === 'function') {
|
2647 | currentTask.callback = null;
|
2648 | currentPriorityLevel = currentTask.priorityLevel;
|
2649 | var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
2650 |
|
2651 | var continuationCallback = callback(didUserCallbackTimeout);
|
2652 | currentTime = getCurrentTime();
|
2653 |
|
2654 | if (typeof continuationCallback === 'function') {
|
2655 | currentTask.callback = continuationCallback;
|
2656 | } else {
|
2657 |
|
2658 | if (currentTask === peek(taskQueue)) {
|
2659 | pop(taskQueue);
|
2660 | }
|
2661 | }
|
2662 |
|
2663 | advanceTimers(currentTime);
|
2664 | } else {
|
2665 | pop(taskQueue);
|
2666 | }
|
2667 |
|
2668 | currentTask = peek(taskQueue);
|
2669 | }
|
2670 |
|
2671 |
|
2672 | if (currentTask !== null) {
|
2673 | return true;
|
2674 | } else {
|
2675 | var firstTimer = peek(timerQueue);
|
2676 |
|
2677 | if (firstTimer !== null) {
|
2678 | requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
2679 | }
|
2680 |
|
2681 | return false;
|
2682 | }
|
2683 | }
|
2684 |
|
2685 | function unstable_runWithPriority(priorityLevel, eventHandler) {
|
2686 | switch (priorityLevel) {
|
2687 | case ImmediatePriority:
|
2688 | case UserBlockingPriority:
|
2689 | case NormalPriority:
|
2690 | case LowPriority:
|
2691 | case IdlePriority:
|
2692 | break;
|
2693 |
|
2694 | default:
|
2695 | priorityLevel = NormalPriority;
|
2696 | }
|
2697 |
|
2698 | var previousPriorityLevel = currentPriorityLevel;
|
2699 | currentPriorityLevel = priorityLevel;
|
2700 |
|
2701 | try {
|
2702 | return eventHandler();
|
2703 | } finally {
|
2704 | currentPriorityLevel = previousPriorityLevel;
|
2705 | }
|
2706 | }
|
2707 |
|
2708 | function unstable_next(eventHandler) {
|
2709 | var priorityLevel;
|
2710 |
|
2711 | switch (currentPriorityLevel) {
|
2712 | case ImmediatePriority:
|
2713 | case UserBlockingPriority:
|
2714 | case NormalPriority:
|
2715 |
|
2716 | priorityLevel = NormalPriority;
|
2717 | break;
|
2718 |
|
2719 | default:
|
2720 |
|
2721 | priorityLevel = currentPriorityLevel;
|
2722 | break;
|
2723 | }
|
2724 |
|
2725 | var previousPriorityLevel = currentPriorityLevel;
|
2726 | currentPriorityLevel = priorityLevel;
|
2727 |
|
2728 | try {
|
2729 | return eventHandler();
|
2730 | } finally {
|
2731 | currentPriorityLevel = previousPriorityLevel;
|
2732 | }
|
2733 | }
|
2734 |
|
2735 | function unstable_wrapCallback(callback) {
|
2736 | var parentPriorityLevel = currentPriorityLevel;
|
2737 | return function () {
|
2738 |
|
2739 | var previousPriorityLevel = currentPriorityLevel;
|
2740 | currentPriorityLevel = parentPriorityLevel;
|
2741 |
|
2742 | try {
|
2743 | return callback.apply(this, arguments);
|
2744 | } finally {
|
2745 | currentPriorityLevel = previousPriorityLevel;
|
2746 | }
|
2747 | };
|
2748 | }
|
2749 |
|
2750 | function unstable_scheduleCallback(priorityLevel, callback, options) {
|
2751 | var currentTime = getCurrentTime();
|
2752 | var startTime;
|
2753 |
|
2754 | if (typeof options === 'object' && options !== null) {
|
2755 | var delay = options.delay;
|
2756 |
|
2757 | if (typeof delay === 'number' && delay > 0) {
|
2758 | startTime = currentTime + delay;
|
2759 | } else {
|
2760 | startTime = currentTime;
|
2761 | }
|
2762 | } else {
|
2763 | startTime = currentTime;
|
2764 | }
|
2765 |
|
2766 | var timeout;
|
2767 |
|
2768 | switch (priorityLevel) {
|
2769 | case ImmediatePriority:
|
2770 | timeout = IMMEDIATE_PRIORITY_TIMEOUT;
|
2771 | break;
|
2772 |
|
2773 | case UserBlockingPriority:
|
2774 | timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
|
2775 | break;
|
2776 |
|
2777 | case IdlePriority:
|
2778 | timeout = IDLE_PRIORITY_TIMEOUT;
|
2779 | break;
|
2780 |
|
2781 | case LowPriority:
|
2782 | timeout = LOW_PRIORITY_TIMEOUT;
|
2783 | break;
|
2784 |
|
2785 | case NormalPriority:
|
2786 | default:
|
2787 | timeout = NORMAL_PRIORITY_TIMEOUT;
|
2788 | break;
|
2789 | }
|
2790 |
|
2791 | var expirationTime = startTime + timeout;
|
2792 | var newTask = {
|
2793 | id: taskIdCounter++,
|
2794 | callback: callback,
|
2795 | priorityLevel: priorityLevel,
|
2796 | startTime: startTime,
|
2797 | expirationTime: expirationTime,
|
2798 | sortIndex: -1
|
2799 | };
|
2800 |
|
2801 | if (startTime > currentTime) {
|
2802 |
|
2803 | newTask.sortIndex = startTime;
|
2804 | push(timerQueue, newTask);
|
2805 |
|
2806 | if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
2807 |
|
2808 | if (isHostTimeoutScheduled) {
|
2809 |
|
2810 | cancelHostTimeout();
|
2811 | } else {
|
2812 | isHostTimeoutScheduled = true;
|
2813 | }
|
2814 |
|
2815 |
|
2816 | requestHostTimeout(handleTimeout, startTime - currentTime);
|
2817 | }
|
2818 | } else {
|
2819 | newTask.sortIndex = expirationTime;
|
2820 | push(taskQueue, newTask);
|
2821 |
|
2822 |
|
2823 |
|
2824 | if (!isHostCallbackScheduled && !isPerformingWork) {
|
2825 | isHostCallbackScheduled = true;
|
2826 | requestHostCallback(flushWork);
|
2827 | }
|
2828 | }
|
2829 |
|
2830 | return newTask;
|
2831 | }
|
2832 |
|
2833 | function unstable_pauseExecution() {
|
2834 | }
|
2835 |
|
2836 | function unstable_continueExecution() {
|
2837 |
|
2838 | if (!isHostCallbackScheduled && !isPerformingWork) {
|
2839 | isHostCallbackScheduled = true;
|
2840 | requestHostCallback(flushWork);
|
2841 | }
|
2842 | }
|
2843 |
|
2844 | function unstable_getFirstCallbackNode() {
|
2845 | return peek(taskQueue);
|
2846 | }
|
2847 |
|
2848 | function unstable_cancelCallback(task) {
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 | task.callback = null;
|
2854 | }
|
2855 |
|
2856 | function unstable_getCurrentPriorityLevel() {
|
2857 | return currentPriorityLevel;
|
2858 | }
|
2859 |
|
2860 | var isMessageLoopRunning = false;
|
2861 | var scheduledHostCallback = null;
|
2862 | var taskTimeoutID = -1;
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 | var frameInterval = frameYieldMs;
|
2868 | var startTime = -1;
|
2869 |
|
2870 | function shouldYieldToHost() {
|
2871 | var timeElapsed = getCurrentTime() - startTime;
|
2872 |
|
2873 | if (timeElapsed < frameInterval) {
|
2874 |
|
2875 |
|
2876 | return false;
|
2877 | }
|
2878 |
|
2879 |
|
2880 | return true;
|
2881 | }
|
2882 |
|
2883 | function requestPaint() {
|
2884 |
|
2885 | }
|
2886 |
|
2887 | function forceFrameRate(fps) {
|
2888 | if (fps < 0 || fps > 125) {
|
2889 |
|
2890 | console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported');
|
2891 | return;
|
2892 | }
|
2893 |
|
2894 | if (fps > 0) {
|
2895 | frameInterval = Math.floor(1000 / fps);
|
2896 | } else {
|
2897 |
|
2898 | frameInterval = frameYieldMs;
|
2899 | }
|
2900 | }
|
2901 |
|
2902 | var performWorkUntilDeadline = function () {
|
2903 | if (scheduledHostCallback !== null) {
|
2904 | var currentTime = getCurrentTime();
|
2905 |
|
2906 |
|
2907 | startTime = currentTime;
|
2908 | var hasTimeRemaining = true;
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 | var hasMoreWork = true;
|
2916 |
|
2917 | try {
|
2918 | hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
|
2919 | } finally {
|
2920 | if (hasMoreWork) {
|
2921 |
|
2922 |
|
2923 | schedulePerformWorkUntilDeadline();
|
2924 | } else {
|
2925 | isMessageLoopRunning = false;
|
2926 | scheduledHostCallback = null;
|
2927 | }
|
2928 | }
|
2929 | } else {
|
2930 | isMessageLoopRunning = false;
|
2931 | }
|
2932 | };
|
2933 |
|
2934 | var schedulePerformWorkUntilDeadline;
|
2935 |
|
2936 | if (typeof localSetImmediate === 'function') {
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 | schedulePerformWorkUntilDeadline = function () {
|
2949 | localSetImmediate(performWorkUntilDeadline);
|
2950 | };
|
2951 | } else if (typeof MessageChannel !== 'undefined') {
|
2952 |
|
2953 |
|
2954 | var channel = new MessageChannel();
|
2955 | var port = channel.port2;
|
2956 | channel.port1.onmessage = performWorkUntilDeadline;
|
2957 |
|
2958 | schedulePerformWorkUntilDeadline = function () {
|
2959 | port.postMessage(null);
|
2960 | };
|
2961 | } else {
|
2962 |
|
2963 | schedulePerformWorkUntilDeadline = function () {
|
2964 | localSetTimeout(performWorkUntilDeadline, 0);
|
2965 | };
|
2966 | }
|
2967 |
|
2968 | function requestHostCallback(callback) {
|
2969 | scheduledHostCallback = callback;
|
2970 |
|
2971 | if (!isMessageLoopRunning) {
|
2972 | isMessageLoopRunning = true;
|
2973 | schedulePerformWorkUntilDeadline();
|
2974 | }
|
2975 | }
|
2976 |
|
2977 | function requestHostTimeout(callback, ms) {
|
2978 | taskTimeoutID = localSetTimeout(function () {
|
2979 | callback(getCurrentTime());
|
2980 | }, ms);
|
2981 | }
|
2982 |
|
2983 | function cancelHostTimeout() {
|
2984 | localClearTimeout(taskTimeoutID);
|
2985 | taskTimeoutID = -1;
|
2986 | }
|
2987 |
|
2988 | var unstable_requestPaint = requestPaint;
|
2989 | var unstable_Profiling = null;
|
2990 |
|
2991 |
|
2992 |
|
2993 | var Scheduler = Object.freeze({
|
2994 | __proto__: null,
|
2995 | unstable_ImmediatePriority: ImmediatePriority,
|
2996 | unstable_UserBlockingPriority: UserBlockingPriority,
|
2997 | unstable_NormalPriority: NormalPriority,
|
2998 | unstable_IdlePriority: IdlePriority,
|
2999 | unstable_LowPriority: LowPriority,
|
3000 | unstable_runWithPriority: unstable_runWithPriority,
|
3001 | unstable_next: unstable_next,
|
3002 | unstable_scheduleCallback: unstable_scheduleCallback,
|
3003 | unstable_cancelCallback: unstable_cancelCallback,
|
3004 | unstable_wrapCallback: unstable_wrapCallback,
|
3005 | unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
|
3006 | unstable_shouldYield: shouldYieldToHost,
|
3007 | unstable_requestPaint: unstable_requestPaint,
|
3008 | unstable_continueExecution: unstable_continueExecution,
|
3009 | unstable_pauseExecution: unstable_pauseExecution,
|
3010 | unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
3011 | get unstable_now () { return getCurrentTime; },
|
3012 | unstable_forceFrameRate: forceFrameRate,
|
3013 | unstable_Profiling: unstable_Profiling
|
3014 | });
|
3015 |
|
3016 | var ReactSharedInternals$1 = {
|
3017 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
3018 | ReactCurrentOwner: ReactCurrentOwner,
|
3019 | ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 | Scheduler: Scheduler
|
3026 | };
|
3027 |
|
3028 | {
|
3029 | ReactSharedInternals$1.ReactCurrentActQueue = ReactCurrentActQueue;
|
3030 | ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
3031 | }
|
3032 |
|
3033 | function startTransition(scope, options) {
|
3034 | var prevTransition = ReactCurrentBatchConfig.transition;
|
3035 | ReactCurrentBatchConfig.transition = {};
|
3036 | var currentTransition = ReactCurrentBatchConfig.transition;
|
3037 |
|
3038 | {
|
3039 | ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
3040 | }
|
3041 |
|
3042 | try {
|
3043 | scope();
|
3044 | } finally {
|
3045 | ReactCurrentBatchConfig.transition = prevTransition;
|
3046 |
|
3047 | {
|
3048 | if (prevTransition === null && currentTransition._updatedFibers) {
|
3049 | var updatedFibersCount = currentTransition._updatedFibers.size;
|
3050 |
|
3051 | if (updatedFibersCount > 10) {
|
3052 | warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
|
3053 | }
|
3054 |
|
3055 | currentTransition._updatedFibers.clear();
|
3056 | }
|
3057 | }
|
3058 | }
|
3059 | }
|
3060 |
|
3061 | var didWarnAboutMessageChannel = false;
|
3062 | var enqueueTaskImpl = null;
|
3063 | function enqueueTask(task) {
|
3064 | if (enqueueTaskImpl === null) {
|
3065 | try {
|
3066 |
|
3067 |
|
3068 | var requireString = ('require' + Math.random()).slice(0, 7);
|
3069 | var nodeRequire = module && module[requireString];
|
3070 |
|
3071 |
|
3072 | enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
3073 | } catch (_err) {
|
3074 |
|
3075 |
|
3076 |
|
3077 | enqueueTaskImpl = function (callback) {
|
3078 | {
|
3079 | if (didWarnAboutMessageChannel === false) {
|
3080 | didWarnAboutMessageChannel = true;
|
3081 |
|
3082 | if (typeof MessageChannel === 'undefined') {
|
3083 | error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
3084 | }
|
3085 | }
|
3086 | }
|
3087 |
|
3088 | var channel = new MessageChannel();
|
3089 | channel.port1.onmessage = callback;
|
3090 | channel.port2.postMessage(undefined);
|
3091 | };
|
3092 | }
|
3093 | }
|
3094 |
|
3095 | return enqueueTaskImpl(task);
|
3096 | }
|
3097 |
|
3098 | var actScopeDepth = 0;
|
3099 | var didWarnNoAwaitAct = false;
|
3100 | function act(callback) {
|
3101 | {
|
3102 |
|
3103 |
|
3104 | var prevActScopeDepth = actScopeDepth;
|
3105 | actScopeDepth++;
|
3106 |
|
3107 | if (ReactCurrentActQueue.current === null) {
|
3108 |
|
3109 |
|
3110 | ReactCurrentActQueue.current = [];
|
3111 | }
|
3112 |
|
3113 | var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
3114 | var result;
|
3115 |
|
3116 | try {
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 | ReactCurrentActQueue.isBatchingLegacy = true;
|
3122 | result = callback();
|
3123 |
|
3124 |
|
3125 |
|
3126 | if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
3127 | var queue = ReactCurrentActQueue.current;
|
3128 |
|
3129 | if (queue !== null) {
|
3130 | ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
3131 | flushActQueue(queue);
|
3132 | }
|
3133 | }
|
3134 | } catch (error) {
|
3135 | popActScope(prevActScopeDepth);
|
3136 | throw error;
|
3137 | } finally {
|
3138 | ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
3139 | }
|
3140 |
|
3141 | if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
3142 | var thenableResult = result;
|
3143 |
|
3144 |
|
3145 | var wasAwaited = false;
|
3146 | var thenable = {
|
3147 | then: function (resolve, reject) {
|
3148 | wasAwaited = true;
|
3149 | thenableResult.then(function (returnValue) {
|
3150 | popActScope(prevActScopeDepth);
|
3151 |
|
3152 | if (actScopeDepth === 0) {
|
3153 |
|
3154 |
|
3155 | recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
3156 | } else {
|
3157 | resolve(returnValue);
|
3158 | }
|
3159 | }, function (error) {
|
3160 |
|
3161 | popActScope(prevActScopeDepth);
|
3162 | reject(error);
|
3163 | });
|
3164 | }
|
3165 | };
|
3166 |
|
3167 | {
|
3168 | if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
3169 |
|
3170 | Promise.resolve().then(function () {}).then(function () {
|
3171 | if (!wasAwaited) {
|
3172 | didWarnNoAwaitAct = true;
|
3173 |
|
3174 | error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
|
3175 | }
|
3176 | });
|
3177 | }
|
3178 | }
|
3179 |
|
3180 | return thenable;
|
3181 | } else {
|
3182 | var returnValue = result;
|
3183 |
|
3184 |
|
3185 | popActScope(prevActScopeDepth);
|
3186 |
|
3187 | if (actScopeDepth === 0) {
|
3188 |
|
3189 | var _queue = ReactCurrentActQueue.current;
|
3190 |
|
3191 | if (_queue !== null) {
|
3192 | flushActQueue(_queue);
|
3193 | ReactCurrentActQueue.current = null;
|
3194 | }
|
3195 |
|
3196 |
|
3197 |
|
3198 | var _thenable = {
|
3199 | then: function (resolve, reject) {
|
3200 |
|
3201 |
|
3202 |
|
3203 | if (ReactCurrentActQueue.current === null) {
|
3204 |
|
3205 | ReactCurrentActQueue.current = [];
|
3206 | recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
3207 | } else {
|
3208 | resolve(returnValue);
|
3209 | }
|
3210 | }
|
3211 | };
|
3212 | return _thenable;
|
3213 | } else {
|
3214 |
|
3215 |
|
3216 | var _thenable2 = {
|
3217 | then: function (resolve, reject) {
|
3218 | resolve(returnValue);
|
3219 | }
|
3220 | };
|
3221 | return _thenable2;
|
3222 | }
|
3223 | }
|
3224 | }
|
3225 | }
|
3226 |
|
3227 | function popActScope(prevActScopeDepth) {
|
3228 | {
|
3229 | if (prevActScopeDepth !== actScopeDepth - 1) {
|
3230 | error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
3231 | }
|
3232 |
|
3233 | actScopeDepth = prevActScopeDepth;
|
3234 | }
|
3235 | }
|
3236 |
|
3237 | function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
3238 | {
|
3239 | var queue = ReactCurrentActQueue.current;
|
3240 |
|
3241 | if (queue !== null) {
|
3242 | try {
|
3243 | flushActQueue(queue);
|
3244 | enqueueTask(function () {
|
3245 | if (queue.length === 0) {
|
3246 |
|
3247 | ReactCurrentActQueue.current = null;
|
3248 | resolve(returnValue);
|
3249 | } else {
|
3250 |
|
3251 | recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
3252 | }
|
3253 | });
|
3254 | } catch (error) {
|
3255 | reject(error);
|
3256 | }
|
3257 | } else {
|
3258 | resolve(returnValue);
|
3259 | }
|
3260 | }
|
3261 | }
|
3262 |
|
3263 | var isFlushing = false;
|
3264 |
|
3265 | function flushActQueue(queue) {
|
3266 | {
|
3267 | if (!isFlushing) {
|
3268 |
|
3269 | isFlushing = true;
|
3270 | var i = 0;
|
3271 |
|
3272 | try {
|
3273 | for (; i < queue.length; i++) {
|
3274 | var callback = queue[i];
|
3275 |
|
3276 | do {
|
3277 | callback = callback(true);
|
3278 | } while (callback !== null);
|
3279 | }
|
3280 |
|
3281 | queue.length = 0;
|
3282 | } catch (error) {
|
3283 |
|
3284 | queue = queue.slice(i + 1);
|
3285 | throw error;
|
3286 | } finally {
|
3287 | isFlushing = false;
|
3288 | }
|
3289 | }
|
3290 | }
|
3291 | }
|
3292 |
|
3293 | var createElement$1 = createElementWithValidation ;
|
3294 | var cloneElement$1 = cloneElementWithValidation ;
|
3295 | var createFactory = createFactoryWithValidation ;
|
3296 | var Children = {
|
3297 | map: mapChildren,
|
3298 | forEach: forEachChildren,
|
3299 | count: countChildren,
|
3300 | toArray: toArray,
|
3301 | only: onlyChild
|
3302 | };
|
3303 |
|
3304 | exports.Children = Children;
|
3305 | exports.Component = Component;
|
3306 | exports.Fragment = REACT_FRAGMENT_TYPE;
|
3307 | exports.Profiler = REACT_PROFILER_TYPE;
|
3308 | exports.PureComponent = PureComponent;
|
3309 | exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
3310 | exports.Suspense = REACT_SUSPENSE_TYPE;
|
3311 | exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1;
|
3312 | exports.cloneElement = cloneElement$1;
|
3313 | exports.createContext = createContext;
|
3314 | exports.createElement = createElement$1;
|
3315 | exports.createFactory = createFactory;
|
3316 | exports.createRef = createRef;
|
3317 | exports.forwardRef = forwardRef;
|
3318 | exports.isValidElement = isValidElement;
|
3319 | exports.lazy = lazy;
|
3320 | exports.memo = memo;
|
3321 | exports.startTransition = startTransition;
|
3322 | exports.unstable_act = act;
|
3323 | exports.useCallback = useCallback;
|
3324 | exports.useContext = useContext;
|
3325 | exports.useDebugValue = useDebugValue;
|
3326 | exports.useDeferredValue = useDeferredValue;
|
3327 | exports.useEffect = useEffect;
|
3328 | exports.useId = useId;
|
3329 | exports.useImperativeHandle = useImperativeHandle;
|
3330 | exports.useInsertionEffect = useInsertionEffect;
|
3331 | exports.useLayoutEffect = useLayoutEffect;
|
3332 | exports.useMemo = useMemo;
|
3333 | exports.useReducer = useReducer;
|
3334 | exports.useRef = useRef;
|
3335 | exports.useState = useState;
|
3336 | exports.useSyncExternalStore = useSyncExternalStore;
|
3337 | exports.useTransition = useTransition;
|
3338 | exports.version = ReactVersion;
|
3339 |
|
3340 | })));
|