UNPKG

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