UNPKG

120 kBJavaScriptView Raw
1/** @license React v16.11.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.11.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 enableMessageLoopImplementation = true;
2301var enableProfiling = true;
2302
2303// works by scheduling a requestAnimationFrame, storing the time for the start
2304// of the frame, then scheduling a postMessage which gets scheduled after paint.
2305// Within the postMessage handler do as much work as possible until time + frame
2306// rate. By separating the idle call into a separate event tick we ensure that
2307// layout, paint and other browser work is counted against the available time.
2308// The frame rate is dynamically adjusted.
2309
2310var requestHostCallback;
2311
2312var requestHostTimeout;
2313var cancelHostTimeout;
2314var shouldYieldToHost;
2315var requestPaint;
2316var getCurrentTime;
2317var forceFrameRate;
2318
2319if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive
2320// implementation using setTimeout.
2321typeof window === 'undefined' || // Check if MessageChannel is supported, too.
2322typeof MessageChannel !== 'function') {
2323 // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
2324 // fallback to a naive implementation.
2325 var _callback = null;
2326 var _timeoutID = null;
2327
2328 var _flushCallback = function () {
2329 if (_callback !== null) {
2330 try {
2331 var currentTime = getCurrentTime();
2332 var hasRemainingTime = true;
2333
2334 _callback(hasRemainingTime, currentTime);
2335
2336 _callback = null;
2337 } catch (e) {
2338 setTimeout(_flushCallback, 0);
2339 throw e;
2340 }
2341 }
2342 };
2343
2344 var initialTime = Date.now();
2345
2346 getCurrentTime = function () {
2347 return Date.now() - initialTime;
2348 };
2349
2350 requestHostCallback = function (cb) {
2351 if (_callback !== null) {
2352 // Protect against re-entrancy.
2353 setTimeout(requestHostCallback, 0, cb);
2354 } else {
2355 _callback = cb;
2356 setTimeout(_flushCallback, 0);
2357 }
2358 };
2359
2360 requestHostTimeout = function (cb, ms) {
2361 _timeoutID = setTimeout(cb, ms);
2362 };
2363
2364 cancelHostTimeout = function () {
2365 clearTimeout(_timeoutID);
2366 };
2367
2368 shouldYieldToHost = function () {
2369 return false;
2370 };
2371
2372 requestPaint = forceFrameRate = function () {};
2373} else {
2374 // Capture local references to native APIs, in case a polyfill overrides them.
2375 var performance = window.performance;
2376 var _Date = window.Date;
2377 var _setTimeout = window.setTimeout;
2378 var _clearTimeout = window.clearTimeout;
2379 var requestAnimationFrame = window.requestAnimationFrame;
2380 var cancelAnimationFrame = window.cancelAnimationFrame;
2381
2382 if (typeof console !== 'undefined') {
2383 // TODO: Remove fb.me link
2384 if (typeof requestAnimationFrame !== 'function') {
2385 console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
2386 }
2387
2388 if (typeof cancelAnimationFrame !== 'function') {
2389 console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
2390 }
2391 }
2392
2393 if (typeof performance === 'object' && typeof performance.now === 'function') {
2394 getCurrentTime = function () {
2395 return performance.now();
2396 };
2397 } else {
2398 var _initialTime = _Date.now();
2399
2400 getCurrentTime = function () {
2401 return _Date.now() - _initialTime;
2402 };
2403 }
2404
2405 var isRAFLoopRunning = false;
2406 var isMessageLoopRunning = false;
2407 var scheduledHostCallback = null;
2408 var rAFTimeoutID = -1;
2409 var taskTimeoutID = -1;
2410 var frameLength = enableMessageLoopImplementation ? // We won't attempt to align with the vsync. Instead we'll yield multiple
2411 // times per frame, often enough to keep it responsive even at really
2412 // high frame rates > 120.
2413 5 : // Use a heuristic to measure the frame rate and yield at the end of the
2414 // frame. We start out assuming that we run at 30fps but then the
2415 // heuristic tracking will adjust this value to a faster fps if we get
2416 // more frequent animation frames.
2417 33.33;
2418 var prevRAFTime = -1;
2419 var prevRAFInterval = -1;
2420 var frameDeadline = 0;
2421 var fpsLocked = false; // TODO: Make this configurable
2422 // TODO: Adjust this based on priority?
2423
2424 var maxFrameLength = 300;
2425 var needsPaint = false;
2426
2427 if (enableIsInputPending && navigator !== undefined && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined) {
2428 var scheduling = navigator.scheduling;
2429
2430 shouldYieldToHost = function () {
2431 var currentTime = getCurrentTime();
2432
2433 if (currentTime >= frameDeadline) {
2434 // There's no time left in the frame. We may want to yield control of
2435 // the main thread, so the browser can perform high priority tasks. The
2436 // main ones are painting and user input. If there's a pending paint or
2437 // a pending input, then we should yield. But if there's neither, then
2438 // we can yield less often while remaining responsive. We'll eventually
2439 // yield regardless, since there could be a pending paint that wasn't
2440 // accompanied by a call to `requestPaint`, or other main thread tasks
2441 // like network events.
2442 if (needsPaint || scheduling.isInputPending()) {
2443 // There is either a pending paint or a pending input.
2444 return true;
2445 } // There's no pending input. Only yield if we've reached the max
2446 // frame length.
2447
2448
2449 return currentTime >= frameDeadline + maxFrameLength;
2450 } else {
2451 // There's still time left in the frame.
2452 return false;
2453 }
2454 };
2455
2456 requestPaint = function () {
2457 needsPaint = true;
2458 };
2459 } else {
2460 // `isInputPending` is not available. Since we have no way of knowing if
2461 // there's pending input, always yield at the end of the frame.
2462 shouldYieldToHost = function () {
2463 return getCurrentTime() >= frameDeadline;
2464 }; // Since we yield every frame regardless, `requestPaint` has no effect.
2465
2466
2467 requestPaint = function () {};
2468 }
2469
2470 forceFrameRate = function (fps) {
2471 if (fps < 0 || fps > 125) {
2472 console.error('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported');
2473 return;
2474 }
2475
2476 if (fps > 0) {
2477 frameLength = Math.floor(1000 / fps);
2478 fpsLocked = true;
2479 } else {
2480 // reset the framerate
2481 frameLength = 33.33;
2482 fpsLocked = false;
2483 }
2484 };
2485
2486 var performWorkUntilDeadline = function () {
2487 if (enableMessageLoopImplementation) {
2488 if (scheduledHostCallback !== null) {
2489 var currentTime = getCurrentTime(); // Yield after `frameLength` ms, regardless of where we are in the vsync
2490 // cycle. This means there's always time remaining at the beginning of
2491 // the message event.
2492
2493 frameDeadline = currentTime + frameLength;
2494 var hasTimeRemaining = true;
2495
2496 try {
2497 var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
2498
2499 if (!hasMoreWork) {
2500 isMessageLoopRunning = false;
2501 scheduledHostCallback = null;
2502 } else {
2503 // If there's more work, schedule the next message event at the end
2504 // of the preceding one.
2505 port.postMessage(null);
2506 }
2507 } catch (error) {
2508 // If a scheduler task throws, exit the current browser task so the
2509 // error can be observed.
2510 port.postMessage(null);
2511 throw error;
2512 }
2513 } else {
2514 isMessageLoopRunning = false;
2515 } // Yielding to the browser will give it a chance to paint, so we can
2516 // reset this.
2517
2518
2519 needsPaint = false;
2520 } else {
2521 if (scheduledHostCallback !== null) {
2522 var _currentTime = getCurrentTime();
2523
2524 var _hasTimeRemaining = frameDeadline - _currentTime > 0;
2525
2526 try {
2527 var _hasMoreWork = scheduledHostCallback(_hasTimeRemaining, _currentTime);
2528
2529 if (!_hasMoreWork) {
2530 scheduledHostCallback = null;
2531 }
2532 } catch (error) {
2533 // If a scheduler task throws, exit the current browser task so the
2534 // error can be observed, and post a new task as soon as possible
2535 // so we can continue where we left off.
2536 port.postMessage(null);
2537 throw error;
2538 }
2539 } // Yielding to the browser will give it a chance to paint, so we can
2540 // reset this.
2541
2542
2543 needsPaint = false;
2544 }
2545 };
2546
2547 var channel = new MessageChannel();
2548 var port = channel.port2;
2549 channel.port1.onmessage = performWorkUntilDeadline;
2550
2551 var onAnimationFrame = function (rAFTime) {
2552 if (scheduledHostCallback === null) {
2553 // No scheduled work. Exit.
2554 prevRAFTime = -1;
2555 prevRAFInterval = -1;
2556 isRAFLoopRunning = false;
2557 return;
2558 } // Eagerly schedule the next animation callback at the beginning of the
2559 // frame. If the scheduler queue is not empty at the end of the frame, it
2560 // will continue flushing inside that callback. If the queue *is* empty,
2561 // then it will exit immediately. Posting the callback at the start of the
2562 // frame ensures it's fired within the earliest possible frame. If we
2563 // waited until the end of the frame to post the callback, we risk the
2564 // browser skipping a frame and not firing the callback until the frame
2565 // after that.
2566
2567
2568 isRAFLoopRunning = true;
2569 requestAnimationFrame(function (nextRAFTime) {
2570 _clearTimeout(rAFTimeoutID);
2571
2572 onAnimationFrame(nextRAFTime);
2573 }); // requestAnimationFrame is throttled when the tab is backgrounded. We
2574 // don't want to stop working entirely. So we'll fallback to a timeout loop.
2575 // TODO: Need a better heuristic for backgrounded work.
2576
2577 var onTimeout = function () {
2578 frameDeadline = getCurrentTime() + frameLength / 2;
2579 performWorkUntilDeadline();
2580 rAFTimeoutID = _setTimeout(onTimeout, frameLength * 3);
2581 };
2582
2583 rAFTimeoutID = _setTimeout(onTimeout, frameLength * 3);
2584
2585 if (prevRAFTime !== -1 && // Make sure this rAF time is different from the previous one. This check
2586 // could fail if two rAFs fire in the same frame.
2587 rAFTime - prevRAFTime > 0.1) {
2588 var rAFInterval = rAFTime - prevRAFTime;
2589
2590 if (!fpsLocked && prevRAFInterval !== -1) {
2591 // We've observed two consecutive frame intervals. We'll use this to
2592 // dynamically adjust the frame rate.
2593 //
2594 // If one frame goes long, then the next one can be short to catch up.
2595 // If two frames are short in a row, then that's an indication that we
2596 // actually have a higher frame rate than what we're currently
2597 // optimizing. For example, if we're running on 120hz display or 90hz VR
2598 // display. Take the max of the two in case one of them was an anomaly
2599 // due to missed frame deadlines.
2600 if (rAFInterval < frameLength && prevRAFInterval < frameLength) {
2601 frameLength = rAFInterval < prevRAFInterval ? prevRAFInterval : rAFInterval;
2602
2603 if (frameLength < 8.33) {
2604 // Defensive coding. We don't support higher frame rates than 120hz.
2605 // If the calculated frame length gets lower than 8, it is probably
2606 // a bug.
2607 frameLength = 8.33;
2608 }
2609 }
2610 }
2611
2612 prevRAFInterval = rAFInterval;
2613 }
2614
2615 prevRAFTime = rAFTime;
2616 frameDeadline = rAFTime + frameLength; // We use the postMessage trick to defer idle work until after the repaint.
2617
2618 port.postMessage(null);
2619 };
2620
2621 requestHostCallback = function (callback) {
2622 scheduledHostCallback = callback;
2623
2624 if (enableMessageLoopImplementation) {
2625 if (!isMessageLoopRunning) {
2626 isMessageLoopRunning = true;
2627 port.postMessage(null);
2628 }
2629 } else {
2630 if (!isRAFLoopRunning) {
2631 // Start a rAF loop.
2632 isRAFLoopRunning = true;
2633 requestAnimationFrame(function (rAFTime) {
2634 onAnimationFrame(rAFTime);
2635 });
2636 }
2637 }
2638 };
2639
2640 requestHostTimeout = function (callback, ms) {
2641 taskTimeoutID = _setTimeout(function () {
2642 callback(getCurrentTime());
2643 }, ms);
2644 };
2645
2646 cancelHostTimeout = function () {
2647 _clearTimeout(taskTimeoutID);
2648
2649 taskTimeoutID = -1;
2650 };
2651}
2652
2653function push(heap, node) {
2654 var index = heap.length;
2655 heap.push(node);
2656 siftUp(heap, node, index);
2657}
2658function peek(heap) {
2659 var first = heap[0];
2660 return first === undefined ? null : first;
2661}
2662function pop(heap) {
2663 var first = heap[0];
2664
2665 if (first !== undefined) {
2666 var last = heap.pop();
2667
2668 if (last !== first) {
2669 heap[0] = last;
2670 siftDown(heap, last, 0);
2671 }
2672
2673 return first;
2674 } else {
2675 return null;
2676 }
2677}
2678
2679function siftUp(heap, node, i) {
2680 var index = i;
2681
2682 while (true) {
2683 var parentIndex = Math.floor((index - 1) / 2);
2684 var parent = heap[parentIndex];
2685
2686 if (parent !== undefined && compare(parent, node) > 0) {
2687 // The parent is larger. Swap positions.
2688 heap[parentIndex] = node;
2689 heap[index] = parent;
2690 index = parentIndex;
2691 } else {
2692 // The parent is smaller. Exit.
2693 return;
2694 }
2695 }
2696}
2697
2698function siftDown(heap, node, i) {
2699 var index = i;
2700 var length = heap.length;
2701
2702 while (index < length) {
2703 var leftIndex = (index + 1) * 2 - 1;
2704 var left = heap[leftIndex];
2705 var rightIndex = leftIndex + 1;
2706 var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
2707
2708 if (left !== undefined && compare(left, node) < 0) {
2709 if (right !== undefined && compare(right, left) < 0) {
2710 heap[index] = right;
2711 heap[rightIndex] = node;
2712 index = rightIndex;
2713 } else {
2714 heap[index] = left;
2715 heap[leftIndex] = node;
2716 index = leftIndex;
2717 }
2718 } else if (right !== undefined && compare(right, node) < 0) {
2719 heap[index] = right;
2720 heap[rightIndex] = node;
2721 index = rightIndex;
2722 } else {
2723 // Neither child is smaller. Exit.
2724 return;
2725 }
2726 }
2727}
2728
2729function compare(a, b) {
2730 // Compare sort index first, then task id.
2731 var diff = a.sortIndex - b.sortIndex;
2732 return diff !== 0 ? diff : a.id - b.id;
2733}
2734
2735// TODO: Use symbols?
2736var NoPriority = 0;
2737var ImmediatePriority = 1;
2738var UserBlockingPriority = 2;
2739var NormalPriority = 3;
2740var LowPriority = 4;
2741var IdlePriority = 5;
2742
2743var runIdCounter = 0;
2744var mainThreadIdCounter = 0;
2745var profilingStateSize = 4;
2746var sharedProfilingBuffer = enableProfiling ? // $FlowFixMe Flow doesn't know about SharedArrayBuffer
2747typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer
2748typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9
2749: null;
2750var profilingState = enableProfiling && sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks
2751
2752var PRIORITY = 0;
2753var CURRENT_TASK_ID = 1;
2754var CURRENT_RUN_ID = 2;
2755var QUEUE_SIZE = 3;
2756
2757if (enableProfiling) {
2758 profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue
2759 // array might include canceled tasks.
2760
2761 profilingState[QUEUE_SIZE] = 0;
2762 profilingState[CURRENT_TASK_ID] = 0;
2763} // Bytes per element is 4
2764
2765
2766var INITIAL_EVENT_LOG_SIZE = 131072;
2767var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes
2768
2769var eventLogSize = 0;
2770var eventLogBuffer = null;
2771var eventLog = null;
2772var eventLogIndex = 0;
2773var TaskStartEvent = 1;
2774var TaskCompleteEvent = 2;
2775var TaskErrorEvent = 3;
2776var TaskCancelEvent = 4;
2777var TaskRunEvent = 5;
2778var TaskYieldEvent = 6;
2779var SchedulerSuspendEvent = 7;
2780var SchedulerResumeEvent = 8;
2781
2782function logEvent(entries) {
2783 if (eventLog !== null) {
2784 var offset = eventLogIndex;
2785 eventLogIndex += entries.length;
2786
2787 if (eventLogIndex + 1 > eventLogSize) {
2788 eventLogSize *= 2;
2789
2790 if (eventLogSize > MAX_EVENT_LOG_SIZE) {
2791 console.error("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.');
2792 stopLoggingProfilingEvents();
2793 return;
2794 }
2795
2796 var newEventLog = new Int32Array(eventLogSize * 4);
2797 newEventLog.set(eventLog);
2798 eventLogBuffer = newEventLog.buffer;
2799 eventLog = newEventLog;
2800 }
2801
2802 eventLog.set(entries, offset);
2803 }
2804}
2805
2806function startLoggingProfilingEvents() {
2807 eventLogSize = INITIAL_EVENT_LOG_SIZE;
2808 eventLogBuffer = new ArrayBuffer(eventLogSize * 4);
2809 eventLog = new Int32Array(eventLogBuffer);
2810 eventLogIndex = 0;
2811}
2812function stopLoggingProfilingEvents() {
2813 var buffer = eventLogBuffer;
2814 eventLogSize = 0;
2815 eventLogBuffer = null;
2816 eventLog = null;
2817 eventLogIndex = 0;
2818 return buffer;
2819}
2820function markTaskStart(task, ms) {
2821 if (enableProfiling) {
2822 profilingState[QUEUE_SIZE]++;
2823
2824 if (eventLog !== null) {
2825 // performance.now returns a float, representing milliseconds. When the
2826 // event is logged, it's coerced to an int. Convert to microseconds to
2827 // maintain extra degrees of precision.
2828 logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]);
2829 }
2830 }
2831}
2832function markTaskCompleted(task, ms) {
2833 if (enableProfiling) {
2834 profilingState[PRIORITY] = NoPriority;
2835 profilingState[CURRENT_TASK_ID] = 0;
2836 profilingState[QUEUE_SIZE]--;
2837
2838 if (eventLog !== null) {
2839 logEvent([TaskCompleteEvent, ms * 1000, task.id]);
2840 }
2841 }
2842}
2843function markTaskCanceled(task, ms) {
2844 if (enableProfiling) {
2845 profilingState[QUEUE_SIZE]--;
2846
2847 if (eventLog !== null) {
2848 logEvent([TaskCancelEvent, ms * 1000, task.id]);
2849 }
2850 }
2851}
2852function markTaskErrored(task, ms) {
2853 if (enableProfiling) {
2854 profilingState[PRIORITY] = NoPriority;
2855 profilingState[CURRENT_TASK_ID] = 0;
2856 profilingState[QUEUE_SIZE]--;
2857
2858 if (eventLog !== null) {
2859 logEvent([TaskErrorEvent, ms * 1000, task.id]);
2860 }
2861 }
2862}
2863function markTaskRun(task, ms) {
2864 if (enableProfiling) {
2865 runIdCounter++;
2866 profilingState[PRIORITY] = task.priorityLevel;
2867 profilingState[CURRENT_TASK_ID] = task.id;
2868 profilingState[CURRENT_RUN_ID] = runIdCounter;
2869
2870 if (eventLog !== null) {
2871 logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]);
2872 }
2873 }
2874}
2875function markTaskYield(task, ms) {
2876 if (enableProfiling) {
2877 profilingState[PRIORITY] = NoPriority;
2878 profilingState[CURRENT_TASK_ID] = 0;
2879 profilingState[CURRENT_RUN_ID] = 0;
2880
2881 if (eventLog !== null) {
2882 logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
2883 }
2884 }
2885}
2886function markSchedulerSuspended(ms) {
2887 if (enableProfiling) {
2888 mainThreadIdCounter++;
2889
2890 if (eventLog !== null) {
2891 logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]);
2892 }
2893 }
2894}
2895function markSchedulerUnsuspended(ms) {
2896 if (enableProfiling) {
2897 if (eventLog !== null) {
2898 logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
2899 }
2900 }
2901}
2902
2903/* eslint-disable no-var */
2904// Math.pow(2, 30) - 1
2905// 0b111111111111111111111111111111
2906
2907var maxSigned31BitInt = 1073741823; // Times out immediately
2908
2909var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
2910
2911var USER_BLOCKING_PRIORITY = 250;
2912var NORMAL_PRIORITY_TIMEOUT = 5000;
2913var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
2914
2915var IDLE_PRIORITY = maxSigned31BitInt; // Tasks are stored on a min heap
2916
2917var taskQueue = [];
2918var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
2919
2920var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
2921
2922var isSchedulerPaused = false;
2923var currentTask = null;
2924var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
2925
2926var isPerformingWork = false;
2927var isHostCallbackScheduled = false;
2928var isHostTimeoutScheduled = false;
2929
2930function advanceTimers(currentTime) {
2931 // Check for tasks that are no longer delayed and add them to the queue.
2932 var timer = peek(timerQueue);
2933
2934 while (timer !== null) {
2935 if (timer.callback === null) {
2936 // Timer was cancelled.
2937 pop(timerQueue);
2938 } else if (timer.startTime <= currentTime) {
2939 // Timer fired. Transfer to the task queue.
2940 pop(timerQueue);
2941 timer.sortIndex = timer.expirationTime;
2942 push(taskQueue, timer);
2943
2944 if (enableProfiling) {
2945 markTaskStart(timer, currentTime);
2946 timer.isQueued = true;
2947 }
2948 } else {
2949 // Remaining timers are pending.
2950 return;
2951 }
2952
2953 timer = peek(timerQueue);
2954 }
2955}
2956
2957function handleTimeout(currentTime) {
2958 isHostTimeoutScheduled = false;
2959 advanceTimers(currentTime);
2960
2961 if (!isHostCallbackScheduled) {
2962 if (peek(taskQueue) !== null) {
2963 isHostCallbackScheduled = true;
2964 requestHostCallback(flushWork);
2965 } else {
2966 var firstTimer = peek(timerQueue);
2967
2968 if (firstTimer !== null) {
2969 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
2970 }
2971 }
2972 }
2973}
2974
2975function flushWork(hasTimeRemaining, initialTime) {
2976 if (enableProfiling) {
2977 markSchedulerUnsuspended(initialTime);
2978 } // We'll need a host callback the next time work is scheduled.
2979
2980
2981 isHostCallbackScheduled = false;
2982
2983 if (isHostTimeoutScheduled) {
2984 // We scheduled a timeout but it's no longer needed. Cancel it.
2985 isHostTimeoutScheduled = false;
2986 cancelHostTimeout();
2987 }
2988
2989 isPerformingWork = true;
2990 var previousPriorityLevel = currentPriorityLevel;
2991
2992 try {
2993 if (enableProfiling) {
2994 try {
2995 return workLoop(hasTimeRemaining, initialTime);
2996 } catch (error) {
2997 if (currentTask !== null) {
2998 var currentTime = getCurrentTime();
2999 markTaskErrored(currentTask, currentTime);
3000 currentTask.isQueued = false;
3001 }
3002
3003 throw error;
3004 }
3005 } else {
3006 // No catch in prod codepath.
3007 return workLoop(hasTimeRemaining, initialTime);
3008 }
3009 } finally {
3010 currentTask = null;
3011 currentPriorityLevel = previousPriorityLevel;
3012 isPerformingWork = false;
3013
3014 if (enableProfiling) {
3015 var _currentTime = getCurrentTime();
3016
3017 markSchedulerSuspended(_currentTime);
3018 }
3019 }
3020}
3021
3022function workLoop(hasTimeRemaining, initialTime) {
3023 var currentTime = initialTime;
3024 advanceTimers(currentTime);
3025 currentTask = peek(taskQueue);
3026
3027 while (currentTask !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
3028 if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
3029 // This currentTask hasn't expired, and we've reached the deadline.
3030 break;
3031 }
3032
3033 var callback = currentTask.callback;
3034
3035 if (callback !== null) {
3036 currentTask.callback = null;
3037 currentPriorityLevel = currentTask.priorityLevel;
3038 var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
3039 markTaskRun(currentTask, currentTime);
3040 var continuationCallback = callback(didUserCallbackTimeout);
3041 currentTime = getCurrentTime();
3042
3043 if (typeof continuationCallback === 'function') {
3044 currentTask.callback = continuationCallback;
3045 markTaskYield(currentTask, currentTime);
3046 } else {
3047 if (enableProfiling) {
3048 markTaskCompleted(currentTask, currentTime);
3049 currentTask.isQueued = false;
3050 }
3051
3052 if (currentTask === peek(taskQueue)) {
3053 pop(taskQueue);
3054 }
3055 }
3056
3057 advanceTimers(currentTime);
3058 } else {
3059 pop(taskQueue);
3060 }
3061
3062 currentTask = peek(taskQueue);
3063 } // Return whether there's additional work
3064
3065
3066 if (currentTask !== null) {
3067 return true;
3068 } else {
3069 var firstTimer = peek(timerQueue);
3070
3071 if (firstTimer !== null) {
3072 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
3073 }
3074
3075 return false;
3076 }
3077}
3078
3079function unstable_runWithPriority(priorityLevel, eventHandler) {
3080 switch (priorityLevel) {
3081 case ImmediatePriority:
3082 case UserBlockingPriority:
3083 case NormalPriority:
3084 case LowPriority:
3085 case IdlePriority:
3086 break;
3087
3088 default:
3089 priorityLevel = NormalPriority;
3090 }
3091
3092 var previousPriorityLevel = currentPriorityLevel;
3093 currentPriorityLevel = priorityLevel;
3094
3095 try {
3096 return eventHandler();
3097 } finally {
3098 currentPriorityLevel = previousPriorityLevel;
3099 }
3100}
3101
3102function unstable_next(eventHandler) {
3103 var priorityLevel;
3104
3105 switch (currentPriorityLevel) {
3106 case ImmediatePriority:
3107 case UserBlockingPriority:
3108 case NormalPriority:
3109 // Shift down to normal priority
3110 priorityLevel = NormalPriority;
3111 break;
3112
3113 default:
3114 // Anything lower than normal priority should remain at the current level.
3115 priorityLevel = currentPriorityLevel;
3116 break;
3117 }
3118
3119 var previousPriorityLevel = currentPriorityLevel;
3120 currentPriorityLevel = priorityLevel;
3121
3122 try {
3123 return eventHandler();
3124 } finally {
3125 currentPriorityLevel = previousPriorityLevel;
3126 }
3127}
3128
3129function unstable_wrapCallback(callback) {
3130 var parentPriorityLevel = currentPriorityLevel;
3131 return function () {
3132 // This is a fork of runWithPriority, inlined for performance.
3133 var previousPriorityLevel = currentPriorityLevel;
3134 currentPriorityLevel = parentPriorityLevel;
3135
3136 try {
3137 return callback.apply(this, arguments);
3138 } finally {
3139 currentPriorityLevel = previousPriorityLevel;
3140 }
3141 };
3142}
3143
3144function timeoutForPriorityLevel(priorityLevel) {
3145 switch (priorityLevel) {
3146 case ImmediatePriority:
3147 return IMMEDIATE_PRIORITY_TIMEOUT;
3148
3149 case UserBlockingPriority:
3150 return USER_BLOCKING_PRIORITY;
3151
3152 case IdlePriority:
3153 return IDLE_PRIORITY;
3154
3155 case LowPriority:
3156 return LOW_PRIORITY_TIMEOUT;
3157
3158 case NormalPriority:
3159 default:
3160 return NORMAL_PRIORITY_TIMEOUT;
3161 }
3162}
3163
3164function unstable_scheduleCallback(priorityLevel, callback, options) {
3165 var currentTime = getCurrentTime();
3166 var startTime;
3167 var timeout;
3168
3169 if (typeof options === 'object' && options !== null) {
3170 var delay = options.delay;
3171
3172 if (typeof delay === 'number' && delay > 0) {
3173 startTime = currentTime + delay;
3174 } else {
3175 startTime = currentTime;
3176 }
3177
3178 timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel);
3179 } else {
3180 timeout = timeoutForPriorityLevel(priorityLevel);
3181 startTime = currentTime;
3182 }
3183
3184 var expirationTime = startTime + timeout;
3185 var newTask = {
3186 id: taskIdCounter++,
3187 callback: callback,
3188 priorityLevel: priorityLevel,
3189 startTime: startTime,
3190 expirationTime: expirationTime,
3191 sortIndex: -1
3192 };
3193
3194 if (enableProfiling) {
3195 newTask.isQueued = false;
3196 }
3197
3198 if (startTime > currentTime) {
3199 // This is a delayed task.
3200 newTask.sortIndex = startTime;
3201 push(timerQueue, newTask);
3202
3203 if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
3204 // All tasks are delayed, and this is the task with the earliest delay.
3205 if (isHostTimeoutScheduled) {
3206 // Cancel an existing timeout.
3207 cancelHostTimeout();
3208 } else {
3209 isHostTimeoutScheduled = true;
3210 } // Schedule a timeout.
3211
3212
3213 requestHostTimeout(handleTimeout, startTime - currentTime);
3214 }
3215 } else {
3216 newTask.sortIndex = expirationTime;
3217 push(taskQueue, newTask);
3218
3219 if (enableProfiling) {
3220 markTaskStart(newTask, currentTime);
3221 newTask.isQueued = true;
3222 } // Schedule a host callback, if needed. If we're already performing work,
3223 // wait until the next time we yield.
3224
3225
3226 if (!isHostCallbackScheduled && !isPerformingWork) {
3227 isHostCallbackScheduled = true;
3228 requestHostCallback(flushWork);
3229 }
3230 }
3231
3232 return newTask;
3233}
3234
3235function unstable_pauseExecution() {
3236 isSchedulerPaused = true;
3237}
3238
3239function unstable_continueExecution() {
3240 isSchedulerPaused = false;
3241
3242 if (!isHostCallbackScheduled && !isPerformingWork) {
3243 isHostCallbackScheduled = true;
3244 requestHostCallback(flushWork);
3245 }
3246}
3247
3248function unstable_getFirstCallbackNode() {
3249 return peek(taskQueue);
3250}
3251
3252function unstable_cancelCallback(task) {
3253 if (enableProfiling) {
3254 if (task.isQueued) {
3255 var currentTime = getCurrentTime();
3256 markTaskCanceled(task, currentTime);
3257 task.isQueued = false;
3258 }
3259 } // Null out the callback to indicate the task has been canceled. (Can't
3260 // remove from the queue because you can't remove arbitrary nodes from an
3261 // array based heap, only the first one.)
3262
3263
3264 task.callback = null;
3265}
3266
3267function unstable_getCurrentPriorityLevel() {
3268 return currentPriorityLevel;
3269}
3270
3271function unstable_shouldYield() {
3272 var currentTime = getCurrentTime();
3273 advanceTimers(currentTime);
3274 var firstTask = peek(taskQueue);
3275 return firstTask !== currentTask && currentTask !== null && firstTask !== null && firstTask.callback !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost();
3276}
3277
3278var unstable_requestPaint = requestPaint;
3279var unstable_Profiling = enableProfiling ? {
3280 startLoggingProfilingEvents: startLoggingProfilingEvents,
3281 stopLoggingProfilingEvents: stopLoggingProfilingEvents,
3282 sharedProfilingBuffer: sharedProfilingBuffer
3283} : null;
3284
3285
3286
3287var Scheduler = Object.freeze({
3288 unstable_ImmediatePriority: ImmediatePriority,
3289 unstable_UserBlockingPriority: UserBlockingPriority,
3290 unstable_NormalPriority: NormalPriority,
3291 unstable_IdlePriority: IdlePriority,
3292 unstable_LowPriority: LowPriority,
3293 unstable_runWithPriority: unstable_runWithPriority,
3294 unstable_next: unstable_next,
3295 unstable_scheduleCallback: unstable_scheduleCallback,
3296 unstable_cancelCallback: unstable_cancelCallback,
3297 unstable_wrapCallback: unstable_wrapCallback,
3298 unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
3299 unstable_shouldYield: unstable_shouldYield,
3300 unstable_requestPaint: unstable_requestPaint,
3301 unstable_continueExecution: unstable_continueExecution,
3302 unstable_pauseExecution: unstable_pauseExecution,
3303 unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
3304 get unstable_now () { return getCurrentTime; },
3305 get unstable_forceFrameRate () { return forceFrameRate; },
3306 unstable_Profiling: unstable_Profiling
3307});
3308
3309// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
3310
3311 // In some cases, StrictMode should also double-render lifecycles.
3312// This can be confusing for tests though,
3313// And it can be bad for performance in production.
3314// This feature flag can be used to control the behavior:
3315
3316 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
3317// replay the begin phase of a failed component inside invokeGuardedCallback.
3318
3319 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
3320
3321 // Gather advanced timing metrics for Profiler subtrees.
3322
3323 // Trace which interactions trigger each commit.
3324
3325var enableSchedulerTracing = true; // SSR experiments
3326
3327
3328 // Only used in www builds.
3329
3330 // Only used in www builds.
3331
3332 // Disable javascript: URL strings in href for XSS protection.
3333
3334 // React Fire: prevent the value and checked attributes from syncing
3335// with their related DOM properties
3336
3337 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
3338// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
3339
3340var exposeConcurrentModeAPIs = false;
3341 // Experimental React Flare event system and event components support.
3342
3343var enableFlareAPI = false; // Experimental Host Component support.
3344
3345var enableFundamentalAPI = false; // Experimental Scope support.
3346
3347var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
3348
3349var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
3350// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
3351
3352 // For tests, we flush suspense fallbacks in an act scope;
3353// *except* in some of our own tests, where we test incremental loading states.
3354
3355 // Add a callback property to suspense to notify which promises are currently
3356// in the update queue. This allows reporting and tracing of what is causing
3357// the user to see a loading state.
3358// Also allows hydration callbacks to fire when a dehydrated boundary gets
3359// hydrated or deleted.
3360
3361 // Part of the simplification of React.createElement so we can eventually move
3362// from React.createElement to React.jsx
3363// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
3364
3365var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs.
3366
3367var interactionIDCounter = 0;
3368var threadIDCounter = 0; // Set of currently traced interactions.
3369// Interactions "stack"–
3370// Meaning that newly traced interactions are appended to the previously active set.
3371// When an interaction goes out of scope, the previous set (if any) is restored.
3372
3373var interactionsRef = null; // Listener(s) to notify when interactions begin and end.
3374
3375var subscriberRef = null;
3376
3377if (enableSchedulerTracing) {
3378 interactionsRef = {
3379 current: new Set()
3380 };
3381 subscriberRef = {
3382 current: null
3383 };
3384}
3385
3386function unstable_clear(callback) {
3387 if (!enableSchedulerTracing) {
3388 return callback();
3389 }
3390
3391 var prevInteractions = interactionsRef.current;
3392 interactionsRef.current = new Set();
3393
3394 try {
3395 return callback();
3396 } finally {
3397 interactionsRef.current = prevInteractions;
3398 }
3399}
3400function unstable_getCurrent() {
3401 if (!enableSchedulerTracing) {
3402 return null;
3403 } else {
3404 return interactionsRef.current;
3405 }
3406}
3407function unstable_getThreadID() {
3408 return ++threadIDCounter;
3409}
3410function unstable_trace(name, timestamp, callback) {
3411 var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
3412
3413 if (!enableSchedulerTracing) {
3414 return callback();
3415 }
3416
3417 var interaction = {
3418 __count: 1,
3419 id: interactionIDCounter++,
3420 name: name,
3421 timestamp: timestamp
3422 };
3423 var prevInteractions = interactionsRef.current; // Traced interactions should stack/accumulate.
3424 // To do that, clone the current interactions.
3425 // The previous set will be restored upon completion.
3426
3427 var interactions = new Set(prevInteractions);
3428 interactions.add(interaction);
3429 interactionsRef.current = interactions;
3430 var subscriber = subscriberRef.current;
3431 var returnValue;
3432
3433 try {
3434 if (subscriber !== null) {
3435 subscriber.onInteractionTraced(interaction);
3436 }
3437 } finally {
3438 try {
3439 if (subscriber !== null) {
3440 subscriber.onWorkStarted(interactions, threadID);
3441 }
3442 } finally {
3443 try {
3444 returnValue = callback();
3445 } finally {
3446 interactionsRef.current = prevInteractions;
3447
3448 try {
3449 if (subscriber !== null) {
3450 subscriber.onWorkStopped(interactions, threadID);
3451 }
3452 } finally {
3453 interaction.__count--; // If no async work was scheduled for this interaction,
3454 // Notify subscribers that it's completed.
3455
3456 if (subscriber !== null && interaction.__count === 0) {
3457 subscriber.onInteractionScheduledWorkCompleted(interaction);
3458 }
3459 }
3460 }
3461 }
3462 }
3463
3464 return returnValue;
3465}
3466function unstable_wrap(callback) {
3467 var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
3468
3469 if (!enableSchedulerTracing) {
3470 return callback;
3471 }
3472
3473 var wrappedInteractions = interactionsRef.current;
3474 var subscriber = subscriberRef.current;
3475
3476 if (subscriber !== null) {
3477 subscriber.onWorkScheduled(wrappedInteractions, threadID);
3478 } // Update the pending async work count for the current interactions.
3479 // Update after calling subscribers in case of error.
3480
3481
3482 wrappedInteractions.forEach(function (interaction) {
3483 interaction.__count++;
3484 });
3485 var hasRun = false;
3486
3487 function wrapped() {
3488 var prevInteractions = interactionsRef.current;
3489 interactionsRef.current = wrappedInteractions;
3490 subscriber = subscriberRef.current;
3491
3492 try {
3493 var returnValue;
3494
3495 try {
3496 if (subscriber !== null) {
3497 subscriber.onWorkStarted(wrappedInteractions, threadID);
3498 }
3499 } finally {
3500 try {
3501 returnValue = callback.apply(undefined, arguments);
3502 } finally {
3503 interactionsRef.current = prevInteractions;
3504
3505 if (subscriber !== null) {
3506 subscriber.onWorkStopped(wrappedInteractions, threadID);
3507 }
3508 }
3509 }
3510
3511 return returnValue;
3512 } finally {
3513 if (!hasRun) {
3514 // We only expect a wrapped function to be executed once,
3515 // But in the event that it's executed more than once–
3516 // Only decrement the outstanding interaction counts once.
3517 hasRun = true; // Update pending async counts for all wrapped interactions.
3518 // If this was the last scheduled async work for any of them,
3519 // Mark them as completed.
3520
3521 wrappedInteractions.forEach(function (interaction) {
3522 interaction.__count--;
3523
3524 if (subscriber !== null && interaction.__count === 0) {
3525 subscriber.onInteractionScheduledWorkCompleted(interaction);
3526 }
3527 });
3528 }
3529 }
3530 }
3531
3532 wrapped.cancel = function cancel() {
3533 subscriber = subscriberRef.current;
3534
3535 try {
3536 if (subscriber !== null) {
3537 subscriber.onWorkCanceled(wrappedInteractions, threadID);
3538 }
3539 } finally {
3540 // Update pending async counts for all wrapped interactions.
3541 // If this was the last scheduled async work for any of them,
3542 // Mark them as completed.
3543 wrappedInteractions.forEach(function (interaction) {
3544 interaction.__count--;
3545
3546 if (subscriber && interaction.__count === 0) {
3547 subscriber.onInteractionScheduledWorkCompleted(interaction);
3548 }
3549 });
3550 }
3551 };
3552
3553 return wrapped;
3554}
3555
3556var subscribers = null;
3557
3558if (enableSchedulerTracing) {
3559 subscribers = new Set();
3560}
3561
3562function unstable_subscribe(subscriber) {
3563 if (enableSchedulerTracing) {
3564 subscribers.add(subscriber);
3565
3566 if (subscribers.size === 1) {
3567 subscriberRef.current = {
3568 onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
3569 onInteractionTraced: onInteractionTraced,
3570 onWorkCanceled: onWorkCanceled,
3571 onWorkScheduled: onWorkScheduled,
3572 onWorkStarted: onWorkStarted,
3573 onWorkStopped: onWorkStopped
3574 };
3575 }
3576 }
3577}
3578function unstable_unsubscribe(subscriber) {
3579 if (enableSchedulerTracing) {
3580 subscribers.delete(subscriber);
3581
3582 if (subscribers.size === 0) {
3583 subscriberRef.current = null;
3584 }
3585 }
3586}
3587
3588function onInteractionTraced(interaction) {
3589 var didCatchError = false;
3590 var caughtError = null;
3591 subscribers.forEach(function (subscriber) {
3592 try {
3593 subscriber.onInteractionTraced(interaction);
3594 } catch (error) {
3595 if (!didCatchError) {
3596 didCatchError = true;
3597 caughtError = error;
3598 }
3599 }
3600 });
3601
3602 if (didCatchError) {
3603 throw caughtError;
3604 }
3605}
3606
3607function onInteractionScheduledWorkCompleted(interaction) {
3608 var didCatchError = false;
3609 var caughtError = null;
3610 subscribers.forEach(function (subscriber) {
3611 try {
3612 subscriber.onInteractionScheduledWorkCompleted(interaction);
3613 } catch (error) {
3614 if (!didCatchError) {
3615 didCatchError = true;
3616 caughtError = error;
3617 }
3618 }
3619 });
3620
3621 if (didCatchError) {
3622 throw caughtError;
3623 }
3624}
3625
3626function onWorkScheduled(interactions, threadID) {
3627 var didCatchError = false;
3628 var caughtError = null;
3629 subscribers.forEach(function (subscriber) {
3630 try {
3631 subscriber.onWorkScheduled(interactions, threadID);
3632 } catch (error) {
3633 if (!didCatchError) {
3634 didCatchError = true;
3635 caughtError = error;
3636 }
3637 }
3638 });
3639
3640 if (didCatchError) {
3641 throw caughtError;
3642 }
3643}
3644
3645function onWorkStarted(interactions, threadID) {
3646 var didCatchError = false;
3647 var caughtError = null;
3648 subscribers.forEach(function (subscriber) {
3649 try {
3650 subscriber.onWorkStarted(interactions, threadID);
3651 } catch (error) {
3652 if (!didCatchError) {
3653 didCatchError = true;
3654 caughtError = error;
3655 }
3656 }
3657 });
3658
3659 if (didCatchError) {
3660 throw caughtError;
3661 }
3662}
3663
3664function onWorkStopped(interactions, threadID) {
3665 var didCatchError = false;
3666 var caughtError = null;
3667 subscribers.forEach(function (subscriber) {
3668 try {
3669 subscriber.onWorkStopped(interactions, threadID);
3670 } catch (error) {
3671 if (!didCatchError) {
3672 didCatchError = true;
3673 caughtError = error;
3674 }
3675 }
3676 });
3677
3678 if (didCatchError) {
3679 throw caughtError;
3680 }
3681}
3682
3683function onWorkCanceled(interactions, threadID) {
3684 var didCatchError = false;
3685 var caughtError = null;
3686 subscribers.forEach(function (subscriber) {
3687 try {
3688 subscriber.onWorkCanceled(interactions, threadID);
3689 } catch (error) {
3690 if (!didCatchError) {
3691 didCatchError = true;
3692 caughtError = error;
3693 }
3694 }
3695 });
3696
3697 if (didCatchError) {
3698 throw caughtError;
3699 }
3700}
3701
3702
3703
3704var SchedulerTracing = Object.freeze({
3705 get __interactionsRef () { return interactionsRef; },
3706 get __subscriberRef () { return subscriberRef; },
3707 unstable_clear: unstable_clear,
3708 unstable_getCurrent: unstable_getCurrent,
3709 unstable_getThreadID: unstable_getThreadID,
3710 unstable_trace: unstable_trace,
3711 unstable_wrap: unstable_wrap,
3712 unstable_subscribe: unstable_subscribe,
3713 unstable_unsubscribe: unstable_unsubscribe
3714});
3715
3716var ReactSharedInternals$2 = {
3717 ReactCurrentDispatcher: ReactCurrentDispatcher,
3718 ReactCurrentOwner: ReactCurrentOwner,
3719 IsSomeRendererActing: IsSomeRendererActing,
3720 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
3721 assign: objectAssign
3722};
3723
3724{
3725 objectAssign(ReactSharedInternals$2, {
3726 // These should not be included in production.
3727 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
3728 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
3729 // TODO: remove in React 17.0.
3730 ReactComponentTreeHook: {}
3731 });
3732} // Re-export the schedule API(s) for UMD bundles.
3733// This avoids introducing a dependency on a new UMD global in a minor update,
3734// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
3735// This re-export is only required for UMD bundles;
3736// CJS bundles use the shared NPM package.
3737
3738
3739objectAssign(ReactSharedInternals$2, {
3740 Scheduler: Scheduler,
3741 SchedulerTracing: SchedulerTracing
3742});
3743
3744var hasBadMapPolyfill;
3745
3746{
3747 hasBadMapPolyfill = false;
3748
3749 try {
3750 var frozenObject = Object.freeze({});
3751 var testMap = new Map([[frozenObject, null]]);
3752 var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
3753 // https://github.com/rollup/rollup/issues/1771
3754 // TODO: we can remove these if Rollup fixes the bug.
3755
3756 testMap.set(0, 0);
3757 testSet.add(0);
3758 } catch (e) {
3759 // TODO: Consider warning about bad polyfills
3760 hasBadMapPolyfill = true;
3761 }
3762}
3763
3764function createFundamentalComponent(impl) {
3765 // We use responder as a Map key later on. When we have a bad
3766 // polyfill, then we can't use it as a key as the polyfill tries
3767 // to add a property to the object.
3768 if (true && !hasBadMapPolyfill) {
3769 Object.freeze(impl);
3770 }
3771
3772 var fundamantalComponent = {
3773 $$typeof: REACT_FUNDAMENTAL_TYPE,
3774 impl: impl
3775 };
3776
3777 {
3778 Object.freeze(fundamantalComponent);
3779 }
3780
3781 return fundamantalComponent;
3782}
3783
3784function createEventResponder(displayName, responderConfig) {
3785 var getInitialState = responderConfig.getInitialState,
3786 onEvent = responderConfig.onEvent,
3787 onMount = responderConfig.onMount,
3788 onUnmount = responderConfig.onUnmount,
3789 onRootEvent = responderConfig.onRootEvent,
3790 rootEventTypes = responderConfig.rootEventTypes,
3791 targetEventTypes = responderConfig.targetEventTypes,
3792 targetPortalPropagation = responderConfig.targetPortalPropagation;
3793 var eventResponder = {
3794 $$typeof: REACT_RESPONDER_TYPE,
3795 displayName: displayName,
3796 getInitialState: getInitialState || null,
3797 onEvent: onEvent || null,
3798 onMount: onMount || null,
3799 onRootEvent: onRootEvent || null,
3800 onUnmount: onUnmount || null,
3801 rootEventTypes: rootEventTypes || null,
3802 targetEventTypes: targetEventTypes || null,
3803 targetPortalPropagation: targetPortalPropagation || false
3804 }; // We use responder as a Map key later on. When we have a bad
3805 // polyfill, then we can't use it as a key as the polyfill tries
3806 // to add a property to the object.
3807
3808 if (true && !hasBadMapPolyfill) {
3809 Object.freeze(eventResponder);
3810 }
3811
3812 return eventResponder;
3813}
3814
3815function createScope() {
3816 var scopeComponent = {
3817 $$typeof: REACT_SCOPE_TYPE
3818 };
3819
3820 {
3821 Object.freeze(scopeComponent);
3822 }
3823
3824 return scopeComponent;
3825}
3826
3827var React = {
3828 Children: {
3829 map: mapChildren,
3830 forEach: forEachChildren,
3831 count: countChildren,
3832 toArray: toArray,
3833 only: onlyChild
3834 },
3835 createRef: createRef,
3836 Component: Component,
3837 PureComponent: PureComponent,
3838 createContext: createContext,
3839 forwardRef: forwardRef,
3840 lazy: lazy,
3841 memo: memo,
3842 useCallback: useCallback,
3843 useContext: useContext,
3844 useEffect: useEffect,
3845 useImperativeHandle: useImperativeHandle,
3846 useDebugValue: useDebugValue,
3847 useLayoutEffect: useLayoutEffect,
3848 useMemo: useMemo,
3849 useReducer: useReducer,
3850 useRef: useRef,
3851 useState: useState,
3852 Fragment: REACT_FRAGMENT_TYPE,
3853 Profiler: REACT_PROFILER_TYPE,
3854 StrictMode: REACT_STRICT_MODE_TYPE,
3855 Suspense: REACT_SUSPENSE_TYPE,
3856 createElement: createElementWithValidation,
3857 cloneElement: cloneElementWithValidation,
3858 createFactory: createFactoryWithValidation,
3859 isValidElement: isValidElement,
3860 version: ReactVersion,
3861 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals$2
3862};
3863
3864if (exposeConcurrentModeAPIs) {
3865 React.useTransition = useTransition;
3866 React.useDeferredValue = useDeferredValue;
3867 React.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
3868 React.unstable_withSuspenseConfig = withSuspenseConfig;
3869}
3870
3871if (enableFlareAPI) {
3872 React.unstable_useResponder = useResponder;
3873 React.unstable_createResponder = createEventResponder;
3874}
3875
3876if (enableFundamentalAPI) {
3877 React.unstable_createFundamental = createFundamentalComponent;
3878}
3879
3880if (enableScopeAPI) {
3881 React.unstable_createScope = createScope;
3882} // Note: some APIs are added with feature flags.
3883// Make sure that stable builds for open source
3884// don't modify the React object to avoid deopts.
3885// Also let's not expose their names in stable builds.
3886
3887
3888if (enableJSXTransformAPI) {
3889 {
3890 React.jsxDEV = jsxWithValidation;
3891 React.jsx = jsxWithValidationDynamic;
3892 React.jsxs = jsxWithValidationStatic;
3893 }
3894}
3895
3896
3897
3898var React$2 = Object.freeze({
3899 default: React
3900});
3901
3902var React$3 = ( React$2 && React ) || React$2;
3903
3904// TODO: decide on the top-level export form.
3905// This is hacky but makes it work with both Rollup and Jest.
3906
3907
3908var react = React$3.default || React$3;
3909
3910return react;
3911
3912})));