UNPKG

116 kBJavaScriptView Raw
1/** @license React v16.12.0
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(function (global, factory) {
13 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
14 typeof define === 'function' && define.amd ? define(factory) :
15 (global.React = factory());
16}(this, (function () { 'use strict';
17
18// TODO: this is special because it gets imported during build.
19
20var ReactVersion = '16.12.0';
21
22// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
23// nor polyfill, then a plain number is used for performance.
24var hasSymbol = typeof Symbol === 'function' && Symbol.for;
25var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
26var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
27var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
28var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
29var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
30var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
31var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
32// (unstable) APIs that have been removed. Can we remove the symbols?
33
34
35var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
36var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
37var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
38var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
39var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
40var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
41var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
42var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
43var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
44var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
45var FAUX_ITERATOR_SYMBOL = '@@iterator';
46function getIteratorFn(maybeIterable) {
47 if (maybeIterable === null || typeof maybeIterable !== 'object') {
48 return null;
49 }
50
51 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
52
53 if (typeof maybeIterator === 'function') {
54 return maybeIterator;
55 }
56
57 return null;
58}
59
60/*
61object-assign
62(c) Sindre Sorhus
63@license MIT
64*/
65
66
67/* eslint-disable no-unused-vars */
68var getOwnPropertySymbols = Object.getOwnPropertySymbols;
69var hasOwnProperty = Object.prototype.hasOwnProperty;
70var propIsEnumerable = Object.prototype.propertyIsEnumerable;
71
72function toObject(val) {
73 if (val === null || val === undefined) {
74 throw new TypeError('Object.assign cannot be called with null or undefined');
75 }
76
77 return Object(val);
78}
79
80function shouldUseNative() {
81 try {
82 if (!Object.assign) {
83 return false;
84 }
85
86 // Detect buggy property enumeration order in older V8 versions.
87
88 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
89 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
90 test1[5] = 'de';
91 if (Object.getOwnPropertyNames(test1)[0] === '5') {
92 return false;
93 }
94
95 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
96 var test2 = {};
97 for (var i = 0; i < 10; i++) {
98 test2['_' + String.fromCharCode(i)] = i;
99 }
100 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
101 return test2[n];
102 });
103 if (order2.join('') !== '0123456789') {
104 return false;
105 }
106
107 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
108 var test3 = {};
109 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
110 test3[letter] = letter;
111 });
112 if (Object.keys(Object.assign({}, test3)).join('') !==
113 'abcdefghijklmnopqrst') {
114 return false;
115 }
116
117 return true;
118 } catch (err) {
119 // We don't expect any of the above to throw, but better to be safe.
120 return false;
121 }
122}
123
124var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
125 var from;
126 var to = toObject(target);
127 var symbols;
128
129 for (var s = 1; s < arguments.length; s++) {
130 from = Object(arguments[s]);
131
132 for (var key in from) {
133 if (hasOwnProperty.call(from, key)) {
134 to[key] = from[key];
135 }
136 }
137
138 if (getOwnPropertySymbols) {
139 symbols = getOwnPropertySymbols(from);
140 for (var i = 0; i < symbols.length; i++) {
141 if (propIsEnumerable.call(from, symbols[i])) {
142 to[symbols[i]] = from[symbols[i]];
143 }
144 }
145 }
146 }
147
148 return to;
149};
150
151// Do not require this module directly! Use normal `invariant` calls with
152// template literal strings. The messages will be replaced with error codes
153// during build.
154
155/**
156 * Use invariant() to assert state which your program assumes to be true.
157 *
158 * Provide sprintf-style format (only %s is supported) and arguments
159 * to provide information about what broke and what you were
160 * expecting.
161 *
162 * The invariant message will be stripped in production, but the invariant
163 * will remain to ensure logic does not differ in production.
164 */
165
166/**
167 * Forked from fbjs/warning:
168 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
169 *
170 * Only change is we use console.warn instead of console.error,
171 * and do nothing when 'console' is not supported.
172 * This really simplifies the code.
173 * ---
174 * Similar to invariant but only logs a warning if the condition is not met.
175 * This can be used to log issues in development environments in critical
176 * paths. Removing the logging code for production environments will keep the
177 * same logic and follow the same code paths.
178 */
179var lowPriorityWarningWithoutStack = function () {};
180
181{
182 var printWarning = function (format) {
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 var argIndex = 0;
188 var message = 'Warning: ' + format.replace(/%s/g, function () {
189 return args[argIndex++];
190 });
191
192 if (typeof console !== 'undefined') {
193 console.warn(message);
194 }
195
196 try {
197 // --- Welcome to debugging React ---
198 // This error was thrown as a convenience so that you can use this stack
199 // to find the callsite that caused this warning to fire.
200 throw new Error(message);
201 } catch (x) {}
202 };
203
204 lowPriorityWarningWithoutStack = function (condition, format) {
205 if (format === undefined) {
206 throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
207 }
208
209 if (!condition) {
210 for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
211 args[_key2 - 2] = arguments[_key2];
212 }
213
214 printWarning.apply(void 0, [format].concat(args));
215 }
216 };
217}
218
219var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
220
221/**
222 * Similar to invariant but only logs a warning if the condition is not met.
223 * This can be used to log issues in development environments in critical
224 * paths. Removing the logging code for production environments will keep the
225 * same logic and follow the same code paths.
226 */
227var warningWithoutStack = function () {};
228
229{
230 warningWithoutStack = function (condition, format) {
231 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
232 args[_key - 2] = arguments[_key];
233 }
234
235 if (format === undefined) {
236 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
237 }
238
239 if (args.length > 8) {
240 // Check before the condition to catch violations early.
241 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
242 }
243
244 if (condition) {
245 return;
246 }
247
248 if (typeof console !== 'undefined') {
249 var argsWithFormat = args.map(function (item) {
250 return '' + item;
251 });
252 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
253 // breaks IE9: https://github.com/facebook/react/issues/13610
254
255 Function.prototype.apply.call(console.error, console, argsWithFormat);
256 }
257
258 try {
259 // --- Welcome to debugging React ---
260 // This error was thrown as a convenience so that you can use this stack
261 // to find the callsite that caused this warning to fire.
262 var argIndex = 0;
263 var message = 'Warning: ' + format.replace(/%s/g, function () {
264 return args[argIndex++];
265 });
266 throw new Error(message);
267 } catch (x) {}
268 };
269}
270
271var warningWithoutStack$1 = warningWithoutStack;
272
273var didWarnStateUpdateForUnmountedComponent = {};
274
275function warnNoop(publicInstance, callerName) {
276 {
277 var _constructor = publicInstance.constructor;
278 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
279 var warningKey = componentName + "." + callerName;
280
281 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
282 return;
283 }
284
285 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);
286 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
287 }
288}
289/**
290 * This is the abstract API for an update queue.
291 */
292
293
294var ReactNoopUpdateQueue = {
295 /**
296 * Checks whether or not this composite component is mounted.
297 * @param {ReactClass} publicInstance The instance we want to test.
298 * @return {boolean} True if mounted, false otherwise.
299 * @protected
300 * @final
301 */
302 isMounted: function (publicInstance) {
303 return false;
304 },
305
306 /**
307 * Forces an update. This should only be invoked when it is known with
308 * certainty that we are **not** in a DOM transaction.
309 *
310 * You may want to call this when you know that some deeper aspect of the
311 * component's state has changed but `setState` was not called.
312 *
313 * This will not invoke `shouldComponentUpdate`, but it will invoke
314 * `componentWillUpdate` and `componentDidUpdate`.
315 *
316 * @param {ReactClass} publicInstance The instance that should rerender.
317 * @param {?function} callback Called after component is updated.
318 * @param {?string} callerName name of the calling function in the public API.
319 * @internal
320 */
321 enqueueForceUpdate: function (publicInstance, callback, callerName) {
322 warnNoop(publicInstance, 'forceUpdate');
323 },
324
325 /**
326 * Replaces all of the state. Always use this or `setState` to mutate state.
327 * You should treat `this.state` as immutable.
328 *
329 * There is no guarantee that `this.state` will be immediately updated, so
330 * accessing `this.state` after calling this method may return the old value.
331 *
332 * @param {ReactClass} publicInstance The instance that should rerender.
333 * @param {object} completeState Next state.
334 * @param {?function} callback Called after component is updated.
335 * @param {?string} callerName name of the calling function in the public API.
336 * @internal
337 */
338 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
339 warnNoop(publicInstance, 'replaceState');
340 },
341
342 /**
343 * Sets a subset of the state. This only exists because _pendingState is
344 * internal. This provides a merging strategy that is not available to deep
345 * properties which is confusing. TODO: Expose pendingState or don't use it
346 * during the merge.
347 *
348 * @param {ReactClass} publicInstance The instance that should rerender.
349 * @param {object} partialState Next partial state to be merged with state.
350 * @param {?function} callback Called after component is updated.
351 * @param {?string} Name of the calling function in the public API.
352 * @internal
353 */
354 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
355 warnNoop(publicInstance, 'setState');
356 }
357};
358
359var emptyObject = {};
360
361{
362 Object.freeze(emptyObject);
363}
364/**
365 * Base class helpers for the updating state of a component.
366 */
367
368
369function Component(props, context, updater) {
370 this.props = props;
371 this.context = context; // If a component has string refs, we will assign a different object later.
372
373 this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
374 // renderer.
375
376 this.updater = updater || ReactNoopUpdateQueue;
377}
378
379Component.prototype.isReactComponent = {};
380/**
381 * Sets a subset of the state. Always use this to mutate
382 * state. You should treat `this.state` as immutable.
383 *
384 * There is no guarantee that `this.state` will be immediately updated, so
385 * accessing `this.state` after calling this method may return the old value.
386 *
387 * There is no guarantee that calls to `setState` will run synchronously,
388 * as they may eventually be batched together. You can provide an optional
389 * callback that will be executed when the call to setState is actually
390 * completed.
391 *
392 * When a function is provided to setState, it will be called at some point in
393 * the future (not synchronously). It will be called with the up to date
394 * component arguments (state, props, context). These values can be different
395 * from this.* because your function may be called after receiveProps but before
396 * shouldComponentUpdate, and this new state, props, and context will not yet be
397 * assigned to this.
398 *
399 * @param {object|function} partialState Next partial state or function to
400 * produce next partial state to be merged with current state.
401 * @param {?function} callback Called after state is updated.
402 * @final
403 * @protected
404 */
405
406Component.prototype.setState = function (partialState, callback) {
407 if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
408 {
409 throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
410 }
411 }
412
413 this.updater.enqueueSetState(this, partialState, callback, 'setState');
414};
415/**
416 * Forces an update. This should only be invoked when it is known with
417 * certainty that we are **not** in a DOM transaction.
418 *
419 * You may want to call this when you know that some deeper aspect of the
420 * component's state has changed but `setState` was not called.
421 *
422 * This will not invoke `shouldComponentUpdate`, but it will invoke
423 * `componentWillUpdate` and `componentDidUpdate`.
424 *
425 * @param {?function} callback Called after update is complete.
426 * @final
427 * @protected
428 */
429
430
431Component.prototype.forceUpdate = function (callback) {
432 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
433};
434/**
435 * Deprecated APIs. These APIs used to exist on classic React classes but since
436 * we would like to deprecate them, we're not going to move them over to this
437 * modern base class. Instead, we define a getter that warns if it's accessed.
438 */
439
440
441{
442 var deprecatedAPIs = {
443 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
444 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
445 };
446
447 var defineDeprecationWarning = function (methodName, info) {
448 Object.defineProperty(Component.prototype, methodName, {
449 get: function () {
450 lowPriorityWarningWithoutStack$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
451 return undefined;
452 }
453 });
454 };
455
456 for (var fnName in deprecatedAPIs) {
457 if (deprecatedAPIs.hasOwnProperty(fnName)) {
458 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
459 }
460 }
461}
462
463function ComponentDummy() {}
464
465ComponentDummy.prototype = Component.prototype;
466/**
467 * Convenience component with default shallow equality check for sCU.
468 */
469
470function PureComponent(props, context, updater) {
471 this.props = props;
472 this.context = context; // If a component has string refs, we will assign a different object later.
473
474 this.refs = emptyObject;
475 this.updater = updater || ReactNoopUpdateQueue;
476}
477
478var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
479pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
480
481objectAssign(pureComponentPrototype, Component.prototype);
482
483pureComponentPrototype.isPureReactComponent = true;
484
485// an immutable object with a single mutable value
486function createRef() {
487 var refObject = {
488 current: null
489 };
490
491 {
492 Object.seal(refObject);
493 }
494
495 return refObject;
496}
497
498/**
499 * Keeps track of the current dispatcher.
500 */
501var ReactCurrentDispatcher = {
502 /**
503 * @internal
504 * @type {ReactComponent}
505 */
506 current: null
507};
508
509/**
510 * Keeps track of the current batch's configuration such as how long an update
511 * should suspend for if it needs to.
512 */
513var ReactCurrentBatchConfig = {
514 suspense: null
515};
516
517/**
518 * Keeps track of the current owner.
519 *
520 * The current owner is the component who should own any components that are
521 * currently being constructed.
522 */
523var ReactCurrentOwner = {
524 /**
525 * @internal
526 * @type {ReactComponent}
527 */
528 current: null
529};
530
531var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
532var describeComponentFrame = function (name, source, ownerName) {
533 var sourceInfo = '';
534
535 if (source) {
536 var path = source.fileName;
537 var fileName = path.replace(BEFORE_SLASH_RE, '');
538
539 {
540 // In DEV, include code for a common special case:
541 // prefer "folder/index.js" instead of just "index.js".
542 if (/^index\./.test(fileName)) {
543 var match = path.match(BEFORE_SLASH_RE);
544
545 if (match) {
546 var pathBeforeSlash = match[1];
547
548 if (pathBeforeSlash) {
549 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
550 fileName = folderName + '/' + fileName;
551 }
552 }
553 }
554 }
555
556 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
557 } else if (ownerName) {
558 sourceInfo = ' (created by ' + ownerName + ')';
559 }
560
561 return '\n in ' + (name || 'Unknown') + sourceInfo;
562};
563
564var Resolved = 1;
565
566function refineResolvedLazyComponent(lazyComponent) {
567 return lazyComponent._status === Resolved ? lazyComponent._result : null;
568}
569
570function getWrappedName(outerType, innerType, wrapperName) {
571 var functionName = innerType.displayName || innerType.name || '';
572 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
573}
574
575function getComponentName(type) {
576 if (type == null) {
577 // Host root, text node or just invalid type.
578 return null;
579 }
580
581 {
582 if (typeof type.tag === 'number') {
583 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
584 }
585 }
586
587 if (typeof type === 'function') {
588 return type.displayName || type.name || null;
589 }
590
591 if (typeof type === 'string') {
592 return type;
593 }
594
595 switch (type) {
596 case REACT_FRAGMENT_TYPE:
597 return 'Fragment';
598
599 case REACT_PORTAL_TYPE:
600 return 'Portal';
601
602 case REACT_PROFILER_TYPE:
603 return "Profiler";
604
605 case REACT_STRICT_MODE_TYPE:
606 return 'StrictMode';
607
608 case REACT_SUSPENSE_TYPE:
609 return 'Suspense';
610
611 case REACT_SUSPENSE_LIST_TYPE:
612 return 'SuspenseList';
613 }
614
615 if (typeof type === 'object') {
616 switch (type.$$typeof) {
617 case REACT_CONTEXT_TYPE:
618 return 'Context.Consumer';
619
620 case REACT_PROVIDER_TYPE:
621 return 'Context.Provider';
622
623 case REACT_FORWARD_REF_TYPE:
624 return getWrappedName(type, type.render, 'ForwardRef');
625
626 case REACT_MEMO_TYPE:
627 return getComponentName(type.type);
628
629 case REACT_LAZY_TYPE:
630 {
631 var thenable = type;
632 var resolvedThenable = refineResolvedLazyComponent(thenable);
633
634 if (resolvedThenable) {
635 return getComponentName(resolvedThenable);
636 }
637
638 break;
639 }
640 }
641 }
642
643 return null;
644}
645
646var ReactDebugCurrentFrame = {};
647var currentlyValidatingElement = null;
648function setCurrentlyValidatingElement(element) {
649 {
650 currentlyValidatingElement = element;
651 }
652}
653
654{
655 // Stack implementation injected by the current renderer.
656 ReactDebugCurrentFrame.getCurrentStack = null;
657
658 ReactDebugCurrentFrame.getStackAddendum = function () {
659 var stack = ''; // Add an extra top frame while an element is being validated
660
661 if (currentlyValidatingElement) {
662 var name = getComponentName(currentlyValidatingElement.type);
663 var owner = currentlyValidatingElement._owner;
664 stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
665 } // Delegate to the injected renderer-specific implementation
666
667
668 var impl = ReactDebugCurrentFrame.getCurrentStack;
669
670 if (impl) {
671 stack += impl() || '';
672 }
673
674 return stack;
675 };
676}
677
678/**
679 * Used by act() to track whether you're inside an act() scope.
680 */
681var IsSomeRendererActing = {
682 current: false
683};
684
685var ReactSharedInternals = {
686 ReactCurrentDispatcher: ReactCurrentDispatcher,
687 ReactCurrentBatchConfig: ReactCurrentBatchConfig,
688 ReactCurrentOwner: ReactCurrentOwner,
689 IsSomeRendererActing: IsSomeRendererActing,
690 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
691 assign: objectAssign
692};
693
694{
695 objectAssign(ReactSharedInternals, {
696 // These should not be included in production.
697 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
698 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
699 // TODO: remove in React 17.0.
700 ReactComponentTreeHook: {}
701 });
702}
703
704/**
705 * Similar to invariant but only logs a warning if the condition is not met.
706 * This can be used to log issues in development environments in critical
707 * paths. Removing the logging code for production environments will keep the
708 * same logic and follow the same code paths.
709 */
710
711var warning = warningWithoutStack$1;
712
713{
714 warning = function (condition, format) {
715 if (condition) {
716 return;
717 }
718
719 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
720 var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
721
722 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
723 args[_key - 2] = arguments[_key];
724 }
725
726 warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
727 };
728}
729
730var warning$1 = warning;
731
732var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
733var RESERVED_PROPS = {
734 key: true,
735 ref: true,
736 __self: true,
737 __source: true
738};
739var specialPropKeyWarningShown;
740var specialPropRefWarningShown;
741
742function hasValidRef(config) {
743 {
744 if (hasOwnProperty$1.call(config, 'ref')) {
745 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
746
747 if (getter && getter.isReactWarning) {
748 return false;
749 }
750 }
751 }
752
753 return config.ref !== undefined;
754}
755
756function hasValidKey(config) {
757 {
758 if (hasOwnProperty$1.call(config, 'key')) {
759 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
760
761 if (getter && getter.isReactWarning) {
762 return false;
763 }
764 }
765 }
766
767 return config.key !== undefined;
768}
769
770function defineKeyPropWarningGetter(props, displayName) {
771 var warnAboutAccessingKey = function () {
772 if (!specialPropKeyWarningShown) {
773 specialPropKeyWarningShown = true;
774 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);
775 }
776 };
777
778 warnAboutAccessingKey.isReactWarning = true;
779 Object.defineProperty(props, 'key', {
780 get: warnAboutAccessingKey,
781 configurable: true
782 });
783}
784
785function defineRefPropWarningGetter(props, displayName) {
786 var warnAboutAccessingRef = function () {
787 if (!specialPropRefWarningShown) {
788 specialPropRefWarningShown = true;
789 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);
790 }
791 };
792
793 warnAboutAccessingRef.isReactWarning = true;
794 Object.defineProperty(props, 'ref', {
795 get: warnAboutAccessingRef,
796 configurable: true
797 });
798}
799/**
800 * Factory method to create a new React element. This no longer adheres to
801 * the class pattern, so do not use new to call it. Also, instanceof check
802 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
803 * if something is a React Element.
804 *
805 * @param {*} type
806 * @param {*} props
807 * @param {*} key
808 * @param {string|object} ref
809 * @param {*} owner
810 * @param {*} self A *temporary* helper to detect places where `this` is
811 * different from the `owner` when React.createElement is called, so that we
812 * can warn. We want to get rid of owner and replace string `ref`s with arrow
813 * functions, and as long as `this` and owner are the same, there will be no
814 * change in behavior.
815 * @param {*} source An annotation object (added by a transpiler or otherwise)
816 * indicating filename, line number, and/or other information.
817 * @internal
818 */
819
820
821var ReactElement = function (type, key, ref, self, source, owner, props) {
822 var element = {
823 // This tag allows us to uniquely identify this as a React Element
824 $$typeof: REACT_ELEMENT_TYPE,
825 // Built-in properties that belong on the element
826 type: type,
827 key: key,
828 ref: ref,
829 props: props,
830 // Record the component responsible for creating this element.
831 _owner: owner
832 };
833
834 {
835 // The validation flag is currently mutative. We put it on
836 // an external backing store so that we can freeze the whole object.
837 // This can be replaced with a WeakMap once they are implemented in
838 // commonly used development environments.
839 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
840 // the validation flag non-enumerable (where possible, which should
841 // include every environment we run tests in), so the test framework
842 // ignores it.
843
844 Object.defineProperty(element._store, 'validated', {
845 configurable: false,
846 enumerable: false,
847 writable: true,
848 value: false
849 }); // self and source are DEV only properties.
850
851 Object.defineProperty(element, '_self', {
852 configurable: false,
853 enumerable: false,
854 writable: false,
855 value: self
856 }); // Two elements created in two different places should be considered
857 // equal for testing purposes and therefore we hide it from enumeration.
858
859 Object.defineProperty(element, '_source', {
860 configurable: false,
861 enumerable: false,
862 writable: false,
863 value: source
864 });
865
866 if (Object.freeze) {
867 Object.freeze(element.props);
868 Object.freeze(element);
869 }
870 }
871
872 return element;
873};
874/**
875 * https://github.com/reactjs/rfcs/pull/107
876 * @param {*} type
877 * @param {object} props
878 * @param {string} key
879 */
880
881
882
883/**
884 * https://github.com/reactjs/rfcs/pull/107
885 * @param {*} type
886 * @param {object} props
887 * @param {string} key
888 */
889
890function jsxDEV(type, config, maybeKey, source, self) {
891 var propName; // Reserved names are extracted
892
893 var props = {};
894 var key = null;
895 var ref = null; // Currently, key can be spread in as a prop. This causes a potential
896 // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
897 // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
898 // but as an intermediary step, we will use jsxDEV for everything except
899 // <div {...props} key="Hi" />, because we aren't currently able to tell if
900 // key is explicitly declared to be undefined or not.
901
902 if (maybeKey !== undefined) {
903 key = '' + maybeKey;
904 }
905
906 if (hasValidKey(config)) {
907 key = '' + config.key;
908 }
909
910 if (hasValidRef(config)) {
911 ref = config.ref;
912 } // Remaining properties are added to a new props object
913
914
915 for (propName in config) {
916 if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
917 props[propName] = config[propName];
918 }
919 } // Resolve default props
920
921
922 if (type && type.defaultProps) {
923 var defaultProps = type.defaultProps;
924
925 for (propName in defaultProps) {
926 if (props[propName] === undefined) {
927 props[propName] = defaultProps[propName];
928 }
929 }
930 }
931
932 if (key || ref) {
933 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
934
935 if (key) {
936 defineKeyPropWarningGetter(props, displayName);
937 }
938
939 if (ref) {
940 defineRefPropWarningGetter(props, displayName);
941 }
942 }
943
944 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
945}
946/**
947 * Create and return a new ReactElement of the given type.
948 * See https://reactjs.org/docs/react-api.html#createelement
949 */
950
951function createElement(type, config, children) {
952 var propName; // Reserved names are extracted
953
954 var props = {};
955 var key = null;
956 var ref = null;
957 var self = null;
958 var source = null;
959
960 if (config != null) {
961 if (hasValidRef(config)) {
962 ref = config.ref;
963 }
964
965 if (hasValidKey(config)) {
966 key = '' + config.key;
967 }
968
969 self = config.__self === undefined ? null : config.__self;
970 source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
971
972 for (propName in config) {
973 if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
974 props[propName] = config[propName];
975 }
976 }
977 } // Children can be more than one argument, and those are transferred onto
978 // the newly allocated props object.
979
980
981 var childrenLength = arguments.length - 2;
982
983 if (childrenLength === 1) {
984 props.children = children;
985 } else if (childrenLength > 1) {
986 var childArray = Array(childrenLength);
987
988 for (var i = 0; i < childrenLength; i++) {
989 childArray[i] = arguments[i + 2];
990 }
991
992 {
993 if (Object.freeze) {
994 Object.freeze(childArray);
995 }
996 }
997
998 props.children = childArray;
999 } // Resolve default props
1000
1001
1002 if (type && type.defaultProps) {
1003 var defaultProps = type.defaultProps;
1004
1005 for (propName in defaultProps) {
1006 if (props[propName] === undefined) {
1007 props[propName] = defaultProps[propName];
1008 }
1009 }
1010 }
1011
1012 {
1013 if (key || ref) {
1014 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1015
1016 if (key) {
1017 defineKeyPropWarningGetter(props, displayName);
1018 }
1019
1020 if (ref) {
1021 defineRefPropWarningGetter(props, displayName);
1022 }
1023 }
1024 }
1025
1026 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1027}
1028/**
1029 * Return a function that produces ReactElements of a given type.
1030 * See https://reactjs.org/docs/react-api.html#createfactory
1031 */
1032
1033
1034function cloneAndReplaceKey(oldElement, newKey) {
1035 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1036 return newElement;
1037}
1038/**
1039 * Clone and return a new ReactElement using element as the starting point.
1040 * See https://reactjs.org/docs/react-api.html#cloneelement
1041 */
1042
1043function cloneElement(element, config, children) {
1044 if (!!(element === null || element === undefined)) {
1045 {
1046 throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
1047 }
1048 }
1049
1050 var propName; // Original props are copied
1051
1052 var props = objectAssign({}, element.props); // Reserved names are extracted
1053
1054
1055 var key = element.key;
1056 var ref = element.ref; // Self is preserved since the owner is preserved.
1057
1058 var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
1059 // transpiler, and the original source is probably a better indicator of the
1060 // true owner.
1061
1062 var source = element._source; // Owner will be preserved, unless ref is overridden
1063
1064 var owner = element._owner;
1065
1066 if (config != null) {
1067 if (hasValidRef(config)) {
1068 // Silently steal the ref from the parent.
1069 ref = config.ref;
1070 owner = ReactCurrentOwner.current;
1071 }
1072
1073 if (hasValidKey(config)) {
1074 key = '' + config.key;
1075 } // Remaining properties override existing props
1076
1077
1078 var defaultProps;
1079
1080 if (element.type && element.type.defaultProps) {
1081 defaultProps = element.type.defaultProps;
1082 }
1083
1084 for (propName in config) {
1085 if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1086 if (config[propName] === undefined && defaultProps !== undefined) {
1087 // Resolve default props
1088 props[propName] = defaultProps[propName];
1089 } else {
1090 props[propName] = config[propName];
1091 }
1092 }
1093 }
1094 } // Children can be more than one argument, and those are transferred onto
1095 // the newly allocated props object.
1096
1097
1098 var childrenLength = arguments.length - 2;
1099
1100 if (childrenLength === 1) {
1101 props.children = children;
1102 } else if (childrenLength > 1) {
1103 var childArray = Array(childrenLength);
1104
1105 for (var i = 0; i < childrenLength; i++) {
1106 childArray[i] = arguments[i + 2];
1107 }
1108
1109 props.children = childArray;
1110 }
1111
1112 return ReactElement(element.type, key, ref, self, source, owner, props);
1113}
1114/**
1115 * Verifies the object is a ReactElement.
1116 * See https://reactjs.org/docs/react-api.html#isvalidelement
1117 * @param {?object} object
1118 * @return {boolean} True if `object` is a ReactElement.
1119 * @final
1120 */
1121
1122function isValidElement(object) {
1123 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1124}
1125
1126var SEPARATOR = '.';
1127var SUBSEPARATOR = ':';
1128/**
1129 * Escape and wrap key so it is safe to use as a reactid
1130 *
1131 * @param {string} key to be escaped.
1132 * @return {string} the escaped key.
1133 */
1134
1135function escape(key) {
1136 var escapeRegex = /[=:]/g;
1137 var escaperLookup = {
1138 '=': '=0',
1139 ':': '=2'
1140 };
1141 var escapedString = ('' + key).replace(escapeRegex, function (match) {
1142 return escaperLookup[match];
1143 });
1144 return '$' + escapedString;
1145}
1146/**
1147 * TODO: Test that a single child and an array with one item have the same key
1148 * pattern.
1149 */
1150
1151
1152var didWarnAboutMaps = false;
1153var userProvidedKeyEscapeRegex = /\/+/g;
1154
1155function escapeUserProvidedKey(text) {
1156 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
1157}
1158
1159var POOL_SIZE = 10;
1160var traverseContextPool = [];
1161
1162function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
1163 if (traverseContextPool.length) {
1164 var traverseContext = traverseContextPool.pop();
1165 traverseContext.result = mapResult;
1166 traverseContext.keyPrefix = keyPrefix;
1167 traverseContext.func = mapFunction;
1168 traverseContext.context = mapContext;
1169 traverseContext.count = 0;
1170 return traverseContext;
1171 } else {
1172 return {
1173 result: mapResult,
1174 keyPrefix: keyPrefix,
1175 func: mapFunction,
1176 context: mapContext,
1177 count: 0
1178 };
1179 }
1180}
1181
1182function releaseTraverseContext(traverseContext) {
1183 traverseContext.result = null;
1184 traverseContext.keyPrefix = null;
1185 traverseContext.func = null;
1186 traverseContext.context = null;
1187 traverseContext.count = 0;
1188
1189 if (traverseContextPool.length < POOL_SIZE) {
1190 traverseContextPool.push(traverseContext);
1191 }
1192}
1193/**
1194 * @param {?*} children Children tree container.
1195 * @param {!string} nameSoFar Name of the key path so far.
1196 * @param {!function} callback Callback to invoke with each child found.
1197 * @param {?*} traverseContext Used to pass information throughout the traversal
1198 * process.
1199 * @return {!number} The number of children in this subtree.
1200 */
1201
1202
1203function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
1204 var type = typeof children;
1205
1206 if (type === 'undefined' || type === 'boolean') {
1207 // All of the above are perceived as null.
1208 children = null;
1209 }
1210
1211 var invokeCallback = false;
1212
1213 if (children === null) {
1214 invokeCallback = true;
1215 } else {
1216 switch (type) {
1217 case 'string':
1218 case 'number':
1219 invokeCallback = true;
1220 break;
1221
1222 case 'object':
1223 switch (children.$$typeof) {
1224 case REACT_ELEMENT_TYPE:
1225 case REACT_PORTAL_TYPE:
1226 invokeCallback = true;
1227 }
1228
1229 }
1230 }
1231
1232 if (invokeCallback) {
1233 callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
1234 // so that it's consistent if the number of children grows.
1235 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
1236 return 1;
1237 }
1238
1239 var child;
1240 var nextName;
1241 var subtreeCount = 0; // Count of children found in the current subtree.
1242
1243 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1244
1245 if (Array.isArray(children)) {
1246 for (var i = 0; i < children.length; i++) {
1247 child = children[i];
1248 nextName = nextNamePrefix + getComponentKey(child, i);
1249 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1250 }
1251 } else {
1252 var iteratorFn = getIteratorFn(children);
1253
1254 if (typeof iteratorFn === 'function') {
1255 {
1256 // Warn about using Maps as children
1257 if (iteratorFn === children.entries) {
1258 !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;
1259 didWarnAboutMaps = true;
1260 }
1261 }
1262
1263 var iterator = iteratorFn.call(children);
1264 var step;
1265 var ii = 0;
1266
1267 while (!(step = iterator.next()).done) {
1268 child = step.value;
1269 nextName = nextNamePrefix + getComponentKey(child, ii++);
1270 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1271 }
1272 } else if (type === 'object') {
1273 var addendum = '';
1274
1275 {
1276 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1277 }
1278
1279 var childrenString = '' + children;
1280
1281 {
1282 {
1283 throw Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum);
1284 }
1285 }
1286 }
1287 }
1288
1289 return subtreeCount;
1290}
1291/**
1292 * Traverses children that are typically specified as `props.children`, but
1293 * might also be specified through attributes:
1294 *
1295 * - `traverseAllChildren(this.props.children, ...)`
1296 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1297 *
1298 * The `traverseContext` is an optional argument that is passed through the
1299 * entire traversal. It can be used to store accumulations or anything else that
1300 * the callback might find relevant.
1301 *
1302 * @param {?*} children Children tree object.
1303 * @param {!function} callback To invoke upon traversing each child.
1304 * @param {?*} traverseContext Context for traversal.
1305 * @return {!number} The number of children in this subtree.
1306 */
1307
1308
1309function traverseAllChildren(children, callback, traverseContext) {
1310 if (children == null) {
1311 return 0;
1312 }
1313
1314 return traverseAllChildrenImpl(children, '', callback, traverseContext);
1315}
1316/**
1317 * Generate a key string that identifies a component within a set.
1318 *
1319 * @param {*} component A component that could contain a manual key.
1320 * @param {number} index Index that is used if a manual key is not provided.
1321 * @return {string}
1322 */
1323
1324
1325function getComponentKey(component, index) {
1326 // Do some typechecking here since we call this blindly. We want to ensure
1327 // that we don't block potential future ES APIs.
1328 if (typeof component === 'object' && component !== null && component.key != null) {
1329 // Explicit key
1330 return escape(component.key);
1331 } // Implicit key determined by the index in the set
1332
1333
1334 return index.toString(36);
1335}
1336
1337function forEachSingleChild(bookKeeping, child, name) {
1338 var func = bookKeeping.func,
1339 context = bookKeeping.context;
1340 func.call(context, child, bookKeeping.count++);
1341}
1342/**
1343 * Iterates through children that are typically specified as `props.children`.
1344 *
1345 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1346 *
1347 * The provided forEachFunc(child, index) will be called for each
1348 * leaf child.
1349 *
1350 * @param {?*} children Children tree container.
1351 * @param {function(*, int)} forEachFunc
1352 * @param {*} forEachContext Context for forEachContext.
1353 */
1354
1355
1356function forEachChildren(children, forEachFunc, forEachContext) {
1357 if (children == null) {
1358 return children;
1359 }
1360
1361 var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1362 traverseAllChildren(children, forEachSingleChild, traverseContext);
1363 releaseTraverseContext(traverseContext);
1364}
1365
1366function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1367 var result = bookKeeping.result,
1368 keyPrefix = bookKeeping.keyPrefix,
1369 func = bookKeeping.func,
1370 context = bookKeeping.context;
1371 var mappedChild = func.call(context, child, bookKeeping.count++);
1372
1373 if (Array.isArray(mappedChild)) {
1374 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1375 return c;
1376 });
1377 } else if (mappedChild != null) {
1378 if (isValidElement(mappedChild)) {
1379 mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1380 // traverseAllChildren used to do for objects as children
1381 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1382 }
1383
1384 result.push(mappedChild);
1385 }
1386}
1387
1388function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1389 var escapedPrefix = '';
1390
1391 if (prefix != null) {
1392 escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1393 }
1394
1395 var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1396 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1397 releaseTraverseContext(traverseContext);
1398}
1399/**
1400 * Maps children that are typically specified as `props.children`.
1401 *
1402 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1403 *
1404 * The provided mapFunction(child, key, index) will be called for each
1405 * leaf child.
1406 *
1407 * @param {?*} children Children tree container.
1408 * @param {function(*, int)} func The map function.
1409 * @param {*} context Context for mapFunction.
1410 * @return {object} Object containing the ordered map of results.
1411 */
1412
1413
1414function mapChildren(children, func, context) {
1415 if (children == null) {
1416 return children;
1417 }
1418
1419 var result = [];
1420 mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1421 return result;
1422}
1423/**
1424 * Count the number of children that are typically specified as
1425 * `props.children`.
1426 *
1427 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1428 *
1429 * @param {?*} children Children tree container.
1430 * @return {number} The number of children.
1431 */
1432
1433
1434function countChildren(children) {
1435 return traverseAllChildren(children, function () {
1436 return null;
1437 }, null);
1438}
1439/**
1440 * Flatten a children object (typically specified as `props.children`) and
1441 * return an array with appropriately re-keyed children.
1442 *
1443 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1444 */
1445
1446
1447function toArray(children) {
1448 var result = [];
1449 mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1450 return child;
1451 });
1452 return result;
1453}
1454/**
1455 * Returns the first child in a collection of children and verifies that there
1456 * is only one child in the collection.
1457 *
1458 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1459 *
1460 * The current implementation of this function assumes that a single child gets
1461 * passed without a wrapper, but the purpose of this helper function is to
1462 * abstract away the particular structure of children.
1463 *
1464 * @param {?object} children Child collection structure.
1465 * @return {ReactElement} The first and only `ReactElement` contained in the
1466 * structure.
1467 */
1468
1469
1470function onlyChild(children) {
1471 if (!isValidElement(children)) {
1472 {
1473 throw Error("React.Children.only expected to receive a single React element child.");
1474 }
1475 }
1476
1477 return children;
1478}
1479
1480function createContext(defaultValue, calculateChangedBits) {
1481 if (calculateChangedBits === undefined) {
1482 calculateChangedBits = null;
1483 } else {
1484 {
1485 !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1486 }
1487 }
1488
1489 var context = {
1490 $$typeof: REACT_CONTEXT_TYPE,
1491 _calculateChangedBits: calculateChangedBits,
1492 // As a workaround to support multiple concurrent renderers, we categorize
1493 // some renderers as primary and others as secondary. We only expect
1494 // there to be two concurrent renderers at most: React Native (primary) and
1495 // Fabric (secondary); React DOM (primary) and React ART (secondary).
1496 // Secondary renderers store their context values on separate fields.
1497 _currentValue: defaultValue,
1498 _currentValue2: defaultValue,
1499 // Used to track how many concurrent renderers this context currently
1500 // supports within in a single renderer. Such as parallel server rendering.
1501 _threadCount: 0,
1502 // These are circular
1503 Provider: null,
1504 Consumer: null
1505 };
1506 context.Provider = {
1507 $$typeof: REACT_PROVIDER_TYPE,
1508 _context: context
1509 };
1510 var hasWarnedAboutUsingNestedContextConsumers = false;
1511 var hasWarnedAboutUsingConsumerProvider = false;
1512
1513 {
1514 // A separate object, but proxies back to the original context object for
1515 // backwards compatibility. It has a different $$typeof, so we can properly
1516 // warn for the incorrect usage of Context as a Consumer.
1517 var Consumer = {
1518 $$typeof: REACT_CONTEXT_TYPE,
1519 _context: context,
1520 _calculateChangedBits: context._calculateChangedBits
1521 }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1522
1523 Object.defineProperties(Consumer, {
1524 Provider: {
1525 get: function () {
1526 if (!hasWarnedAboutUsingConsumerProvider) {
1527 hasWarnedAboutUsingConsumerProvider = true;
1528 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?');
1529 }
1530
1531 return context.Provider;
1532 },
1533 set: function (_Provider) {
1534 context.Provider = _Provider;
1535 }
1536 },
1537 _currentValue: {
1538 get: function () {
1539 return context._currentValue;
1540 },
1541 set: function (_currentValue) {
1542 context._currentValue = _currentValue;
1543 }
1544 },
1545 _currentValue2: {
1546 get: function () {
1547 return context._currentValue2;
1548 },
1549 set: function (_currentValue2) {
1550 context._currentValue2 = _currentValue2;
1551 }
1552 },
1553 _threadCount: {
1554 get: function () {
1555 return context._threadCount;
1556 },
1557 set: function (_threadCount) {
1558 context._threadCount = _threadCount;
1559 }
1560 },
1561 Consumer: {
1562 get: function () {
1563 if (!hasWarnedAboutUsingNestedContextConsumers) {
1564 hasWarnedAboutUsingNestedContextConsumers = true;
1565 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?');
1566 }
1567
1568 return context.Consumer;
1569 }
1570 }
1571 }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1572
1573 context.Consumer = Consumer;
1574 }
1575
1576 {
1577 context._currentRenderer = null;
1578 context._currentRenderer2 = null;
1579 }
1580
1581 return context;
1582}
1583
1584function lazy(ctor) {
1585 var lazyType = {
1586 $$typeof: REACT_LAZY_TYPE,
1587 _ctor: ctor,
1588 // React uses these fields to store the result.
1589 _status: -1,
1590 _result: null
1591 };
1592
1593 {
1594 // In production, this would just set it on the object.
1595 var defaultProps;
1596 var propTypes;
1597 Object.defineProperties(lazyType, {
1598 defaultProps: {
1599 configurable: true,
1600 get: function () {
1601 return defaultProps;
1602 },
1603 set: function (newDefaultProps) {
1604 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.');
1605 defaultProps = newDefaultProps; // Match production behavior more closely:
1606
1607 Object.defineProperty(lazyType, 'defaultProps', {
1608 enumerable: true
1609 });
1610 }
1611 },
1612 propTypes: {
1613 configurable: true,
1614 get: function () {
1615 return propTypes;
1616 },
1617 set: function (newPropTypes) {
1618 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.');
1619 propTypes = newPropTypes; // Match production behavior more closely:
1620
1621 Object.defineProperty(lazyType, 'propTypes', {
1622 enumerable: true
1623 });
1624 }
1625 }
1626 });
1627 }
1628
1629 return lazyType;
1630}
1631
1632function forwardRef(render) {
1633 {
1634 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1635 warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1636 } else if (typeof render !== 'function') {
1637 warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1638 } else {
1639 !( // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
1640 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;
1641 }
1642
1643 if (render != null) {
1644 !(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;
1645 }
1646 }
1647
1648 return {
1649 $$typeof: REACT_FORWARD_REF_TYPE,
1650 render: render
1651 };
1652}
1653
1654function isValidElementType(type) {
1655 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1656 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);
1657}
1658
1659function memo(type, compare) {
1660 {
1661 if (!isValidElementType(type)) {
1662 warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1663 }
1664 }
1665
1666 return {
1667 $$typeof: REACT_MEMO_TYPE,
1668 type: type,
1669 compare: compare === undefined ? null : compare
1670 };
1671}
1672
1673function resolveDispatcher() {
1674 var dispatcher = ReactCurrentDispatcher.current;
1675
1676 if (!(dispatcher !== null)) {
1677 {
1678 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://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
1679 }
1680 }
1681
1682 return dispatcher;
1683}
1684
1685function useContext(Context, unstable_observedBits) {
1686 var dispatcher = resolveDispatcher();
1687
1688 {
1689 !(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.
1690
1691 if (Context._context !== undefined) {
1692 var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1693 // and nobody should be using this in existing code.
1694
1695 if (realContext.Consumer === Context) {
1696 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?');
1697 } else if (realContext.Provider === Context) {
1698 warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1699 }
1700 }
1701 }
1702
1703 return dispatcher.useContext(Context, unstable_observedBits);
1704}
1705function useState(initialState) {
1706 var dispatcher = resolveDispatcher();
1707 return dispatcher.useState(initialState);
1708}
1709function useReducer(reducer, initialArg, init) {
1710 var dispatcher = resolveDispatcher();
1711 return dispatcher.useReducer(reducer, initialArg, init);
1712}
1713function useRef(initialValue) {
1714 var dispatcher = resolveDispatcher();
1715 return dispatcher.useRef(initialValue);
1716}
1717function useEffect(create, inputs) {
1718 var dispatcher = resolveDispatcher();
1719 return dispatcher.useEffect(create, inputs);
1720}
1721function useLayoutEffect(create, inputs) {
1722 var dispatcher = resolveDispatcher();
1723 return dispatcher.useLayoutEffect(create, inputs);
1724}
1725function useCallback(callback, inputs) {
1726 var dispatcher = resolveDispatcher();
1727 return dispatcher.useCallback(callback, inputs);
1728}
1729function useMemo(create, inputs) {
1730 var dispatcher = resolveDispatcher();
1731 return dispatcher.useMemo(create, inputs);
1732}
1733function useImperativeHandle(ref, create, inputs) {
1734 var dispatcher = resolveDispatcher();
1735 return dispatcher.useImperativeHandle(ref, create, inputs);
1736}
1737function useDebugValue(value, formatterFn) {
1738 {
1739 var dispatcher = resolveDispatcher();
1740 return dispatcher.useDebugValue(value, formatterFn);
1741 }
1742}
1743var emptyObject$1 = {};
1744function useResponder(responder, listenerProps) {
1745 var dispatcher = resolveDispatcher();
1746
1747 {
1748 if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
1749 warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
1750 return;
1751 }
1752 }
1753
1754 return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
1755}
1756function useTransition(config) {
1757 var dispatcher = resolveDispatcher();
1758 return dispatcher.useTransition(config);
1759}
1760function useDeferredValue(value, config) {
1761 var dispatcher = resolveDispatcher();
1762 return dispatcher.useDeferredValue(value, config);
1763}
1764
1765function withSuspenseConfig(scope, config) {
1766 var previousConfig = ReactCurrentBatchConfig.suspense;
1767 ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
1768
1769 try {
1770 scope();
1771 } finally {
1772 ReactCurrentBatchConfig.suspense = previousConfig;
1773 }
1774}
1775
1776/**
1777 * Copyright (c) 2013-present, Facebook, Inc.
1778 *
1779 * This source code is licensed under the MIT license found in the
1780 * LICENSE file in the root directory of this source tree.
1781 */
1782
1783
1784
1785var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1786
1787var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
1788
1789/**
1790 * Copyright (c) 2013-present, Facebook, Inc.
1791 *
1792 * This source code is licensed under the MIT license found in the
1793 * LICENSE file in the root directory of this source tree.
1794 */
1795
1796
1797
1798var printWarning$1 = function() {};
1799
1800{
1801 var ReactPropTypesSecret = ReactPropTypesSecret_1;
1802 var loggedTypeFailures = {};
1803 var has = Function.call.bind(Object.prototype.hasOwnProperty);
1804
1805 printWarning$1 = function(text) {
1806 var message = 'Warning: ' + text;
1807 if (typeof console !== 'undefined') {
1808 console.error(message);
1809 }
1810 try {
1811 // --- Welcome to debugging React ---
1812 // This error was thrown as a convenience so that you can use this stack
1813 // to find the callsite that caused this warning to fire.
1814 throw new Error(message);
1815 } catch (x) {}
1816 };
1817}
1818
1819/**
1820 * Assert that the values match with the type specs.
1821 * Error messages are memorized and will only be shown once.
1822 *
1823 * @param {object} typeSpecs Map of name to a ReactPropType
1824 * @param {object} values Runtime values that need to be type-checked
1825 * @param {string} location e.g. "prop", "context", "child context"
1826 * @param {string} componentName Name of the component for error messages.
1827 * @param {?Function} getStack Returns the component stack.
1828 * @private
1829 */
1830function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1831 {
1832 for (var typeSpecName in typeSpecs) {
1833 if (has(typeSpecs, typeSpecName)) {
1834 var error;
1835 // Prop type validation may throw. In case they do, we don't want to
1836 // fail the render phase where it didn't fail before. So we log it.
1837 // After these have been cleaned up, we'll let them throw.
1838 try {
1839 // This is intentionally an invariant that gets caught. It's the same
1840 // behavior as without this statement except with a better message.
1841 if (typeof typeSpecs[typeSpecName] !== 'function') {
1842 var err = Error(
1843 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
1844 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
1845 );
1846 err.name = 'Invariant Violation';
1847 throw err;
1848 }
1849 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1850 } catch (ex) {
1851 error = ex;
1852 }
1853 if (error && !(error instanceof Error)) {
1854 printWarning$1(
1855 (componentName || 'React class') + ': type specification of ' +
1856 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
1857 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
1858 'You may have forgotten to pass an argument to the type checker ' +
1859 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
1860 'shape all require an argument).'
1861 );
1862 }
1863 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1864 // Only monitor this failure once because there tends to be a lot of the
1865 // same error.
1866 loggedTypeFailures[error.message] = true;
1867
1868 var stack = getStack ? getStack() : '';
1869
1870 printWarning$1(
1871 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
1872 );
1873 }
1874 }
1875 }
1876 }
1877}
1878
1879/**
1880 * Resets warning cache when testing.
1881 *
1882 * @private
1883 */
1884checkPropTypes.resetWarningCache = function() {
1885 {
1886 loggedTypeFailures = {};
1887 }
1888};
1889
1890var checkPropTypes_1 = checkPropTypes;
1891
1892/**
1893 * ReactElementValidator provides a wrapper around a element factory
1894 * which validates the props passed to the element. This is intended to be
1895 * used only in DEV and could be replaced by a static type checker for languages
1896 * that support it.
1897 */
1898var propTypesMisspellWarningShown;
1899
1900{
1901 propTypesMisspellWarningShown = false;
1902}
1903
1904var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1905
1906function getDeclarationErrorAddendum() {
1907 if (ReactCurrentOwner.current) {
1908 var name = getComponentName(ReactCurrentOwner.current.type);
1909
1910 if (name) {
1911 return '\n\nCheck the render method of `' + name + '`.';
1912 }
1913 }
1914
1915 return '';
1916}
1917
1918function getSourceInfoErrorAddendum(source) {
1919 if (source !== undefined) {
1920 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1921 var lineNumber = source.lineNumber;
1922 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1923 }
1924
1925 return '';
1926}
1927
1928function getSourceInfoErrorAddendumForProps(elementProps) {
1929 if (elementProps !== null && elementProps !== undefined) {
1930 return getSourceInfoErrorAddendum(elementProps.__source);
1931 }
1932
1933 return '';
1934}
1935/**
1936 * Warn if there's no key explicitly set on dynamic arrays of children or
1937 * object keys are not valid. This allows us to keep track of children between
1938 * updates.
1939 */
1940
1941
1942var ownerHasKeyUseWarning = {};
1943
1944function getCurrentComponentErrorInfo(parentType) {
1945 var info = getDeclarationErrorAddendum();
1946
1947 if (!info) {
1948 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1949
1950 if (parentName) {
1951 info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1952 }
1953 }
1954
1955 return info;
1956}
1957/**
1958 * Warn if the element doesn't have an explicit key assigned to it.
1959 * This element is in an array. The array could grow and shrink or be
1960 * reordered. All children that haven't already been validated are required to
1961 * have a "key" property assigned to it. Error statuses are cached so a warning
1962 * will only be shown once.
1963 *
1964 * @internal
1965 * @param {ReactElement} element Element that requires a key.
1966 * @param {*} parentType element's parent's type.
1967 */
1968
1969
1970function validateExplicitKey(element, parentType) {
1971 if (!element._store || element._store.validated || element.key != null) {
1972 return;
1973 }
1974
1975 element._store.validated = true;
1976 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1977
1978 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1979 return;
1980 }
1981
1982 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1983 // property, it may be the creator of the child that's responsible for
1984 // assigning it a key.
1985
1986 var childOwner = '';
1987
1988 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1989 // Give the component that originally created this child.
1990 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
1991 }
1992
1993 setCurrentlyValidatingElement(element);
1994
1995 {
1996 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);
1997 }
1998
1999 setCurrentlyValidatingElement(null);
2000}
2001/**
2002 * Ensure that every element either is passed in a static location, in an
2003 * array with an explicit keys property defined, or in an object literal
2004 * with valid key property.
2005 *
2006 * @internal
2007 * @param {ReactNode} node Statically passed child of any type.
2008 * @param {*} parentType node's parent's type.
2009 */
2010
2011
2012function validateChildKeys(node, parentType) {
2013 if (typeof node !== 'object') {
2014 return;
2015 }
2016
2017 if (Array.isArray(node)) {
2018 for (var i = 0; i < node.length; i++) {
2019 var child = node[i];
2020
2021 if (isValidElement(child)) {
2022 validateExplicitKey(child, parentType);
2023 }
2024 }
2025 } else if (isValidElement(node)) {
2026 // This element was passed in a valid location.
2027 if (node._store) {
2028 node._store.validated = true;
2029 }
2030 } else if (node) {
2031 var iteratorFn = getIteratorFn(node);
2032
2033 if (typeof iteratorFn === 'function') {
2034 // Entry iterators used to provide implicit keys,
2035 // but now we print a separate warning for them later.
2036 if (iteratorFn !== node.entries) {
2037 var iterator = iteratorFn.call(node);
2038 var step;
2039
2040 while (!(step = iterator.next()).done) {
2041 if (isValidElement(step.value)) {
2042 validateExplicitKey(step.value, parentType);
2043 }
2044 }
2045 }
2046 }
2047 }
2048}
2049/**
2050 * Given an element, validate that its props follow the propTypes definition,
2051 * provided by the type.
2052 *
2053 * @param {ReactElement} element
2054 */
2055
2056
2057function validatePropTypes(element) {
2058 var type = element.type;
2059
2060 if (type === null || type === undefined || typeof type === 'string') {
2061 return;
2062 }
2063
2064 var name = getComponentName(type);
2065 var propTypes;
2066
2067 if (typeof type === 'function') {
2068 propTypes = type.propTypes;
2069 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2070 // Inner props are checked in the reconciler.
2071 type.$$typeof === REACT_MEMO_TYPE)) {
2072 propTypes = type.propTypes;
2073 } else {
2074 return;
2075 }
2076
2077 if (propTypes) {
2078 setCurrentlyValidatingElement(element);
2079 checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
2080 setCurrentlyValidatingElement(null);
2081 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2082 propTypesMisspellWarningShown = true;
2083 warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
2084 }
2085
2086 if (typeof type.getDefaultProps === 'function') {
2087 !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
2088 }
2089}
2090/**
2091 * Given a fragment, validate that it can only be provided with fragment props
2092 * @param {ReactElement} fragment
2093 */
2094
2095
2096function validateFragmentProps(fragment) {
2097 setCurrentlyValidatingElement(fragment);
2098 var keys = Object.keys(fragment.props);
2099
2100 for (var i = 0; i < keys.length; i++) {
2101 var key = keys[i];
2102
2103 if (key !== 'children' && key !== 'key') {
2104 warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2105 break;
2106 }
2107 }
2108
2109 if (fragment.ref !== null) {
2110 warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
2111 }
2112
2113 setCurrentlyValidatingElement(null);
2114}
2115
2116function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
2117 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2118 // succeed and there will likely be errors in render.
2119
2120 if (!validType) {
2121 var info = '';
2122
2123 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2124 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.";
2125 }
2126
2127 var sourceInfo = getSourceInfoErrorAddendum(source);
2128
2129 if (sourceInfo) {
2130 info += sourceInfo;
2131 } else {
2132 info += getDeclarationErrorAddendum();
2133 }
2134
2135 var typeString;
2136
2137 if (type === null) {
2138 typeString = 'null';
2139 } else if (Array.isArray(type)) {
2140 typeString = 'array';
2141 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2142 typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2143 info = ' Did you accidentally export a JSX literal instead of a component?';
2144 } else {
2145 typeString = typeof type;
2146 }
2147
2148 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);
2149 }
2150
2151 var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
2152 // TODO: Drop this when these are no longer allowed as the type argument.
2153
2154 if (element == null) {
2155 return element;
2156 } // Skip key warning if the type isn't valid since our key validation logic
2157 // doesn't expect a non-string/function type and can throw confusing errors.
2158 // We don't want exception behavior to differ between dev and prod.
2159 // (Rendering will throw with a helpful message and as soon as the type is
2160 // fixed, the key warnings will appear.)
2161
2162
2163 if (validType) {
2164 var children = props.children;
2165
2166 if (children !== undefined) {
2167 if (isStaticChildren) {
2168 if (Array.isArray(children)) {
2169 for (var i = 0; i < children.length; i++) {
2170 validateChildKeys(children[i], type);
2171 }
2172
2173 if (Object.freeze) {
2174 Object.freeze(children);
2175 }
2176 } else {
2177 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.');
2178 }
2179 } else {
2180 validateChildKeys(children, type);
2181 }
2182 }
2183 }
2184
2185 if (hasOwnProperty$2.call(props, 'key')) {
2186 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} />');
2187 }
2188
2189 if (type === REACT_FRAGMENT_TYPE) {
2190 validateFragmentProps(element);
2191 } else {
2192 validatePropTypes(element);
2193 }
2194
2195 return element;
2196} // These two functions exist to still get child warnings in dev
2197// even with the prod transform. This means that jsxDEV is purely
2198// opt-in behavior for better messages but that we won't stop
2199// giving you warnings if you use production apis.
2200
2201function jsxWithValidationStatic(type, props, key) {
2202 return jsxWithValidation(type, props, key, true);
2203}
2204function jsxWithValidationDynamic(type, props, key) {
2205 return jsxWithValidation(type, props, key, false);
2206}
2207function createElementWithValidation(type, props, children) {
2208 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2209 // succeed and there will likely be errors in render.
2210
2211 if (!validType) {
2212 var info = '';
2213
2214 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2215 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.";
2216 }
2217
2218 var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2219
2220 if (sourceInfo) {
2221 info += sourceInfo;
2222 } else {
2223 info += getDeclarationErrorAddendum();
2224 }
2225
2226 var typeString;
2227
2228 if (type === null) {
2229 typeString = 'null';
2230 } else if (Array.isArray(type)) {
2231 typeString = 'array';
2232 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2233 typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2234 info = ' Did you accidentally export a JSX literal instead of a component?';
2235 } else {
2236 typeString = typeof type;
2237 }
2238
2239 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);
2240 }
2241
2242 var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2243 // TODO: Drop this when these are no longer allowed as the type argument.
2244
2245 if (element == null) {
2246 return element;
2247 } // Skip key warning if the type isn't valid since our key validation logic
2248 // doesn't expect a non-string/function type and can throw confusing errors.
2249 // We don't want exception behavior to differ between dev and prod.
2250 // (Rendering will throw with a helpful message and as soon as the type is
2251 // fixed, the key warnings will appear.)
2252
2253
2254 if (validType) {
2255 for (var i = 2; i < arguments.length; i++) {
2256 validateChildKeys(arguments[i], type);
2257 }
2258 }
2259
2260 if (type === REACT_FRAGMENT_TYPE) {
2261 validateFragmentProps(element);
2262 } else {
2263 validatePropTypes(element);
2264 }
2265
2266 return element;
2267}
2268function createFactoryWithValidation(type) {
2269 var validatedFactory = createElementWithValidation.bind(null, type);
2270 validatedFactory.type = type; // Legacy hook: remove it
2271
2272 {
2273 Object.defineProperty(validatedFactory, 'type', {
2274 enumerable: false,
2275 get: function () {
2276 lowPriorityWarningWithoutStack$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2277 Object.defineProperty(this, 'type', {
2278 value: type
2279 });
2280 return type;
2281 }
2282 });
2283 }
2284
2285 return validatedFactory;
2286}
2287function cloneElementWithValidation(element, props, children) {
2288 var newElement = cloneElement.apply(this, arguments);
2289
2290 for (var i = 2; i < arguments.length; i++) {
2291 validateChildKeys(arguments[i], newElement.type);
2292 }
2293
2294 validatePropTypes(newElement);
2295 return newElement;
2296}
2297
2298var enableSchedulerDebugging = false;
2299var enableIsInputPending = false;
2300var enableProfiling = true;
2301
2302var requestHostCallback;
2303
2304var requestHostTimeout;
2305var cancelHostTimeout;
2306var shouldYieldToHost;
2307var requestPaint;
2308var getCurrentTime;
2309var forceFrameRate;
2310
2311if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive
2312// implementation using setTimeout.
2313typeof window === 'undefined' || // Check if MessageChannel is supported, too.
2314typeof MessageChannel !== 'function') {
2315 // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
2316 // fallback to a naive implementation.
2317 var _callback = null;
2318 var _timeoutID = null;
2319
2320 var _flushCallback = function () {
2321 if (_callback !== null) {
2322 try {
2323 var currentTime = getCurrentTime();
2324 var hasRemainingTime = true;
2325
2326 _callback(hasRemainingTime, currentTime);
2327
2328 _callback = null;
2329 } catch (e) {
2330 setTimeout(_flushCallback, 0);
2331 throw e;
2332 }
2333 }
2334 };
2335
2336 var initialTime = Date.now();
2337
2338 getCurrentTime = function () {
2339 return Date.now() - initialTime;
2340 };
2341
2342 requestHostCallback = function (cb) {
2343 if (_callback !== null) {
2344 // Protect against re-entrancy.
2345 setTimeout(requestHostCallback, 0, cb);
2346 } else {
2347 _callback = cb;
2348 setTimeout(_flushCallback, 0);
2349 }
2350 };
2351
2352 requestHostTimeout = function (cb, ms) {
2353 _timeoutID = setTimeout(cb, ms);
2354 };
2355
2356 cancelHostTimeout = function () {
2357 clearTimeout(_timeoutID);
2358 };
2359
2360 shouldYieldToHost = function () {
2361 return false;
2362 };
2363
2364 requestPaint = forceFrameRate = function () {};
2365} else {
2366 // Capture local references to native APIs, in case a polyfill overrides them.
2367 var performance = window.performance;
2368 var _Date = window.Date;
2369 var _setTimeout = window.setTimeout;
2370 var _clearTimeout = window.clearTimeout;
2371
2372 if (typeof console !== 'undefined') {
2373 // TODO: Scheduler no longer requires these methods to be polyfilled. But
2374 // maybe we want to continue warning if they don't exist, to preserve the
2375 // option to rely on it in the future?
2376 var requestAnimationFrame = window.requestAnimationFrame;
2377 var cancelAnimationFrame = window.cancelAnimationFrame; // TODO: Remove fb.me link
2378
2379 if (typeof requestAnimationFrame !== 'function') {
2380 console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
2381 }
2382
2383 if (typeof cancelAnimationFrame !== 'function') {
2384 console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
2385 }
2386 }
2387
2388 if (typeof performance === 'object' && typeof performance.now === 'function') {
2389 getCurrentTime = function () {
2390 return performance.now();
2391 };
2392 } else {
2393 var _initialTime = _Date.now();
2394
2395 getCurrentTime = function () {
2396 return _Date.now() - _initialTime;
2397 };
2398 }
2399
2400 var isMessageLoopRunning = false;
2401 var scheduledHostCallback = null;
2402 var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
2403 // thread, like user events. By default, it yields multiple times per frame.
2404 // It does not attempt to align with frame boundaries, since most tasks don't
2405 // need to be frame aligned; for those that do, use requestAnimationFrame.
2406
2407 var yieldInterval = 5;
2408 var deadline = 0; // TODO: Make this configurable
2409 // TODO: Adjust this based on priority?
2410
2411 var maxYieldInterval = 300;
2412 var needsPaint = false;
2413
2414 if (enableIsInputPending && navigator !== undefined && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined) {
2415 var scheduling = navigator.scheduling;
2416
2417 shouldYieldToHost = function () {
2418 var currentTime = getCurrentTime();
2419
2420 if (currentTime >= deadline) {
2421 // There's no time left. We may want to yield control of the main
2422 // thread, so the browser can perform high priority tasks. The main ones
2423 // are painting and user input. If there's a pending paint or a pending
2424 // input, then we should yield. But if there's neither, then we can
2425 // yield less often while remaining responsive. We'll eventually yield
2426 // regardless, since there could be a pending paint that wasn't
2427 // accompanied by a call to `requestPaint`, or other main thread tasks
2428 // like network events.
2429 if (needsPaint || scheduling.isInputPending()) {
2430 // There is either a pending paint or a pending input.
2431 return true;
2432 } // There's no pending input. Only yield if we've reached the max
2433 // yield interval.
2434
2435
2436 return currentTime >= maxYieldInterval;
2437 } else {
2438 // There's still time left in the frame.
2439 return false;
2440 }
2441 };
2442
2443 requestPaint = function () {
2444 needsPaint = true;
2445 };
2446 } else {
2447 // `isInputPending` is not available. Since we have no way of knowing if
2448 // there's pending input, always yield at the end of the frame.
2449 shouldYieldToHost = function () {
2450 return getCurrentTime() >= deadline;
2451 }; // Since we yield every frame regardless, `requestPaint` has no effect.
2452
2453
2454 requestPaint = function () {};
2455 }
2456
2457 forceFrameRate = function (fps) {
2458 if (fps < 0 || fps > 125) {
2459 console.error('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported');
2460 return;
2461 }
2462
2463 if (fps > 0) {
2464 yieldInterval = Math.floor(1000 / fps);
2465 } else {
2466 // reset the framerate
2467 yieldInterval = 5;
2468 }
2469 };
2470
2471 var performWorkUntilDeadline = function () {
2472 if (scheduledHostCallback !== null) {
2473 var currentTime = getCurrentTime(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync
2474 // cycle. This means there's always time remaining at the beginning of
2475 // the message event.
2476
2477 deadline = currentTime + yieldInterval;
2478 var hasTimeRemaining = true;
2479
2480 try {
2481 var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
2482
2483 if (!hasMoreWork) {
2484 isMessageLoopRunning = false;
2485 scheduledHostCallback = null;
2486 } else {
2487 // If there's more work, schedule the next message event at the end
2488 // of the preceding one.
2489 port.postMessage(null);
2490 }
2491 } catch (error) {
2492 // If a scheduler task throws, exit the current browser task so the
2493 // error can be observed.
2494 port.postMessage(null);
2495 throw error;
2496 }
2497 } else {
2498 isMessageLoopRunning = false;
2499 } // Yielding to the browser will give it a chance to paint, so we can
2500 // reset this.
2501
2502
2503 needsPaint = false;
2504 };
2505
2506 var channel = new MessageChannel();
2507 var port = channel.port2;
2508 channel.port1.onmessage = performWorkUntilDeadline;
2509
2510 requestHostCallback = function (callback) {
2511 scheduledHostCallback = callback;
2512
2513 if (!isMessageLoopRunning) {
2514 isMessageLoopRunning = true;
2515 port.postMessage(null);
2516 }
2517 };
2518
2519 requestHostTimeout = function (callback, ms) {
2520 taskTimeoutID = _setTimeout(function () {
2521 callback(getCurrentTime());
2522 }, ms);
2523 };
2524
2525 cancelHostTimeout = function () {
2526 _clearTimeout(taskTimeoutID);
2527
2528 taskTimeoutID = -1;
2529 };
2530}
2531
2532function push(heap, node) {
2533 var index = heap.length;
2534 heap.push(node);
2535 siftUp(heap, node, index);
2536}
2537function peek(heap) {
2538 var first = heap[0];
2539 return first === undefined ? null : first;
2540}
2541function pop(heap) {
2542 var first = heap[0];
2543
2544 if (first !== undefined) {
2545 var last = heap.pop();
2546
2547 if (last !== first) {
2548 heap[0] = last;
2549 siftDown(heap, last, 0);
2550 }
2551
2552 return first;
2553 } else {
2554 return null;
2555 }
2556}
2557
2558function siftUp(heap, node, i) {
2559 var index = i;
2560
2561 while (true) {
2562 var parentIndex = Math.floor((index - 1) / 2);
2563 var parent = heap[parentIndex];
2564
2565 if (parent !== undefined && compare(parent, node) > 0) {
2566 // The parent is larger. Swap positions.
2567 heap[parentIndex] = node;
2568 heap[index] = parent;
2569 index = parentIndex;
2570 } else {
2571 // The parent is smaller. Exit.
2572 return;
2573 }
2574 }
2575}
2576
2577function siftDown(heap, node, i) {
2578 var index = i;
2579 var length = heap.length;
2580
2581 while (index < length) {
2582 var leftIndex = (index + 1) * 2 - 1;
2583 var left = heap[leftIndex];
2584 var rightIndex = leftIndex + 1;
2585 var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
2586
2587 if (left !== undefined && compare(left, node) < 0) {
2588 if (right !== undefined && compare(right, left) < 0) {
2589 heap[index] = right;
2590 heap[rightIndex] = node;
2591 index = rightIndex;
2592 } else {
2593 heap[index] = left;
2594 heap[leftIndex] = node;
2595 index = leftIndex;
2596 }
2597 } else if (right !== undefined && compare(right, node) < 0) {
2598 heap[index] = right;
2599 heap[rightIndex] = node;
2600 index = rightIndex;
2601 } else {
2602 // Neither child is smaller. Exit.
2603 return;
2604 }
2605 }
2606}
2607
2608function compare(a, b) {
2609 // Compare sort index first, then task id.
2610 var diff = a.sortIndex - b.sortIndex;
2611 return diff !== 0 ? diff : a.id - b.id;
2612}
2613
2614// TODO: Use symbols?
2615var NoPriority = 0;
2616var ImmediatePriority = 1;
2617var UserBlockingPriority = 2;
2618var NormalPriority = 3;
2619var LowPriority = 4;
2620var IdlePriority = 5;
2621
2622var runIdCounter = 0;
2623var mainThreadIdCounter = 0;
2624var profilingStateSize = 4;
2625var sharedProfilingBuffer = enableProfiling ? // $FlowFixMe Flow doesn't know about SharedArrayBuffer
2626typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer
2627typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9
2628: null;
2629var profilingState = enableProfiling && sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks
2630
2631var PRIORITY = 0;
2632var CURRENT_TASK_ID = 1;
2633var CURRENT_RUN_ID = 2;
2634var QUEUE_SIZE = 3;
2635
2636if (enableProfiling) {
2637 profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue
2638 // array might include canceled tasks.
2639
2640 profilingState[QUEUE_SIZE] = 0;
2641 profilingState[CURRENT_TASK_ID] = 0;
2642} // Bytes per element is 4
2643
2644
2645var INITIAL_EVENT_LOG_SIZE = 131072;
2646var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes
2647
2648var eventLogSize = 0;
2649var eventLogBuffer = null;
2650var eventLog = null;
2651var eventLogIndex = 0;
2652var TaskStartEvent = 1;
2653var TaskCompleteEvent = 2;
2654var TaskErrorEvent = 3;
2655var TaskCancelEvent = 4;
2656var TaskRunEvent = 5;
2657var TaskYieldEvent = 6;
2658var SchedulerSuspendEvent = 7;
2659var SchedulerResumeEvent = 8;
2660
2661function logEvent(entries) {
2662 if (eventLog !== null) {
2663 var offset = eventLogIndex;
2664 eventLogIndex += entries.length;
2665
2666 if (eventLogIndex + 1 > eventLogSize) {
2667 eventLogSize *= 2;
2668
2669 if (eventLogSize > MAX_EVENT_LOG_SIZE) {
2670 console.error("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.');
2671 stopLoggingProfilingEvents();
2672 return;
2673 }
2674
2675 var newEventLog = new Int32Array(eventLogSize * 4);
2676 newEventLog.set(eventLog);
2677 eventLogBuffer = newEventLog.buffer;
2678 eventLog = newEventLog;
2679 }
2680
2681 eventLog.set(entries, offset);
2682 }
2683}
2684
2685function startLoggingProfilingEvents() {
2686 eventLogSize = INITIAL_EVENT_LOG_SIZE;
2687 eventLogBuffer = new ArrayBuffer(eventLogSize * 4);
2688 eventLog = new Int32Array(eventLogBuffer);
2689 eventLogIndex = 0;
2690}
2691function stopLoggingProfilingEvents() {
2692 var buffer = eventLogBuffer;
2693 eventLogSize = 0;
2694 eventLogBuffer = null;
2695 eventLog = null;
2696 eventLogIndex = 0;
2697 return buffer;
2698}
2699function markTaskStart(task, ms) {
2700 if (enableProfiling) {
2701 profilingState[QUEUE_SIZE]++;
2702
2703 if (eventLog !== null) {
2704 // performance.now returns a float, representing milliseconds. When the
2705 // event is logged, it's coerced to an int. Convert to microseconds to
2706 // maintain extra degrees of precision.
2707 logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]);
2708 }
2709 }
2710}
2711function markTaskCompleted(task, ms) {
2712 if (enableProfiling) {
2713 profilingState[PRIORITY] = NoPriority;
2714 profilingState[CURRENT_TASK_ID] = 0;
2715 profilingState[QUEUE_SIZE]--;
2716
2717 if (eventLog !== null) {
2718 logEvent([TaskCompleteEvent, ms * 1000, task.id]);
2719 }
2720 }
2721}
2722function markTaskCanceled(task, ms) {
2723 if (enableProfiling) {
2724 profilingState[QUEUE_SIZE]--;
2725
2726 if (eventLog !== null) {
2727 logEvent([TaskCancelEvent, ms * 1000, task.id]);
2728 }
2729 }
2730}
2731function markTaskErrored(task, ms) {
2732 if (enableProfiling) {
2733 profilingState[PRIORITY] = NoPriority;
2734 profilingState[CURRENT_TASK_ID] = 0;
2735 profilingState[QUEUE_SIZE]--;
2736
2737 if (eventLog !== null) {
2738 logEvent([TaskErrorEvent, ms * 1000, task.id]);
2739 }
2740 }
2741}
2742function markTaskRun(task, ms) {
2743 if (enableProfiling) {
2744 runIdCounter++;
2745 profilingState[PRIORITY] = task.priorityLevel;
2746 profilingState[CURRENT_TASK_ID] = task.id;
2747 profilingState[CURRENT_RUN_ID] = runIdCounter;
2748
2749 if (eventLog !== null) {
2750 logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]);
2751 }
2752 }
2753}
2754function markTaskYield(task, ms) {
2755 if (enableProfiling) {
2756 profilingState[PRIORITY] = NoPriority;
2757 profilingState[CURRENT_TASK_ID] = 0;
2758 profilingState[CURRENT_RUN_ID] = 0;
2759
2760 if (eventLog !== null) {
2761 logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
2762 }
2763 }
2764}
2765function markSchedulerSuspended(ms) {
2766 if (enableProfiling) {
2767 mainThreadIdCounter++;
2768
2769 if (eventLog !== null) {
2770 logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]);
2771 }
2772 }
2773}
2774function markSchedulerUnsuspended(ms) {
2775 if (enableProfiling) {
2776 if (eventLog !== null) {
2777 logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
2778 }
2779 }
2780}
2781
2782/* eslint-disable no-var */
2783// Math.pow(2, 30) - 1
2784// 0b111111111111111111111111111111
2785
2786var maxSigned31BitInt = 1073741823; // Times out immediately
2787
2788var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
2789
2790var USER_BLOCKING_PRIORITY = 250;
2791var NORMAL_PRIORITY_TIMEOUT = 5000;
2792var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
2793
2794var IDLE_PRIORITY = maxSigned31BitInt; // Tasks are stored on a min heap
2795
2796var taskQueue = [];
2797var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
2798
2799var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
2800
2801var isSchedulerPaused = false;
2802var currentTask = null;
2803var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
2804
2805var isPerformingWork = false;
2806var isHostCallbackScheduled = false;
2807var isHostTimeoutScheduled = false;
2808
2809function advanceTimers(currentTime) {
2810 // Check for tasks that are no longer delayed and add them to the queue.
2811 var timer = peek(timerQueue);
2812
2813 while (timer !== null) {
2814 if (timer.callback === null) {
2815 // Timer was cancelled.
2816 pop(timerQueue);
2817 } else if (timer.startTime <= currentTime) {
2818 // Timer fired. Transfer to the task queue.
2819 pop(timerQueue);
2820 timer.sortIndex = timer.expirationTime;
2821 push(taskQueue, timer);
2822
2823 if (enableProfiling) {
2824 markTaskStart(timer, currentTime);
2825 timer.isQueued = true;
2826 }
2827 } else {
2828 // Remaining timers are pending.
2829 return;
2830 }
2831
2832 timer = peek(timerQueue);
2833 }
2834}
2835
2836function handleTimeout(currentTime) {
2837 isHostTimeoutScheduled = false;
2838 advanceTimers(currentTime);
2839
2840 if (!isHostCallbackScheduled) {
2841 if (peek(taskQueue) !== null) {
2842 isHostCallbackScheduled = true;
2843 requestHostCallback(flushWork);
2844 } else {
2845 var firstTimer = peek(timerQueue);
2846
2847 if (firstTimer !== null) {
2848 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
2849 }
2850 }
2851 }
2852}
2853
2854function flushWork(hasTimeRemaining, initialTime) {
2855 if (enableProfiling) {
2856 markSchedulerUnsuspended(initialTime);
2857 } // We'll need a host callback the next time work is scheduled.
2858
2859
2860 isHostCallbackScheduled = false;
2861
2862 if (isHostTimeoutScheduled) {
2863 // We scheduled a timeout but it's no longer needed. Cancel it.
2864 isHostTimeoutScheduled = false;
2865 cancelHostTimeout();
2866 }
2867
2868 isPerformingWork = true;
2869 var previousPriorityLevel = currentPriorityLevel;
2870
2871 try {
2872 if (enableProfiling) {
2873 try {
2874 return workLoop(hasTimeRemaining, initialTime);
2875 } catch (error) {
2876 if (currentTask !== null) {
2877 var currentTime = getCurrentTime();
2878 markTaskErrored(currentTask, currentTime);
2879 currentTask.isQueued = false;
2880 }
2881
2882 throw error;
2883 }
2884 } else {
2885 // No catch in prod codepath.
2886 return workLoop(hasTimeRemaining, initialTime);
2887 }
2888 } finally {
2889 currentTask = null;
2890 currentPriorityLevel = previousPriorityLevel;
2891 isPerformingWork = false;
2892
2893 if (enableProfiling) {
2894 var _currentTime = getCurrentTime();
2895
2896 markSchedulerSuspended(_currentTime);
2897 }
2898 }
2899}
2900
2901function workLoop(hasTimeRemaining, initialTime) {
2902 var currentTime = initialTime;
2903 advanceTimers(currentTime);
2904 currentTask = peek(taskQueue);
2905
2906 while (currentTask !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
2907 if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
2908 // This currentTask hasn't expired, and we've reached the deadline.
2909 break;
2910 }
2911
2912 var callback = currentTask.callback;
2913
2914 if (callback !== null) {
2915 currentTask.callback = null;
2916 currentPriorityLevel = currentTask.priorityLevel;
2917 var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
2918 markTaskRun(currentTask, currentTime);
2919 var continuationCallback = callback(didUserCallbackTimeout);
2920 currentTime = getCurrentTime();
2921
2922 if (typeof continuationCallback === 'function') {
2923 currentTask.callback = continuationCallback;
2924 markTaskYield(currentTask, currentTime);
2925 } else {
2926 if (enableProfiling) {
2927 markTaskCompleted(currentTask, currentTime);
2928 currentTask.isQueued = false;
2929 }
2930
2931 if (currentTask === peek(taskQueue)) {
2932 pop(taskQueue);
2933 }
2934 }
2935
2936 advanceTimers(currentTime);
2937 } else {
2938 pop(taskQueue);
2939 }
2940
2941 currentTask = peek(taskQueue);
2942 } // Return whether there's additional work
2943
2944
2945 if (currentTask !== null) {
2946 return true;
2947 } else {
2948 var firstTimer = peek(timerQueue);
2949
2950 if (firstTimer !== null) {
2951 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
2952 }
2953
2954 return false;
2955 }
2956}
2957
2958function unstable_runWithPriority(priorityLevel, eventHandler) {
2959 switch (priorityLevel) {
2960 case ImmediatePriority:
2961 case UserBlockingPriority:
2962 case NormalPriority:
2963 case LowPriority:
2964 case IdlePriority:
2965 break;
2966
2967 default:
2968 priorityLevel = NormalPriority;
2969 }
2970
2971 var previousPriorityLevel = currentPriorityLevel;
2972 currentPriorityLevel = priorityLevel;
2973
2974 try {
2975 return eventHandler();
2976 } finally {
2977 currentPriorityLevel = previousPriorityLevel;
2978 }
2979}
2980
2981function unstable_next(eventHandler) {
2982 var priorityLevel;
2983
2984 switch (currentPriorityLevel) {
2985 case ImmediatePriority:
2986 case UserBlockingPriority:
2987 case NormalPriority:
2988 // Shift down to normal priority
2989 priorityLevel = NormalPriority;
2990 break;
2991
2992 default:
2993 // Anything lower than normal priority should remain at the current level.
2994 priorityLevel = currentPriorityLevel;
2995 break;
2996 }
2997
2998 var previousPriorityLevel = currentPriorityLevel;
2999 currentPriorityLevel = priorityLevel;
3000
3001 try {
3002 return eventHandler();
3003 } finally {
3004 currentPriorityLevel = previousPriorityLevel;
3005 }
3006}
3007
3008function unstable_wrapCallback(callback) {
3009 var parentPriorityLevel = currentPriorityLevel;
3010 return function () {
3011 // This is a fork of runWithPriority, inlined for performance.
3012 var previousPriorityLevel = currentPriorityLevel;
3013 currentPriorityLevel = parentPriorityLevel;
3014
3015 try {
3016 return callback.apply(this, arguments);
3017 } finally {
3018 currentPriorityLevel = previousPriorityLevel;
3019 }
3020 };
3021}
3022
3023function timeoutForPriorityLevel(priorityLevel) {
3024 switch (priorityLevel) {
3025 case ImmediatePriority:
3026 return IMMEDIATE_PRIORITY_TIMEOUT;
3027
3028 case UserBlockingPriority:
3029 return USER_BLOCKING_PRIORITY;
3030
3031 case IdlePriority:
3032 return IDLE_PRIORITY;
3033
3034 case LowPriority:
3035 return LOW_PRIORITY_TIMEOUT;
3036
3037 case NormalPriority:
3038 default:
3039 return NORMAL_PRIORITY_TIMEOUT;
3040 }
3041}
3042
3043function unstable_scheduleCallback(priorityLevel, callback, options) {
3044 var currentTime = getCurrentTime();
3045 var startTime;
3046 var timeout;
3047
3048 if (typeof options === 'object' && options !== null) {
3049 var delay = options.delay;
3050
3051 if (typeof delay === 'number' && delay > 0) {
3052 startTime = currentTime + delay;
3053 } else {
3054 startTime = currentTime;
3055 }
3056
3057 timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel);
3058 } else {
3059 timeout = timeoutForPriorityLevel(priorityLevel);
3060 startTime = currentTime;
3061 }
3062
3063 var expirationTime = startTime + timeout;
3064 var newTask = {
3065 id: taskIdCounter++,
3066 callback: callback,
3067 priorityLevel: priorityLevel,
3068 startTime: startTime,
3069 expirationTime: expirationTime,
3070 sortIndex: -1
3071 };
3072
3073 if (enableProfiling) {
3074 newTask.isQueued = false;
3075 }
3076
3077 if (startTime > currentTime) {
3078 // This is a delayed task.
3079 newTask.sortIndex = startTime;
3080 push(timerQueue, newTask);
3081
3082 if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
3083 // All tasks are delayed, and this is the task with the earliest delay.
3084 if (isHostTimeoutScheduled) {
3085 // Cancel an existing timeout.
3086 cancelHostTimeout();
3087 } else {
3088 isHostTimeoutScheduled = true;
3089 } // Schedule a timeout.
3090
3091
3092 requestHostTimeout(handleTimeout, startTime - currentTime);
3093 }
3094 } else {
3095 newTask.sortIndex = expirationTime;
3096 push(taskQueue, newTask);
3097
3098 if (enableProfiling) {
3099 markTaskStart(newTask, currentTime);
3100 newTask.isQueued = true;
3101 } // Schedule a host callback, if needed. If we're already performing work,
3102 // wait until the next time we yield.
3103
3104
3105 if (!isHostCallbackScheduled && !isPerformingWork) {
3106 isHostCallbackScheduled = true;
3107 requestHostCallback(flushWork);
3108 }
3109 }
3110
3111 return newTask;
3112}
3113
3114function unstable_pauseExecution() {
3115 isSchedulerPaused = true;
3116}
3117
3118function unstable_continueExecution() {
3119 isSchedulerPaused = false;
3120
3121 if (!isHostCallbackScheduled && !isPerformingWork) {
3122 isHostCallbackScheduled = true;
3123 requestHostCallback(flushWork);
3124 }
3125}
3126
3127function unstable_getFirstCallbackNode() {
3128 return peek(taskQueue);
3129}
3130
3131function unstable_cancelCallback(task) {
3132 if (enableProfiling) {
3133 if (task.isQueued) {
3134 var currentTime = getCurrentTime();
3135 markTaskCanceled(task, currentTime);
3136 task.isQueued = false;
3137 }
3138 } // Null out the callback to indicate the task has been canceled. (Can't
3139 // remove from the queue because you can't remove arbitrary nodes from an
3140 // array based heap, only the first one.)
3141
3142
3143 task.callback = null;
3144}
3145
3146function unstable_getCurrentPriorityLevel() {
3147 return currentPriorityLevel;
3148}
3149
3150function unstable_shouldYield() {
3151 var currentTime = getCurrentTime();
3152 advanceTimers(currentTime);
3153 var firstTask = peek(taskQueue);
3154 return firstTask !== currentTask && currentTask !== null && firstTask !== null && firstTask.callback !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost();
3155}
3156
3157var unstable_requestPaint = requestPaint;
3158var unstable_Profiling = enableProfiling ? {
3159 startLoggingProfilingEvents: startLoggingProfilingEvents,
3160 stopLoggingProfilingEvents: stopLoggingProfilingEvents,
3161 sharedProfilingBuffer: sharedProfilingBuffer
3162} : null;
3163
3164
3165
3166var Scheduler = Object.freeze({
3167 unstable_ImmediatePriority: ImmediatePriority,
3168 unstable_UserBlockingPriority: UserBlockingPriority,
3169 unstable_NormalPriority: NormalPriority,
3170 unstable_IdlePriority: IdlePriority,
3171 unstable_LowPriority: LowPriority,
3172 unstable_runWithPriority: unstable_runWithPriority,
3173 unstable_next: unstable_next,
3174 unstable_scheduleCallback: unstable_scheduleCallback,
3175 unstable_cancelCallback: unstable_cancelCallback,
3176 unstable_wrapCallback: unstable_wrapCallback,
3177 unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
3178 unstable_shouldYield: unstable_shouldYield,
3179 unstable_requestPaint: unstable_requestPaint,
3180 unstable_continueExecution: unstable_continueExecution,
3181 unstable_pauseExecution: unstable_pauseExecution,
3182 unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
3183 get unstable_now () { return getCurrentTime; },
3184 get unstable_forceFrameRate () { return forceFrameRate; },
3185 unstable_Profiling: unstable_Profiling
3186});
3187
3188// Helps identify side effects in render-phase lifecycle hooks and setState
3189// reducers by double invoking them in Strict Mode.
3190
3191 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
3192// replay the begin phase of a failed component inside invokeGuardedCallback.
3193
3194 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
3195
3196 // Gather advanced timing metrics for Profiler subtrees.
3197
3198 // Trace which interactions trigger each commit.
3199
3200var enableSchedulerTracing = true; // SSR experiments
3201
3202
3203 // Only used in www builds.
3204
3205 // Only used in www builds.
3206
3207 // Disable javascript: URL strings in href for XSS protection.
3208
3209 // React Fire: prevent the value and checked attributes from syncing
3210// with their related DOM properties
3211
3212 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
3213// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
3214
3215var exposeConcurrentModeAPIs = false;
3216 // Experimental React Flare event system and event components support.
3217
3218var enableFlareAPI = false; // Experimental Host Component support.
3219
3220var enableFundamentalAPI = false; // Experimental Scope support.
3221
3222var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
3223
3224var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
3225// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
3226
3227 // For tests, we flush suspense fallbacks in an act scope;
3228// *except* in some of our own tests, where we test incremental loading states.
3229
3230 // Add a callback property to suspense to notify which promises are currently
3231// in the update queue. This allows reporting and tracing of what is causing
3232// the user to see a loading state.
3233// Also allows hydration callbacks to fire when a dehydrated boundary gets
3234// hydrated or deleted.
3235
3236 // Part of the simplification of React.createElement so we can eventually move
3237// from React.createElement to React.jsx
3238// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
3239
3240
3241
3242
3243
3244 // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
3245
3246var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs.
3247
3248var interactionIDCounter = 0;
3249var threadIDCounter = 0; // Set of currently traced interactions.
3250// Interactions "stack"–
3251// Meaning that newly traced interactions are appended to the previously active set.
3252// When an interaction goes out of scope, the previous set (if any) is restored.
3253
3254var interactionsRef = null; // Listener(s) to notify when interactions begin and end.
3255
3256var subscriberRef = null;
3257
3258if (enableSchedulerTracing) {
3259 interactionsRef = {
3260 current: new Set()
3261 };
3262 subscriberRef = {
3263 current: null
3264 };
3265}
3266
3267function unstable_clear(callback) {
3268 if (!enableSchedulerTracing) {
3269 return callback();
3270 }
3271
3272 var prevInteractions = interactionsRef.current;
3273 interactionsRef.current = new Set();
3274
3275 try {
3276 return callback();
3277 } finally {
3278 interactionsRef.current = prevInteractions;
3279 }
3280}
3281function unstable_getCurrent() {
3282 if (!enableSchedulerTracing) {
3283 return null;
3284 } else {
3285 return interactionsRef.current;
3286 }
3287}
3288function unstable_getThreadID() {
3289 return ++threadIDCounter;
3290}
3291function unstable_trace(name, timestamp, callback) {
3292 var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
3293
3294 if (!enableSchedulerTracing) {
3295 return callback();
3296 }
3297
3298 var interaction = {
3299 __count: 1,
3300 id: interactionIDCounter++,
3301 name: name,
3302 timestamp: timestamp
3303 };
3304 var prevInteractions = interactionsRef.current; // Traced interactions should stack/accumulate.
3305 // To do that, clone the current interactions.
3306 // The previous set will be restored upon completion.
3307
3308 var interactions = new Set(prevInteractions);
3309 interactions.add(interaction);
3310 interactionsRef.current = interactions;
3311 var subscriber = subscriberRef.current;
3312 var returnValue;
3313
3314 try {
3315 if (subscriber !== null) {
3316 subscriber.onInteractionTraced(interaction);
3317 }
3318 } finally {
3319 try {
3320 if (subscriber !== null) {
3321 subscriber.onWorkStarted(interactions, threadID);
3322 }
3323 } finally {
3324 try {
3325 returnValue = callback();
3326 } finally {
3327 interactionsRef.current = prevInteractions;
3328
3329 try {
3330 if (subscriber !== null) {
3331 subscriber.onWorkStopped(interactions, threadID);
3332 }
3333 } finally {
3334 interaction.__count--; // If no async work was scheduled for this interaction,
3335 // Notify subscribers that it's completed.
3336
3337 if (subscriber !== null && interaction.__count === 0) {
3338 subscriber.onInteractionScheduledWorkCompleted(interaction);
3339 }
3340 }
3341 }
3342 }
3343 }
3344
3345 return returnValue;
3346}
3347function unstable_wrap(callback) {
3348 var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
3349
3350 if (!enableSchedulerTracing) {
3351 return callback;
3352 }
3353
3354 var wrappedInteractions = interactionsRef.current;
3355 var subscriber = subscriberRef.current;
3356
3357 if (subscriber !== null) {
3358 subscriber.onWorkScheduled(wrappedInteractions, threadID);
3359 } // Update the pending async work count for the current interactions.
3360 // Update after calling subscribers in case of error.
3361
3362
3363 wrappedInteractions.forEach(function (interaction) {
3364 interaction.__count++;
3365 });
3366 var hasRun = false;
3367
3368 function wrapped() {
3369 var prevInteractions = interactionsRef.current;
3370 interactionsRef.current = wrappedInteractions;
3371 subscriber = subscriberRef.current;
3372
3373 try {
3374 var returnValue;
3375
3376 try {
3377 if (subscriber !== null) {
3378 subscriber.onWorkStarted(wrappedInteractions, threadID);
3379 }
3380 } finally {
3381 try {
3382 returnValue = callback.apply(undefined, arguments);
3383 } finally {
3384 interactionsRef.current = prevInteractions;
3385
3386 if (subscriber !== null) {
3387 subscriber.onWorkStopped(wrappedInteractions, threadID);
3388 }
3389 }
3390 }
3391
3392 return returnValue;
3393 } finally {
3394 if (!hasRun) {
3395 // We only expect a wrapped function to be executed once,
3396 // But in the event that it's executed more than once–
3397 // Only decrement the outstanding interaction counts once.
3398 hasRun = true; // Update pending async counts for all wrapped interactions.
3399 // If this was the last scheduled async work for any of them,
3400 // Mark them as completed.
3401
3402 wrappedInteractions.forEach(function (interaction) {
3403 interaction.__count--;
3404
3405 if (subscriber !== null && interaction.__count === 0) {
3406 subscriber.onInteractionScheduledWorkCompleted(interaction);
3407 }
3408 });
3409 }
3410 }
3411 }
3412
3413 wrapped.cancel = function cancel() {
3414 subscriber = subscriberRef.current;
3415
3416 try {
3417 if (subscriber !== null) {
3418 subscriber.onWorkCanceled(wrappedInteractions, threadID);
3419 }
3420 } finally {
3421 // Update pending async counts for all wrapped interactions.
3422 // If this was the last scheduled async work for any of them,
3423 // Mark them as completed.
3424 wrappedInteractions.forEach(function (interaction) {
3425 interaction.__count--;
3426
3427 if (subscriber && interaction.__count === 0) {
3428 subscriber.onInteractionScheduledWorkCompleted(interaction);
3429 }
3430 });
3431 }
3432 };
3433
3434 return wrapped;
3435}
3436
3437var subscribers = null;
3438
3439if (enableSchedulerTracing) {
3440 subscribers = new Set();
3441}
3442
3443function unstable_subscribe(subscriber) {
3444 if (enableSchedulerTracing) {
3445 subscribers.add(subscriber);
3446
3447 if (subscribers.size === 1) {
3448 subscriberRef.current = {
3449 onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
3450 onInteractionTraced: onInteractionTraced,
3451 onWorkCanceled: onWorkCanceled,
3452 onWorkScheduled: onWorkScheduled,
3453 onWorkStarted: onWorkStarted,
3454 onWorkStopped: onWorkStopped
3455 };
3456 }
3457 }
3458}
3459function unstable_unsubscribe(subscriber) {
3460 if (enableSchedulerTracing) {
3461 subscribers.delete(subscriber);
3462
3463 if (subscribers.size === 0) {
3464 subscriberRef.current = null;
3465 }
3466 }
3467}
3468
3469function onInteractionTraced(interaction) {
3470 var didCatchError = false;
3471 var caughtError = null;
3472 subscribers.forEach(function (subscriber) {
3473 try {
3474 subscriber.onInteractionTraced(interaction);
3475 } catch (error) {
3476 if (!didCatchError) {
3477 didCatchError = true;
3478 caughtError = error;
3479 }
3480 }
3481 });
3482
3483 if (didCatchError) {
3484 throw caughtError;
3485 }
3486}
3487
3488function onInteractionScheduledWorkCompleted(interaction) {
3489 var didCatchError = false;
3490 var caughtError = null;
3491 subscribers.forEach(function (subscriber) {
3492 try {
3493 subscriber.onInteractionScheduledWorkCompleted(interaction);
3494 } catch (error) {
3495 if (!didCatchError) {
3496 didCatchError = true;
3497 caughtError = error;
3498 }
3499 }
3500 });
3501
3502 if (didCatchError) {
3503 throw caughtError;
3504 }
3505}
3506
3507function onWorkScheduled(interactions, threadID) {
3508 var didCatchError = false;
3509 var caughtError = null;
3510 subscribers.forEach(function (subscriber) {
3511 try {
3512 subscriber.onWorkScheduled(interactions, threadID);
3513 } catch (error) {
3514 if (!didCatchError) {
3515 didCatchError = true;
3516 caughtError = error;
3517 }
3518 }
3519 });
3520
3521 if (didCatchError) {
3522 throw caughtError;
3523 }
3524}
3525
3526function onWorkStarted(interactions, threadID) {
3527 var didCatchError = false;
3528 var caughtError = null;
3529 subscribers.forEach(function (subscriber) {
3530 try {
3531 subscriber.onWorkStarted(interactions, threadID);
3532 } catch (error) {
3533 if (!didCatchError) {
3534 didCatchError = true;
3535 caughtError = error;
3536 }
3537 }
3538 });
3539
3540 if (didCatchError) {
3541 throw caughtError;
3542 }
3543}
3544
3545function onWorkStopped(interactions, threadID) {
3546 var didCatchError = false;
3547 var caughtError = null;
3548 subscribers.forEach(function (subscriber) {
3549 try {
3550 subscriber.onWorkStopped(interactions, threadID);
3551 } catch (error) {
3552 if (!didCatchError) {
3553 didCatchError = true;
3554 caughtError = error;
3555 }
3556 }
3557 });
3558
3559 if (didCatchError) {
3560 throw caughtError;
3561 }
3562}
3563
3564function onWorkCanceled(interactions, threadID) {
3565 var didCatchError = false;
3566 var caughtError = null;
3567 subscribers.forEach(function (subscriber) {
3568 try {
3569 subscriber.onWorkCanceled(interactions, threadID);
3570 } catch (error) {
3571 if (!didCatchError) {
3572 didCatchError = true;
3573 caughtError = error;
3574 }
3575 }
3576 });
3577
3578 if (didCatchError) {
3579 throw caughtError;
3580 }
3581}
3582
3583
3584
3585var SchedulerTracing = Object.freeze({
3586 get __interactionsRef () { return interactionsRef; },
3587 get __subscriberRef () { return subscriberRef; },
3588 unstable_clear: unstable_clear,
3589 unstable_getCurrent: unstable_getCurrent,
3590 unstable_getThreadID: unstable_getThreadID,
3591 unstable_trace: unstable_trace,
3592 unstable_wrap: unstable_wrap,
3593 unstable_subscribe: unstable_subscribe,
3594 unstable_unsubscribe: unstable_unsubscribe
3595});
3596
3597var ReactSharedInternals$2 = {
3598 ReactCurrentDispatcher: ReactCurrentDispatcher,
3599 ReactCurrentOwner: ReactCurrentOwner,
3600 IsSomeRendererActing: IsSomeRendererActing,
3601 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
3602 assign: objectAssign
3603};
3604
3605{
3606 objectAssign(ReactSharedInternals$2, {
3607 // These should not be included in production.
3608 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
3609 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
3610 // TODO: remove in React 17.0.
3611 ReactComponentTreeHook: {}
3612 });
3613} // Re-export the schedule API(s) for UMD bundles.
3614// This avoids introducing a dependency on a new UMD global in a minor update,
3615// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
3616// This re-export is only required for UMD bundles;
3617// CJS bundles use the shared NPM package.
3618
3619
3620objectAssign(ReactSharedInternals$2, {
3621 Scheduler: Scheduler,
3622 SchedulerTracing: SchedulerTracing
3623});
3624
3625var hasBadMapPolyfill;
3626
3627{
3628 hasBadMapPolyfill = false;
3629
3630 try {
3631 var frozenObject = Object.freeze({});
3632 var testMap = new Map([[frozenObject, null]]);
3633 var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
3634 // https://github.com/rollup/rollup/issues/1771
3635 // TODO: we can remove these if Rollup fixes the bug.
3636
3637 testMap.set(0, 0);
3638 testSet.add(0);
3639 } catch (e) {
3640 // TODO: Consider warning about bad polyfills
3641 hasBadMapPolyfill = true;
3642 }
3643}
3644
3645function createFundamentalComponent(impl) {
3646 // We use responder as a Map key later on. When we have a bad
3647 // polyfill, then we can't use it as a key as the polyfill tries
3648 // to add a property to the object.
3649 if (true && !hasBadMapPolyfill) {
3650 Object.freeze(impl);
3651 }
3652
3653 var fundamantalComponent = {
3654 $$typeof: REACT_FUNDAMENTAL_TYPE,
3655 impl: impl
3656 };
3657
3658 {
3659 Object.freeze(fundamantalComponent);
3660 }
3661
3662 return fundamantalComponent;
3663}
3664
3665function createEventResponder(displayName, responderConfig) {
3666 var getInitialState = responderConfig.getInitialState,
3667 onEvent = responderConfig.onEvent,
3668 onMount = responderConfig.onMount,
3669 onUnmount = responderConfig.onUnmount,
3670 onRootEvent = responderConfig.onRootEvent,
3671 rootEventTypes = responderConfig.rootEventTypes,
3672 targetEventTypes = responderConfig.targetEventTypes,
3673 targetPortalPropagation = responderConfig.targetPortalPropagation;
3674 var eventResponder = {
3675 $$typeof: REACT_RESPONDER_TYPE,
3676 displayName: displayName,
3677 getInitialState: getInitialState || null,
3678 onEvent: onEvent || null,
3679 onMount: onMount || null,
3680 onRootEvent: onRootEvent || null,
3681 onUnmount: onUnmount || null,
3682 rootEventTypes: rootEventTypes || null,
3683 targetEventTypes: targetEventTypes || null,
3684 targetPortalPropagation: targetPortalPropagation || false
3685 }; // We use responder as a Map key later on. When we have a bad
3686 // polyfill, then we can't use it as a key as the polyfill tries
3687 // to add a property to the object.
3688
3689 if (true && !hasBadMapPolyfill) {
3690 Object.freeze(eventResponder);
3691 }
3692
3693 return eventResponder;
3694}
3695
3696function createScope() {
3697 var scopeComponent = {
3698 $$typeof: REACT_SCOPE_TYPE
3699 };
3700
3701 {
3702 Object.freeze(scopeComponent);
3703 }
3704
3705 return scopeComponent;
3706}
3707
3708var React = {
3709 Children: {
3710 map: mapChildren,
3711 forEach: forEachChildren,
3712 count: countChildren,
3713 toArray: toArray,
3714 only: onlyChild
3715 },
3716 createRef: createRef,
3717 Component: Component,
3718 PureComponent: PureComponent,
3719 createContext: createContext,
3720 forwardRef: forwardRef,
3721 lazy: lazy,
3722 memo: memo,
3723 useCallback: useCallback,
3724 useContext: useContext,
3725 useEffect: useEffect,
3726 useImperativeHandle: useImperativeHandle,
3727 useDebugValue: useDebugValue,
3728 useLayoutEffect: useLayoutEffect,
3729 useMemo: useMemo,
3730 useReducer: useReducer,
3731 useRef: useRef,
3732 useState: useState,
3733 Fragment: REACT_FRAGMENT_TYPE,
3734 Profiler: REACT_PROFILER_TYPE,
3735 StrictMode: REACT_STRICT_MODE_TYPE,
3736 Suspense: REACT_SUSPENSE_TYPE,
3737 createElement: createElementWithValidation,
3738 cloneElement: cloneElementWithValidation,
3739 createFactory: createFactoryWithValidation,
3740 isValidElement: isValidElement,
3741 version: ReactVersion,
3742 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals$2
3743};
3744
3745if (exposeConcurrentModeAPIs) {
3746 React.useTransition = useTransition;
3747 React.useDeferredValue = useDeferredValue;
3748 React.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
3749 React.unstable_withSuspenseConfig = withSuspenseConfig;
3750}
3751
3752if (enableFlareAPI) {
3753 React.unstable_useResponder = useResponder;
3754 React.unstable_createResponder = createEventResponder;
3755}
3756
3757if (enableFundamentalAPI) {
3758 React.unstable_createFundamental = createFundamentalComponent;
3759}
3760
3761if (enableScopeAPI) {
3762 React.unstable_createScope = createScope;
3763} // Note: some APIs are added with feature flags.
3764// Make sure that stable builds for open source
3765// don't modify the React object to avoid deopts.
3766// Also let's not expose their names in stable builds.
3767
3768
3769if (enableJSXTransformAPI) {
3770 {
3771 React.jsxDEV = jsxWithValidation;
3772 React.jsx = jsxWithValidationDynamic;
3773 React.jsxs = jsxWithValidationStatic;
3774 }
3775}
3776
3777
3778
3779var React$2 = Object.freeze({
3780 default: React
3781});
3782
3783var React$3 = ( React$2 && React ) || React$2;
3784
3785// TODO: decide on the top-level export form.
3786// This is hacky but makes it work with both Rollup and Jest.
3787
3788
3789var react = React$3.default || React$3;
3790
3791return react;
3792
3793})));