UNPKG

72.1 kBJavaScriptView Raw
1/** @license React v17.0.2
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
10'use strict';
11
12if (process.env.NODE_ENV !== "production") {
13 (function() {
14'use strict';
15
16var _assign = require('object-assign');
17
18// TODO: this is special because it gets imported during build.
19var ReactVersion = '17.0.2';
20
21// ATTENTION
22// When adding new symbols to this file,
23// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
24// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
25// nor polyfill, then a plain number is used for performance.
26var REACT_ELEMENT_TYPE = 0xeac7;
27var REACT_PORTAL_TYPE = 0xeaca;
28exports.Fragment = 0xeacb;
29exports.StrictMode = 0xeacc;
30exports.Profiler = 0xead2;
31var REACT_PROVIDER_TYPE = 0xeacd;
32var REACT_CONTEXT_TYPE = 0xeace;
33var REACT_FORWARD_REF_TYPE = 0xead0;
34exports.Suspense = 0xead1;
35var REACT_SUSPENSE_LIST_TYPE = 0xead8;
36var REACT_MEMO_TYPE = 0xead3;
37var REACT_LAZY_TYPE = 0xead4;
38var REACT_BLOCK_TYPE = 0xead9;
39var REACT_SERVER_BLOCK_TYPE = 0xeada;
40var REACT_FUNDAMENTAL_TYPE = 0xead5;
41var REACT_SCOPE_TYPE = 0xead7;
42var REACT_OPAQUE_ID_TYPE = 0xeae0;
43var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
44var REACT_OFFSCREEN_TYPE = 0xeae2;
45var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
46
47if (typeof Symbol === 'function' && Symbol.for) {
48 var symbolFor = Symbol.for;
49 REACT_ELEMENT_TYPE = symbolFor('react.element');
50 REACT_PORTAL_TYPE = symbolFor('react.portal');
51 exports.Fragment = symbolFor('react.fragment');
52 exports.StrictMode = symbolFor('react.strict_mode');
53 exports.Profiler = symbolFor('react.profiler');
54 REACT_PROVIDER_TYPE = symbolFor('react.provider');
55 REACT_CONTEXT_TYPE = symbolFor('react.context');
56 REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
57 exports.Suspense = symbolFor('react.suspense');
58 REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
59 REACT_MEMO_TYPE = symbolFor('react.memo');
60 REACT_LAZY_TYPE = symbolFor('react.lazy');
61 REACT_BLOCK_TYPE = symbolFor('react.block');
62 REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
63 REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
64 REACT_SCOPE_TYPE = symbolFor('react.scope');
65 REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
66 REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
67 REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
68 REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
69}
70
71var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
72var FAUX_ITERATOR_SYMBOL = '@@iterator';
73function getIteratorFn(maybeIterable) {
74 if (maybeIterable === null || typeof maybeIterable !== 'object') {
75 return null;
76 }
77
78 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
79
80 if (typeof maybeIterator === 'function') {
81 return maybeIterator;
82 }
83
84 return null;
85}
86
87/**
88 * Keeps track of the current dispatcher.
89 */
90var ReactCurrentDispatcher = {
91 /**
92 * @internal
93 * @type {ReactComponent}
94 */
95 current: null
96};
97
98/**
99 * Keeps track of the current batch's configuration such as how long an update
100 * should suspend for if it needs to.
101 */
102var ReactCurrentBatchConfig = {
103 transition: 0
104};
105
106/**
107 * Keeps track of the current owner.
108 *
109 * The current owner is the component who should own any components that are
110 * currently being constructed.
111 */
112var ReactCurrentOwner = {
113 /**
114 * @internal
115 * @type {ReactComponent}
116 */
117 current: null
118};
119
120var ReactDebugCurrentFrame = {};
121var currentExtraStackFrame = null;
122function setExtraStackFrame(stack) {
123 {
124 currentExtraStackFrame = stack;
125 }
126}
127
128{
129 ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
130 {
131 currentExtraStackFrame = stack;
132 }
133 }; // Stack implementation injected by the current renderer.
134
135
136 ReactDebugCurrentFrame.getCurrentStack = null;
137
138 ReactDebugCurrentFrame.getStackAddendum = function () {
139 var stack = ''; // Add an extra top frame while an element is being validated
140
141 if (currentExtraStackFrame) {
142 stack += currentExtraStackFrame;
143 } // Delegate to the injected renderer-specific implementation
144
145
146 var impl = ReactDebugCurrentFrame.getCurrentStack;
147
148 if (impl) {
149 stack += impl() || '';
150 }
151
152 return stack;
153 };
154}
155
156/**
157 * Used by act() to track whether you're inside an act() scope.
158 */
159var IsSomeRendererActing = {
160 current: false
161};
162
163var ReactSharedInternals = {
164 ReactCurrentDispatcher: ReactCurrentDispatcher,
165 ReactCurrentBatchConfig: ReactCurrentBatchConfig,
166 ReactCurrentOwner: ReactCurrentOwner,
167 IsSomeRendererActing: IsSomeRendererActing,
168 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
169 assign: _assign
170};
171
172{
173 ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
174}
175
176// by calls to these methods by a Babel plugin.
177//
178// In PROD (or in packages without access to React internals),
179// they are left as they are instead.
180
181function warn(format) {
182 {
183 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
184 args[_key - 1] = arguments[_key];
185 }
186
187 printWarning('warn', format, args);
188 }
189}
190function error(format) {
191 {
192 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
193 args[_key2 - 1] = arguments[_key2];
194 }
195
196 printWarning('error', format, args);
197 }
198}
199
200function printWarning(level, format, args) {
201 // When changing this logic, you might want to also
202 // update consoleWithStackDev.www.js as well.
203 {
204 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
205 var stack = ReactDebugCurrentFrame.getStackAddendum();
206
207 if (stack !== '') {
208 format += '%s';
209 args = args.concat([stack]);
210 }
211
212 var argsWithFormat = args.map(function (item) {
213 return '' + item;
214 }); // Careful: RN currently depends on this prefix
215
216 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
217 // breaks IE9: https://github.com/facebook/react/issues/13610
218 // eslint-disable-next-line react-internal/no-production-logging
219
220 Function.prototype.apply.call(console[level], console, argsWithFormat);
221 }
222}
223
224var didWarnStateUpdateForUnmountedComponent = {};
225
226function warnNoop(publicInstance, callerName) {
227 {
228 var _constructor = publicInstance.constructor;
229 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
230 var warningKey = componentName + "." + callerName;
231
232 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
233 return;
234 }
235
236 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);
237
238 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
239 }
240}
241/**
242 * This is the abstract API for an update queue.
243 */
244
245
246var ReactNoopUpdateQueue = {
247 /**
248 * Checks whether or not this composite component is mounted.
249 * @param {ReactClass} publicInstance The instance we want to test.
250 * @return {boolean} True if mounted, false otherwise.
251 * @protected
252 * @final
253 */
254 isMounted: function (publicInstance) {
255 return false;
256 },
257
258 /**
259 * Forces an update. This should only be invoked when it is known with
260 * certainty that we are **not** in a DOM transaction.
261 *
262 * You may want to call this when you know that some deeper aspect of the
263 * component's state has changed but `setState` was not called.
264 *
265 * This will not invoke `shouldComponentUpdate`, but it will invoke
266 * `componentWillUpdate` and `componentDidUpdate`.
267 *
268 * @param {ReactClass} publicInstance The instance that should rerender.
269 * @param {?function} callback Called after component is updated.
270 * @param {?string} callerName name of the calling function in the public API.
271 * @internal
272 */
273 enqueueForceUpdate: function (publicInstance, callback, callerName) {
274 warnNoop(publicInstance, 'forceUpdate');
275 },
276
277 /**
278 * Replaces all of the state. Always use this or `setState` to mutate state.
279 * You should treat `this.state` as immutable.
280 *
281 * There is no guarantee that `this.state` will be immediately updated, so
282 * accessing `this.state` after calling this method may return the old value.
283 *
284 * @param {ReactClass} publicInstance The instance that should rerender.
285 * @param {object} completeState Next state.
286 * @param {?function} callback Called after component is updated.
287 * @param {?string} callerName name of the calling function in the public API.
288 * @internal
289 */
290 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
291 warnNoop(publicInstance, 'replaceState');
292 },
293
294 /**
295 * Sets a subset of the state. This only exists because _pendingState is
296 * internal. This provides a merging strategy that is not available to deep
297 * properties which is confusing. TODO: Expose pendingState or don't use it
298 * during the merge.
299 *
300 * @param {ReactClass} publicInstance The instance that should rerender.
301 * @param {object} partialState Next partial state to be merged with state.
302 * @param {?function} callback Called after component is updated.
303 * @param {?string} Name of the calling function in the public API.
304 * @internal
305 */
306 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
307 warnNoop(publicInstance, 'setState');
308 }
309};
310
311var emptyObject = {};
312
313{
314 Object.freeze(emptyObject);
315}
316/**
317 * Base class helpers for the updating state of a component.
318 */
319
320
321function Component(props, context, updater) {
322 this.props = props;
323 this.context = context; // If a component has string refs, we will assign a different object later.
324
325 this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
326 // renderer.
327
328 this.updater = updater || ReactNoopUpdateQueue;
329}
330
331Component.prototype.isReactComponent = {};
332/**
333 * Sets a subset of the state. Always use this to mutate
334 * state. You should treat `this.state` as immutable.
335 *
336 * There is no guarantee that `this.state` will be immediately updated, so
337 * accessing `this.state` after calling this method may return the old value.
338 *
339 * There is no guarantee that calls to `setState` will run synchronously,
340 * as they may eventually be batched together. You can provide an optional
341 * callback that will be executed when the call to setState is actually
342 * completed.
343 *
344 * When a function is provided to setState, it will be called at some point in
345 * the future (not synchronously). It will be called with the up to date
346 * component arguments (state, props, context). These values can be different
347 * from this.* because your function may be called after receiveProps but before
348 * shouldComponentUpdate, and this new state, props, and context will not yet be
349 * assigned to this.
350 *
351 * @param {object|function} partialState Next partial state or function to
352 * produce next partial state to be merged with current state.
353 * @param {?function} callback Called after state is updated.
354 * @final
355 * @protected
356 */
357
358Component.prototype.setState = function (partialState, callback) {
359 if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
360 {
361 throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
362 }
363 }
364
365 this.updater.enqueueSetState(this, partialState, callback, 'setState');
366};
367/**
368 * Forces an update. This should only be invoked when it is known with
369 * certainty that we are **not** in a DOM transaction.
370 *
371 * You may want to call this when you know that some deeper aspect of the
372 * component's state has changed but `setState` was not called.
373 *
374 * This will not invoke `shouldComponentUpdate`, but it will invoke
375 * `componentWillUpdate` and `componentDidUpdate`.
376 *
377 * @param {?function} callback Called after update is complete.
378 * @final
379 * @protected
380 */
381
382
383Component.prototype.forceUpdate = function (callback) {
384 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
385};
386/**
387 * Deprecated APIs. These APIs used to exist on classic React classes but since
388 * we would like to deprecate them, we're not going to move them over to this
389 * modern base class. Instead, we define a getter that warns if it's accessed.
390 */
391
392
393{
394 var deprecatedAPIs = {
395 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
396 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
397 };
398
399 var defineDeprecationWarning = function (methodName, info) {
400 Object.defineProperty(Component.prototype, methodName, {
401 get: function () {
402 warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
403
404 return undefined;
405 }
406 });
407 };
408
409 for (var fnName in deprecatedAPIs) {
410 if (deprecatedAPIs.hasOwnProperty(fnName)) {
411 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
412 }
413 }
414}
415
416function ComponentDummy() {}
417
418ComponentDummy.prototype = Component.prototype;
419/**
420 * Convenience component with default shallow equality check for sCU.
421 */
422
423function PureComponent(props, context, updater) {
424 this.props = props;
425 this.context = context; // If a component has string refs, we will assign a different object later.
426
427 this.refs = emptyObject;
428 this.updater = updater || ReactNoopUpdateQueue;
429}
430
431var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
432pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
433
434_assign(pureComponentPrototype, Component.prototype);
435
436pureComponentPrototype.isPureReactComponent = true;
437
438// an immutable object with a single mutable value
439function createRef() {
440 var refObject = {
441 current: null
442 };
443
444 {
445 Object.seal(refObject);
446 }
447
448 return refObject;
449}
450
451function getWrappedName(outerType, innerType, wrapperName) {
452 var functionName = innerType.displayName || innerType.name || '';
453 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
454}
455
456function getContextName(type) {
457 return type.displayName || 'Context';
458}
459
460function getComponentName(type) {
461 if (type == null) {
462 // Host root, text node or just invalid type.
463 return null;
464 }
465
466 {
467 if (typeof type.tag === 'number') {
468 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
469 }
470 }
471
472 if (typeof type === 'function') {
473 return type.displayName || type.name || null;
474 }
475
476 if (typeof type === 'string') {
477 return type;
478 }
479
480 switch (type) {
481 case exports.Fragment:
482 return 'Fragment';
483
484 case REACT_PORTAL_TYPE:
485 return 'Portal';
486
487 case exports.Profiler:
488 return 'Profiler';
489
490 case exports.StrictMode:
491 return 'StrictMode';
492
493 case exports.Suspense:
494 return 'Suspense';
495
496 case REACT_SUSPENSE_LIST_TYPE:
497 return 'SuspenseList';
498 }
499
500 if (typeof type === 'object') {
501 switch (type.$$typeof) {
502 case REACT_CONTEXT_TYPE:
503 var context = type;
504 return getContextName(context) + '.Consumer';
505
506 case REACT_PROVIDER_TYPE:
507 var provider = type;
508 return getContextName(provider._context) + '.Provider';
509
510 case REACT_FORWARD_REF_TYPE:
511 return getWrappedName(type, type.render, 'ForwardRef');
512
513 case REACT_MEMO_TYPE:
514 return getComponentName(type.type);
515
516 case REACT_BLOCK_TYPE:
517 return getComponentName(type._render);
518
519 case REACT_LAZY_TYPE:
520 {
521 var lazyComponent = type;
522 var payload = lazyComponent._payload;
523 var init = lazyComponent._init;
524
525 try {
526 return getComponentName(init(payload));
527 } catch (x) {
528 return null;
529 }
530 }
531 }
532 }
533
534 return null;
535}
536
537var hasOwnProperty = Object.prototype.hasOwnProperty;
538var RESERVED_PROPS = {
539 key: true,
540 ref: true,
541 __self: true,
542 __source: true
543};
544var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
545
546{
547 didWarnAboutStringRefs = {};
548}
549
550function hasValidRef(config) {
551 {
552 if (hasOwnProperty.call(config, 'ref')) {
553 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
554
555 if (getter && getter.isReactWarning) {
556 return false;
557 }
558 }
559 }
560
561 return config.ref !== undefined;
562}
563
564function hasValidKey(config) {
565 {
566 if (hasOwnProperty.call(config, 'key')) {
567 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
568
569 if (getter && getter.isReactWarning) {
570 return false;
571 }
572 }
573 }
574
575 return config.key !== undefined;
576}
577
578function defineKeyPropWarningGetter(props, displayName) {
579 var warnAboutAccessingKey = function () {
580 {
581 if (!specialPropKeyWarningShown) {
582 specialPropKeyWarningShown = true;
583
584 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);
585 }
586 }
587 };
588
589 warnAboutAccessingKey.isReactWarning = true;
590 Object.defineProperty(props, 'key', {
591 get: warnAboutAccessingKey,
592 configurable: true
593 });
594}
595
596function defineRefPropWarningGetter(props, displayName) {
597 var warnAboutAccessingRef = function () {
598 {
599 if (!specialPropRefWarningShown) {
600 specialPropRefWarningShown = true;
601
602 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);
603 }
604 }
605 };
606
607 warnAboutAccessingRef.isReactWarning = true;
608 Object.defineProperty(props, 'ref', {
609 get: warnAboutAccessingRef,
610 configurable: true
611 });
612}
613
614function warnIfStringRefCannotBeAutoConverted(config) {
615 {
616 if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
617 var componentName = getComponentName(ReactCurrentOwner.current.type);
618
619 if (!didWarnAboutStringRefs[componentName]) {
620 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);
621
622 didWarnAboutStringRefs[componentName] = true;
623 }
624 }
625 }
626}
627/**
628 * Factory method to create a new React element. This no longer adheres to
629 * the class pattern, so do not use new to call it. Also, instanceof check
630 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
631 * if something is a React Element.
632 *
633 * @param {*} type
634 * @param {*} props
635 * @param {*} key
636 * @param {string|object} ref
637 * @param {*} owner
638 * @param {*} self A *temporary* helper to detect places where `this` is
639 * different from the `owner` when React.createElement is called, so that we
640 * can warn. We want to get rid of owner and replace string `ref`s with arrow
641 * functions, and as long as `this` and owner are the same, there will be no
642 * change in behavior.
643 * @param {*} source An annotation object (added by a transpiler or otherwise)
644 * indicating filename, line number, and/or other information.
645 * @internal
646 */
647
648
649var ReactElement = function (type, key, ref, self, source, owner, props) {
650 var element = {
651 // This tag allows us to uniquely identify this as a React Element
652 $$typeof: REACT_ELEMENT_TYPE,
653 // Built-in properties that belong on the element
654 type: type,
655 key: key,
656 ref: ref,
657 props: props,
658 // Record the component responsible for creating this element.
659 _owner: owner
660 };
661
662 {
663 // The validation flag is currently mutative. We put it on
664 // an external backing store so that we can freeze the whole object.
665 // This can be replaced with a WeakMap once they are implemented in
666 // commonly used development environments.
667 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
668 // the validation flag non-enumerable (where possible, which should
669 // include every environment we run tests in), so the test framework
670 // ignores it.
671
672 Object.defineProperty(element._store, 'validated', {
673 configurable: false,
674 enumerable: false,
675 writable: true,
676 value: false
677 }); // self and source are DEV only properties.
678
679 Object.defineProperty(element, '_self', {
680 configurable: false,
681 enumerable: false,
682 writable: false,
683 value: self
684 }); // Two elements created in two different places should be considered
685 // equal for testing purposes and therefore we hide it from enumeration.
686
687 Object.defineProperty(element, '_source', {
688 configurable: false,
689 enumerable: false,
690 writable: false,
691 value: source
692 });
693
694 if (Object.freeze) {
695 Object.freeze(element.props);
696 Object.freeze(element);
697 }
698 }
699
700 return element;
701};
702/**
703 * Create and return a new ReactElement of the given type.
704 * See https://reactjs.org/docs/react-api.html#createelement
705 */
706
707function createElement(type, config, children) {
708 var propName; // Reserved names are extracted
709
710 var props = {};
711 var key = null;
712 var ref = null;
713 var self = null;
714 var source = null;
715
716 if (config != null) {
717 if (hasValidRef(config)) {
718 ref = config.ref;
719
720 {
721 warnIfStringRefCannotBeAutoConverted(config);
722 }
723 }
724
725 if (hasValidKey(config)) {
726 key = '' + config.key;
727 }
728
729 self = config.__self === undefined ? null : config.__self;
730 source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
731
732 for (propName in config) {
733 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
734 props[propName] = config[propName];
735 }
736 }
737 } // Children can be more than one argument, and those are transferred onto
738 // the newly allocated props object.
739
740
741 var childrenLength = arguments.length - 2;
742
743 if (childrenLength === 1) {
744 props.children = children;
745 } else if (childrenLength > 1) {
746 var childArray = Array(childrenLength);
747
748 for (var i = 0; i < childrenLength; i++) {
749 childArray[i] = arguments[i + 2];
750 }
751
752 {
753 if (Object.freeze) {
754 Object.freeze(childArray);
755 }
756 }
757
758 props.children = childArray;
759 } // Resolve default props
760
761
762 if (type && type.defaultProps) {
763 var defaultProps = type.defaultProps;
764
765 for (propName in defaultProps) {
766 if (props[propName] === undefined) {
767 props[propName] = defaultProps[propName];
768 }
769 }
770 }
771
772 {
773 if (key || ref) {
774 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
775
776 if (key) {
777 defineKeyPropWarningGetter(props, displayName);
778 }
779
780 if (ref) {
781 defineRefPropWarningGetter(props, displayName);
782 }
783 }
784 }
785
786 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
787}
788function cloneAndReplaceKey(oldElement, newKey) {
789 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
790 return newElement;
791}
792/**
793 * Clone and return a new ReactElement using element as the starting point.
794 * See https://reactjs.org/docs/react-api.html#cloneelement
795 */
796
797function cloneElement(element, config, children) {
798 if (!!(element === null || element === undefined)) {
799 {
800 throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
801 }
802 }
803
804 var propName; // Original props are copied
805
806 var props = _assign({}, element.props); // Reserved names are extracted
807
808
809 var key = element.key;
810 var ref = element.ref; // Self is preserved since the owner is preserved.
811
812 var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
813 // transpiler, and the original source is probably a better indicator of the
814 // true owner.
815
816 var source = element._source; // Owner will be preserved, unless ref is overridden
817
818 var owner = element._owner;
819
820 if (config != null) {
821 if (hasValidRef(config)) {
822 // Silently steal the ref from the parent.
823 ref = config.ref;
824 owner = ReactCurrentOwner.current;
825 }
826
827 if (hasValidKey(config)) {
828 key = '' + config.key;
829 } // Remaining properties override existing props
830
831
832 var defaultProps;
833
834 if (element.type && element.type.defaultProps) {
835 defaultProps = element.type.defaultProps;
836 }
837
838 for (propName in config) {
839 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
840 if (config[propName] === undefined && defaultProps !== undefined) {
841 // Resolve default props
842 props[propName] = defaultProps[propName];
843 } else {
844 props[propName] = config[propName];
845 }
846 }
847 }
848 } // Children can be more than one argument, and those are transferred onto
849 // the newly allocated props object.
850
851
852 var childrenLength = arguments.length - 2;
853
854 if (childrenLength === 1) {
855 props.children = children;
856 } else if (childrenLength > 1) {
857 var childArray = Array(childrenLength);
858
859 for (var i = 0; i < childrenLength; i++) {
860 childArray[i] = arguments[i + 2];
861 }
862
863 props.children = childArray;
864 }
865
866 return ReactElement(element.type, key, ref, self, source, owner, props);
867}
868/**
869 * Verifies the object is a ReactElement.
870 * See https://reactjs.org/docs/react-api.html#isvalidelement
871 * @param {?object} object
872 * @return {boolean} True if `object` is a ReactElement.
873 * @final
874 */
875
876function isValidElement(object) {
877 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
878}
879
880var SEPARATOR = '.';
881var SUBSEPARATOR = ':';
882/**
883 * Escape and wrap key so it is safe to use as a reactid
884 *
885 * @param {string} key to be escaped.
886 * @return {string} the escaped key.
887 */
888
889function escape(key) {
890 var escapeRegex = /[=:]/g;
891 var escaperLookup = {
892 '=': '=0',
893 ':': '=2'
894 };
895 var escapedString = key.replace(escapeRegex, function (match) {
896 return escaperLookup[match];
897 });
898 return '$' + escapedString;
899}
900/**
901 * TODO: Test that a single child and an array with one item have the same key
902 * pattern.
903 */
904
905
906var didWarnAboutMaps = false;
907var userProvidedKeyEscapeRegex = /\/+/g;
908
909function escapeUserProvidedKey(text) {
910 return text.replace(userProvidedKeyEscapeRegex, '$&/');
911}
912/**
913 * Generate a key string that identifies a element within a set.
914 *
915 * @param {*} element A element that could contain a manual key.
916 * @param {number} index Index that is used if a manual key is not provided.
917 * @return {string}
918 */
919
920
921function getElementKey(element, index) {
922 // Do some typechecking here since we call this blindly. We want to ensure
923 // that we don't block potential future ES APIs.
924 if (typeof element === 'object' && element !== null && element.key != null) {
925 // Explicit key
926 return escape('' + element.key);
927 } // Implicit key determined by the index in the set
928
929
930 return index.toString(36);
931}
932
933function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
934 var type = typeof children;
935
936 if (type === 'undefined' || type === 'boolean') {
937 // All of the above are perceived as null.
938 children = null;
939 }
940
941 var invokeCallback = false;
942
943 if (children === null) {
944 invokeCallback = true;
945 } else {
946 switch (type) {
947 case 'string':
948 case 'number':
949 invokeCallback = true;
950 break;
951
952 case 'object':
953 switch (children.$$typeof) {
954 case REACT_ELEMENT_TYPE:
955 case REACT_PORTAL_TYPE:
956 invokeCallback = true;
957 }
958
959 }
960 }
961
962 if (invokeCallback) {
963 var _child = children;
964 var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
965 // so that it's consistent if the number of children grows:
966
967 var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
968
969 if (Array.isArray(mappedChild)) {
970 var escapedChildKey = '';
971
972 if (childKey != null) {
973 escapedChildKey = escapeUserProvidedKey(childKey) + '/';
974 }
975
976 mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
977 return c;
978 });
979 } else if (mappedChild != null) {
980 if (isValidElement(mappedChild)) {
981 mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
982 // traverseAllChildren used to do for objects as children
983 escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
984 mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
985 escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
986 }
987
988 array.push(mappedChild);
989 }
990
991 return 1;
992 }
993
994 var child;
995 var nextName;
996 var subtreeCount = 0; // Count of children found in the current subtree.
997
998 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
999
1000 if (Array.isArray(children)) {
1001 for (var i = 0; i < children.length; i++) {
1002 child = children[i];
1003 nextName = nextNamePrefix + getElementKey(child, i);
1004 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1005 }
1006 } else {
1007 var iteratorFn = getIteratorFn(children);
1008
1009 if (typeof iteratorFn === 'function') {
1010 var iterableChildren = children;
1011
1012 {
1013 // Warn about using Maps as children
1014 if (iteratorFn === iterableChildren.entries) {
1015 if (!didWarnAboutMaps) {
1016 warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1017 }
1018
1019 didWarnAboutMaps = true;
1020 }
1021 }
1022
1023 var iterator = iteratorFn.call(iterableChildren);
1024 var step;
1025 var ii = 0;
1026
1027 while (!(step = iterator.next()).done) {
1028 child = step.value;
1029 nextName = nextNamePrefix + getElementKey(child, ii++);
1030 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1031 }
1032 } else if (type === 'object') {
1033 var childrenString = '' + children;
1034
1035 {
1036 {
1037 throw 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." );
1038 }
1039 }
1040 }
1041 }
1042
1043 return subtreeCount;
1044}
1045
1046/**
1047 * Maps children that are typically specified as `props.children`.
1048 *
1049 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1050 *
1051 * The provided mapFunction(child, index) will be called for each
1052 * leaf child.
1053 *
1054 * @param {?*} children Children tree container.
1055 * @param {function(*, int)} func The map function.
1056 * @param {*} context Context for mapFunction.
1057 * @return {object} Object containing the ordered map of results.
1058 */
1059function mapChildren(children, func, context) {
1060 if (children == null) {
1061 return children;
1062 }
1063
1064 var result = [];
1065 var count = 0;
1066 mapIntoArray(children, result, '', '', function (child) {
1067 return func.call(context, child, count++);
1068 });
1069 return result;
1070}
1071/**
1072 * Count the number of children that are typically specified as
1073 * `props.children`.
1074 *
1075 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1076 *
1077 * @param {?*} children Children tree container.
1078 * @return {number} The number of children.
1079 */
1080
1081
1082function countChildren(children) {
1083 var n = 0;
1084 mapChildren(children, function () {
1085 n++; // Don't return anything
1086 });
1087 return n;
1088}
1089
1090/**
1091 * Iterates through children that are typically specified as `props.children`.
1092 *
1093 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1094 *
1095 * The provided forEachFunc(child, index) will be called for each
1096 * leaf child.
1097 *
1098 * @param {?*} children Children tree container.
1099 * @param {function(*, int)} forEachFunc
1100 * @param {*} forEachContext Context for forEachContext.
1101 */
1102function forEachChildren(children, forEachFunc, forEachContext) {
1103 mapChildren(children, function () {
1104 forEachFunc.apply(this, arguments); // Don't return anything.
1105 }, forEachContext);
1106}
1107/**
1108 * Flatten a children object (typically specified as `props.children`) and
1109 * return an array with appropriately re-keyed children.
1110 *
1111 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1112 */
1113
1114
1115function toArray(children) {
1116 return mapChildren(children, function (child) {
1117 return child;
1118 }) || [];
1119}
1120/**
1121 * Returns the first child in a collection of children and verifies that there
1122 * is only one child in the collection.
1123 *
1124 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1125 *
1126 * The current implementation of this function assumes that a single child gets
1127 * passed without a wrapper, but the purpose of this helper function is to
1128 * abstract away the particular structure of children.
1129 *
1130 * @param {?object} children Child collection structure.
1131 * @return {ReactElement} The first and only `ReactElement` contained in the
1132 * structure.
1133 */
1134
1135
1136function onlyChild(children) {
1137 if (!isValidElement(children)) {
1138 {
1139 throw Error( "React.Children.only expected to receive a single React element child." );
1140 }
1141 }
1142
1143 return children;
1144}
1145
1146function createContext(defaultValue, calculateChangedBits) {
1147 if (calculateChangedBits === undefined) {
1148 calculateChangedBits = null;
1149 } else {
1150 {
1151 if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1152 error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1153 }
1154 }
1155 }
1156
1157 var context = {
1158 $$typeof: REACT_CONTEXT_TYPE,
1159 _calculateChangedBits: calculateChangedBits,
1160 // As a workaround to support multiple concurrent renderers, we categorize
1161 // some renderers as primary and others as secondary. We only expect
1162 // there to be two concurrent renderers at most: React Native (primary) and
1163 // Fabric (secondary); React DOM (primary) and React ART (secondary).
1164 // Secondary renderers store their context values on separate fields.
1165 _currentValue: defaultValue,
1166 _currentValue2: defaultValue,
1167 // Used to track how many concurrent renderers this context currently
1168 // supports within in a single renderer. Such as parallel server rendering.
1169 _threadCount: 0,
1170 // These are circular
1171 Provider: null,
1172 Consumer: null
1173 };
1174 context.Provider = {
1175 $$typeof: REACT_PROVIDER_TYPE,
1176 _context: context
1177 };
1178 var hasWarnedAboutUsingNestedContextConsumers = false;
1179 var hasWarnedAboutUsingConsumerProvider = false;
1180 var hasWarnedAboutDisplayNameOnConsumer = false;
1181
1182 {
1183 // A separate object, but proxies back to the original context object for
1184 // backwards compatibility. It has a different $$typeof, so we can properly
1185 // warn for the incorrect usage of Context as a Consumer.
1186 var Consumer = {
1187 $$typeof: REACT_CONTEXT_TYPE,
1188 _context: context,
1189 _calculateChangedBits: context._calculateChangedBits
1190 }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1191
1192 Object.defineProperties(Consumer, {
1193 Provider: {
1194 get: function () {
1195 if (!hasWarnedAboutUsingConsumerProvider) {
1196 hasWarnedAboutUsingConsumerProvider = true;
1197
1198 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?');
1199 }
1200
1201 return context.Provider;
1202 },
1203 set: function (_Provider) {
1204 context.Provider = _Provider;
1205 }
1206 },
1207 _currentValue: {
1208 get: function () {
1209 return context._currentValue;
1210 },
1211 set: function (_currentValue) {
1212 context._currentValue = _currentValue;
1213 }
1214 },
1215 _currentValue2: {
1216 get: function () {
1217 return context._currentValue2;
1218 },
1219 set: function (_currentValue2) {
1220 context._currentValue2 = _currentValue2;
1221 }
1222 },
1223 _threadCount: {
1224 get: function () {
1225 return context._threadCount;
1226 },
1227 set: function (_threadCount) {
1228 context._threadCount = _threadCount;
1229 }
1230 },
1231 Consumer: {
1232 get: function () {
1233 if (!hasWarnedAboutUsingNestedContextConsumers) {
1234 hasWarnedAboutUsingNestedContextConsumers = true;
1235
1236 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?');
1237 }
1238
1239 return context.Consumer;
1240 }
1241 },
1242 displayName: {
1243 get: function () {
1244 return context.displayName;
1245 },
1246 set: function (displayName) {
1247 if (!hasWarnedAboutDisplayNameOnConsumer) {
1248 warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1249
1250 hasWarnedAboutDisplayNameOnConsumer = true;
1251 }
1252 }
1253 }
1254 }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1255
1256 context.Consumer = Consumer;
1257 }
1258
1259 {
1260 context._currentRenderer = null;
1261 context._currentRenderer2 = null;
1262 }
1263
1264 return context;
1265}
1266
1267var Uninitialized = -1;
1268var Pending = 0;
1269var Resolved = 1;
1270var Rejected = 2;
1271
1272function lazyInitializer(payload) {
1273 if (payload._status === Uninitialized) {
1274 var ctor = payload._result;
1275 var thenable = ctor(); // Transition to the next state.
1276
1277 var pending = payload;
1278 pending._status = Pending;
1279 pending._result = thenable;
1280 thenable.then(function (moduleObject) {
1281 if (payload._status === Pending) {
1282 var defaultExport = moduleObject.default;
1283
1284 {
1285 if (defaultExport === undefined) {
1286 error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1287 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1288 }
1289 } // Transition to the next state.
1290
1291
1292 var resolved = payload;
1293 resolved._status = Resolved;
1294 resolved._result = defaultExport;
1295 }
1296 }, function (error) {
1297 if (payload._status === Pending) {
1298 // Transition to the next state.
1299 var rejected = payload;
1300 rejected._status = Rejected;
1301 rejected._result = error;
1302 }
1303 });
1304 }
1305
1306 if (payload._status === Resolved) {
1307 return payload._result;
1308 } else {
1309 throw payload._result;
1310 }
1311}
1312
1313function lazy(ctor) {
1314 var payload = {
1315 // We use these fields to store the result.
1316 _status: -1,
1317 _result: ctor
1318 };
1319 var lazyType = {
1320 $$typeof: REACT_LAZY_TYPE,
1321 _payload: payload,
1322 _init: lazyInitializer
1323 };
1324
1325 {
1326 // In production, this would just set it on the object.
1327 var defaultProps;
1328 var propTypes; // $FlowFixMe
1329
1330 Object.defineProperties(lazyType, {
1331 defaultProps: {
1332 configurable: true,
1333 get: function () {
1334 return defaultProps;
1335 },
1336 set: function (newDefaultProps) {
1337 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.');
1338
1339 defaultProps = newDefaultProps; // Match production behavior more closely:
1340 // $FlowFixMe
1341
1342 Object.defineProperty(lazyType, 'defaultProps', {
1343 enumerable: true
1344 });
1345 }
1346 },
1347 propTypes: {
1348 configurable: true,
1349 get: function () {
1350 return propTypes;
1351 },
1352 set: function (newPropTypes) {
1353 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.');
1354
1355 propTypes = newPropTypes; // Match production behavior more closely:
1356 // $FlowFixMe
1357
1358 Object.defineProperty(lazyType, 'propTypes', {
1359 enumerable: true
1360 });
1361 }
1362 }
1363 });
1364 }
1365
1366 return lazyType;
1367}
1368
1369function forwardRef(render) {
1370 {
1371 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1372 error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1373 } else if (typeof render !== 'function') {
1374 error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1375 } else {
1376 if (render.length !== 0 && render.length !== 2) {
1377 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.');
1378 }
1379 }
1380
1381 if (render != null) {
1382 if (render.defaultProps != null || render.propTypes != null) {
1383 error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1384 }
1385 }
1386 }
1387
1388 var elementType = {
1389 $$typeof: REACT_FORWARD_REF_TYPE,
1390 render: render
1391 };
1392
1393 {
1394 var ownName;
1395 Object.defineProperty(elementType, 'displayName', {
1396 enumerable: false,
1397 configurable: true,
1398 get: function () {
1399 return ownName;
1400 },
1401 set: function (name) {
1402 ownName = name;
1403
1404 if (render.displayName == null) {
1405 render.displayName = name;
1406 }
1407 }
1408 });
1409 }
1410
1411 return elementType;
1412}
1413
1414// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1415
1416var enableScopeAPI = false; // Experimental Create Event Handle API.
1417
1418function isValidElementType(type) {
1419 if (typeof type === 'string' || typeof type === 'function') {
1420 return true;
1421 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1422
1423
1424 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 || enableScopeAPI ) {
1425 return true;
1426 }
1427
1428 if (typeof type === 'object' && type !== null) {
1429 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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1430 return true;
1431 }
1432 }
1433
1434 return false;
1435}
1436
1437function memo(type, compare) {
1438 {
1439 if (!isValidElementType(type)) {
1440 error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1441 }
1442 }
1443
1444 var elementType = {
1445 $$typeof: REACT_MEMO_TYPE,
1446 type: type,
1447 compare: compare === undefined ? null : compare
1448 };
1449
1450 {
1451 var ownName;
1452 Object.defineProperty(elementType, 'displayName', {
1453 enumerable: false,
1454 configurable: true,
1455 get: function () {
1456 return ownName;
1457 },
1458 set: function (name) {
1459 ownName = name;
1460
1461 if (type.displayName == null) {
1462 type.displayName = name;
1463 }
1464 }
1465 });
1466 }
1467
1468 return elementType;
1469}
1470
1471function resolveDispatcher() {
1472 var dispatcher = ReactCurrentDispatcher.current;
1473
1474 if (!(dispatcher !== null)) {
1475 {
1476 throw 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:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1477 }
1478 }
1479
1480 return dispatcher;
1481}
1482
1483function useContext(Context, unstable_observedBits) {
1484 var dispatcher = resolveDispatcher();
1485
1486 {
1487 if (unstable_observedBits !== undefined) {
1488 error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1489 } // TODO: add a more generic warning for invalid values.
1490
1491
1492 if (Context._context !== undefined) {
1493 var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1494 // and nobody should be using this in existing code.
1495
1496 if (realContext.Consumer === Context) {
1497 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?');
1498 } else if (realContext.Provider === Context) {
1499 error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1500 }
1501 }
1502 }
1503
1504 return dispatcher.useContext(Context, unstable_observedBits);
1505}
1506function useState(initialState) {
1507 var dispatcher = resolveDispatcher();
1508 return dispatcher.useState(initialState);
1509}
1510function useReducer(reducer, initialArg, init) {
1511 var dispatcher = resolveDispatcher();
1512 return dispatcher.useReducer(reducer, initialArg, init);
1513}
1514function useRef(initialValue) {
1515 var dispatcher = resolveDispatcher();
1516 return dispatcher.useRef(initialValue);
1517}
1518function useEffect(create, deps) {
1519 var dispatcher = resolveDispatcher();
1520 return dispatcher.useEffect(create, deps);
1521}
1522function useLayoutEffect(create, deps) {
1523 var dispatcher = resolveDispatcher();
1524 return dispatcher.useLayoutEffect(create, deps);
1525}
1526function useCallback(callback, deps) {
1527 var dispatcher = resolveDispatcher();
1528 return dispatcher.useCallback(callback, deps);
1529}
1530function useMemo(create, deps) {
1531 var dispatcher = resolveDispatcher();
1532 return dispatcher.useMemo(create, deps);
1533}
1534function useImperativeHandle(ref, create, deps) {
1535 var dispatcher = resolveDispatcher();
1536 return dispatcher.useImperativeHandle(ref, create, deps);
1537}
1538function useDebugValue(value, formatterFn) {
1539 {
1540 var dispatcher = resolveDispatcher();
1541 return dispatcher.useDebugValue(value, formatterFn);
1542 }
1543}
1544
1545// Helpers to patch console.logs to avoid logging during side-effect free
1546// replaying on render function. This currently only patches the object
1547// lazily which won't cover if the log function was extracted eagerly.
1548// We could also eagerly patch the method.
1549var disabledDepth = 0;
1550var prevLog;
1551var prevInfo;
1552var prevWarn;
1553var prevError;
1554var prevGroup;
1555var prevGroupCollapsed;
1556var prevGroupEnd;
1557
1558function disabledLog() {}
1559
1560disabledLog.__reactDisabledLog = true;
1561function disableLogs() {
1562 {
1563 if (disabledDepth === 0) {
1564 /* eslint-disable react-internal/no-production-logging */
1565 prevLog = console.log;
1566 prevInfo = console.info;
1567 prevWarn = console.warn;
1568 prevError = console.error;
1569 prevGroup = console.group;
1570 prevGroupCollapsed = console.groupCollapsed;
1571 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1572
1573 var props = {
1574 configurable: true,
1575 enumerable: true,
1576 value: disabledLog,
1577 writable: true
1578 }; // $FlowFixMe Flow thinks console is immutable.
1579
1580 Object.defineProperties(console, {
1581 info: props,
1582 log: props,
1583 warn: props,
1584 error: props,
1585 group: props,
1586 groupCollapsed: props,
1587 groupEnd: props
1588 });
1589 /* eslint-enable react-internal/no-production-logging */
1590 }
1591
1592 disabledDepth++;
1593 }
1594}
1595function reenableLogs() {
1596 {
1597 disabledDepth--;
1598
1599 if (disabledDepth === 0) {
1600 /* eslint-disable react-internal/no-production-logging */
1601 var props = {
1602 configurable: true,
1603 enumerable: true,
1604 writable: true
1605 }; // $FlowFixMe Flow thinks console is immutable.
1606
1607 Object.defineProperties(console, {
1608 log: _assign({}, props, {
1609 value: prevLog
1610 }),
1611 info: _assign({}, props, {
1612 value: prevInfo
1613 }),
1614 warn: _assign({}, props, {
1615 value: prevWarn
1616 }),
1617 error: _assign({}, props, {
1618 value: prevError
1619 }),
1620 group: _assign({}, props, {
1621 value: prevGroup
1622 }),
1623 groupCollapsed: _assign({}, props, {
1624 value: prevGroupCollapsed
1625 }),
1626 groupEnd: _assign({}, props, {
1627 value: prevGroupEnd
1628 })
1629 });
1630 /* eslint-enable react-internal/no-production-logging */
1631 }
1632
1633 if (disabledDepth < 0) {
1634 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1635 }
1636 }
1637}
1638
1639var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1640var prefix;
1641function describeBuiltInComponentFrame(name, source, ownerFn) {
1642 {
1643 if (prefix === undefined) {
1644 // Extract the VM specific prefix used by each line.
1645 try {
1646 throw Error();
1647 } catch (x) {
1648 var match = x.stack.trim().match(/\n( *(at )?)/);
1649 prefix = match && match[1] || '';
1650 }
1651 } // We use the prefix to ensure our stacks line up with native stack frames.
1652
1653
1654 return '\n' + prefix + name;
1655 }
1656}
1657var reentry = false;
1658var componentFrameCache;
1659
1660{
1661 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1662 componentFrameCache = new PossiblyWeakMap();
1663}
1664
1665function describeNativeComponentFrame(fn, construct) {
1666 // If something asked for a stack inside a fake render, it should get ignored.
1667 if (!fn || reentry) {
1668 return '';
1669 }
1670
1671 {
1672 var frame = componentFrameCache.get(fn);
1673
1674 if (frame !== undefined) {
1675 return frame;
1676 }
1677 }
1678
1679 var control;
1680 reentry = true;
1681 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1682
1683 Error.prepareStackTrace = undefined;
1684 var previousDispatcher;
1685
1686 {
1687 previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1688 // for warnings.
1689
1690 ReactCurrentDispatcher$1.current = null;
1691 disableLogs();
1692 }
1693
1694 try {
1695 // This should throw.
1696 if (construct) {
1697 // Something should be setting the props in the constructor.
1698 var Fake = function () {
1699 throw Error();
1700 }; // $FlowFixMe
1701
1702
1703 Object.defineProperty(Fake.prototype, 'props', {
1704 set: function () {
1705 // We use a throwing setter instead of frozen or non-writable props
1706 // because that won't throw in a non-strict mode function.
1707 throw Error();
1708 }
1709 });
1710
1711 if (typeof Reflect === 'object' && Reflect.construct) {
1712 // We construct a different control for this case to include any extra
1713 // frames added by the construct call.
1714 try {
1715 Reflect.construct(Fake, []);
1716 } catch (x) {
1717 control = x;
1718 }
1719
1720 Reflect.construct(fn, [], Fake);
1721 } else {
1722 try {
1723 Fake.call();
1724 } catch (x) {
1725 control = x;
1726 }
1727
1728 fn.call(Fake.prototype);
1729 }
1730 } else {
1731 try {
1732 throw Error();
1733 } catch (x) {
1734 control = x;
1735 }
1736
1737 fn();
1738 }
1739 } catch (sample) {
1740 // This is inlined manually because closure doesn't do it for us.
1741 if (sample && control && typeof sample.stack === 'string') {
1742 // This extracts the first frame from the sample that isn't also in the control.
1743 // Skipping one frame that we assume is the frame that calls the two.
1744 var sampleLines = sample.stack.split('\n');
1745 var controlLines = control.stack.split('\n');
1746 var s = sampleLines.length - 1;
1747 var c = controlLines.length - 1;
1748
1749 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1750 // We expect at least one stack frame to be shared.
1751 // Typically this will be the root most one. However, stack frames may be
1752 // cut off due to maximum stack limits. In this case, one maybe cut off
1753 // earlier than the other. We assume that the sample is longer or the same
1754 // and there for cut off earlier. So we should find the root most frame in
1755 // the sample somewhere in the control.
1756 c--;
1757 }
1758
1759 for (; s >= 1 && c >= 0; s--, c--) {
1760 // Next we find the first one that isn't the same which should be the
1761 // frame that called our sample function and the control.
1762 if (sampleLines[s] !== controlLines[c]) {
1763 // In V8, the first line is describing the message but other VMs don't.
1764 // If we're about to return the first line, and the control is also on the same
1765 // line, that's a pretty good indicator that our sample threw at same line as
1766 // the control. I.e. before we entered the sample frame. So we ignore this result.
1767 // This can happen if you passed a class to function component, or non-function.
1768 if (s !== 1 || c !== 1) {
1769 do {
1770 s--;
1771 c--; // We may still have similar intermediate frames from the construct call.
1772 // The next one that isn't the same should be our match though.
1773
1774 if (c < 0 || sampleLines[s] !== controlLines[c]) {
1775 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1776 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1777
1778 {
1779 if (typeof fn === 'function') {
1780 componentFrameCache.set(fn, _frame);
1781 }
1782 } // Return the line we found.
1783
1784
1785 return _frame;
1786 }
1787 } while (s >= 1 && c >= 0);
1788 }
1789
1790 break;
1791 }
1792 }
1793 }
1794 } finally {
1795 reentry = false;
1796
1797 {
1798 ReactCurrentDispatcher$1.current = previousDispatcher;
1799 reenableLogs();
1800 }
1801
1802 Error.prepareStackTrace = previousPrepareStackTrace;
1803 } // Fallback to just using the name if we couldn't make it throw.
1804
1805
1806 var name = fn ? fn.displayName || fn.name : '';
1807 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1808
1809 {
1810 if (typeof fn === 'function') {
1811 componentFrameCache.set(fn, syntheticFrame);
1812 }
1813 }
1814
1815 return syntheticFrame;
1816}
1817function describeFunctionComponentFrame(fn, source, ownerFn) {
1818 {
1819 return describeNativeComponentFrame(fn, false);
1820 }
1821}
1822
1823function shouldConstruct(Component) {
1824 var prototype = Component.prototype;
1825 return !!(prototype && prototype.isReactComponent);
1826}
1827
1828function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1829
1830 if (type == null) {
1831 return '';
1832 }
1833
1834 if (typeof type === 'function') {
1835 {
1836 return describeNativeComponentFrame(type, shouldConstruct(type));
1837 }
1838 }
1839
1840 if (typeof type === 'string') {
1841 return describeBuiltInComponentFrame(type);
1842 }
1843
1844 switch (type) {
1845 case exports.Suspense:
1846 return describeBuiltInComponentFrame('Suspense');
1847
1848 case REACT_SUSPENSE_LIST_TYPE:
1849 return describeBuiltInComponentFrame('SuspenseList');
1850 }
1851
1852 if (typeof type === 'object') {
1853 switch (type.$$typeof) {
1854 case REACT_FORWARD_REF_TYPE:
1855 return describeFunctionComponentFrame(type.render);
1856
1857 case REACT_MEMO_TYPE:
1858 // Memo may contain any component type so we recursively resolve it.
1859 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1860
1861 case REACT_BLOCK_TYPE:
1862 return describeFunctionComponentFrame(type._render);
1863
1864 case REACT_LAZY_TYPE:
1865 {
1866 var lazyComponent = type;
1867 var payload = lazyComponent._payload;
1868 var init = lazyComponent._init;
1869
1870 try {
1871 // Lazy may contain any component type so we recursively resolve it.
1872 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1873 } catch (x) {}
1874 }
1875 }
1876 }
1877
1878 return '';
1879}
1880
1881var loggedTypeFailures = {};
1882var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1883
1884function setCurrentlyValidatingElement(element) {
1885 {
1886 if (element) {
1887 var owner = element._owner;
1888 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1889 ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1890 } else {
1891 ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1892 }
1893 }
1894}
1895
1896function checkPropTypes(typeSpecs, values, location, componentName, element) {
1897 {
1898 // $FlowFixMe This is okay but Flow doesn't know it.
1899 var has = Function.call.bind(Object.prototype.hasOwnProperty);
1900
1901 for (var typeSpecName in typeSpecs) {
1902 if (has(typeSpecs, typeSpecName)) {
1903 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
1904 // fail the render phase where it didn't fail before. So we log it.
1905 // After these have been cleaned up, we'll let them throw.
1906
1907 try {
1908 // This is intentionally an invariant that gets caught. It's the same
1909 // behavior as without this statement except with a better message.
1910 if (typeof typeSpecs[typeSpecName] !== 'function') {
1911 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`.');
1912 err.name = 'Invariant Violation';
1913 throw err;
1914 }
1915
1916 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1917 } catch (ex) {
1918 error$1 = ex;
1919 }
1920
1921 if (error$1 && !(error$1 instanceof Error)) {
1922 setCurrentlyValidatingElement(element);
1923
1924 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);
1925
1926 setCurrentlyValidatingElement(null);
1927 }
1928
1929 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1930 // Only monitor this failure once because there tends to be a lot of the
1931 // same error.
1932 loggedTypeFailures[error$1.message] = true;
1933 setCurrentlyValidatingElement(element);
1934
1935 error('Failed %s type: %s', location, error$1.message);
1936
1937 setCurrentlyValidatingElement(null);
1938 }
1939 }
1940 }
1941 }
1942}
1943
1944function setCurrentlyValidatingElement$1(element) {
1945 {
1946 if (element) {
1947 var owner = element._owner;
1948 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1949 setExtraStackFrame(stack);
1950 } else {
1951 setExtraStackFrame(null);
1952 }
1953 }
1954}
1955
1956var propTypesMisspellWarningShown;
1957
1958{
1959 propTypesMisspellWarningShown = false;
1960}
1961
1962function getDeclarationErrorAddendum() {
1963 if (ReactCurrentOwner.current) {
1964 var name = getComponentName(ReactCurrentOwner.current.type);
1965
1966 if (name) {
1967 return '\n\nCheck the render method of `' + name + '`.';
1968 }
1969 }
1970
1971 return '';
1972}
1973
1974function getSourceInfoErrorAddendum(source) {
1975 if (source !== undefined) {
1976 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1977 var lineNumber = source.lineNumber;
1978 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1979 }
1980
1981 return '';
1982}
1983
1984function getSourceInfoErrorAddendumForProps(elementProps) {
1985 if (elementProps !== null && elementProps !== undefined) {
1986 return getSourceInfoErrorAddendum(elementProps.__source);
1987 }
1988
1989 return '';
1990}
1991/**
1992 * Warn if there's no key explicitly set on dynamic arrays of children or
1993 * object keys are not valid. This allows us to keep track of children between
1994 * updates.
1995 */
1996
1997
1998var ownerHasKeyUseWarning = {};
1999
2000function getCurrentComponentErrorInfo(parentType) {
2001 var info = getDeclarationErrorAddendum();
2002
2003 if (!info) {
2004 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2005
2006 if (parentName) {
2007 info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2008 }
2009 }
2010
2011 return info;
2012}
2013/**
2014 * Warn if the element doesn't have an explicit key assigned to it.
2015 * This element is in an array. The array could grow and shrink or be
2016 * reordered. All children that haven't already been validated are required to
2017 * have a "key" property assigned to it. Error statuses are cached so a warning
2018 * will only be shown once.
2019 *
2020 * @internal
2021 * @param {ReactElement} element Element that requires a key.
2022 * @param {*} parentType element's parent's type.
2023 */
2024
2025
2026function validateExplicitKey(element, parentType) {
2027 if (!element._store || element._store.validated || element.key != null) {
2028 return;
2029 }
2030
2031 element._store.validated = true;
2032 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2033
2034 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2035 return;
2036 }
2037
2038 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2039 // property, it may be the creator of the child that's responsible for
2040 // assigning it a key.
2041
2042 var childOwner = '';
2043
2044 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2045 // Give the component that originally created this child.
2046 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2047 }
2048
2049 {
2050 setCurrentlyValidatingElement$1(element);
2051
2052 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);
2053
2054 setCurrentlyValidatingElement$1(null);
2055 }
2056}
2057/**
2058 * Ensure that every element either is passed in a static location, in an
2059 * array with an explicit keys property defined, or in an object literal
2060 * with valid key property.
2061 *
2062 * @internal
2063 * @param {ReactNode} node Statically passed child of any type.
2064 * @param {*} parentType node's parent's type.
2065 */
2066
2067
2068function validateChildKeys(node, parentType) {
2069 if (typeof node !== 'object') {
2070 return;
2071 }
2072
2073 if (Array.isArray(node)) {
2074 for (var i = 0; i < node.length; i++) {
2075 var child = node[i];
2076
2077 if (isValidElement(child)) {
2078 validateExplicitKey(child, parentType);
2079 }
2080 }
2081 } else if (isValidElement(node)) {
2082 // This element was passed in a valid location.
2083 if (node._store) {
2084 node._store.validated = true;
2085 }
2086 } else if (node) {
2087 var iteratorFn = getIteratorFn(node);
2088
2089 if (typeof iteratorFn === 'function') {
2090 // Entry iterators used to provide implicit keys,
2091 // but now we print a separate warning for them later.
2092 if (iteratorFn !== node.entries) {
2093 var iterator = iteratorFn.call(node);
2094 var step;
2095
2096 while (!(step = iterator.next()).done) {
2097 if (isValidElement(step.value)) {
2098 validateExplicitKey(step.value, parentType);
2099 }
2100 }
2101 }
2102 }
2103 }
2104}
2105/**
2106 * Given an element, validate that its props follow the propTypes definition,
2107 * provided by the type.
2108 *
2109 * @param {ReactElement} element
2110 */
2111
2112
2113function validatePropTypes(element) {
2114 {
2115 var type = element.type;
2116
2117 if (type === null || type === undefined || typeof type === 'string') {
2118 return;
2119 }
2120
2121 var propTypes;
2122
2123 if (typeof type === 'function') {
2124 propTypes = type.propTypes;
2125 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2126 // Inner props are checked in the reconciler.
2127 type.$$typeof === REACT_MEMO_TYPE)) {
2128 propTypes = type.propTypes;
2129 } else {
2130 return;
2131 }
2132
2133 if (propTypes) {
2134 // Intentionally inside to avoid triggering lazy initializers:
2135 var name = getComponentName(type);
2136 checkPropTypes(propTypes, element.props, 'prop', name, element);
2137 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2138 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2139
2140 var _name = getComponentName(type);
2141
2142 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2143 }
2144
2145 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2146 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2147 }
2148 }
2149}
2150/**
2151 * Given a fragment, validate that it can only be provided with fragment props
2152 * @param {ReactElement} fragment
2153 */
2154
2155
2156function validateFragmentProps(fragment) {
2157 {
2158 var keys = Object.keys(fragment.props);
2159
2160 for (var i = 0; i < keys.length; i++) {
2161 var key = keys[i];
2162
2163 if (key !== 'children' && key !== 'key') {
2164 setCurrentlyValidatingElement$1(fragment);
2165
2166 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2167
2168 setCurrentlyValidatingElement$1(null);
2169 break;
2170 }
2171 }
2172
2173 if (fragment.ref !== null) {
2174 setCurrentlyValidatingElement$1(fragment);
2175
2176 error('Invalid attribute `ref` supplied to `React.Fragment`.');
2177
2178 setCurrentlyValidatingElement$1(null);
2179 }
2180 }
2181}
2182function createElementWithValidation(type, props, children) {
2183 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2184 // succeed and there will likely be errors in render.
2185
2186 if (!validType) {
2187 var info = '';
2188
2189 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2190 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.";
2191 }
2192
2193 var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2194
2195 if (sourceInfo) {
2196 info += sourceInfo;
2197 } else {
2198 info += getDeclarationErrorAddendum();
2199 }
2200
2201 var typeString;
2202
2203 if (type === null) {
2204 typeString = 'null';
2205 } else if (Array.isArray(type)) {
2206 typeString = 'array';
2207 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2208 typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2209 info = ' Did you accidentally export a JSX literal instead of a component?';
2210 } else {
2211 typeString = typeof type;
2212 }
2213
2214 {
2215 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);
2216 }
2217 }
2218
2219 var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2220 // TODO: Drop this when these are no longer allowed as the type argument.
2221
2222 if (element == null) {
2223 return element;
2224 } // Skip key warning if the type isn't valid since our key validation logic
2225 // doesn't expect a non-string/function type and can throw confusing errors.
2226 // We don't want exception behavior to differ between dev and prod.
2227 // (Rendering will throw with a helpful message and as soon as the type is
2228 // fixed, the key warnings will appear.)
2229
2230
2231 if (validType) {
2232 for (var i = 2; i < arguments.length; i++) {
2233 validateChildKeys(arguments[i], type);
2234 }
2235 }
2236
2237 if (type === exports.Fragment) {
2238 validateFragmentProps(element);
2239 } else {
2240 validatePropTypes(element);
2241 }
2242
2243 return element;
2244}
2245var didWarnAboutDeprecatedCreateFactory = false;
2246function createFactoryWithValidation(type) {
2247 var validatedFactory = createElementWithValidation.bind(null, type);
2248 validatedFactory.type = type;
2249
2250 {
2251 if (!didWarnAboutDeprecatedCreateFactory) {
2252 didWarnAboutDeprecatedCreateFactory = true;
2253
2254 warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2255 } // Legacy hook: remove it
2256
2257
2258 Object.defineProperty(validatedFactory, 'type', {
2259 enumerable: false,
2260 get: function () {
2261 warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2262
2263 Object.defineProperty(this, 'type', {
2264 value: type
2265 });
2266 return type;
2267 }
2268 });
2269 }
2270
2271 return validatedFactory;
2272}
2273function cloneElementWithValidation(element, props, children) {
2274 var newElement = cloneElement.apply(this, arguments);
2275
2276 for (var i = 2; i < arguments.length; i++) {
2277 validateChildKeys(arguments[i], newElement.type);
2278 }
2279
2280 validatePropTypes(newElement);
2281 return newElement;
2282}
2283
2284{
2285
2286 try {
2287 var frozenObject = Object.freeze({});
2288 /* eslint-disable no-new */
2289
2290 new Map([[frozenObject, null]]);
2291 new Set([frozenObject]);
2292 /* eslint-enable no-new */
2293 } catch (e) {
2294 }
2295}
2296
2297var createElement$1 = createElementWithValidation ;
2298var cloneElement$1 = cloneElementWithValidation ;
2299var createFactory = createFactoryWithValidation ;
2300var Children = {
2301 map: mapChildren,
2302 forEach: forEachChildren,
2303 count: countChildren,
2304 toArray: toArray,
2305 only: onlyChild
2306};
2307
2308exports.Children = Children;
2309exports.Component = Component;
2310exports.PureComponent = PureComponent;
2311exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2312exports.cloneElement = cloneElement$1;
2313exports.createContext = createContext;
2314exports.createElement = createElement$1;
2315exports.createFactory = createFactory;
2316exports.createRef = createRef;
2317exports.forwardRef = forwardRef;
2318exports.isValidElement = isValidElement;
2319exports.lazy = lazy;
2320exports.memo = memo;
2321exports.useCallback = useCallback;
2322exports.useContext = useContext;
2323exports.useDebugValue = useDebugValue;
2324exports.useEffect = useEffect;
2325exports.useImperativeHandle = useImperativeHandle;
2326exports.useLayoutEffect = useLayoutEffect;
2327exports.useMemo = useMemo;
2328exports.useReducer = useReducer;
2329exports.useRef = useRef;
2330exports.useState = useState;
2331exports.version = ReactVersion;
2332 })();
2333}