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