tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

react-dev.mjs (102653B)


      1 /** @license React v16.8.6
      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 // TODO: this is special because it gets imported during build.
     13 
     14 var ReactVersion = '16.8.6';
     15 
     16 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
     17 // nor polyfill, then a plain number is used for performance.
     18 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
     19 
     20 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
     21 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
     22 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
     23 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
     24 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
     25 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
     26 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
     27 
     28 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
     29 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
     30 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
     31 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
     32 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
     33 
     34 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
     35 var FAUX_ITERATOR_SYMBOL = '@@iterator';
     36 
     37 function getIteratorFn(maybeIterable) {
     38  if (maybeIterable === null || typeof maybeIterable !== 'object') {
     39    return null;
     40  }
     41  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
     42  if (typeof maybeIterator === 'function') {
     43    return maybeIterator;
     44  }
     45  return null;
     46 }
     47 
     48 /*
     49 object-assign
     50 (c) Sindre Sorhus
     51 @license MIT
     52 */
     53 
     54 
     55 /* eslint-disable no-unused-vars */
     56 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
     57 var hasOwnProperty = Object.prototype.hasOwnProperty;
     58 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
     59 
     60 function toObject(val) {
     61 if (val === null || val === undefined) {
     62 	throw new TypeError('Object.assign cannot be called with null or undefined');
     63 }
     64 
     65 return Object(val);
     66 }
     67 
     68 function shouldUseNative() {
     69 try {
     70 	if (!Object.assign) {
     71 		return false;
     72 	}
     73 
     74 	// Detect buggy property enumeration order in older V8 versions.
     75 
     76 	// https://bugs.chromium.org/p/v8/issues/detail?id=4118
     77 	var test1 = new String('abc');  // eslint-disable-line no-new-wrappers
     78 	test1[5] = 'de';
     79 	if (Object.getOwnPropertyNames(test1)[0] === '5') {
     80 		return false;
     81 	}
     82 
     83 	// https://bugs.chromium.org/p/v8/issues/detail?id=3056
     84 	var test2 = {};
     85 	for (var i = 0; i < 10; i++) {
     86 		test2['_' + String.fromCharCode(i)] = i;
     87 	}
     88 	var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
     89 		return test2[n];
     90 	});
     91 	if (order2.join('') !== '0123456789') {
     92 		return false;
     93 	}
     94 
     95 	// https://bugs.chromium.org/p/v8/issues/detail?id=3056
     96 	var test3 = {};
     97 	'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
     98 		test3[letter] = letter;
     99 	});
    100 	if (Object.keys(Object.assign({}, test3)).join('') !==
    101 			'abcdefghijklmnopqrst') {
    102 		return false;
    103 	}
    104 
    105 	return true;
    106 } catch (err) {
    107 	// We don't expect any of the above to throw, but better to be safe.
    108 	return false;
    109 }
    110 }
    111 
    112 var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
    113 var from;
    114 var to = toObject(target);
    115 var symbols;
    116 
    117 for (var s = 1; s < arguments.length; s++) {
    118 	from = Object(arguments[s]);
    119 
    120 	for (var key in from) {
    121 		if (hasOwnProperty.call(from, key)) {
    122 			to[key] = from[key];
    123 		}
    124 	}
    125 
    126 	if (getOwnPropertySymbols) {
    127 		symbols = getOwnPropertySymbols(from);
    128 		for (var i = 0; i < symbols.length; i++) {
    129 			if (propIsEnumerable.call(from, symbols[i])) {
    130 				to[symbols[i]] = from[symbols[i]];
    131 			}
    132 		}
    133 	}
    134 }
    135 
    136 return to;
    137 };
    138 
    139 /**
    140 * Use invariant() to assert state which your program assumes to be true.
    141 *
    142 * Provide sprintf-style format (only %s is supported) and arguments
    143 * to provide information about what broke and what you were
    144 * expecting.
    145 *
    146 * The invariant message will be stripped in production, but the invariant
    147 * will remain to ensure logic does not differ in production.
    148 */
    149 
    150 var validateFormat = function () {};
    151 
    152 {
    153  validateFormat = function (format) {
    154    if (format === undefined) {
    155      throw new Error('invariant requires an error message argument');
    156    }
    157  };
    158 }
    159 
    160 function invariant(condition, format, a, b, c, d, e, f) {
    161  validateFormat(format);
    162 
    163  if (!condition) {
    164    var error = void 0;
    165    if (format === undefined) {
    166      error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
    167    } else {
    168      var args = [a, b, c, d, e, f];
    169      var argIndex = 0;
    170      error = new Error(format.replace(/%s/g, function () {
    171        return args[argIndex++];
    172      }));
    173      error.name = 'Invariant Violation';
    174    }
    175 
    176    error.framesToPop = 1; // we don't care about invariant's own frame
    177    throw error;
    178  }
    179 }
    180 
    181 // Relying on the `invariant()` implementation lets us
    182 // preserve the format and params in the www builds.
    183 
    184 /**
    185 * Forked from fbjs/warning:
    186 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
    187 *
    188 * Only change is we use console.warn instead of console.error,
    189 * and do nothing when 'console' is not supported.
    190 * This really simplifies the code.
    191 * ---
    192 * Similar to invariant but only logs a warning if the condition is not met.
    193 * This can be used to log issues in development environments in critical
    194 * paths. Removing the logging code for production environments will keep the
    195 * same logic and follow the same code paths.
    196 */
    197 
    198 var lowPriorityWarning = function () {};
    199 
    200 {
    201  var printWarning = function (format) {
    202    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    203      args[_key - 1] = arguments[_key];
    204    }
    205 
    206    var argIndex = 0;
    207    var message = 'Warning: ' + format.replace(/%s/g, function () {
    208      return args[argIndex++];
    209    });
    210    if (typeof console !== 'undefined') {
    211      console.warn(message);
    212    }
    213    try {
    214      // --- Welcome to debugging React ---
    215      // This error was thrown as a convenience so that you can use this stack
    216      // to find the callsite that caused this warning to fire.
    217      throw new Error(message);
    218    } catch (x) {}
    219  };
    220 
    221  lowPriorityWarning = function (condition, format) {
    222    if (format === undefined) {
    223      throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
    224    }
    225    if (!condition) {
    226      for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
    227        args[_key2 - 2] = arguments[_key2];
    228      }
    229 
    230      printWarning.apply(undefined, [format].concat(args));
    231    }
    232  };
    233 }
    234 
    235 var lowPriorityWarning$1 = lowPriorityWarning;
    236 
    237 /**
    238 * Similar to invariant but only logs a warning if the condition is not met.
    239 * This can be used to log issues in development environments in critical
    240 * paths. Removing the logging code for production environments will keep the
    241 * same logic and follow the same code paths.
    242 */
    243 
    244 var warningWithoutStack = function () {};
    245 
    246 {
    247  warningWithoutStack = function (condition, format) {
    248    for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
    249      args[_key - 2] = arguments[_key];
    250    }
    251 
    252    if (format === undefined) {
    253      throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
    254    }
    255    if (args.length > 8) {
    256      // Check before the condition to catch violations early.
    257      throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
    258    }
    259    if (condition) {
    260      return;
    261    }
    262    if (typeof console !== 'undefined') {
    263      var argsWithFormat = args.map(function (item) {
    264        return '' + item;
    265      });
    266      argsWithFormat.unshift('Warning: ' + format);
    267 
    268      // We intentionally don't use spread (or .apply) directly because it
    269      // breaks IE9: https://github.com/facebook/react/issues/13610
    270      Function.prototype.apply.call(console.error, console, argsWithFormat);
    271    }
    272    try {
    273      // --- Welcome to debugging React ---
    274      // This error was thrown as a convenience so that you can use this stack
    275      // to find the callsite that caused this warning to fire.
    276      var argIndex = 0;
    277      var message = 'Warning: ' + format.replace(/%s/g, function () {
    278        return args[argIndex++];
    279      });
    280      throw new Error(message);
    281    } catch (x) {}
    282  };
    283 }
    284 
    285 var warningWithoutStack$1 = warningWithoutStack;
    286 
    287 var didWarnStateUpdateForUnmountedComponent = {};
    288 
    289 function warnNoop(publicInstance, callerName) {
    290  {
    291    var _constructor = publicInstance.constructor;
    292    var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
    293    var warningKey = componentName + '.' + callerName;
    294    if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
    295      return;
    296    }
    297    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);
    298    didWarnStateUpdateForUnmountedComponent[warningKey] = true;
    299  }
    300 }
    301 
    302 /**
    303 * This is the abstract API for an update queue.
    304 */
    305 var ReactNoopUpdateQueue = {
    306  /**
    307   * Checks whether or not this composite component is mounted.
    308   * @param {ReactClass} publicInstance The instance we want to test.
    309   * @return {boolean} True if mounted, false otherwise.
    310   * @protected
    311   * @final
    312   */
    313  isMounted: function (publicInstance) {
    314    return false;
    315  },
    316 
    317  /**
    318   * Forces an update. This should only be invoked when it is known with
    319   * certainty that we are **not** in a DOM transaction.
    320   *
    321   * You may want to call this when you know that some deeper aspect of the
    322   * component's state has changed but `setState` was not called.
    323   *
    324   * This will not invoke `shouldComponentUpdate`, but it will invoke
    325   * `componentWillUpdate` and `componentDidUpdate`.
    326   *
    327   * @param {ReactClass} publicInstance The instance that should rerender.
    328   * @param {?function} callback Called after component is updated.
    329   * @param {?string} callerName name of the calling function in the public API.
    330   * @internal
    331   */
    332  enqueueForceUpdate: function (publicInstance, callback, callerName) {
    333    warnNoop(publicInstance, 'forceUpdate');
    334  },
    335 
    336  /**
    337   * Replaces all of the state. Always use this or `setState` to mutate state.
    338   * You should treat `this.state` as immutable.
    339   *
    340   * There is no guarantee that `this.state` will be immediately updated, so
    341   * accessing `this.state` after calling this method may return the old value.
    342   *
    343   * @param {ReactClass} publicInstance The instance that should rerender.
    344   * @param {object} completeState Next state.
    345   * @param {?function} callback Called after component is updated.
    346   * @param {?string} callerName name of the calling function in the public API.
    347   * @internal
    348   */
    349  enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
    350    warnNoop(publicInstance, 'replaceState');
    351  },
    352 
    353  /**
    354   * Sets a subset of the state. This only exists because _pendingState is
    355   * internal. This provides a merging strategy that is not available to deep
    356   * properties which is confusing. TODO: Expose pendingState or don't use it
    357   * during the merge.
    358   *
    359   * @param {ReactClass} publicInstance The instance that should rerender.
    360   * @param {object} partialState Next partial state to be merged with state.
    361   * @param {?function} callback Called after component is updated.
    362   * @param {?string} Name of the calling function in the public API.
    363   * @internal
    364   */
    365  enqueueSetState: function (publicInstance, partialState, callback, callerName) {
    366    warnNoop(publicInstance, 'setState');
    367  }
    368 };
    369 
    370 var emptyObject = {};
    371 {
    372  Object.freeze(emptyObject);
    373 }
    374 
    375 /**
    376 * Base class helpers for the updating state of a component.
    377 */
    378 function Component(props, context, updater) {
    379  this.props = props;
    380  this.context = context;
    381  // If a component has string refs, we will assign a different object later.
    382  this.refs = emptyObject;
    383  // We initialize the default updater but the real one gets injected by the
    384  // renderer.
    385  this.updater = updater || ReactNoopUpdateQueue;
    386 }
    387 
    388 Component.prototype.isReactComponent = {};
    389 
    390 /**
    391 * Sets a subset of the state. Always use this to mutate
    392 * state. You should treat `this.state` as immutable.
    393 *
    394 * There is no guarantee that `this.state` will be immediately updated, so
    395 * accessing `this.state` after calling this method may return the old value.
    396 *
    397 * There is no guarantee that calls to `setState` will run synchronously,
    398 * as they may eventually be batched together.  You can provide an optional
    399 * callback that will be executed when the call to setState is actually
    400 * completed.
    401 *
    402 * When a function is provided to setState, it will be called at some point in
    403 * the future (not synchronously). It will be called with the up to date
    404 * component arguments (state, props, context). These values can be different
    405 * from this.* because your function may be called after receiveProps but before
    406 * shouldComponentUpdate, and this new state, props, and context will not yet be
    407 * assigned to this.
    408 *
    409 * @param {object|function} partialState Next partial state or function to
    410 *        produce next partial state to be merged with current state.
    411 * @param {?function} callback Called after state is updated.
    412 * @final
    413 * @protected
    414 */
    415 Component.prototype.setState = function (partialState, callback) {
    416  !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
    417  this.updater.enqueueSetState(this, partialState, callback, 'setState');
    418 };
    419 
    420 /**
    421 * Forces an update. This should only be invoked when it is known with
    422 * certainty that we are **not** in a DOM transaction.
    423 *
    424 * You may want to call this when you know that some deeper aspect of the
    425 * component's state has changed but `setState` was not called.
    426 *
    427 * This will not invoke `shouldComponentUpdate`, but it will invoke
    428 * `componentWillUpdate` and `componentDidUpdate`.
    429 *
    430 * @param {?function} callback Called after update is complete.
    431 * @final
    432 * @protected
    433 */
    434 Component.prototype.forceUpdate = function (callback) {
    435  this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
    436 };
    437 
    438 /**
    439 * Deprecated APIs. These APIs used to exist on classic React classes but since
    440 * we would like to deprecate them, we're not going to move them over to this
    441 * modern base class. Instead, we define a getter that warns if it's accessed.
    442 */
    443 {
    444  var deprecatedAPIs = {
    445    isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
    446    replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
    447  };
    448  var defineDeprecationWarning = function (methodName, info) {
    449    Object.defineProperty(Component.prototype, methodName, {
    450      get: function () {
    451        lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
    452        return undefined;
    453      }
    454    });
    455  };
    456  for (var fnName in deprecatedAPIs) {
    457    if (deprecatedAPIs.hasOwnProperty(fnName)) {
    458      defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
    459    }
    460  }
    461 }
    462 
    463 function ComponentDummy() {}
    464 ComponentDummy.prototype = Component.prototype;
    465 
    466 /**
    467 * Convenience component with default shallow equality check for sCU.
    468 */
    469 function PureComponent(props, context, updater) {
    470  this.props = props;
    471  this.context = context;
    472  // If a component has string refs, we will assign a different object later.
    473  this.refs = emptyObject;
    474  this.updater = updater || ReactNoopUpdateQueue;
    475 }
    476 
    477 var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
    478 pureComponentPrototype.constructor = PureComponent;
    479 // Avoid an extra prototype jump for these methods.
    480 objectAssign(pureComponentPrototype, Component.prototype);
    481 pureComponentPrototype.isPureReactComponent = true;
    482 
    483 // an immutable object with a single mutable value
    484 function createRef() {
    485  var refObject = {
    486    current: null
    487  };
    488  {
    489    Object.seal(refObject);
    490  }
    491  return refObject;
    492 }
    493 
    494 var enableSchedulerDebugging = false;
    495 
    496 /* eslint-disable no-var */
    497 
    498 // TODO: Use symbols?
    499 var ImmediatePriority = 1;
    500 var UserBlockingPriority = 2;
    501 var NormalPriority = 3;
    502 var LowPriority = 4;
    503 var IdlePriority = 5;
    504 
    505 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
    506 // Math.pow(2, 30) - 1
    507 // 0b111111111111111111111111111111
    508 var maxSigned31BitInt = 1073741823;
    509 
    510 // Times out immediately
    511 var IMMEDIATE_PRIORITY_TIMEOUT = -1;
    512 // Eventually times out
    513 var USER_BLOCKING_PRIORITY = 250;
    514 var NORMAL_PRIORITY_TIMEOUT = 5000;
    515 var LOW_PRIORITY_TIMEOUT = 10000;
    516 // Never times out
    517 var IDLE_PRIORITY = maxSigned31BitInt;
    518 
    519 // Callbacks are stored as a circular, doubly linked list.
    520 var firstCallbackNode = null;
    521 
    522 var currentDidTimeout = false;
    523 // Pausing the scheduler is useful for debugging.
    524 var isSchedulerPaused = false;
    525 
    526 var currentPriorityLevel = NormalPriority;
    527 var currentEventStartTime = -1;
    528 var currentExpirationTime = -1;
    529 
    530 // This is set when a callback is being executed, to prevent re-entrancy.
    531 var isExecutingCallback = false;
    532 
    533 var isHostCallbackScheduled = false;
    534 
    535 var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
    536 
    537 function ensureHostCallbackIsScheduled() {
    538  if (isExecutingCallback) {
    539    // Don't schedule work yet; wait until the next time we yield.
    540    return;
    541  }
    542  // Schedule the host callback using the earliest expiration in the list.
    543  var expirationTime = firstCallbackNode.expirationTime;
    544  if (!isHostCallbackScheduled) {
    545    isHostCallbackScheduled = true;
    546  } else {
    547    // Cancel the existing host callback.
    548    cancelHostCallback();
    549  }
    550  requestHostCallback(flushWork, expirationTime);
    551 }
    552 
    553 function flushFirstCallback() {
    554  var flushedNode = firstCallbackNode;
    555 
    556  // Remove the node from the list before calling the callback. That way the
    557  // list is in a consistent state even if the callback throws.
    558  var next = firstCallbackNode.next;
    559  if (firstCallbackNode === next) {
    560    // This is the last callback in the list.
    561    firstCallbackNode = null;
    562    next = null;
    563  } else {
    564    var lastCallbackNode = firstCallbackNode.previous;
    565    firstCallbackNode = lastCallbackNode.next = next;
    566    next.previous = lastCallbackNode;
    567  }
    568 
    569  flushedNode.next = flushedNode.previous = null;
    570 
    571  // Now it's safe to call the callback.
    572  var callback = flushedNode.callback;
    573  var expirationTime = flushedNode.expirationTime;
    574  var priorityLevel = flushedNode.priorityLevel;
    575  var previousPriorityLevel = currentPriorityLevel;
    576  var previousExpirationTime = currentExpirationTime;
    577  currentPriorityLevel = priorityLevel;
    578  currentExpirationTime = expirationTime;
    579  var continuationCallback;
    580  try {
    581    continuationCallback = callback();
    582  } finally {
    583    currentPriorityLevel = previousPriorityLevel;
    584    currentExpirationTime = previousExpirationTime;
    585  }
    586 
    587  // A callback may return a continuation. The continuation should be scheduled
    588  // with the same priority and expiration as the just-finished callback.
    589  if (typeof continuationCallback === 'function') {
    590    var continuationNode = {
    591      callback: continuationCallback,
    592      priorityLevel: priorityLevel,
    593      expirationTime: expirationTime,
    594      next: null,
    595      previous: null
    596    };
    597 
    598    // Insert the new callback into the list, sorted by its expiration. This is
    599    // almost the same as the code in `scheduleCallback`, except the callback
    600    // is inserted into the list *before* callbacks of equal expiration instead
    601    // of after.
    602    if (firstCallbackNode === null) {
    603      // This is the first callback in the list.
    604      firstCallbackNode = continuationNode.next = continuationNode.previous = continuationNode;
    605    } else {
    606      var nextAfterContinuation = null;
    607      var node = firstCallbackNode;
    608      do {
    609        if (node.expirationTime >= expirationTime) {
    610          // This callback expires at or after the continuation. We will insert
    611          // the continuation *before* this callback.
    612          nextAfterContinuation = node;
    613          break;
    614        }
    615        node = node.next;
    616      } while (node !== firstCallbackNode);
    617 
    618      if (nextAfterContinuation === null) {
    619        // No equal or lower priority callback was found, which means the new
    620        // callback is the lowest priority callback in the list.
    621        nextAfterContinuation = firstCallbackNode;
    622      } else if (nextAfterContinuation === firstCallbackNode) {
    623        // The new callback is the highest priority callback in the list.
    624        firstCallbackNode = continuationNode;
    625        ensureHostCallbackIsScheduled();
    626      }
    627 
    628      var previous = nextAfterContinuation.previous;
    629      previous.next = nextAfterContinuation.previous = continuationNode;
    630      continuationNode.next = nextAfterContinuation;
    631      continuationNode.previous = previous;
    632    }
    633  }
    634 }
    635 
    636 function flushImmediateWork() {
    637  if (
    638  // Confirm we've exited the outer most event handler
    639  currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
    640    isExecutingCallback = true;
    641    try {
    642      do {
    643        flushFirstCallback();
    644      } while (
    645      // Keep flushing until there are no more immediate callbacks
    646      firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
    647    } finally {
    648      isExecutingCallback = false;
    649      if (firstCallbackNode !== null) {
    650        // There's still work remaining. Request another callback.
    651        ensureHostCallbackIsScheduled();
    652      } else {
    653        isHostCallbackScheduled = false;
    654      }
    655    }
    656  }
    657 }
    658 
    659 function flushWork(didTimeout) {
    660  // Exit right away if we're currently paused
    661 
    662  if (enableSchedulerDebugging && isSchedulerPaused) {
    663    return;
    664  }
    665 
    666  isExecutingCallback = true;
    667  var previousDidTimeout = currentDidTimeout;
    668  currentDidTimeout = didTimeout;
    669  try {
    670    if (didTimeout) {
    671      // Flush all the expired callbacks without yielding.
    672      while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
    673        // TODO Wrap in feature flag
    674        // Read the current time. Flush all the callbacks that expire at or
    675        // earlier than that time. Then read the current time again and repeat.
    676        // This optimizes for as few performance.now calls as possible.
    677        var currentTime = getCurrentTime();
    678        if (firstCallbackNode.expirationTime <= currentTime) {
    679          do {
    680            flushFirstCallback();
    681          } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
    682          continue;
    683        }
    684        break;
    685      }
    686    } else {
    687      // Keep flushing callbacks until we run out of time in the frame.
    688      if (firstCallbackNode !== null) {
    689        do {
    690          if (enableSchedulerDebugging && isSchedulerPaused) {
    691            break;
    692          }
    693          flushFirstCallback();
    694        } while (firstCallbackNode !== null && !shouldYieldToHost());
    695      }
    696    }
    697  } finally {
    698    isExecutingCallback = false;
    699    currentDidTimeout = previousDidTimeout;
    700    if (firstCallbackNode !== null) {
    701      // There's still work remaining. Request another callback.
    702      ensureHostCallbackIsScheduled();
    703    } else {
    704      isHostCallbackScheduled = false;
    705    }
    706    // Before exiting, flush all the immediate work that was scheduled.
    707    flushImmediateWork();
    708  }
    709 }
    710 
    711 function unstable_runWithPriority(priorityLevel, eventHandler) {
    712  switch (priorityLevel) {
    713    case ImmediatePriority:
    714    case UserBlockingPriority:
    715    case NormalPriority:
    716    case LowPriority:
    717    case IdlePriority:
    718      break;
    719    default:
    720      priorityLevel = NormalPriority;
    721  }
    722 
    723  var previousPriorityLevel = currentPriorityLevel;
    724  var previousEventStartTime = currentEventStartTime;
    725  currentPriorityLevel = priorityLevel;
    726  currentEventStartTime = getCurrentTime();
    727 
    728  try {
    729    return eventHandler();
    730  } finally {
    731    currentPriorityLevel = previousPriorityLevel;
    732    currentEventStartTime = previousEventStartTime;
    733 
    734    // Before exiting, flush all the immediate work that was scheduled.
    735    flushImmediateWork();
    736  }
    737 }
    738 
    739 function unstable_next(eventHandler) {
    740  var priorityLevel = void 0;
    741  switch (currentPriorityLevel) {
    742    case ImmediatePriority:
    743    case UserBlockingPriority:
    744    case NormalPriority:
    745      // Shift down to normal priority
    746      priorityLevel = NormalPriority;
    747      break;
    748    default:
    749      // Anything lower than normal priority should remain at the current level.
    750      priorityLevel = currentPriorityLevel;
    751      break;
    752  }
    753 
    754  var previousPriorityLevel = currentPriorityLevel;
    755  var previousEventStartTime = currentEventStartTime;
    756  currentPriorityLevel = priorityLevel;
    757  currentEventStartTime = getCurrentTime();
    758 
    759  try {
    760    return eventHandler();
    761  } finally {
    762    currentPriorityLevel = previousPriorityLevel;
    763    currentEventStartTime = previousEventStartTime;
    764 
    765    // Before exiting, flush all the immediate work that was scheduled.
    766    flushImmediateWork();
    767  }
    768 }
    769 
    770 function unstable_wrapCallback(callback) {
    771  var parentPriorityLevel = currentPriorityLevel;
    772  return function () {
    773    // This is a fork of runWithPriority, inlined for performance.
    774    var previousPriorityLevel = currentPriorityLevel;
    775    var previousEventStartTime = currentEventStartTime;
    776    currentPriorityLevel = parentPriorityLevel;
    777    currentEventStartTime = getCurrentTime();
    778 
    779    try {
    780      return callback.apply(this, arguments);
    781    } finally {
    782      currentPriorityLevel = previousPriorityLevel;
    783      currentEventStartTime = previousEventStartTime;
    784      flushImmediateWork();
    785    }
    786  };
    787 }
    788 
    789 function unstable_scheduleCallback(callback, deprecated_options) {
    790  var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
    791 
    792  var expirationTime;
    793  if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
    794    // FIXME: Remove this branch once we lift expiration times out of React.
    795    expirationTime = startTime + deprecated_options.timeout;
    796  } else {
    797    switch (currentPriorityLevel) {
    798      case ImmediatePriority:
    799        expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
    800        break;
    801      case UserBlockingPriority:
    802        expirationTime = startTime + USER_BLOCKING_PRIORITY;
    803        break;
    804      case IdlePriority:
    805        expirationTime = startTime + IDLE_PRIORITY;
    806        break;
    807      case LowPriority:
    808        expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
    809        break;
    810      case NormalPriority:
    811      default:
    812        expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
    813    }
    814  }
    815 
    816  var newNode = {
    817    callback: callback,
    818    priorityLevel: currentPriorityLevel,
    819    expirationTime: expirationTime,
    820    next: null,
    821    previous: null
    822  };
    823 
    824  // Insert the new callback into the list, ordered first by expiration, then
    825  // by insertion. So the new callback is inserted any other callback with
    826  // equal expiration.
    827  if (firstCallbackNode === null) {
    828    // This is the first callback in the list.
    829    firstCallbackNode = newNode.next = newNode.previous = newNode;
    830    ensureHostCallbackIsScheduled();
    831  } else {
    832    var next = null;
    833    var node = firstCallbackNode;
    834    do {
    835      if (node.expirationTime > expirationTime) {
    836        // The new callback expires before this one.
    837        next = node;
    838        break;
    839      }
    840      node = node.next;
    841    } while (node !== firstCallbackNode);
    842 
    843    if (next === null) {
    844      // No callback with a later expiration was found, which means the new
    845      // callback has the latest expiration in the list.
    846      next = firstCallbackNode;
    847    } else if (next === firstCallbackNode) {
    848      // The new callback has the earliest expiration in the entire list.
    849      firstCallbackNode = newNode;
    850      ensureHostCallbackIsScheduled();
    851    }
    852 
    853    var previous = next.previous;
    854    previous.next = next.previous = newNode;
    855    newNode.next = next;
    856    newNode.previous = previous;
    857  }
    858 
    859  return newNode;
    860 }
    861 
    862 function unstable_pauseExecution() {
    863  isSchedulerPaused = true;
    864 }
    865 
    866 function unstable_continueExecution() {
    867  isSchedulerPaused = false;
    868  if (firstCallbackNode !== null) {
    869    ensureHostCallbackIsScheduled();
    870  }
    871 }
    872 
    873 function unstable_getFirstCallbackNode() {
    874  return firstCallbackNode;
    875 }
    876 
    877 function unstable_cancelCallback(callbackNode) {
    878  var next = callbackNode.next;
    879  if (next === null) {
    880    // Already cancelled.
    881    return;
    882  }
    883 
    884  if (next === callbackNode) {
    885    // This is the only scheduled callback. Clear the list.
    886    firstCallbackNode = null;
    887  } else {
    888    // Remove the callback from its position in the list.
    889    if (callbackNode === firstCallbackNode) {
    890      firstCallbackNode = next;
    891    }
    892    var previous = callbackNode.previous;
    893    previous.next = next;
    894    next.previous = previous;
    895  }
    896 
    897  callbackNode.next = callbackNode.previous = null;
    898 }
    899 
    900 function unstable_getCurrentPriorityLevel() {
    901  return currentPriorityLevel;
    902 }
    903 
    904 function unstable_shouldYield() {
    905  return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
    906 }
    907 
    908 // The remaining code is essentially a polyfill for requestIdleCallback. It
    909 // works by scheduling a requestAnimationFrame, storing the time for the start
    910 // of the frame, then scheduling a postMessage which gets scheduled after paint.
    911 // Within the postMessage handler do as much work as possible until time + frame
    912 // rate. By separating the idle call into a separate event tick we ensure that
    913 // layout, paint and other browser work is counted against the available time.
    914 // The frame rate is dynamically adjusted.
    915 
    916 // We capture a local reference to any global, in case it gets polyfilled after
    917 // this module is initially evaluated. We want to be using a
    918 // consistent implementation.
    919 var localDate = Date;
    920 
    921 // This initialization code may run even on server environments if a component
    922 // just imports ReactDOM (e.g. for findDOMNode). Some environments might not
    923 // have setTimeout or clearTimeout. However, we always expect them to be defined
    924 // on the client. https://github.com/facebook/react/pull/13088
    925 var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
    926 var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
    927 
    928 // We don't expect either of these to necessarily be defined, but we will error
    929 // later if they are missing on the client.
    930 var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
    931 var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
    932 
    933 var getCurrentTime;
    934 
    935 // requestAnimationFrame does not run when the tab is in the background. If
    936 // we're backgrounded we prefer for that work to happen so that the page
    937 // continues to load in the background. So we also schedule a 'setTimeout' as
    938 // a fallback.
    939 // TODO: Need a better heuristic for backgrounded work.
    940 var ANIMATION_FRAME_TIMEOUT = 100;
    941 var rAFID;
    942 var rAFTimeoutID;
    943 var requestAnimationFrameWithTimeout = function (callback) {
    944  // schedule rAF and also a setTimeout
    945  rAFID = localRequestAnimationFrame(function (timestamp) {
    946    // cancel the setTimeout
    947    localClearTimeout(rAFTimeoutID);
    948    callback(timestamp);
    949  });
    950  rAFTimeoutID = localSetTimeout(function () {
    951    // cancel the requestAnimationFrame
    952    localCancelAnimationFrame(rAFID);
    953    callback(getCurrentTime());
    954  }, ANIMATION_FRAME_TIMEOUT);
    955 };
    956 
    957 if (hasNativePerformanceNow) {
    958  var Performance = performance;
    959  getCurrentTime = function () {
    960    return Performance.now();
    961  };
    962 } else {
    963  getCurrentTime = function () {
    964    return localDate.now();
    965  };
    966 }
    967 
    968 var requestHostCallback;
    969 var cancelHostCallback;
    970 var shouldYieldToHost;
    971 
    972 var globalValue = null;
    973 if (typeof window !== 'undefined') {
    974  globalValue = window;
    975 } else if (typeof global !== 'undefined') {
    976  globalValue = global;
    977 }
    978 
    979 if (globalValue && globalValue._schedMock) {
    980  // Dynamic injection, only for testing purposes.
    981  var globalImpl = globalValue._schedMock;
    982  requestHostCallback = globalImpl[0];
    983  cancelHostCallback = globalImpl[1];
    984  shouldYieldToHost = globalImpl[2];
    985  getCurrentTime = globalImpl[3];
    986 } else if (
    987 // If Scheduler runs in a non-DOM environment, it falls back to a naive
    988 // implementation using setTimeout.
    989 typeof window === 'undefined' ||
    990 // Check if MessageChannel is supported, too.
    991 typeof MessageChannel !== 'function') {
    992  // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
    993  // fallback to a naive implementation.
    994  var _callback = null;
    995  var _flushCallback = function (didTimeout) {
    996    if (_callback !== null) {
    997      try {
    998        _callback(didTimeout);
    999      } finally {
   1000        _callback = null;
   1001      }
   1002    }
   1003  };
   1004  requestHostCallback = function (cb, ms) {
   1005    if (_callback !== null) {
   1006      // Protect against re-entrancy.
   1007      setTimeout(requestHostCallback, 0, cb);
   1008    } else {
   1009      _callback = cb;
   1010      setTimeout(_flushCallback, 0, false);
   1011    }
   1012  };
   1013  cancelHostCallback = function () {
   1014    _callback = null;
   1015  };
   1016  shouldYieldToHost = function () {
   1017    return false;
   1018  };
   1019 } else {
   1020  if (typeof console !== 'undefined') {
   1021    // TODO: Remove fb.me link
   1022    if (typeof localRequestAnimationFrame !== 'function') {
   1023      console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
   1024    }
   1025    if (typeof localCancelAnimationFrame !== 'function') {
   1026      console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
   1027    }
   1028  }
   1029 
   1030  var scheduledHostCallback = null;
   1031  var isMessageEventScheduled = false;
   1032  var timeoutTime = -1;
   1033 
   1034  var isAnimationFrameScheduled = false;
   1035 
   1036  var isFlushingHostCallback = false;
   1037 
   1038  var frameDeadline = 0;
   1039  // We start out assuming that we run at 30fps but then the heuristic tracking
   1040  // will adjust this value to a faster fps if we get more frequent animation
   1041  // frames.
   1042  var previousFrameTime = 33;
   1043  var activeFrameTime = 33;
   1044 
   1045  shouldYieldToHost = function () {
   1046    return frameDeadline <= getCurrentTime();
   1047  };
   1048 
   1049  // We use the postMessage trick to defer idle work until after the repaint.
   1050  var channel = new MessageChannel();
   1051  var port = channel.port2;
   1052  channel.port1.onmessage = function (event) {
   1053    isMessageEventScheduled = false;
   1054 
   1055    var prevScheduledCallback = scheduledHostCallback;
   1056    var prevTimeoutTime = timeoutTime;
   1057    scheduledHostCallback = null;
   1058    timeoutTime = -1;
   1059 
   1060    var currentTime = getCurrentTime();
   1061 
   1062    var didTimeout = false;
   1063    if (frameDeadline - currentTime <= 0) {
   1064      // There's no time left in this idle period. Check if the callback has
   1065      // a timeout and whether it's been exceeded.
   1066      if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
   1067        // Exceeded the timeout. Invoke the callback even though there's no
   1068        // time left.
   1069        didTimeout = true;
   1070      } else {
   1071        // No timeout.
   1072        if (!isAnimationFrameScheduled) {
   1073          // Schedule another animation callback so we retry later.
   1074          isAnimationFrameScheduled = true;
   1075          requestAnimationFrameWithTimeout(animationTick);
   1076        }
   1077        // Exit without invoking the callback.
   1078        scheduledHostCallback = prevScheduledCallback;
   1079        timeoutTime = prevTimeoutTime;
   1080        return;
   1081      }
   1082    }
   1083 
   1084    if (prevScheduledCallback !== null) {
   1085      isFlushingHostCallback = true;
   1086      try {
   1087        prevScheduledCallback(didTimeout);
   1088      } finally {
   1089        isFlushingHostCallback = false;
   1090      }
   1091    }
   1092  };
   1093 
   1094  var animationTick = function (rafTime) {
   1095    if (scheduledHostCallback !== null) {
   1096      // Eagerly schedule the next animation callback at the beginning of the
   1097      // frame. If the scheduler queue is not empty at the end of the frame, it
   1098      // will continue flushing inside that callback. If the queue *is* empty,
   1099      // then it will exit immediately. Posting the callback at the start of the
   1100      // frame ensures it's fired within the earliest possible frame. If we
   1101      // waited until the end of the frame to post the callback, we risk the
   1102      // browser skipping a frame and not firing the callback until the frame
   1103      // after that.
   1104      requestAnimationFrameWithTimeout(animationTick);
   1105    } else {
   1106      // No pending work. Exit.
   1107      isAnimationFrameScheduled = false;
   1108      return;
   1109    }
   1110 
   1111    var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
   1112    if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
   1113      if (nextFrameTime < 8) {
   1114        // Defensive coding. We don't support higher frame rates than 120hz.
   1115        // If the calculated frame time gets lower than 8, it is probably a bug.
   1116        nextFrameTime = 8;
   1117      }
   1118      // If one frame goes long, then the next one can be short to catch up.
   1119      // If two frames are short in a row, then that's an indication that we
   1120      // actually have a higher frame rate than what we're currently optimizing.
   1121      // We adjust our heuristic dynamically accordingly. For example, if we're
   1122      // running on 120hz display or 90hz VR display.
   1123      // Take the max of the two in case one of them was an anomaly due to
   1124      // missed frame deadlines.
   1125      activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
   1126    } else {
   1127      previousFrameTime = nextFrameTime;
   1128    }
   1129    frameDeadline = rafTime + activeFrameTime;
   1130    if (!isMessageEventScheduled) {
   1131      isMessageEventScheduled = true;
   1132      port.postMessage(undefined);
   1133    }
   1134  };
   1135 
   1136  requestHostCallback = function (callback, absoluteTimeout) {
   1137    scheduledHostCallback = callback;
   1138    timeoutTime = absoluteTimeout;
   1139    if (isFlushingHostCallback || absoluteTimeout < 0) {
   1140      // Don't wait for the next frame. Continue working ASAP, in a new event.
   1141      port.postMessage(undefined);
   1142    } else if (!isAnimationFrameScheduled) {
   1143      // If rAF didn't already schedule one, we need to schedule a frame.
   1144      // TODO: If this rAF doesn't materialize because the browser throttles, we
   1145      // might want to still have setTimeout trigger rIC as a backup to ensure
   1146      // that we keep performing work.
   1147      isAnimationFrameScheduled = true;
   1148      requestAnimationFrameWithTimeout(animationTick);
   1149    }
   1150  };
   1151 
   1152  cancelHostCallback = function () {
   1153    scheduledHostCallback = null;
   1154    isMessageEventScheduled = false;
   1155    timeoutTime = -1;
   1156  };
   1157 }
   1158 
   1159 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
   1160 
   1161 
   1162 // In some cases, StrictMode should also double-render lifecycles.
   1163 // This can be confusing for tests though,
   1164 // And it can be bad for performance in production.
   1165 // This feature flag can be used to control the behavior:
   1166 
   1167 
   1168 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
   1169 // replay the begin phase of a failed component inside invokeGuardedCallback.
   1170 
   1171 
   1172 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
   1173 
   1174 
   1175 // Gather advanced timing metrics for Profiler subtrees.
   1176 
   1177 
   1178 // Trace which interactions trigger each commit.
   1179 var enableSchedulerTracing = true;
   1180 
   1181 // Only used in www builds.
   1182 // TODO: true? Here it might just be false.
   1183 
   1184 // Only used in www builds.
   1185 
   1186 
   1187 // Only used in www builds.
   1188 
   1189 
   1190 // React Fire: prevent the value and checked attributes from syncing
   1191 // with their related DOM properties
   1192 
   1193 
   1194 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
   1195 // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
   1196 var enableStableConcurrentModeAPIs = false;
   1197 
   1198 var DEFAULT_THREAD_ID = 0;
   1199 
   1200 // Counters used to generate unique IDs.
   1201 var interactionIDCounter = 0;
   1202 var threadIDCounter = 0;
   1203 
   1204 // Set of currently traced interactions.
   1205 // Interactions "stack"–
   1206 // Meaning that newly traced interactions are appended to the previously active set.
   1207 // When an interaction goes out of scope, the previous set (if any) is restored.
   1208 var interactionsRef = null;
   1209 
   1210 // Listener(s) to notify when interactions begin and end.
   1211 var subscriberRef = null;
   1212 
   1213 if (enableSchedulerTracing) {
   1214  interactionsRef = {
   1215    current: new Set()
   1216  };
   1217  subscriberRef = {
   1218    current: null
   1219  };
   1220 }
   1221 
   1222 function unstable_clear(callback) {
   1223  if (!enableSchedulerTracing) {
   1224    return callback();
   1225  }
   1226 
   1227  var prevInteractions = interactionsRef.current;
   1228  interactionsRef.current = new Set();
   1229 
   1230  try {
   1231    return callback();
   1232  } finally {
   1233    interactionsRef.current = prevInteractions;
   1234  }
   1235 }
   1236 
   1237 function unstable_getCurrent() {
   1238  if (!enableSchedulerTracing) {
   1239    return null;
   1240  } else {
   1241    return interactionsRef.current;
   1242  }
   1243 }
   1244 
   1245 function unstable_getThreadID() {
   1246  return ++threadIDCounter;
   1247 }
   1248 
   1249 function unstable_trace(name, timestamp, callback) {
   1250  var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
   1251 
   1252  if (!enableSchedulerTracing) {
   1253    return callback();
   1254  }
   1255 
   1256  var interaction = {
   1257    __count: 1,
   1258    id: interactionIDCounter++,
   1259    name: name,
   1260    timestamp: timestamp
   1261  };
   1262 
   1263  var prevInteractions = interactionsRef.current;
   1264 
   1265  // Traced interactions should stack/accumulate.
   1266  // To do that, clone the current interactions.
   1267  // The previous set will be restored upon completion.
   1268  var interactions = new Set(prevInteractions);
   1269  interactions.add(interaction);
   1270  interactionsRef.current = interactions;
   1271 
   1272  var subscriber = subscriberRef.current;
   1273  var returnValue = void 0;
   1274 
   1275  try {
   1276    if (subscriber !== null) {
   1277      subscriber.onInteractionTraced(interaction);
   1278    }
   1279  } finally {
   1280    try {
   1281      if (subscriber !== null) {
   1282        subscriber.onWorkStarted(interactions, threadID);
   1283      }
   1284    } finally {
   1285      try {
   1286        returnValue = callback();
   1287      } finally {
   1288        interactionsRef.current = prevInteractions;
   1289 
   1290        try {
   1291          if (subscriber !== null) {
   1292            subscriber.onWorkStopped(interactions, threadID);
   1293          }
   1294        } finally {
   1295          interaction.__count--;
   1296 
   1297          // If no async work was scheduled for this interaction,
   1298          // Notify subscribers that it's completed.
   1299          if (subscriber !== null && interaction.__count === 0) {
   1300            subscriber.onInteractionScheduledWorkCompleted(interaction);
   1301          }
   1302        }
   1303      }
   1304    }
   1305  }
   1306 
   1307  return returnValue;
   1308 }
   1309 
   1310 function unstable_wrap(callback) {
   1311  var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
   1312 
   1313  if (!enableSchedulerTracing) {
   1314    return callback;
   1315  }
   1316 
   1317  var wrappedInteractions = interactionsRef.current;
   1318 
   1319  var subscriber = subscriberRef.current;
   1320  if (subscriber !== null) {
   1321    subscriber.onWorkScheduled(wrappedInteractions, threadID);
   1322  }
   1323 
   1324  // Update the pending async work count for the current interactions.
   1325  // Update after calling subscribers in case of error.
   1326  wrappedInteractions.forEach(function (interaction) {
   1327    interaction.__count++;
   1328  });
   1329 
   1330  var hasRun = false;
   1331 
   1332  function wrapped() {
   1333    var prevInteractions = interactionsRef.current;
   1334    interactionsRef.current = wrappedInteractions;
   1335 
   1336    subscriber = subscriberRef.current;
   1337 
   1338    try {
   1339      var returnValue = void 0;
   1340 
   1341      try {
   1342        if (subscriber !== null) {
   1343          subscriber.onWorkStarted(wrappedInteractions, threadID);
   1344        }
   1345      } finally {
   1346        try {
   1347          returnValue = callback.apply(undefined, arguments);
   1348        } finally {
   1349          interactionsRef.current = prevInteractions;
   1350 
   1351          if (subscriber !== null) {
   1352            subscriber.onWorkStopped(wrappedInteractions, threadID);
   1353          }
   1354        }
   1355      }
   1356 
   1357      return returnValue;
   1358    } finally {
   1359      if (!hasRun) {
   1360        // We only expect a wrapped function to be executed once,
   1361        // But in the event that it's executed more than once–
   1362        // Only decrement the outstanding interaction counts once.
   1363        hasRun = true;
   1364 
   1365        // Update pending async counts for all wrapped interactions.
   1366        // If this was the last scheduled async work for any of them,
   1367        // Mark them as completed.
   1368        wrappedInteractions.forEach(function (interaction) {
   1369          interaction.__count--;
   1370 
   1371          if (subscriber !== null && interaction.__count === 0) {
   1372            subscriber.onInteractionScheduledWorkCompleted(interaction);
   1373          }
   1374        });
   1375      }
   1376    }
   1377  }
   1378 
   1379  wrapped.cancel = function cancel() {
   1380    subscriber = subscriberRef.current;
   1381 
   1382    try {
   1383      if (subscriber !== null) {
   1384        subscriber.onWorkCanceled(wrappedInteractions, threadID);
   1385      }
   1386    } finally {
   1387      // Update pending async counts for all wrapped interactions.
   1388      // If this was the last scheduled async work for any of them,
   1389      // Mark them as completed.
   1390      wrappedInteractions.forEach(function (interaction) {
   1391        interaction.__count--;
   1392 
   1393        if (subscriber && interaction.__count === 0) {
   1394          subscriber.onInteractionScheduledWorkCompleted(interaction);
   1395        }
   1396      });
   1397    }
   1398  };
   1399 
   1400  return wrapped;
   1401 }
   1402 
   1403 var subscribers = null;
   1404 if (enableSchedulerTracing) {
   1405  subscribers = new Set();
   1406 }
   1407 
   1408 function unstable_subscribe(subscriber) {
   1409  if (enableSchedulerTracing) {
   1410    subscribers.add(subscriber);
   1411 
   1412    if (subscribers.size === 1) {
   1413      subscriberRef.current = {
   1414        onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
   1415        onInteractionTraced: onInteractionTraced,
   1416        onWorkCanceled: onWorkCanceled,
   1417        onWorkScheduled: onWorkScheduled,
   1418        onWorkStarted: onWorkStarted,
   1419        onWorkStopped: onWorkStopped
   1420      };
   1421    }
   1422  }
   1423 }
   1424 
   1425 function unstable_unsubscribe(subscriber) {
   1426  if (enableSchedulerTracing) {
   1427    subscribers.delete(subscriber);
   1428 
   1429    if (subscribers.size === 0) {
   1430      subscriberRef.current = null;
   1431    }
   1432  }
   1433 }
   1434 
   1435 function onInteractionTraced(interaction) {
   1436  var didCatchError = false;
   1437  var caughtError = null;
   1438 
   1439  subscribers.forEach(function (subscriber) {
   1440    try {
   1441      subscriber.onInteractionTraced(interaction);
   1442    } catch (error) {
   1443      if (!didCatchError) {
   1444        didCatchError = true;
   1445        caughtError = error;
   1446      }
   1447    }
   1448  });
   1449 
   1450  if (didCatchError) {
   1451    throw caughtError;
   1452  }
   1453 }
   1454 
   1455 function onInteractionScheduledWorkCompleted(interaction) {
   1456  var didCatchError = false;
   1457  var caughtError = null;
   1458 
   1459  subscribers.forEach(function (subscriber) {
   1460    try {
   1461      subscriber.onInteractionScheduledWorkCompleted(interaction);
   1462    } catch (error) {
   1463      if (!didCatchError) {
   1464        didCatchError = true;
   1465        caughtError = error;
   1466      }
   1467    }
   1468  });
   1469 
   1470  if (didCatchError) {
   1471    throw caughtError;
   1472  }
   1473 }
   1474 
   1475 function onWorkScheduled(interactions, threadID) {
   1476  var didCatchError = false;
   1477  var caughtError = null;
   1478 
   1479  subscribers.forEach(function (subscriber) {
   1480    try {
   1481      subscriber.onWorkScheduled(interactions, threadID);
   1482    } catch (error) {
   1483      if (!didCatchError) {
   1484        didCatchError = true;
   1485        caughtError = error;
   1486      }
   1487    }
   1488  });
   1489 
   1490  if (didCatchError) {
   1491    throw caughtError;
   1492  }
   1493 }
   1494 
   1495 function onWorkStarted(interactions, threadID) {
   1496  var didCatchError = false;
   1497  var caughtError = null;
   1498 
   1499  subscribers.forEach(function (subscriber) {
   1500    try {
   1501      subscriber.onWorkStarted(interactions, threadID);
   1502    } catch (error) {
   1503      if (!didCatchError) {
   1504        didCatchError = true;
   1505        caughtError = error;
   1506      }
   1507    }
   1508  });
   1509 
   1510  if (didCatchError) {
   1511    throw caughtError;
   1512  }
   1513 }
   1514 
   1515 function onWorkStopped(interactions, threadID) {
   1516  var didCatchError = false;
   1517  var caughtError = null;
   1518 
   1519  subscribers.forEach(function (subscriber) {
   1520    try {
   1521      subscriber.onWorkStopped(interactions, threadID);
   1522    } catch (error) {
   1523      if (!didCatchError) {
   1524        didCatchError = true;
   1525        caughtError = error;
   1526      }
   1527    }
   1528  });
   1529 
   1530  if (didCatchError) {
   1531    throw caughtError;
   1532  }
   1533 }
   1534 
   1535 function onWorkCanceled(interactions, threadID) {
   1536  var didCatchError = false;
   1537  var caughtError = null;
   1538 
   1539  subscribers.forEach(function (subscriber) {
   1540    try {
   1541      subscriber.onWorkCanceled(interactions, threadID);
   1542    } catch (error) {
   1543      if (!didCatchError) {
   1544        didCatchError = true;
   1545        caughtError = error;
   1546      }
   1547    }
   1548  });
   1549 
   1550  if (didCatchError) {
   1551    throw caughtError;
   1552  }
   1553 }
   1554 
   1555 /**
   1556 * Keeps track of the current dispatcher.
   1557 */
   1558 var ReactCurrentDispatcher = {
   1559  /**
   1560   * @internal
   1561   * @type {ReactComponent}
   1562   */
   1563  current: null
   1564 };
   1565 
   1566 /**
   1567 * Keeps track of the current owner.
   1568 *
   1569 * The current owner is the component who should own any components that are
   1570 * currently being constructed.
   1571 */
   1572 var ReactCurrentOwner = {
   1573  /**
   1574   * @internal
   1575   * @type {ReactComponent}
   1576   */
   1577  current: null
   1578 };
   1579 
   1580 var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
   1581 
   1582 var describeComponentFrame = function (name, source, ownerName) {
   1583  var sourceInfo = '';
   1584  if (source) {
   1585    var path = source.fileName;
   1586    var fileName = path.replace(BEFORE_SLASH_RE, '');
   1587    {
   1588      // In DEV, include code for a common special case:
   1589      // prefer "folder/index.js" instead of just "index.js".
   1590      if (/^index\./.test(fileName)) {
   1591        var match = path.match(BEFORE_SLASH_RE);
   1592        if (match) {
   1593          var pathBeforeSlash = match[1];
   1594          if (pathBeforeSlash) {
   1595            var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
   1596            fileName = folderName + '/' + fileName;
   1597          }
   1598        }
   1599      }
   1600    }
   1601    sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
   1602  } else if (ownerName) {
   1603    sourceInfo = ' (created by ' + ownerName + ')';
   1604  }
   1605  return '\n    in ' + (name || 'Unknown') + sourceInfo;
   1606 };
   1607 
   1608 var Resolved = 1;
   1609 
   1610 
   1611 function refineResolvedLazyComponent(lazyComponent) {
   1612  return lazyComponent._status === Resolved ? lazyComponent._result : null;
   1613 }
   1614 
   1615 function getWrappedName(outerType, innerType, wrapperName) {
   1616  var functionName = innerType.displayName || innerType.name || '';
   1617  return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
   1618 }
   1619 
   1620 function getComponentName(type) {
   1621  if (type == null) {
   1622    // Host root, text node or just invalid type.
   1623    return null;
   1624  }
   1625  {
   1626    if (typeof type.tag === 'number') {
   1627      warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
   1628    }
   1629  }
   1630  if (typeof type === 'function') {
   1631    return type.displayName || type.name || null;
   1632  }
   1633  if (typeof type === 'string') {
   1634    return type;
   1635  }
   1636  switch (type) {
   1637    case REACT_CONCURRENT_MODE_TYPE:
   1638      return 'ConcurrentMode';
   1639    case REACT_FRAGMENT_TYPE:
   1640      return 'Fragment';
   1641    case REACT_PORTAL_TYPE:
   1642      return 'Portal';
   1643    case REACT_PROFILER_TYPE:
   1644      return 'Profiler';
   1645    case REACT_STRICT_MODE_TYPE:
   1646      return 'StrictMode';
   1647    case REACT_SUSPENSE_TYPE:
   1648      return 'Suspense';
   1649  }
   1650  if (typeof type === 'object') {
   1651    switch (type.$$typeof) {
   1652      case REACT_CONTEXT_TYPE:
   1653        return 'Context.Consumer';
   1654      case REACT_PROVIDER_TYPE:
   1655        return 'Context.Provider';
   1656      case REACT_FORWARD_REF_TYPE:
   1657        return getWrappedName(type, type.render, 'ForwardRef');
   1658      case REACT_MEMO_TYPE:
   1659        return getComponentName(type.type);
   1660      case REACT_LAZY_TYPE:
   1661        {
   1662          var thenable = type;
   1663          var resolvedThenable = refineResolvedLazyComponent(thenable);
   1664          if (resolvedThenable) {
   1665            return getComponentName(resolvedThenable);
   1666          }
   1667        }
   1668    }
   1669  }
   1670  return null;
   1671 }
   1672 
   1673 var ReactDebugCurrentFrame = {};
   1674 
   1675 var currentlyValidatingElement = null;
   1676 
   1677 function setCurrentlyValidatingElement(element) {
   1678  {
   1679    currentlyValidatingElement = element;
   1680  }
   1681 }
   1682 
   1683 {
   1684  // Stack implementation injected by the current renderer.
   1685  ReactDebugCurrentFrame.getCurrentStack = null;
   1686 
   1687  ReactDebugCurrentFrame.getStackAddendum = function () {
   1688    var stack = '';
   1689 
   1690    // Add an extra top frame while an element is being validated
   1691    if (currentlyValidatingElement) {
   1692      var name = getComponentName(currentlyValidatingElement.type);
   1693      var owner = currentlyValidatingElement._owner;
   1694      stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
   1695    }
   1696 
   1697    // Delegate to the injected renderer-specific implementation
   1698    var impl = ReactDebugCurrentFrame.getCurrentStack;
   1699    if (impl) {
   1700      stack += impl() || '';
   1701    }
   1702 
   1703    return stack;
   1704  };
   1705 }
   1706 
   1707 var ReactSharedInternals = {
   1708  ReactCurrentDispatcher: ReactCurrentDispatcher,
   1709  ReactCurrentOwner: ReactCurrentOwner,
   1710  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
   1711  assign: objectAssign
   1712 };
   1713 
   1714 {
   1715  // Re-export the schedule API(s) for UMD bundles.
   1716  // This avoids introducing a dependency on a new UMD global in a minor update,
   1717  // Since that would be a breaking change (e.g. for all existing CodeSandboxes).
   1718  // This re-export is only required for UMD bundles;
   1719  // CJS bundles use the shared NPM package.
   1720  objectAssign(ReactSharedInternals, {
   1721    Scheduler: {
   1722      unstable_cancelCallback: unstable_cancelCallback,
   1723      unstable_shouldYield: unstable_shouldYield,
   1724      unstable_now: getCurrentTime,
   1725      unstable_scheduleCallback: unstable_scheduleCallback,
   1726      unstable_runWithPriority: unstable_runWithPriority,
   1727      unstable_next: unstable_next,
   1728      unstable_wrapCallback: unstable_wrapCallback,
   1729      unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
   1730      unstable_pauseExecution: unstable_pauseExecution,
   1731      unstable_continueExecution: unstable_continueExecution,
   1732      unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
   1733      unstable_IdlePriority: IdlePriority,
   1734      unstable_ImmediatePriority: ImmediatePriority,
   1735      unstable_LowPriority: LowPriority,
   1736      unstable_NormalPriority: NormalPriority,
   1737      unstable_UserBlockingPriority: UserBlockingPriority
   1738    },
   1739    SchedulerTracing: {
   1740      __interactionsRef: interactionsRef,
   1741      __subscriberRef: subscriberRef,
   1742      unstable_clear: unstable_clear,
   1743      unstable_getCurrent: unstable_getCurrent,
   1744      unstable_getThreadID: unstable_getThreadID,
   1745      unstable_subscribe: unstable_subscribe,
   1746      unstable_trace: unstable_trace,
   1747      unstable_unsubscribe: unstable_unsubscribe,
   1748      unstable_wrap: unstable_wrap
   1749    }
   1750  });
   1751 }
   1752 
   1753 {
   1754  objectAssign(ReactSharedInternals, {
   1755    // These should not be included in production.
   1756    ReactDebugCurrentFrame: ReactDebugCurrentFrame,
   1757    // Shim for React DOM 16.0.0 which still destructured (but not used) this.
   1758    // TODO: remove in React 17.0.
   1759    ReactComponentTreeHook: {}
   1760  });
   1761 }
   1762 
   1763 /**
   1764 * Similar to invariant but only logs a warning if the condition is not met.
   1765 * This can be used to log issues in development environments in critical
   1766 * paths. Removing the logging code for production environments will keep the
   1767 * same logic and follow the same code paths.
   1768 */
   1769 
   1770 var warning = warningWithoutStack$1;
   1771 
   1772 {
   1773  warning = function (condition, format) {
   1774    if (condition) {
   1775      return;
   1776    }
   1777    var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
   1778    var stack = ReactDebugCurrentFrame.getStackAddendum();
   1779    // eslint-disable-next-line react-internal/warning-and-invariant-args
   1780 
   1781    for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
   1782      args[_key - 2] = arguments[_key];
   1783    }
   1784 
   1785    warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
   1786  };
   1787 }
   1788 
   1789 var warning$1 = warning;
   1790 
   1791 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
   1792 
   1793 var RESERVED_PROPS = {
   1794  key: true,
   1795  ref: true,
   1796  __self: true,
   1797  __source: true
   1798 };
   1799 
   1800 var specialPropKeyWarningShown = void 0;
   1801 var specialPropRefWarningShown = void 0;
   1802 
   1803 function hasValidRef(config) {
   1804  {
   1805    if (hasOwnProperty$1.call(config, 'ref')) {
   1806      var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
   1807      if (getter && getter.isReactWarning) {
   1808        return false;
   1809      }
   1810    }
   1811  }
   1812  return config.ref !== undefined;
   1813 }
   1814 
   1815 function hasValidKey(config) {
   1816  {
   1817    if (hasOwnProperty$1.call(config, 'key')) {
   1818      var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
   1819      if (getter && getter.isReactWarning) {
   1820        return false;
   1821      }
   1822    }
   1823  }
   1824  return config.key !== undefined;
   1825 }
   1826 
   1827 function defineKeyPropWarningGetter(props, displayName) {
   1828  var warnAboutAccessingKey = function () {
   1829    if (!specialPropKeyWarningShown) {
   1830      specialPropKeyWarningShown = true;
   1831      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);
   1832    }
   1833  };
   1834  warnAboutAccessingKey.isReactWarning = true;
   1835  Object.defineProperty(props, 'key', {
   1836    get: warnAboutAccessingKey,
   1837    configurable: true
   1838  });
   1839 }
   1840 
   1841 function defineRefPropWarningGetter(props, displayName) {
   1842  var warnAboutAccessingRef = function () {
   1843    if (!specialPropRefWarningShown) {
   1844      specialPropRefWarningShown = true;
   1845      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);
   1846    }
   1847  };
   1848  warnAboutAccessingRef.isReactWarning = true;
   1849  Object.defineProperty(props, 'ref', {
   1850    get: warnAboutAccessingRef,
   1851    configurable: true
   1852  });
   1853 }
   1854 
   1855 /**
   1856 * Factory method to create a new React element. This no longer adheres to
   1857 * the class pattern, so do not use new to call it. Also, no instanceof check
   1858 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
   1859 * if something is a React Element.
   1860 *
   1861 * @param {*} type
   1862 * @param {*} key
   1863 * @param {string|object} ref
   1864 * @param {*} self A *temporary* helper to detect places where `this` is
   1865 * different from the `owner` when React.createElement is called, so that we
   1866 * can warn. We want to get rid of owner and replace string `ref`s with arrow
   1867 * functions, and as long as `this` and owner are the same, there will be no
   1868 * change in behavior.
   1869 * @param {*} source An annotation object (added by a transpiler or otherwise)
   1870 * indicating filename, line number, and/or other information.
   1871 * @param {*} owner
   1872 * @param {*} props
   1873 * @internal
   1874 */
   1875 var ReactElement = function (type, key, ref, self, source, owner, props) {
   1876  var element = {
   1877    // This tag allows us to uniquely identify this as a React Element
   1878    $$typeof: REACT_ELEMENT_TYPE,
   1879 
   1880    // Built-in properties that belong on the element
   1881    type: type,
   1882    key: key,
   1883    ref: ref,
   1884    props: props,
   1885 
   1886    // Record the component responsible for creating this element.
   1887    _owner: owner
   1888  };
   1889 
   1890  {
   1891    // The validation flag is currently mutative. We put it on
   1892    // an external backing store so that we can freeze the whole object.
   1893    // This can be replaced with a WeakMap once they are implemented in
   1894    // commonly used development environments.
   1895    element._store = {};
   1896 
   1897    // To make comparing ReactElements easier for testing purposes, we make
   1898    // the validation flag non-enumerable (where possible, which should
   1899    // include every environment we run tests in), so the test framework
   1900    // ignores it.
   1901    Object.defineProperty(element._store, 'validated', {
   1902      configurable: false,
   1903      enumerable: false,
   1904      writable: true,
   1905      value: false
   1906    });
   1907    // self and source are DEV only properties.
   1908    Object.defineProperty(element, '_self', {
   1909      configurable: false,
   1910      enumerable: false,
   1911      writable: false,
   1912      value: self
   1913    });
   1914    // Two elements created in two different places should be considered
   1915    // equal for testing purposes and therefore we hide it from enumeration.
   1916    Object.defineProperty(element, '_source', {
   1917      configurable: false,
   1918      enumerable: false,
   1919      writable: false,
   1920      value: source
   1921    });
   1922    if (Object.freeze) {
   1923      Object.freeze(element.props);
   1924      Object.freeze(element);
   1925    }
   1926  }
   1927 
   1928  return element;
   1929 };
   1930 
   1931 /**
   1932 * Create and return a new ReactElement of the given type.
   1933 * See https://reactjs.org/docs/react-api.html#createelement
   1934 */
   1935 function createElement(type, config, children) {
   1936  var propName = void 0;
   1937 
   1938  // Reserved names are extracted
   1939  var props = {};
   1940 
   1941  var key = null;
   1942  var ref = null;
   1943  var self = null;
   1944  var source = null;
   1945 
   1946  if (config != null) {
   1947    if (hasValidRef(config)) {
   1948      ref = config.ref;
   1949    }
   1950    if (hasValidKey(config)) {
   1951      key = '' + config.key;
   1952    }
   1953 
   1954    self = config.__self === undefined ? null : config.__self;
   1955    source = config.__source === undefined ? null : config.__source;
   1956    // Remaining properties are added to a new props object
   1957    for (propName in config) {
   1958      if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
   1959        props[propName] = config[propName];
   1960      }
   1961    }
   1962  }
   1963 
   1964  // Children can be more than one argument, and those are transferred onto
   1965  // the newly allocated props object.
   1966  var childrenLength = arguments.length - 2;
   1967  if (childrenLength === 1) {
   1968    props.children = children;
   1969  } else if (childrenLength > 1) {
   1970    var childArray = Array(childrenLength);
   1971    for (var i = 0; i < childrenLength; i++) {
   1972      childArray[i] = arguments[i + 2];
   1973    }
   1974    {
   1975      if (Object.freeze) {
   1976        Object.freeze(childArray);
   1977      }
   1978    }
   1979    props.children = childArray;
   1980  }
   1981 
   1982  // Resolve default props
   1983  if (type && type.defaultProps) {
   1984    var defaultProps = type.defaultProps;
   1985    for (propName in defaultProps) {
   1986      if (props[propName] === undefined) {
   1987        props[propName] = defaultProps[propName];
   1988      }
   1989    }
   1990  }
   1991  {
   1992    if (key || ref) {
   1993      var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
   1994      if (key) {
   1995        defineKeyPropWarningGetter(props, displayName);
   1996      }
   1997      if (ref) {
   1998        defineRefPropWarningGetter(props, displayName);
   1999      }
   2000    }
   2001  }
   2002  return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
   2003 }
   2004 
   2005 /**
   2006 * Return a function that produces ReactElements of a given type.
   2007 * See https://reactjs.org/docs/react-api.html#createfactory
   2008 */
   2009 
   2010 
   2011 function cloneAndReplaceKey(oldElement, newKey) {
   2012  var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
   2013 
   2014  return newElement;
   2015 }
   2016 
   2017 /**
   2018 * Clone and return a new ReactElement using element as the starting point.
   2019 * See https://reactjs.org/docs/react-api.html#cloneelement
   2020 */
   2021 function cloneElement(element, config, children) {
   2022  !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
   2023 
   2024  var propName = void 0;
   2025 
   2026  // Original props are copied
   2027  var props = objectAssign({}, element.props);
   2028 
   2029  // Reserved names are extracted
   2030  var key = element.key;
   2031  var ref = element.ref;
   2032  // Self is preserved since the owner is preserved.
   2033  var self = element._self;
   2034  // Source is preserved since cloneElement is unlikely to be targeted by a
   2035  // transpiler, and the original source is probably a better indicator of the
   2036  // true owner.
   2037  var source = element._source;
   2038 
   2039  // Owner will be preserved, unless ref is overridden
   2040  var owner = element._owner;
   2041 
   2042  if (config != null) {
   2043    if (hasValidRef(config)) {
   2044      // Silently steal the ref from the parent.
   2045      ref = config.ref;
   2046      owner = ReactCurrentOwner.current;
   2047    }
   2048    if (hasValidKey(config)) {
   2049      key = '' + config.key;
   2050    }
   2051 
   2052    // Remaining properties override existing props
   2053    var defaultProps = void 0;
   2054    if (element.type && element.type.defaultProps) {
   2055      defaultProps = element.type.defaultProps;
   2056    }
   2057    for (propName in config) {
   2058      if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
   2059        if (config[propName] === undefined && defaultProps !== undefined) {
   2060          // Resolve default props
   2061          props[propName] = defaultProps[propName];
   2062        } else {
   2063          props[propName] = config[propName];
   2064        }
   2065      }
   2066    }
   2067  }
   2068 
   2069  // Children can be more than one argument, and those are transferred onto
   2070  // the newly allocated props object.
   2071  var childrenLength = arguments.length - 2;
   2072  if (childrenLength === 1) {
   2073    props.children = children;
   2074  } else if (childrenLength > 1) {
   2075    var childArray = Array(childrenLength);
   2076    for (var i = 0; i < childrenLength; i++) {
   2077      childArray[i] = arguments[i + 2];
   2078    }
   2079    props.children = childArray;
   2080  }
   2081 
   2082  return ReactElement(element.type, key, ref, self, source, owner, props);
   2083 }
   2084 
   2085 /**
   2086 * Verifies the object is a ReactElement.
   2087 * See https://reactjs.org/docs/react-api.html#isvalidelement
   2088 * @param {?object} object
   2089 * @return {boolean} True if `object` is a ReactElement.
   2090 * @final
   2091 */
   2092 function isValidElement(object) {
   2093  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
   2094 }
   2095 
   2096 var SEPARATOR = '.';
   2097 var SUBSEPARATOR = ':';
   2098 
   2099 /**
   2100 * Escape and wrap key so it is safe to use as a reactid
   2101 *
   2102 * @param {string} key to be escaped.
   2103 * @return {string} the escaped key.
   2104 */
   2105 function escape(key) {
   2106  var escapeRegex = /[=:]/g;
   2107  var escaperLookup = {
   2108    '=': '=0',
   2109    ':': '=2'
   2110  };
   2111  var escapedString = ('' + key).replace(escapeRegex, function (match) {
   2112    return escaperLookup[match];
   2113  });
   2114 
   2115  return '$' + escapedString;
   2116 }
   2117 
   2118 /**
   2119 * TODO: Test that a single child and an array with one item have the same key
   2120 * pattern.
   2121 */
   2122 
   2123 var didWarnAboutMaps = false;
   2124 
   2125 var userProvidedKeyEscapeRegex = /\/+/g;
   2126 function escapeUserProvidedKey(text) {
   2127  return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
   2128 }
   2129 
   2130 var POOL_SIZE = 10;
   2131 var traverseContextPool = [];
   2132 function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
   2133  if (traverseContextPool.length) {
   2134    var traverseContext = traverseContextPool.pop();
   2135    traverseContext.result = mapResult;
   2136    traverseContext.keyPrefix = keyPrefix;
   2137    traverseContext.func = mapFunction;
   2138    traverseContext.context = mapContext;
   2139    traverseContext.count = 0;
   2140    return traverseContext;
   2141  } else {
   2142    return {
   2143      result: mapResult,
   2144      keyPrefix: keyPrefix,
   2145      func: mapFunction,
   2146      context: mapContext,
   2147      count: 0
   2148    };
   2149  }
   2150 }
   2151 
   2152 function releaseTraverseContext(traverseContext) {
   2153  traverseContext.result = null;
   2154  traverseContext.keyPrefix = null;
   2155  traverseContext.func = null;
   2156  traverseContext.context = null;
   2157  traverseContext.count = 0;
   2158  if (traverseContextPool.length < POOL_SIZE) {
   2159    traverseContextPool.push(traverseContext);
   2160  }
   2161 }
   2162 
   2163 /**
   2164 * @param {?*} children Children tree container.
   2165 * @param {!string} nameSoFar Name of the key path so far.
   2166 * @param {!function} callback Callback to invoke with each child found.
   2167 * @param {?*} traverseContext Used to pass information throughout the traversal
   2168 * process.
   2169 * @return {!number} The number of children in this subtree.
   2170 */
   2171 function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
   2172  var type = typeof children;
   2173 
   2174  if (type === 'undefined' || type === 'boolean') {
   2175    // All of the above are perceived as null.
   2176    children = null;
   2177  }
   2178 
   2179  var invokeCallback = false;
   2180 
   2181  if (children === null) {
   2182    invokeCallback = true;
   2183  } else {
   2184    switch (type) {
   2185      case 'string':
   2186      case 'number':
   2187        invokeCallback = true;
   2188        break;
   2189      case 'object':
   2190        switch (children.$$typeof) {
   2191          case REACT_ELEMENT_TYPE:
   2192          case REACT_PORTAL_TYPE:
   2193            invokeCallback = true;
   2194        }
   2195    }
   2196  }
   2197 
   2198  if (invokeCallback) {
   2199    callback(traverseContext, children,
   2200    // If it's the only child, treat the name as if it was wrapped in an array
   2201    // so that it's consistent if the number of children grows.
   2202    nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
   2203    return 1;
   2204  }
   2205 
   2206  var child = void 0;
   2207  var nextName = void 0;
   2208  var subtreeCount = 0; // Count of children found in the current subtree.
   2209  var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
   2210 
   2211  if (Array.isArray(children)) {
   2212    for (var i = 0; i < children.length; i++) {
   2213      child = children[i];
   2214      nextName = nextNamePrefix + getComponentKey(child, i);
   2215      subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
   2216    }
   2217  } else {
   2218    var iteratorFn = getIteratorFn(children);
   2219    if (typeof iteratorFn === 'function') {
   2220      {
   2221        // Warn about using Maps as children
   2222        if (iteratorFn === children.entries) {
   2223          !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;
   2224          didWarnAboutMaps = true;
   2225        }
   2226      }
   2227 
   2228      var iterator = iteratorFn.call(children);
   2229      var step = void 0;
   2230      var ii = 0;
   2231      while (!(step = iterator.next()).done) {
   2232        child = step.value;
   2233        nextName = nextNamePrefix + getComponentKey(child, ii++);
   2234        subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
   2235      }
   2236    } else if (type === 'object') {
   2237      var addendum = '';
   2238      {
   2239        addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
   2240      }
   2241      var childrenString = '' + children;
   2242      invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
   2243    }
   2244  }
   2245 
   2246  return subtreeCount;
   2247 }
   2248 
   2249 /**
   2250 * Traverses children that are typically specified as `props.children`, but
   2251 * might also be specified through attributes:
   2252 *
   2253 * - `traverseAllChildren(this.props.children, ...)`
   2254 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
   2255 *
   2256 * The `traverseContext` is an optional argument that is passed through the
   2257 * entire traversal. It can be used to store accumulations or anything else that
   2258 * the callback might find relevant.
   2259 *
   2260 * @param {?*} children Children tree object.
   2261 * @param {!function} callback To invoke upon traversing each child.
   2262 * @param {?*} traverseContext Context for traversal.
   2263 * @return {!number} The number of children in this subtree.
   2264 */
   2265 function traverseAllChildren(children, callback, traverseContext) {
   2266  if (children == null) {
   2267    return 0;
   2268  }
   2269 
   2270  return traverseAllChildrenImpl(children, '', callback, traverseContext);
   2271 }
   2272 
   2273 /**
   2274 * Generate a key string that identifies a component within a set.
   2275 *
   2276 * @param {*} component A component that could contain a manual key.
   2277 * @param {number} index Index that is used if a manual key is not provided.
   2278 * @return {string}
   2279 */
   2280 function getComponentKey(component, index) {
   2281  // Do some typechecking here since we call this blindly. We want to ensure
   2282  // that we don't block potential future ES APIs.
   2283  if (typeof component === 'object' && component !== null && component.key != null) {
   2284    // Explicit key
   2285    return escape(component.key);
   2286  }
   2287  // Implicit key determined by the index in the set
   2288  return index.toString(36);
   2289 }
   2290 
   2291 function forEachSingleChild(bookKeeping, child, name) {
   2292  var func = bookKeeping.func,
   2293      context = bookKeeping.context;
   2294 
   2295  func.call(context, child, bookKeeping.count++);
   2296 }
   2297 
   2298 /**
   2299 * Iterates through children that are typically specified as `props.children`.
   2300 *
   2301 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
   2302 *
   2303 * The provided forEachFunc(child, index) will be called for each
   2304 * leaf child.
   2305 *
   2306 * @param {?*} children Children tree container.
   2307 * @param {function(*, int)} forEachFunc
   2308 * @param {*} forEachContext Context for forEachContext.
   2309 */
   2310 function forEachChildren(children, forEachFunc, forEachContext) {
   2311  if (children == null) {
   2312    return children;
   2313  }
   2314  var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
   2315  traverseAllChildren(children, forEachSingleChild, traverseContext);
   2316  releaseTraverseContext(traverseContext);
   2317 }
   2318 
   2319 function mapSingleChildIntoContext(bookKeeping, child, childKey) {
   2320  var result = bookKeeping.result,
   2321      keyPrefix = bookKeeping.keyPrefix,
   2322      func = bookKeeping.func,
   2323      context = bookKeeping.context;
   2324 
   2325 
   2326  var mappedChild = func.call(context, child, bookKeeping.count++);
   2327  if (Array.isArray(mappedChild)) {
   2328    mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
   2329      return c;
   2330    });
   2331  } else if (mappedChild != null) {
   2332    if (isValidElement(mappedChild)) {
   2333      mappedChild = cloneAndReplaceKey(mappedChild,
   2334      // Keep both the (mapped) and old keys if they differ, just as
   2335      // traverseAllChildren used to do for objects as children
   2336      keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
   2337    }
   2338    result.push(mappedChild);
   2339  }
   2340 }
   2341 
   2342 function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
   2343  var escapedPrefix = '';
   2344  if (prefix != null) {
   2345    escapedPrefix = escapeUserProvidedKey(prefix) + '/';
   2346  }
   2347  var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
   2348  traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
   2349  releaseTraverseContext(traverseContext);
   2350 }
   2351 
   2352 /**
   2353 * Maps children that are typically specified as `props.children`.
   2354 *
   2355 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
   2356 *
   2357 * The provided mapFunction(child, key, index) will be called for each
   2358 * leaf child.
   2359 *
   2360 * @param {?*} children Children tree container.
   2361 * @param {function(*, int)} func The map function.
   2362 * @param {*} context Context for mapFunction.
   2363 * @return {object} Object containing the ordered map of results.
   2364 */
   2365 function mapChildren(children, func, context) {
   2366  if (children == null) {
   2367    return children;
   2368  }
   2369  var result = [];
   2370  mapIntoWithKeyPrefixInternal(children, result, null, func, context);
   2371  return result;
   2372 }
   2373 
   2374 /**
   2375 * Count the number of children that are typically specified as
   2376 * `props.children`.
   2377 *
   2378 * See https://reactjs.org/docs/react-api.html#reactchildrencount
   2379 *
   2380 * @param {?*} children Children tree container.
   2381 * @return {number} The number of children.
   2382 */
   2383 function countChildren(children) {
   2384  return traverseAllChildren(children, function () {
   2385    return null;
   2386  }, null);
   2387 }
   2388 
   2389 /**
   2390 * Flatten a children object (typically specified as `props.children`) and
   2391 * return an array with appropriately re-keyed children.
   2392 *
   2393 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
   2394 */
   2395 function toArray(children) {
   2396  var result = [];
   2397  mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
   2398    return child;
   2399  });
   2400  return result;
   2401 }
   2402 
   2403 /**
   2404 * Returns the first child in a collection of children and verifies that there
   2405 * is only one child in the collection.
   2406 *
   2407 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
   2408 *
   2409 * The current implementation of this function assumes that a single child gets
   2410 * passed without a wrapper, but the purpose of this helper function is to
   2411 * abstract away the particular structure of children.
   2412 *
   2413 * @param {?object} children Child collection structure.
   2414 * @return {ReactElement} The first and only `ReactElement` contained in the
   2415 * structure.
   2416 */
   2417 function onlyChild(children) {
   2418  !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
   2419  return children;
   2420 }
   2421 
   2422 function createContext(defaultValue, calculateChangedBits) {
   2423  if (calculateChangedBits === undefined) {
   2424    calculateChangedBits = null;
   2425  } else {
   2426    {
   2427      !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
   2428    }
   2429  }
   2430 
   2431  var context = {
   2432    $$typeof: REACT_CONTEXT_TYPE,
   2433    _calculateChangedBits: calculateChangedBits,
   2434    // As a workaround to support multiple concurrent renderers, we categorize
   2435    // some renderers as primary and others as secondary. We only expect
   2436    // there to be two concurrent renderers at most: React Native (primary) and
   2437    // Fabric (secondary); React DOM (primary) and React ART (secondary).
   2438    // Secondary renderers store their context values on separate fields.
   2439    _currentValue: defaultValue,
   2440    _currentValue2: defaultValue,
   2441    // Used to track how many concurrent renderers this context currently
   2442    // supports within in a single renderer. Such as parallel server rendering.
   2443    _threadCount: 0,
   2444    // These are circular
   2445    Provider: null,
   2446    Consumer: null
   2447  };
   2448 
   2449  context.Provider = {
   2450    $$typeof: REACT_PROVIDER_TYPE,
   2451    _context: context
   2452  };
   2453 
   2454  var hasWarnedAboutUsingNestedContextConsumers = false;
   2455  var hasWarnedAboutUsingConsumerProvider = false;
   2456 
   2457  {
   2458    // A separate object, but proxies back to the original context object for
   2459    // backwards compatibility. It has a different $$typeof, so we can properly
   2460    // warn for the incorrect usage of Context as a Consumer.
   2461    var Consumer = {
   2462      $$typeof: REACT_CONTEXT_TYPE,
   2463      _context: context,
   2464      _calculateChangedBits: context._calculateChangedBits
   2465    };
   2466    // $FlowFixMe: Flow complains about not setting a value, which is intentional here
   2467    Object.defineProperties(Consumer, {
   2468      Provider: {
   2469        get: function () {
   2470          if (!hasWarnedAboutUsingConsumerProvider) {
   2471            hasWarnedAboutUsingConsumerProvider = true;
   2472            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?');
   2473          }
   2474          return context.Provider;
   2475        },
   2476        set: function (_Provider) {
   2477          context.Provider = _Provider;
   2478        }
   2479      },
   2480      _currentValue: {
   2481        get: function () {
   2482          return context._currentValue;
   2483        },
   2484        set: function (_currentValue) {
   2485          context._currentValue = _currentValue;
   2486        }
   2487      },
   2488      _currentValue2: {
   2489        get: function () {
   2490          return context._currentValue2;
   2491        },
   2492        set: function (_currentValue2) {
   2493          context._currentValue2 = _currentValue2;
   2494        }
   2495      },
   2496      _threadCount: {
   2497        get: function () {
   2498          return context._threadCount;
   2499        },
   2500        set: function (_threadCount) {
   2501          context._threadCount = _threadCount;
   2502        }
   2503      },
   2504      Consumer: {
   2505        get: function () {
   2506          if (!hasWarnedAboutUsingNestedContextConsumers) {
   2507            hasWarnedAboutUsingNestedContextConsumers = true;
   2508            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?');
   2509          }
   2510          return context.Consumer;
   2511        }
   2512      }
   2513    });
   2514    // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
   2515    context.Consumer = Consumer;
   2516  }
   2517 
   2518  {
   2519    context._currentRenderer = null;
   2520    context._currentRenderer2 = null;
   2521  }
   2522 
   2523  return context;
   2524 }
   2525 
   2526 function lazy(ctor) {
   2527  var lazyType = {
   2528    $$typeof: REACT_LAZY_TYPE,
   2529    _ctor: ctor,
   2530    // React uses these fields to store the result.
   2531    _status: -1,
   2532    _result: null
   2533  };
   2534 
   2535  {
   2536    // In production, this would just set it on the object.
   2537    var defaultProps = void 0;
   2538    var propTypes = void 0;
   2539    Object.defineProperties(lazyType, {
   2540      defaultProps: {
   2541        configurable: true,
   2542        get: function () {
   2543          return defaultProps;
   2544        },
   2545        set: function (newDefaultProps) {
   2546          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.');
   2547          defaultProps = newDefaultProps;
   2548          // Match production behavior more closely:
   2549          Object.defineProperty(lazyType, 'defaultProps', {
   2550            enumerable: true
   2551          });
   2552        }
   2553      },
   2554      propTypes: {
   2555        configurable: true,
   2556        get: function () {
   2557          return propTypes;
   2558        },
   2559        set: function (newPropTypes) {
   2560          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.');
   2561          propTypes = newPropTypes;
   2562          // Match production behavior more closely:
   2563          Object.defineProperty(lazyType, 'propTypes', {
   2564            enumerable: true
   2565          });
   2566        }
   2567      }
   2568    });
   2569  }
   2570 
   2571  return lazyType;
   2572 }
   2573 
   2574 function forwardRef(render) {
   2575  {
   2576    if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
   2577      warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
   2578    } else if (typeof render !== 'function') {
   2579      warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
   2580    } else {
   2581      !(
   2582      // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
   2583      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;
   2584    }
   2585 
   2586    if (render != null) {
   2587      !(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;
   2588    }
   2589  }
   2590 
   2591  return {
   2592    $$typeof: REACT_FORWARD_REF_TYPE,
   2593    render: render
   2594  };
   2595 }
   2596 
   2597 function isValidElementType(type) {
   2598  return typeof type === 'string' || typeof type === 'function' ||
   2599  // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
   2600  type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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);
   2601 }
   2602 
   2603 function memo(type, compare) {
   2604  {
   2605    if (!isValidElementType(type)) {
   2606      warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
   2607    }
   2608  }
   2609  return {
   2610    $$typeof: REACT_MEMO_TYPE,
   2611    type: type,
   2612    compare: compare === undefined ? null : compare
   2613  };
   2614 }
   2615 
   2616 function resolveDispatcher() {
   2617  var dispatcher = ReactCurrentDispatcher.current;
   2618  !(dispatcher !== null) ? invariant(false, '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.') : void 0;
   2619  return dispatcher;
   2620 }
   2621 
   2622 function useContext(Context, unstable_observedBits) {
   2623  var dispatcher = resolveDispatcher();
   2624  {
   2625    !(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;
   2626 
   2627    // TODO: add a more generic warning for invalid values.
   2628    if (Context._context !== undefined) {
   2629      var realContext = Context._context;
   2630      // Don't deduplicate because this legitimately causes bugs
   2631      // and nobody should be using this in existing code.
   2632      if (realContext.Consumer === Context) {
   2633        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?');
   2634      } else if (realContext.Provider === Context) {
   2635        warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
   2636      }
   2637    }
   2638  }
   2639  return dispatcher.useContext(Context, unstable_observedBits);
   2640 }
   2641 
   2642 function useState(initialState) {
   2643  var dispatcher = resolveDispatcher();
   2644  return dispatcher.useState(initialState);
   2645 }
   2646 
   2647 function useReducer(reducer, initialArg, init) {
   2648  var dispatcher = resolveDispatcher();
   2649  return dispatcher.useReducer(reducer, initialArg, init);
   2650 }
   2651 
   2652 function useRef(initialValue) {
   2653  var dispatcher = resolveDispatcher();
   2654  return dispatcher.useRef(initialValue);
   2655 }
   2656 
   2657 function useEffect(create, inputs) {
   2658  var dispatcher = resolveDispatcher();
   2659  return dispatcher.useEffect(create, inputs);
   2660 }
   2661 
   2662 function useLayoutEffect(create, inputs) {
   2663  var dispatcher = resolveDispatcher();
   2664  return dispatcher.useLayoutEffect(create, inputs);
   2665 }
   2666 
   2667 function useCallback(callback, inputs) {
   2668  var dispatcher = resolveDispatcher();
   2669  return dispatcher.useCallback(callback, inputs);
   2670 }
   2671 
   2672 function useMemo(create, inputs) {
   2673  var dispatcher = resolveDispatcher();
   2674  return dispatcher.useMemo(create, inputs);
   2675 }
   2676 
   2677 function useImperativeHandle(ref, create, inputs) {
   2678  var dispatcher = resolveDispatcher();
   2679  return dispatcher.useImperativeHandle(ref, create, inputs);
   2680 }
   2681 
   2682 function useDebugValue(value, formatterFn) {
   2683  {
   2684    var dispatcher = resolveDispatcher();
   2685    return dispatcher.useDebugValue(value, formatterFn);
   2686  }
   2687 }
   2688 
   2689 /**
   2690 * Copyright (c) 2013-present, Facebook, Inc.
   2691 *
   2692 * This source code is licensed under the MIT license found in the
   2693 * LICENSE file in the root directory of this source tree.
   2694 */
   2695 
   2696 
   2697 
   2698 var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
   2699 
   2700 var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
   2701 
   2702 /**
   2703 * Copyright (c) 2013-present, Facebook, Inc.
   2704 *
   2705 * This source code is licensed under the MIT license found in the
   2706 * LICENSE file in the root directory of this source tree.
   2707 */
   2708 
   2709 
   2710 
   2711 var printWarning$1 = function() {};
   2712 
   2713 {
   2714  var ReactPropTypesSecret = ReactPropTypesSecret_1;
   2715  var loggedTypeFailures = {};
   2716 
   2717  printWarning$1 = function(text) {
   2718    var message = 'Warning: ' + text;
   2719    if (typeof console !== 'undefined') {
   2720      console.error(message);
   2721    }
   2722    try {
   2723      // --- Welcome to debugging React ---
   2724      // This error was thrown as a convenience so that you can use this stack
   2725      // to find the callsite that caused this warning to fire.
   2726      throw new Error(message);
   2727    } catch (x) {}
   2728  };
   2729 }
   2730 
   2731 /**
   2732 * Assert that the values match with the type specs.
   2733 * Error messages are memorized and will only be shown once.
   2734 *
   2735 * @param {object} typeSpecs Map of name to a ReactPropType
   2736 * @param {object} values Runtime values that need to be type-checked
   2737 * @param {string} location e.g. "prop", "context", "child context"
   2738 * @param {string} componentName Name of the component for error messages.
   2739 * @param {?Function} getStack Returns the component stack.
   2740 * @private
   2741 */
   2742 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
   2743  {
   2744    for (var typeSpecName in typeSpecs) {
   2745      if (typeSpecs.hasOwnProperty(typeSpecName)) {
   2746        var error;
   2747        // Prop type validation may throw. In case they do, we don't want to
   2748        // fail the render phase where it didn't fail before. So we log it.
   2749        // After these have been cleaned up, we'll let them throw.
   2750        try {
   2751          // This is intentionally an invariant that gets caught. It's the same
   2752          // behavior as without this statement except with a better message.
   2753          if (typeof typeSpecs[typeSpecName] !== 'function') {
   2754            var err = Error(
   2755              (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
   2756              'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
   2757            );
   2758            err.name = 'Invariant Violation';
   2759            throw err;
   2760          }
   2761          error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
   2762        } catch (ex) {
   2763          error = ex;
   2764        }
   2765        if (error && !(error instanceof Error)) {
   2766          printWarning$1(
   2767            (componentName || 'React class') + ': type specification of ' +
   2768            location + ' `' + typeSpecName + '` is invalid; the type checker ' +
   2769            'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
   2770            'You may have forgotten to pass an argument to the type checker ' +
   2771            'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
   2772            'shape all require an argument).'
   2773          );
   2774 
   2775        }
   2776        if (error instanceof Error && !(error.message in loggedTypeFailures)) {
   2777          // Only monitor this failure once because there tends to be a lot of the
   2778          // same error.
   2779          loggedTypeFailures[error.message] = true;
   2780 
   2781          var stack = getStack ? getStack() : '';
   2782 
   2783          printWarning$1(
   2784            'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
   2785          );
   2786        }
   2787      }
   2788    }
   2789  }
   2790 }
   2791 
   2792 var checkPropTypes_1 = checkPropTypes;
   2793 
   2794 /**
   2795 * ReactElementValidator provides a wrapper around a element factory
   2796 * which validates the props passed to the element. This is intended to be
   2797 * used only in DEV and could be replaced by a static type checker for languages
   2798 * that support it.
   2799 */
   2800 
   2801 var propTypesMisspellWarningShown = void 0;
   2802 
   2803 {
   2804  propTypesMisspellWarningShown = false;
   2805 }
   2806 
   2807 function getDeclarationErrorAddendum() {
   2808  if (ReactCurrentOwner.current) {
   2809    var name = getComponentName(ReactCurrentOwner.current.type);
   2810    if (name) {
   2811      return '\n\nCheck the render method of `' + name + '`.';
   2812    }
   2813  }
   2814  return '';
   2815 }
   2816 
   2817 function getSourceInfoErrorAddendum(elementProps) {
   2818  if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
   2819    var source = elementProps.__source;
   2820    var fileName = source.fileName.replace(/^.*[\\\/]/, '');
   2821    var lineNumber = source.lineNumber;
   2822    return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
   2823  }
   2824  return '';
   2825 }
   2826 
   2827 /**
   2828 * Warn if there's no key explicitly set on dynamic arrays of children or
   2829 * object keys are not valid. This allows us to keep track of children between
   2830 * updates.
   2831 */
   2832 var ownerHasKeyUseWarning = {};
   2833 
   2834 function getCurrentComponentErrorInfo(parentType) {
   2835  var info = getDeclarationErrorAddendum();
   2836 
   2837  if (!info) {
   2838    var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
   2839    if (parentName) {
   2840      info = '\n\nCheck the top-level render call using <' + parentName + '>.';
   2841    }
   2842  }
   2843  return info;
   2844 }
   2845 
   2846 /**
   2847 * Warn if the element doesn't have an explicit key assigned to it.
   2848 * This element is in an array. The array could grow and shrink or be
   2849 * reordered. All children that haven't already been validated are required to
   2850 * have a "key" property assigned to it. Error statuses are cached so a warning
   2851 * will only be shown once.
   2852 *
   2853 * @internal
   2854 * @param {ReactElement} element Element that requires a key.
   2855 * @param {*} parentType element's parent's type.
   2856 */
   2857 function validateExplicitKey(element, parentType) {
   2858  if (!element._store || element._store.validated || element.key != null) {
   2859    return;
   2860  }
   2861  element._store.validated = true;
   2862 
   2863  var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
   2864  if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
   2865    return;
   2866  }
   2867  ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
   2868 
   2869  // Usually the current owner is the offender, but if it accepts children as a
   2870  // property, it may be the creator of the child that's responsible for
   2871  // assigning it a key.
   2872  var childOwner = '';
   2873  if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
   2874    // Give the component that originally created this child.
   2875    childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
   2876  }
   2877 
   2878  setCurrentlyValidatingElement(element);
   2879  {
   2880    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);
   2881  }
   2882  setCurrentlyValidatingElement(null);
   2883 }
   2884 
   2885 /**
   2886 * Ensure that every element either is passed in a static location, in an
   2887 * array with an explicit keys property defined, or in an object literal
   2888 * with valid key property.
   2889 *
   2890 * @internal
   2891 * @param {ReactNode} node Statically passed child of any type.
   2892 * @param {*} parentType node's parent's type.
   2893 */
   2894 function validateChildKeys(node, parentType) {
   2895  if (typeof node !== 'object') {
   2896    return;
   2897  }
   2898  if (Array.isArray(node)) {
   2899    for (var i = 0; i < node.length; i++) {
   2900      var child = node[i];
   2901      if (isValidElement(child)) {
   2902        validateExplicitKey(child, parentType);
   2903      }
   2904    }
   2905  } else if (isValidElement(node)) {
   2906    // This element was passed in a valid location.
   2907    if (node._store) {
   2908      node._store.validated = true;
   2909    }
   2910  } else if (node) {
   2911    var iteratorFn = getIteratorFn(node);
   2912    if (typeof iteratorFn === 'function') {
   2913      // Entry iterators used to provide implicit keys,
   2914      // but now we print a separate warning for them later.
   2915      if (iteratorFn !== node.entries) {
   2916        var iterator = iteratorFn.call(node);
   2917        var step = void 0;
   2918        while (!(step = iterator.next()).done) {
   2919          if (isValidElement(step.value)) {
   2920            validateExplicitKey(step.value, parentType);
   2921          }
   2922        }
   2923      }
   2924    }
   2925  }
   2926 }
   2927 
   2928 /**
   2929 * Given an element, validate that its props follow the propTypes definition,
   2930 * provided by the type.
   2931 *
   2932 * @param {ReactElement} element
   2933 */
   2934 function validatePropTypes(element) {
   2935  var type = element.type;
   2936  if (type === null || type === undefined || typeof type === 'string') {
   2937    return;
   2938  }
   2939  var name = getComponentName(type);
   2940  var propTypes = void 0;
   2941  if (typeof type === 'function') {
   2942    propTypes = type.propTypes;
   2943  } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
   2944  // Note: Memo only checks outer props here.
   2945  // Inner props are checked in the reconciler.
   2946  type.$$typeof === REACT_MEMO_TYPE)) {
   2947    propTypes = type.propTypes;
   2948  } else {
   2949    return;
   2950  }
   2951  if (propTypes) {
   2952    setCurrentlyValidatingElement(element);
   2953    checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
   2954    setCurrentlyValidatingElement(null);
   2955  } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
   2956    propTypesMisspellWarningShown = true;
   2957    warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
   2958  }
   2959  if (typeof type.getDefaultProps === 'function') {
   2960    !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
   2961  }
   2962 }
   2963 
   2964 /**
   2965 * Given a fragment, validate that it can only be provided with fragment props
   2966 * @param {ReactElement} fragment
   2967 */
   2968 function validateFragmentProps(fragment) {
   2969  setCurrentlyValidatingElement(fragment);
   2970 
   2971  var keys = Object.keys(fragment.props);
   2972  for (var i = 0; i < keys.length; i++) {
   2973    var key = keys[i];
   2974    if (key !== 'children' && key !== 'key') {
   2975      warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
   2976      break;
   2977    }
   2978  }
   2979 
   2980  if (fragment.ref !== null) {
   2981    warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
   2982  }
   2983 
   2984  setCurrentlyValidatingElement(null);
   2985 }
   2986 
   2987 function createElementWithValidation(type, props, children) {
   2988  var validType = isValidElementType(type);
   2989 
   2990  // We warn in this case but don't throw. We expect the element creation to
   2991  // succeed and there will likely be errors in render.
   2992  if (!validType) {
   2993    var info = '';
   2994    if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
   2995      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.";
   2996    }
   2997 
   2998    var sourceInfo = getSourceInfoErrorAddendum(props);
   2999    if (sourceInfo) {
   3000      info += sourceInfo;
   3001    } else {
   3002      info += getDeclarationErrorAddendum();
   3003    }
   3004 
   3005    var typeString = void 0;
   3006    if (type === null) {
   3007      typeString = 'null';
   3008    } else if (Array.isArray(type)) {
   3009      typeString = 'array';
   3010    } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
   3011      typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
   3012      info = ' Did you accidentally export a JSX literal instead of a component?';
   3013    } else {
   3014      typeString = typeof type;
   3015    }
   3016 
   3017    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);
   3018  }
   3019 
   3020  var element = createElement.apply(this, arguments);
   3021 
   3022  // The result can be nullish if a mock or a custom function is used.
   3023  // TODO: Drop this when these are no longer allowed as the type argument.
   3024  if (element == null) {
   3025    return element;
   3026  }
   3027 
   3028  // Skip key warning if the type isn't valid since our key validation logic
   3029  // doesn't expect a non-string/function type and can throw confusing errors.
   3030  // We don't want exception behavior to differ between dev and prod.
   3031  // (Rendering will throw with a helpful message and as soon as the type is
   3032  // fixed, the key warnings will appear.)
   3033  if (validType) {
   3034    for (var i = 2; i < arguments.length; i++) {
   3035      validateChildKeys(arguments[i], type);
   3036    }
   3037  }
   3038 
   3039  if (type === REACT_FRAGMENT_TYPE) {
   3040    validateFragmentProps(element);
   3041  } else {
   3042    validatePropTypes(element);
   3043  }
   3044 
   3045  return element;
   3046 }
   3047 
   3048 function createFactoryWithValidation(type) {
   3049  var validatedFactory = createElementWithValidation.bind(null, type);
   3050  validatedFactory.type = type;
   3051  // Legacy hook: remove it
   3052  {
   3053    Object.defineProperty(validatedFactory, 'type', {
   3054      enumerable: false,
   3055      get: function () {
   3056        lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
   3057        Object.defineProperty(this, 'type', {
   3058          value: type
   3059        });
   3060        return type;
   3061      }
   3062    });
   3063  }
   3064 
   3065  return validatedFactory;
   3066 }
   3067 
   3068 function cloneElementWithValidation(element, props, children) {
   3069  var newElement = cloneElement.apply(this, arguments);
   3070  for (var i = 2; i < arguments.length; i++) {
   3071    validateChildKeys(arguments[i], newElement.type);
   3072  }
   3073  validatePropTypes(newElement);
   3074  return newElement;
   3075 }
   3076 
   3077 var React = {
   3078  Children: {
   3079    map: mapChildren,
   3080    forEach: forEachChildren,
   3081    count: countChildren,
   3082    toArray: toArray,
   3083    only: onlyChild
   3084  },
   3085 
   3086  createRef: createRef,
   3087  Component: Component,
   3088  PureComponent: PureComponent,
   3089 
   3090  createContext: createContext,
   3091  forwardRef: forwardRef,
   3092  lazy: lazy,
   3093  memo: memo,
   3094 
   3095  useCallback: useCallback,
   3096  useContext: useContext,
   3097  useEffect: useEffect,
   3098  useImperativeHandle: useImperativeHandle,
   3099  useDebugValue: useDebugValue,
   3100  useLayoutEffect: useLayoutEffect,
   3101  useMemo: useMemo,
   3102  useReducer: useReducer,
   3103  useRef: useRef,
   3104  useState: useState,
   3105 
   3106  Fragment: REACT_FRAGMENT_TYPE,
   3107  StrictMode: REACT_STRICT_MODE_TYPE,
   3108  Suspense: REACT_SUSPENSE_TYPE,
   3109 
   3110  createElement: createElementWithValidation,
   3111  cloneElement: cloneElementWithValidation,
   3112  createFactory: createFactoryWithValidation,
   3113  isValidElement: isValidElement,
   3114 
   3115  version: ReactVersion,
   3116 
   3117  unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
   3118  unstable_Profiler: REACT_PROFILER_TYPE,
   3119 
   3120  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
   3121 };
   3122 
   3123 // Note: some APIs are added with feature flags.
   3124 // Make sure that stable builds for open source
   3125 // don't modify the React object to avoid deopts.
   3126 // Also let's not expose their names in stable builds.
   3127 
   3128 if (enableStableConcurrentModeAPIs) {
   3129  React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
   3130  React.Profiler = REACT_PROFILER_TYPE;
   3131  React.unstable_ConcurrentMode = undefined;
   3132  React.unstable_Profiler = undefined;
   3133 }
   3134 
   3135 
   3136 
   3137 var React$2 = ({
   3138 default: React
   3139 });
   3140 
   3141 var React$3 = ( React$2 && React ) || React$2;
   3142 
   3143 // TODO: decide on the top-level export form.
   3144 // This is hacky but makes it work with both Rollup and Jest.
   3145 var react = React$3.default || React$3;
   3146 
   3147 export default react;
   3148 
   3149 // createFactory only exists on React object,
   3150 // and createElement is overloaded via createElementWithValidation on React object.
   3151 var createFactoryExport = React.createFactory;
   3152 var createElementExport = React.createElement;
   3153 
   3154 export {
   3155  createFactoryExport as createFactory, createElementExport as createElement, Component, PureComponent, createRef, cloneElement,
   3156 }