UNPKG

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