tor-browser

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

react.mjs (69228B)


      1 /** @license React v16.8.6
      2 * react.production.min.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 // TODO: this is special because it gets imported during build.
     10 
     11 var ReactVersion = '16.8.6';
     12 
     13 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
     14 // nor polyfill, then a plain number is used for performance.
     15 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
     16 
     17 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
     18 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
     19 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
     20 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
     21 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
     22 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
     23 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
     24 
     25 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
     26 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
     27 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
     28 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
     29 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
     30 
     31 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
     32 var FAUX_ITERATOR_SYMBOL = '@@iterator';
     33 
     34 function getIteratorFn(maybeIterable) {
     35  if (maybeIterable === null || typeof maybeIterable !== 'object') {
     36    return null;
     37  }
     38  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
     39  if (typeof maybeIterator === 'function') {
     40    return maybeIterator;
     41  }
     42  return null;
     43 }
     44 
     45 /*
     46 object-assign
     47 (c) Sindre Sorhus
     48 @license MIT
     49 */
     50 
     51 
     52 /* eslint-disable no-unused-vars */
     53 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
     54 var hasOwnProperty = Object.prototype.hasOwnProperty;
     55 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
     56 
     57 function toObject(val) {
     58 if (val === null || val === undefined) {
     59 	throw new TypeError('Object.assign cannot be called with null or undefined');
     60 }
     61 
     62 return Object(val);
     63 }
     64 
     65 function shouldUseNative() {
     66 try {
     67 	if (!Object.assign) {
     68 		return false;
     69 	}
     70 
     71 	// Detect buggy property enumeration order in older V8 versions.
     72 
     73 	// https://bugs.chromium.org/p/v8/issues/detail?id=4118
     74 	var test1 = new String('abc');  // eslint-disable-line no-new-wrappers
     75 	test1[5] = 'de';
     76 	if (Object.getOwnPropertyNames(test1)[0] === '5') {
     77 		return false;
     78 	}
     79 
     80 	// https://bugs.chromium.org/p/v8/issues/detail?id=3056
     81 	var test2 = {};
     82 	for (var i = 0; i < 10; i++) {
     83 		test2['_' + String.fromCharCode(i)] = i;
     84 	}
     85 	var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
     86 		return test2[n];
     87 	});
     88 	if (order2.join('') !== '0123456789') {
     89 		return false;
     90 	}
     91 
     92 	// https://bugs.chromium.org/p/v8/issues/detail?id=3056
     93 	var test3 = {};
     94 	'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
     95 		test3[letter] = letter;
     96 	});
     97 	if (Object.keys(Object.assign({}, test3)).join('') !==
     98 			'abcdefghijklmnopqrst') {
     99 		return false;
    100 	}
    101 
    102 	return true;
    103 } catch (err) {
    104 	// We don't expect any of the above to throw, but better to be safe.
    105 	return false;
    106 }
    107 }
    108 
    109 var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
    110 var from;
    111 var to = toObject(target);
    112 var symbols;
    113 
    114 for (var s = 1; s < arguments.length; s++) {
    115 	from = Object(arguments[s]);
    116 
    117 	for (var key in from) {
    118 		if (hasOwnProperty.call(from, key)) {
    119 			to[key] = from[key];
    120 		}
    121 	}
    122 
    123 	if (getOwnPropertySymbols) {
    124 		symbols = getOwnPropertySymbols(from);
    125 		for (var i = 0; i < symbols.length; i++) {
    126 			if (propIsEnumerable.call(from, symbols[i])) {
    127 				to[symbols[i]] = from[symbols[i]];
    128 			}
    129 		}
    130 	}
    131 }
    132 
    133 return to;
    134 };
    135 
    136 /**
    137 * Use invariant() to assert state which your program assumes to be true.
    138 *
    139 * Provide sprintf-style format (only %s is supported) and arguments
    140 * to provide information about what broke and what you were
    141 * expecting.
    142 *
    143 * The invariant message will be stripped in production, but the invariant
    144 * will remain to ensure logic does not differ in production.
    145 */
    146 
    147 function invariant(condition, format, a, b, c, d, e, f) {
    148  if (!condition) {
    149    var error = void 0;
    150    if (format === undefined) {
    151      error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
    152    } else {
    153      var args = [a, b, c, d, e, f];
    154      var argIndex = 0;
    155      error = new Error(format.replace(/%s/g, function () {
    156        return args[argIndex++];
    157      }));
    158      error.name = 'Invariant Violation';
    159    }
    160 
    161    error.framesToPop = 1; // we don't care about invariant's own frame
    162    throw error;
    163  }
    164 }
    165 
    166 // Relying on the `invariant()` implementation lets us
    167 // preserve the format and params in the www builds.
    168 /**
    169 * WARNING: DO NOT manually require this module.
    170 * This is a replacement for `invariant(...)` used by the error code system
    171 * and will _only_ be required by the corresponding babel pass.
    172 * It always throws.
    173 */
    174 function reactProdInvariant(code) {
    175  var argCount = arguments.length - 1;
    176  var url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code;
    177  for (var argIdx = 0; argIdx < argCount; argIdx++) {
    178    url += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
    179  }
    180  // Rename it so that our build transform doesn't attempt
    181  // to replace this invariant() call with reactProdInvariant().
    182  var i = invariant;
    183  i(false,
    184  // The error code is intentionally part of the message (and
    185  // not the format argument) so that we could deduplicate
    186  // different errors in logs based on the code.
    187  'Minified React error #' + code + '; visit %s ' + 'for the full message or use the non-minified dev environment ' + 'for full errors and additional helpful warnings. ', url);
    188 }
    189 
    190 /**
    191 * Forked from fbjs/warning:
    192 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
    193 *
    194 * Only change is we use console.warn instead of console.error,
    195 * and do nothing when 'console' is not supported.
    196 * This really simplifies the code.
    197 * ---
    198 * Similar to invariant but only logs a warning if the condition is not met.
    199 * This can be used to log issues in development environments in critical
    200 * paths. Removing the logging code for production environments will keep the
    201 * same logic and follow the same code paths.
    202 */
    203 
    204 /**
    205 * Similar to invariant but only logs a warning if the condition is not met.
    206 * This can be used to log issues in development environments in critical
    207 * paths. Removing the logging code for production environments will keep the
    208 * same logic and follow the same code paths.
    209 */
    210 
    211 /**
    212 * This is the abstract API for an update queue.
    213 */
    214 var ReactNoopUpdateQueue = {
    215  /**
    216   * Checks whether or not this composite component is mounted.
    217   * @param {ReactClass} publicInstance The instance we want to test.
    218   * @return {boolean} True if mounted, false otherwise.
    219   * @protected
    220   * @final
    221   */
    222  isMounted: function (publicInstance) {
    223    return false;
    224  },
    225 
    226  /**
    227   * Forces an update. This should only be invoked when it is known with
    228   * certainty that we are **not** in a DOM transaction.
    229   *
    230   * You may want to call this when you know that some deeper aspect of the
    231   * component's state has changed but `setState` was not called.
    232   *
    233   * This will not invoke `shouldComponentUpdate`, but it will invoke
    234   * `componentWillUpdate` and `componentDidUpdate`.
    235   *
    236   * @param {ReactClass} publicInstance The instance that should rerender.
    237   * @param {?function} callback Called after component is updated.
    238   * @param {?string} callerName name of the calling function in the public API.
    239   * @internal
    240   */
    241  enqueueForceUpdate: function (publicInstance, callback, callerName) {
    242    
    243  },
    244 
    245  /**
    246   * Replaces all of the state. Always use this or `setState` to mutate state.
    247   * You should treat `this.state` as immutable.
    248   *
    249   * There is no guarantee that `this.state` will be immediately updated, so
    250   * accessing `this.state` after calling this method may return the old value.
    251   *
    252   * @param {ReactClass} publicInstance The instance that should rerender.
    253   * @param {object} completeState Next state.
    254   * @param {?function} callback Called after component is updated.
    255   * @param {?string} callerName name of the calling function in the public API.
    256   * @internal
    257   */
    258  enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
    259    
    260  },
    261 
    262  /**
    263   * Sets a subset of the state. This only exists because _pendingState is
    264   * internal. This provides a merging strategy that is not available to deep
    265   * properties which is confusing. TODO: Expose pendingState or don't use it
    266   * during the merge.
    267   *
    268   * @param {ReactClass} publicInstance The instance that should rerender.
    269   * @param {object} partialState Next partial state to be merged with state.
    270   * @param {?function} callback Called after component is updated.
    271   * @param {?string} Name of the calling function in the public API.
    272   * @internal
    273   */
    274  enqueueSetState: function (publicInstance, partialState, callback, callerName) {
    275    
    276  }
    277 };
    278 
    279 var emptyObject = {};
    280 /**
    281 * Base class helpers for the updating state of a component.
    282 */
    283 function Component(props, context, updater) {
    284  this.props = props;
    285  this.context = context;
    286  // If a component has string refs, we will assign a different object later.
    287  this.refs = emptyObject;
    288  // We initialize the default updater but the real one gets injected by the
    289  // renderer.
    290  this.updater = updater || ReactNoopUpdateQueue;
    291 }
    292 
    293 Component.prototype.isReactComponent = {};
    294 
    295 /**
    296 * Sets a subset of the state. Always use this to mutate
    297 * state. You should treat `this.state` as immutable.
    298 *
    299 * There is no guarantee that `this.state` will be immediately updated, so
    300 * accessing `this.state` after calling this method may return the old value.
    301 *
    302 * There is no guarantee that calls to `setState` will run synchronously,
    303 * as they may eventually be batched together.  You can provide an optional
    304 * callback that will be executed when the call to setState is actually
    305 * completed.
    306 *
    307 * When a function is provided to setState, it will be called at some point in
    308 * the future (not synchronously). It will be called with the up to date
    309 * component arguments (state, props, context). These values can be different
    310 * from this.* because your function may be called after receiveProps but before
    311 * shouldComponentUpdate, and this new state, props, and context will not yet be
    312 * assigned to this.
    313 *
    314 * @param {object|function} partialState Next partial state or function to
    315 *        produce next partial state to be merged with current state.
    316 * @param {?function} callback Called after state is updated.
    317 * @final
    318 * @protected
    319 */
    320 Component.prototype.setState = function (partialState, callback) {
    321  !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? reactProdInvariant('85') : void 0;
    322  this.updater.enqueueSetState(this, partialState, callback, 'setState');
    323 };
    324 
    325 /**
    326 * Forces an update. This should only be invoked when it is known with
    327 * certainty that we are **not** in a DOM transaction.
    328 *
    329 * You may want to call this when you know that some deeper aspect of the
    330 * component's state has changed but `setState` was not called.
    331 *
    332 * This will not invoke `shouldComponentUpdate`, but it will invoke
    333 * `componentWillUpdate` and `componentDidUpdate`.
    334 *
    335 * @param {?function} callback Called after update is complete.
    336 * @final
    337 * @protected
    338 */
    339 Component.prototype.forceUpdate = function (callback) {
    340  this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
    341 };
    342 
    343 /**
    344 * Deprecated APIs. These APIs used to exist on classic React classes but since
    345 * we would like to deprecate them, we're not going to move them over to this
    346 * modern base class. Instead, we define a getter that warns if it's accessed.
    347 */
    348 function ComponentDummy() {}
    349 ComponentDummy.prototype = Component.prototype;
    350 
    351 /**
    352 * Convenience component with default shallow equality check for sCU.
    353 */
    354 function PureComponent(props, context, updater) {
    355  this.props = props;
    356  this.context = context;
    357  // If a component has string refs, we will assign a different object later.
    358  this.refs = emptyObject;
    359  this.updater = updater || ReactNoopUpdateQueue;
    360 }
    361 
    362 var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
    363 pureComponentPrototype.constructor = PureComponent;
    364 // Avoid an extra prototype jump for these methods.
    365 objectAssign(pureComponentPrototype, Component.prototype);
    366 pureComponentPrototype.isPureReactComponent = true;
    367 
    368 // an immutable object with a single mutable value
    369 function createRef() {
    370  var refObject = {
    371    current: null
    372  };
    373  return refObject;
    374 }
    375 
    376 var enableSchedulerDebugging = false;
    377 
    378 /* eslint-disable no-var */
    379 
    380 // TODO: Use symbols?
    381 var ImmediatePriority = 1;
    382 var UserBlockingPriority = 2;
    383 var NormalPriority = 3;
    384 var LowPriority = 4;
    385 var IdlePriority = 5;
    386 
    387 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
    388 // Math.pow(2, 30) - 1
    389 // 0b111111111111111111111111111111
    390 var maxSigned31BitInt = 1073741823;
    391 
    392 // Times out immediately
    393 var IMMEDIATE_PRIORITY_TIMEOUT = -1;
    394 // Eventually times out
    395 var USER_BLOCKING_PRIORITY = 250;
    396 var NORMAL_PRIORITY_TIMEOUT = 5000;
    397 var LOW_PRIORITY_TIMEOUT = 10000;
    398 // Never times out
    399 var IDLE_PRIORITY = maxSigned31BitInt;
    400 
    401 // Callbacks are stored as a circular, doubly linked list.
    402 var firstCallbackNode = null;
    403 
    404 var currentDidTimeout = false;
    405 // Pausing the scheduler is useful for debugging.
    406 var isSchedulerPaused = false;
    407 
    408 var currentPriorityLevel = NormalPriority;
    409 var currentEventStartTime = -1;
    410 var currentExpirationTime = -1;
    411 
    412 // This is set when a callback is being executed, to prevent re-entrancy.
    413 var isExecutingCallback = false;
    414 
    415 var isHostCallbackScheduled = false;
    416 
    417 var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
    418 
    419 function ensureHostCallbackIsScheduled() {
    420  if (isExecutingCallback) {
    421    // Don't schedule work yet; wait until the next time we yield.
    422    return;
    423  }
    424  // Schedule the host callback using the earliest expiration in the list.
    425  var expirationTime = firstCallbackNode.expirationTime;
    426  if (!isHostCallbackScheduled) {
    427    isHostCallbackScheduled = true;
    428  } else {
    429    // Cancel the existing host callback.
    430    cancelHostCallback();
    431  }
    432  requestHostCallback(flushWork, expirationTime);
    433 }
    434 
    435 function flushFirstCallback() {
    436  var flushedNode = firstCallbackNode;
    437 
    438  // Remove the node from the list before calling the callback. That way the
    439  // list is in a consistent state even if the callback throws.
    440  var next = firstCallbackNode.next;
    441  if (firstCallbackNode === next) {
    442    // This is the last callback in the list.
    443    firstCallbackNode = null;
    444    next = null;
    445  } else {
    446    var lastCallbackNode = firstCallbackNode.previous;
    447    firstCallbackNode = lastCallbackNode.next = next;
    448    next.previous = lastCallbackNode;
    449  }
    450 
    451  flushedNode.next = flushedNode.previous = null;
    452 
    453  // Now it's safe to call the callback.
    454  var callback = flushedNode.callback;
    455  var expirationTime = flushedNode.expirationTime;
    456  var priorityLevel = flushedNode.priorityLevel;
    457  var previousPriorityLevel = currentPriorityLevel;
    458  var previousExpirationTime = currentExpirationTime;
    459  currentPriorityLevel = priorityLevel;
    460  currentExpirationTime = expirationTime;
    461  var continuationCallback;
    462  try {
    463    continuationCallback = callback();
    464  } finally {
    465    currentPriorityLevel = previousPriorityLevel;
    466    currentExpirationTime = previousExpirationTime;
    467  }
    468 
    469  // A callback may return a continuation. The continuation should be scheduled
    470  // with the same priority and expiration as the just-finished callback.
    471  if (typeof continuationCallback === 'function') {
    472    var continuationNode = {
    473      callback: continuationCallback,
    474      priorityLevel: priorityLevel,
    475      expirationTime: expirationTime,
    476      next: null,
    477      previous: null
    478    };
    479 
    480    // Insert the new callback into the list, sorted by its expiration. This is
    481    // almost the same as the code in `scheduleCallback`, except the callback
    482    // is inserted into the list *before* callbacks of equal expiration instead
    483    // of after.
    484    if (firstCallbackNode === null) {
    485      // This is the first callback in the list.
    486      firstCallbackNode = continuationNode.next = continuationNode.previous = continuationNode;
    487    } else {
    488      var nextAfterContinuation = null;
    489      var node = firstCallbackNode;
    490      do {
    491        if (node.expirationTime >= expirationTime) {
    492          // This callback expires at or after the continuation. We will insert
    493          // the continuation *before* this callback.
    494          nextAfterContinuation = node;
    495          break;
    496        }
    497        node = node.next;
    498      } while (node !== firstCallbackNode);
    499 
    500      if (nextAfterContinuation === null) {
    501        // No equal or lower priority callback was found, which means the new
    502        // callback is the lowest priority callback in the list.
    503        nextAfterContinuation = firstCallbackNode;
    504      } else if (nextAfterContinuation === firstCallbackNode) {
    505        // The new callback is the highest priority callback in the list.
    506        firstCallbackNode = continuationNode;
    507        ensureHostCallbackIsScheduled();
    508      }
    509 
    510      var previous = nextAfterContinuation.previous;
    511      previous.next = nextAfterContinuation.previous = continuationNode;
    512      continuationNode.next = nextAfterContinuation;
    513      continuationNode.previous = previous;
    514    }
    515  }
    516 }
    517 
    518 function flushImmediateWork() {
    519  if (
    520  // Confirm we've exited the outer most event handler
    521  currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
    522    isExecutingCallback = true;
    523    try {
    524      do {
    525        flushFirstCallback();
    526      } while (
    527      // Keep flushing until there are no more immediate callbacks
    528      firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
    529    } finally {
    530      isExecutingCallback = false;
    531      if (firstCallbackNode !== null) {
    532        // There's still work remaining. Request another callback.
    533        ensureHostCallbackIsScheduled();
    534      } else {
    535        isHostCallbackScheduled = false;
    536      }
    537    }
    538  }
    539 }
    540 
    541 function flushWork(didTimeout) {
    542  // Exit right away if we're currently paused
    543 
    544  if (enableSchedulerDebugging && isSchedulerPaused) {
    545    return;
    546  }
    547 
    548  isExecutingCallback = true;
    549  var previousDidTimeout = currentDidTimeout;
    550  currentDidTimeout = didTimeout;
    551  try {
    552    if (didTimeout) {
    553      // Flush all the expired callbacks without yielding.
    554      while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
    555        // TODO Wrap in feature flag
    556        // Read the current time. Flush all the callbacks that expire at or
    557        // earlier than that time. Then read the current time again and repeat.
    558        // This optimizes for as few performance.now calls as possible.
    559        var currentTime = getCurrentTime();
    560        if (firstCallbackNode.expirationTime <= currentTime) {
    561          do {
    562            flushFirstCallback();
    563          } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
    564          continue;
    565        }
    566        break;
    567      }
    568    } else {
    569      // Keep flushing callbacks until we run out of time in the frame.
    570      if (firstCallbackNode !== null) {
    571        do {
    572          if (enableSchedulerDebugging && isSchedulerPaused) {
    573            break;
    574          }
    575          flushFirstCallback();
    576        } while (firstCallbackNode !== null && !shouldYieldToHost());
    577      }
    578    }
    579  } finally {
    580    isExecutingCallback = false;
    581    currentDidTimeout = previousDidTimeout;
    582    if (firstCallbackNode !== null) {
    583      // There's still work remaining. Request another callback.
    584      ensureHostCallbackIsScheduled();
    585    } else {
    586      isHostCallbackScheduled = false;
    587    }
    588    // Before exiting, flush all the immediate work that was scheduled.
    589    flushImmediateWork();
    590  }
    591 }
    592 
    593 function unstable_runWithPriority(priorityLevel, eventHandler) {
    594  switch (priorityLevel) {
    595    case ImmediatePriority:
    596    case UserBlockingPriority:
    597    case NormalPriority:
    598    case LowPriority:
    599    case IdlePriority:
    600      break;
    601    default:
    602      priorityLevel = NormalPriority;
    603  }
    604 
    605  var previousPriorityLevel = currentPriorityLevel;
    606  var previousEventStartTime = currentEventStartTime;
    607  currentPriorityLevel = priorityLevel;
    608  currentEventStartTime = getCurrentTime();
    609 
    610  try {
    611    return eventHandler();
    612  } finally {
    613    currentPriorityLevel = previousPriorityLevel;
    614    currentEventStartTime = previousEventStartTime;
    615 
    616    // Before exiting, flush all the immediate work that was scheduled.
    617    flushImmediateWork();
    618  }
    619 }
    620 
    621 function unstable_next(eventHandler) {
    622  var priorityLevel = void 0;
    623  switch (currentPriorityLevel) {
    624    case ImmediatePriority:
    625    case UserBlockingPriority:
    626    case NormalPriority:
    627      // Shift down to normal priority
    628      priorityLevel = NormalPriority;
    629      break;
    630    default:
    631      // Anything lower than normal priority should remain at the current level.
    632      priorityLevel = currentPriorityLevel;
    633      break;
    634  }
    635 
    636  var previousPriorityLevel = currentPriorityLevel;
    637  var previousEventStartTime = currentEventStartTime;
    638  currentPriorityLevel = priorityLevel;
    639  currentEventStartTime = getCurrentTime();
    640 
    641  try {
    642    return eventHandler();
    643  } finally {
    644    currentPriorityLevel = previousPriorityLevel;
    645    currentEventStartTime = previousEventStartTime;
    646 
    647    // Before exiting, flush all the immediate work that was scheduled.
    648    flushImmediateWork();
    649  }
    650 }
    651 
    652 function unstable_wrapCallback(callback) {
    653  var parentPriorityLevel = currentPriorityLevel;
    654  return function () {
    655    // This is a fork of runWithPriority, inlined for performance.
    656    var previousPriorityLevel = currentPriorityLevel;
    657    var previousEventStartTime = currentEventStartTime;
    658    currentPriorityLevel = parentPriorityLevel;
    659    currentEventStartTime = getCurrentTime();
    660 
    661    try {
    662      return callback.apply(this, arguments);
    663    } finally {
    664      currentPriorityLevel = previousPriorityLevel;
    665      currentEventStartTime = previousEventStartTime;
    666      flushImmediateWork();
    667    }
    668  };
    669 }
    670 
    671 function unstable_scheduleCallback(callback, deprecated_options) {
    672  var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
    673 
    674  var expirationTime;
    675  if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
    676    // FIXME: Remove this branch once we lift expiration times out of React.
    677    expirationTime = startTime + deprecated_options.timeout;
    678  } else {
    679    switch (currentPriorityLevel) {
    680      case ImmediatePriority:
    681        expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
    682        break;
    683      case UserBlockingPriority:
    684        expirationTime = startTime + USER_BLOCKING_PRIORITY;
    685        break;
    686      case IdlePriority:
    687        expirationTime = startTime + IDLE_PRIORITY;
    688        break;
    689      case LowPriority:
    690        expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
    691        break;
    692      case NormalPriority:
    693      default:
    694        expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
    695    }
    696  }
    697 
    698  var newNode = {
    699    callback: callback,
    700    priorityLevel: currentPriorityLevel,
    701    expirationTime: expirationTime,
    702    next: null,
    703    previous: null
    704  };
    705 
    706  // Insert the new callback into the list, ordered first by expiration, then
    707  // by insertion. So the new callback is inserted any other callback with
    708  // equal expiration.
    709  if (firstCallbackNode === null) {
    710    // This is the first callback in the list.
    711    firstCallbackNode = newNode.next = newNode.previous = newNode;
    712    ensureHostCallbackIsScheduled();
    713  } else {
    714    var next = null;
    715    var node = firstCallbackNode;
    716    do {
    717      if (node.expirationTime > expirationTime) {
    718        // The new callback expires before this one.
    719        next = node;
    720        break;
    721      }
    722      node = node.next;
    723    } while (node !== firstCallbackNode);
    724 
    725    if (next === null) {
    726      // No callback with a later expiration was found, which means the new
    727      // callback has the latest expiration in the list.
    728      next = firstCallbackNode;
    729    } else if (next === firstCallbackNode) {
    730      // The new callback has the earliest expiration in the entire list.
    731      firstCallbackNode = newNode;
    732      ensureHostCallbackIsScheduled();
    733    }
    734 
    735    var previous = next.previous;
    736    previous.next = next.previous = newNode;
    737    newNode.next = next;
    738    newNode.previous = previous;
    739  }
    740 
    741  return newNode;
    742 }
    743 
    744 function unstable_pauseExecution() {
    745  isSchedulerPaused = true;
    746 }
    747 
    748 function unstable_continueExecution() {
    749  isSchedulerPaused = false;
    750  if (firstCallbackNode !== null) {
    751    ensureHostCallbackIsScheduled();
    752  }
    753 }
    754 
    755 function unstable_getFirstCallbackNode() {
    756  return firstCallbackNode;
    757 }
    758 
    759 function unstable_cancelCallback(callbackNode) {
    760  var next = callbackNode.next;
    761  if (next === null) {
    762    // Already cancelled.
    763    return;
    764  }
    765 
    766  if (next === callbackNode) {
    767    // This is the only scheduled callback. Clear the list.
    768    firstCallbackNode = null;
    769  } else {
    770    // Remove the callback from its position in the list.
    771    if (callbackNode === firstCallbackNode) {
    772      firstCallbackNode = next;
    773    }
    774    var previous = callbackNode.previous;
    775    previous.next = next;
    776    next.previous = previous;
    777  }
    778 
    779  callbackNode.next = callbackNode.previous = null;
    780 }
    781 
    782 function unstable_getCurrentPriorityLevel() {
    783  return currentPriorityLevel;
    784 }
    785 
    786 function unstable_shouldYield() {
    787  return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
    788 }
    789 
    790 // The remaining code is essentially a polyfill for requestIdleCallback. It
    791 // works by scheduling a requestAnimationFrame, storing the time for the start
    792 // of the frame, then scheduling a postMessage which gets scheduled after paint.
    793 // Within the postMessage handler do as much work as possible until time + frame
    794 // rate. By separating the idle call into a separate event tick we ensure that
    795 // layout, paint and other browser work is counted against the available time.
    796 // The frame rate is dynamically adjusted.
    797 
    798 // We capture a local reference to any global, in case it gets polyfilled after
    799 // this module is initially evaluated. We want to be using a
    800 // consistent implementation.
    801 var localDate = Date;
    802 
    803 // This initialization code may run even on server environments if a component
    804 // just imports ReactDOM (e.g. for findDOMNode). Some environments might not
    805 // have setTimeout or clearTimeout. However, we always expect them to be defined
    806 // on the client. https://github.com/facebook/react/pull/13088
    807 var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
    808 var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
    809 
    810 // We don't expect either of these to necessarily be defined, but we will error
    811 // later if they are missing on the client.
    812 var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
    813 var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
    814 
    815 var getCurrentTime;
    816 
    817 // requestAnimationFrame does not run when the tab is in the background. If
    818 // we're backgrounded we prefer for that work to happen so that the page
    819 // continues to load in the background. So we also schedule a 'setTimeout' as
    820 // a fallback.
    821 // TODO: Need a better heuristic for backgrounded work.
    822 var ANIMATION_FRAME_TIMEOUT = 100;
    823 var rAFID;
    824 var rAFTimeoutID;
    825 var requestAnimationFrameWithTimeout = function (callback) {
    826  // schedule rAF and also a setTimeout
    827  rAFID = localRequestAnimationFrame(function (timestamp) {
    828    // cancel the setTimeout
    829    localClearTimeout(rAFTimeoutID);
    830    callback(timestamp);
    831  });
    832  rAFTimeoutID = localSetTimeout(function () {
    833    // cancel the requestAnimationFrame
    834    localCancelAnimationFrame(rAFID);
    835    callback(getCurrentTime());
    836  }, ANIMATION_FRAME_TIMEOUT);
    837 };
    838 
    839 if (hasNativePerformanceNow) {
    840  var Performance = performance;
    841  getCurrentTime = function () {
    842    return Performance.now();
    843  };
    844 } else {
    845  getCurrentTime = function () {
    846    return localDate.now();
    847  };
    848 }
    849 
    850 var requestHostCallback;
    851 var cancelHostCallback;
    852 var shouldYieldToHost;
    853 
    854 var globalValue = null;
    855 if (typeof window !== 'undefined') {
    856  globalValue = window;
    857 } else if (typeof global !== 'undefined') {
    858  globalValue = global;
    859 }
    860 
    861 if (globalValue && globalValue._schedMock) {
    862  // Dynamic injection, only for testing purposes.
    863  var globalImpl = globalValue._schedMock;
    864  requestHostCallback = globalImpl[0];
    865  cancelHostCallback = globalImpl[1];
    866  shouldYieldToHost = globalImpl[2];
    867  getCurrentTime = globalImpl[3];
    868 } else if (
    869 // If Scheduler runs in a non-DOM environment, it falls back to a naive
    870 // implementation using setTimeout.
    871 typeof window === 'undefined' ||
    872 // Check if MessageChannel is supported, too.
    873 typeof MessageChannel !== 'function') {
    874  // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
    875  // fallback to a naive implementation.
    876  var _callback = null;
    877  var _flushCallback = function (didTimeout) {
    878    if (_callback !== null) {
    879      try {
    880        _callback(didTimeout);
    881      } finally {
    882        _callback = null;
    883      }
    884    }
    885  };
    886  requestHostCallback = function (cb, ms) {
    887    if (_callback !== null) {
    888      // Protect against re-entrancy.
    889      setTimeout(requestHostCallback, 0, cb);
    890    } else {
    891      _callback = cb;
    892      setTimeout(_flushCallback, 0, false);
    893    }
    894  };
    895  cancelHostCallback = function () {
    896    _callback = null;
    897  };
    898  shouldYieldToHost = function () {
    899    return false;
    900  };
    901 } else {
    902  if (typeof console !== 'undefined') {
    903    // TODO: Remove fb.me link
    904    if (typeof localRequestAnimationFrame !== 'function') {
    905      console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
    906    }
    907    if (typeof localCancelAnimationFrame !== 'function') {
    908      console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
    909    }
    910  }
    911 
    912  var scheduledHostCallback = null;
    913  var isMessageEventScheduled = false;
    914  var timeoutTime = -1;
    915 
    916  var isAnimationFrameScheduled = false;
    917 
    918  var isFlushingHostCallback = false;
    919 
    920  var frameDeadline = 0;
    921  // We start out assuming that we run at 30fps but then the heuristic tracking
    922  // will adjust this value to a faster fps if we get more frequent animation
    923  // frames.
    924  var previousFrameTime = 33;
    925  var activeFrameTime = 33;
    926 
    927  shouldYieldToHost = function () {
    928    return frameDeadline <= getCurrentTime();
    929  };
    930 
    931  // We use the postMessage trick to defer idle work until after the repaint.
    932  var channel = new MessageChannel();
    933  var port = channel.port2;
    934  channel.port1.onmessage = function (event) {
    935    isMessageEventScheduled = false;
    936 
    937    var prevScheduledCallback = scheduledHostCallback;
    938    var prevTimeoutTime = timeoutTime;
    939    scheduledHostCallback = null;
    940    timeoutTime = -1;
    941 
    942    var currentTime = getCurrentTime();
    943 
    944    var didTimeout = false;
    945    if (frameDeadline - currentTime <= 0) {
    946      // There's no time left in this idle period. Check if the callback has
    947      // a timeout and whether it's been exceeded.
    948      if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
    949        // Exceeded the timeout. Invoke the callback even though there's no
    950        // time left.
    951        didTimeout = true;
    952      } else {
    953        // No timeout.
    954        if (!isAnimationFrameScheduled) {
    955          // Schedule another animation callback so we retry later.
    956          isAnimationFrameScheduled = true;
    957          requestAnimationFrameWithTimeout(animationTick);
    958        }
    959        // Exit without invoking the callback.
    960        scheduledHostCallback = prevScheduledCallback;
    961        timeoutTime = prevTimeoutTime;
    962        return;
    963      }
    964    }
    965 
    966    if (prevScheduledCallback !== null) {
    967      isFlushingHostCallback = true;
    968      try {
    969        prevScheduledCallback(didTimeout);
    970      } finally {
    971        isFlushingHostCallback = false;
    972      }
    973    }
    974  };
    975 
    976  var animationTick = function (rafTime) {
    977    if (scheduledHostCallback !== null) {
    978      // Eagerly schedule the next animation callback at the beginning of the
    979      // frame. If the scheduler queue is not empty at the end of the frame, it
    980      // will continue flushing inside that callback. If the queue *is* empty,
    981      // then it will exit immediately. Posting the callback at the start of the
    982      // frame ensures it's fired within the earliest possible frame. If we
    983      // waited until the end of the frame to post the callback, we risk the
    984      // browser skipping a frame and not firing the callback until the frame
    985      // after that.
    986      requestAnimationFrameWithTimeout(animationTick);
    987    } else {
    988      // No pending work. Exit.
    989      isAnimationFrameScheduled = false;
    990      return;
    991    }
    992 
    993    var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
    994    if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
    995      if (nextFrameTime < 8) {
    996        // Defensive coding. We don't support higher frame rates than 120hz.
    997        // If the calculated frame time gets lower than 8, it is probably a bug.
    998        nextFrameTime = 8;
    999      }
   1000      // If one frame goes long, then the next one can be short to catch up.
   1001      // If two frames are short in a row, then that's an indication that we
   1002      // actually have a higher frame rate than what we're currently optimizing.
   1003      // We adjust our heuristic dynamically accordingly. For example, if we're
   1004      // running on 120hz display or 90hz VR display.
   1005      // Take the max of the two in case one of them was an anomaly due to
   1006      // missed frame deadlines.
   1007      activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
   1008    } else {
   1009      previousFrameTime = nextFrameTime;
   1010    }
   1011    frameDeadline = rafTime + activeFrameTime;
   1012    if (!isMessageEventScheduled) {
   1013      isMessageEventScheduled = true;
   1014      port.postMessage(undefined);
   1015    }
   1016  };
   1017 
   1018  requestHostCallback = function (callback, absoluteTimeout) {
   1019    scheduledHostCallback = callback;
   1020    timeoutTime = absoluteTimeout;
   1021    if (isFlushingHostCallback || absoluteTimeout < 0) {
   1022      // Don't wait for the next frame. Continue working ASAP, in a new event.
   1023      port.postMessage(undefined);
   1024    } else if (!isAnimationFrameScheduled) {
   1025      // If rAF didn't already schedule one, we need to schedule a frame.
   1026      // TODO: If this rAF doesn't materialize because the browser throttles, we
   1027      // might want to still have setTimeout trigger rIC as a backup to ensure
   1028      // that we keep performing work.
   1029      isAnimationFrameScheduled = true;
   1030      requestAnimationFrameWithTimeout(animationTick);
   1031    }
   1032  };
   1033 
   1034  cancelHostCallback = function () {
   1035    scheduledHostCallback = null;
   1036    isMessageEventScheduled = false;
   1037    timeoutTime = -1;
   1038  };
   1039 }
   1040 
   1041 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
   1042 
   1043 
   1044 // In some cases, StrictMode should also double-render lifecycles.
   1045 // This can be confusing for tests though,
   1046 // And it can be bad for performance in production.
   1047 // This feature flag can be used to control the behavior:
   1048 
   1049 
   1050 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
   1051 // replay the begin phase of a failed component inside invokeGuardedCallback.
   1052 
   1053 
   1054 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
   1055 
   1056 
   1057 // Gather advanced timing metrics for Profiler subtrees.
   1058 
   1059 
   1060 // Trace which interactions trigger each commit.
   1061 var enableSchedulerTracing = false;
   1062 
   1063 // Only used in www builds.
   1064 // TODO: false? Here it might just be false.
   1065 
   1066 // Only used in www builds.
   1067 
   1068 
   1069 // Only used in www builds.
   1070 
   1071 
   1072 // React Fire: prevent the value and checked attributes from syncing
   1073 // with their related DOM properties
   1074 
   1075 
   1076 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
   1077 // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
   1078 var enableStableConcurrentModeAPIs = false;
   1079 
   1080 var DEFAULT_THREAD_ID = 0;
   1081 
   1082 // Counters used to generate unique IDs.
   1083 var interactionIDCounter = 0;
   1084 var threadIDCounter = 0;
   1085 
   1086 // Set of currently traced interactions.
   1087 // Interactions "stack"–
   1088 // Meaning that newly traced interactions are appended to the previously active set.
   1089 // When an interaction goes out of scope, the previous set (if any) is restored.
   1090 var interactionsRef = null;
   1091 
   1092 // Listener(s) to notify when interactions begin and end.
   1093 var subscriberRef = null;
   1094 
   1095 if (enableSchedulerTracing) {
   1096  interactionsRef = {
   1097    current: new Set()
   1098  };
   1099  subscriberRef = {
   1100    current: null
   1101  };
   1102 }
   1103 
   1104 function unstable_clear(callback) {
   1105  if (!enableSchedulerTracing) {
   1106    return callback();
   1107  }
   1108 
   1109  var prevInteractions = interactionsRef.current;
   1110  interactionsRef.current = new Set();
   1111 
   1112  try {
   1113    return callback();
   1114  } finally {
   1115    interactionsRef.current = prevInteractions;
   1116  }
   1117 }
   1118 
   1119 function unstable_getCurrent() {
   1120  if (!enableSchedulerTracing) {
   1121    return null;
   1122  } else {
   1123    return interactionsRef.current;
   1124  }
   1125 }
   1126 
   1127 function unstable_getThreadID() {
   1128  return ++threadIDCounter;
   1129 }
   1130 
   1131 function unstable_trace(name, timestamp, callback) {
   1132  var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
   1133 
   1134  if (!enableSchedulerTracing) {
   1135    return callback();
   1136  }
   1137 
   1138  var interaction = {
   1139    __count: 1,
   1140    id: interactionIDCounter++,
   1141    name: name,
   1142    timestamp: timestamp
   1143  };
   1144 
   1145  var prevInteractions = interactionsRef.current;
   1146 
   1147  // Traced interactions should stack/accumulate.
   1148  // To do that, clone the current interactions.
   1149  // The previous set will be restored upon completion.
   1150  var interactions = new Set(prevInteractions);
   1151  interactions.add(interaction);
   1152  interactionsRef.current = interactions;
   1153 
   1154  var subscriber = subscriberRef.current;
   1155  var returnValue = void 0;
   1156 
   1157  try {
   1158    if (subscriber !== null) {
   1159      subscriber.onInteractionTraced(interaction);
   1160    }
   1161  } finally {
   1162    try {
   1163      if (subscriber !== null) {
   1164        subscriber.onWorkStarted(interactions, threadID);
   1165      }
   1166    } finally {
   1167      try {
   1168        returnValue = callback();
   1169      } finally {
   1170        interactionsRef.current = prevInteractions;
   1171 
   1172        try {
   1173          if (subscriber !== null) {
   1174            subscriber.onWorkStopped(interactions, threadID);
   1175          }
   1176        } finally {
   1177          interaction.__count--;
   1178 
   1179          // If no async work was scheduled for this interaction,
   1180          // Notify subscribers that it's completed.
   1181          if (subscriber !== null && interaction.__count === 0) {
   1182            subscriber.onInteractionScheduledWorkCompleted(interaction);
   1183          }
   1184        }
   1185      }
   1186    }
   1187  }
   1188 
   1189  return returnValue;
   1190 }
   1191 
   1192 function unstable_wrap(callback) {
   1193  var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
   1194 
   1195  if (!enableSchedulerTracing) {
   1196    return callback;
   1197  }
   1198 
   1199  var wrappedInteractions = interactionsRef.current;
   1200 
   1201  var subscriber = subscriberRef.current;
   1202  if (subscriber !== null) {
   1203    subscriber.onWorkScheduled(wrappedInteractions, threadID);
   1204  }
   1205 
   1206  // Update the pending async work count for the current interactions.
   1207  // Update after calling subscribers in case of error.
   1208  wrappedInteractions.forEach(function (interaction) {
   1209    interaction.__count++;
   1210  });
   1211 
   1212  var hasRun = false;
   1213 
   1214  function wrapped() {
   1215    var prevInteractions = interactionsRef.current;
   1216    interactionsRef.current = wrappedInteractions;
   1217 
   1218    subscriber = subscriberRef.current;
   1219 
   1220    try {
   1221      var returnValue = void 0;
   1222 
   1223      try {
   1224        if (subscriber !== null) {
   1225          subscriber.onWorkStarted(wrappedInteractions, threadID);
   1226        }
   1227      } finally {
   1228        try {
   1229          returnValue = callback.apply(undefined, arguments);
   1230        } finally {
   1231          interactionsRef.current = prevInteractions;
   1232 
   1233          if (subscriber !== null) {
   1234            subscriber.onWorkStopped(wrappedInteractions, threadID);
   1235          }
   1236        }
   1237      }
   1238 
   1239      return returnValue;
   1240    } finally {
   1241      if (!hasRun) {
   1242        // We only expect a wrapped function to be executed once,
   1243        // But in the event that it's executed more than once–
   1244        // Only decrement the outstanding interaction counts once.
   1245        hasRun = true;
   1246 
   1247        // Update pending async counts for all wrapped interactions.
   1248        // If this was the last scheduled async work for any of them,
   1249        // Mark them as completed.
   1250        wrappedInteractions.forEach(function (interaction) {
   1251          interaction.__count--;
   1252 
   1253          if (subscriber !== null && interaction.__count === 0) {
   1254            subscriber.onInteractionScheduledWorkCompleted(interaction);
   1255          }
   1256        });
   1257      }
   1258    }
   1259  }
   1260 
   1261  wrapped.cancel = function cancel() {
   1262    subscriber = subscriberRef.current;
   1263 
   1264    try {
   1265      if (subscriber !== null) {
   1266        subscriber.onWorkCanceled(wrappedInteractions, threadID);
   1267      }
   1268    } finally {
   1269      // Update pending async counts for all wrapped interactions.
   1270      // If this was the last scheduled async work for any of them,
   1271      // Mark them as completed.
   1272      wrappedInteractions.forEach(function (interaction) {
   1273        interaction.__count--;
   1274 
   1275        if (subscriber && interaction.__count === 0) {
   1276          subscriber.onInteractionScheduledWorkCompleted(interaction);
   1277        }
   1278      });
   1279    }
   1280  };
   1281 
   1282  return wrapped;
   1283 }
   1284 
   1285 var subscribers = null;
   1286 if (enableSchedulerTracing) {
   1287  subscribers = new Set();
   1288 }
   1289 
   1290 function unstable_subscribe(subscriber) {
   1291  if (enableSchedulerTracing) {
   1292    subscribers.add(subscriber);
   1293 
   1294    if (subscribers.size === 1) {
   1295      subscriberRef.current = {
   1296        onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
   1297        onInteractionTraced: onInteractionTraced,
   1298        onWorkCanceled: onWorkCanceled,
   1299        onWorkScheduled: onWorkScheduled,
   1300        onWorkStarted: onWorkStarted,
   1301        onWorkStopped: onWorkStopped
   1302      };
   1303    }
   1304  }
   1305 }
   1306 
   1307 function unstable_unsubscribe(subscriber) {
   1308  if (enableSchedulerTracing) {
   1309    subscribers.delete(subscriber);
   1310 
   1311    if (subscribers.size === 0) {
   1312      subscriberRef.current = null;
   1313    }
   1314  }
   1315 }
   1316 
   1317 function onInteractionTraced(interaction) {
   1318  var didCatchError = false;
   1319  var caughtError = null;
   1320 
   1321  subscribers.forEach(function (subscriber) {
   1322    try {
   1323      subscriber.onInteractionTraced(interaction);
   1324    } catch (error) {
   1325      if (!didCatchError) {
   1326        didCatchError = true;
   1327        caughtError = error;
   1328      }
   1329    }
   1330  });
   1331 
   1332  if (didCatchError) {
   1333    throw caughtError;
   1334  }
   1335 }
   1336 
   1337 function onInteractionScheduledWorkCompleted(interaction) {
   1338  var didCatchError = false;
   1339  var caughtError = null;
   1340 
   1341  subscribers.forEach(function (subscriber) {
   1342    try {
   1343      subscriber.onInteractionScheduledWorkCompleted(interaction);
   1344    } catch (error) {
   1345      if (!didCatchError) {
   1346        didCatchError = true;
   1347        caughtError = error;
   1348      }
   1349    }
   1350  });
   1351 
   1352  if (didCatchError) {
   1353    throw caughtError;
   1354  }
   1355 }
   1356 
   1357 function onWorkScheduled(interactions, threadID) {
   1358  var didCatchError = false;
   1359  var caughtError = null;
   1360 
   1361  subscribers.forEach(function (subscriber) {
   1362    try {
   1363      subscriber.onWorkScheduled(interactions, threadID);
   1364    } catch (error) {
   1365      if (!didCatchError) {
   1366        didCatchError = true;
   1367        caughtError = error;
   1368      }
   1369    }
   1370  });
   1371 
   1372  if (didCatchError) {
   1373    throw caughtError;
   1374  }
   1375 }
   1376 
   1377 function onWorkStarted(interactions, threadID) {
   1378  var didCatchError = false;
   1379  var caughtError = null;
   1380 
   1381  subscribers.forEach(function (subscriber) {
   1382    try {
   1383      subscriber.onWorkStarted(interactions, threadID);
   1384    } catch (error) {
   1385      if (!didCatchError) {
   1386        didCatchError = true;
   1387        caughtError = error;
   1388      }
   1389    }
   1390  });
   1391 
   1392  if (didCatchError) {
   1393    throw caughtError;
   1394  }
   1395 }
   1396 
   1397 function onWorkStopped(interactions, threadID) {
   1398  var didCatchError = false;
   1399  var caughtError = null;
   1400 
   1401  subscribers.forEach(function (subscriber) {
   1402    try {
   1403      subscriber.onWorkStopped(interactions, threadID);
   1404    } catch (error) {
   1405      if (!didCatchError) {
   1406        didCatchError = true;
   1407        caughtError = error;
   1408      }
   1409    }
   1410  });
   1411 
   1412  if (didCatchError) {
   1413    throw caughtError;
   1414  }
   1415 }
   1416 
   1417 function onWorkCanceled(interactions, threadID) {
   1418  var didCatchError = false;
   1419  var caughtError = null;
   1420 
   1421  subscribers.forEach(function (subscriber) {
   1422    try {
   1423      subscriber.onWorkCanceled(interactions, threadID);
   1424    } catch (error) {
   1425      if (!didCatchError) {
   1426        didCatchError = true;
   1427        caughtError = error;
   1428      }
   1429    }
   1430  });
   1431 
   1432  if (didCatchError) {
   1433    throw caughtError;
   1434  }
   1435 }
   1436 
   1437 /**
   1438 * Keeps track of the current dispatcher.
   1439 */
   1440 var ReactCurrentDispatcher = {
   1441  /**
   1442   * @internal
   1443   * @type {ReactComponent}
   1444   */
   1445  current: null
   1446 };
   1447 
   1448 /**
   1449 * Keeps track of the current owner.
   1450 *
   1451 * The current owner is the component who should own any components that are
   1452 * currently being constructed.
   1453 */
   1454 var ReactCurrentOwner = {
   1455  /**
   1456   * @internal
   1457   * @type {ReactComponent}
   1458   */
   1459  current: null
   1460 };
   1461 
   1462 var ReactSharedInternals = {
   1463  ReactCurrentDispatcher: ReactCurrentDispatcher,
   1464  ReactCurrentOwner: ReactCurrentOwner,
   1465  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
   1466  assign: objectAssign
   1467 };
   1468 
   1469 {
   1470  // Re-export the schedule API(s) for UMD bundles.
   1471  // This avoids introducing a dependency on a new UMD global in a minor update,
   1472  // Since that would be a breaking change (e.g. for all existing CodeSandboxes).
   1473  // This re-export is only required for UMD bundles;
   1474  // CJS bundles use the shared NPM package.
   1475  objectAssign(ReactSharedInternals, {
   1476    Scheduler: {
   1477      unstable_cancelCallback: unstable_cancelCallback,
   1478      unstable_shouldYield: unstable_shouldYield,
   1479      unstable_now: getCurrentTime,
   1480      unstable_scheduleCallback: unstable_scheduleCallback,
   1481      unstable_runWithPriority: unstable_runWithPriority,
   1482      unstable_next: unstable_next,
   1483      unstable_wrapCallback: unstable_wrapCallback,
   1484      unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
   1485      unstable_pauseExecution: unstable_pauseExecution,
   1486      unstable_continueExecution: unstable_continueExecution,
   1487      unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
   1488      unstable_IdlePriority: IdlePriority,
   1489      unstable_ImmediatePriority: ImmediatePriority,
   1490      unstable_LowPriority: LowPriority,
   1491      unstable_NormalPriority: NormalPriority,
   1492      unstable_UserBlockingPriority: UserBlockingPriority
   1493    },
   1494    SchedulerTracing: {
   1495      __interactionsRef: interactionsRef,
   1496      __subscriberRef: subscriberRef,
   1497      unstable_clear: unstable_clear,
   1498      unstable_getCurrent: unstable_getCurrent,
   1499      unstable_getThreadID: unstable_getThreadID,
   1500      unstable_subscribe: unstable_subscribe,
   1501      unstable_trace: unstable_trace,
   1502      unstable_unsubscribe: unstable_unsubscribe,
   1503      unstable_wrap: unstable_wrap
   1504    }
   1505  });
   1506 }
   1507 
   1508 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
   1509 
   1510 var RESERVED_PROPS = {
   1511  key: true,
   1512  ref: true,
   1513  __self: true,
   1514  __source: true
   1515 };
   1516 
   1517 function hasValidRef(config) {
   1518  return config.ref !== undefined;
   1519 }
   1520 
   1521 function hasValidKey(config) {
   1522  return config.key !== undefined;
   1523 }
   1524 
   1525 /**
   1526 * Factory method to create a new React element. This no longer adheres to
   1527 * the class pattern, so do not use new to call it. Also, no instanceof check
   1528 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
   1529 * if something is a React Element.
   1530 *
   1531 * @param {*} type
   1532 * @param {*} key
   1533 * @param {string|object} ref
   1534 * @param {*} self A *temporary* helper to detect places where `this` is
   1535 * different from the `owner` when React.createElement is called, so that we
   1536 * can warn. We want to get rid of owner and replace string `ref`s with arrow
   1537 * functions, and as long as `this` and owner are the same, there will be no
   1538 * change in behavior.
   1539 * @param {*} source An annotation object (added by a transpiler or otherwise)
   1540 * indicating filename, line number, and/or other information.
   1541 * @param {*} owner
   1542 * @param {*} props
   1543 * @internal
   1544 */
   1545 var ReactElement = function (type, key, ref, self, source, owner, props) {
   1546  var element = {
   1547    // This tag allows us to uniquely identify this as a React Element
   1548    $$typeof: REACT_ELEMENT_TYPE,
   1549 
   1550    // Built-in properties that belong on the element
   1551    type: type,
   1552    key: key,
   1553    ref: ref,
   1554    props: props,
   1555 
   1556    // Record the component responsible for creating this element.
   1557    _owner: owner
   1558  };
   1559 
   1560  return element;
   1561 };
   1562 
   1563 /**
   1564 * Create and return a new ReactElement of the given type.
   1565 * See https://reactjs.org/docs/react-api.html#createelement
   1566 */
   1567 function createElement(type, config, children) {
   1568  var propName = void 0;
   1569 
   1570  // Reserved names are extracted
   1571  var props = {};
   1572 
   1573  var key = null;
   1574  var ref = null;
   1575  var self = null;
   1576  var source = null;
   1577 
   1578  if (config != null) {
   1579    if (hasValidRef(config)) {
   1580      ref = config.ref;
   1581    }
   1582    if (hasValidKey(config)) {
   1583      key = '' + config.key;
   1584    }
   1585 
   1586    self = config.__self === undefined ? null : config.__self;
   1587    source = config.__source === undefined ? null : config.__source;
   1588    // Remaining properties are added to a new props object
   1589    for (propName in config) {
   1590      if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
   1591        props[propName] = config[propName];
   1592      }
   1593    }
   1594  }
   1595 
   1596  // Children can be more than one argument, and those are transferred onto
   1597  // the newly allocated props object.
   1598  var childrenLength = arguments.length - 2;
   1599  if (childrenLength === 1) {
   1600    props.children = children;
   1601  } else if (childrenLength > 1) {
   1602    var childArray = Array(childrenLength);
   1603    for (var i = 0; i < childrenLength; i++) {
   1604      childArray[i] = arguments[i + 2];
   1605    }
   1606    props.children = childArray;
   1607  }
   1608 
   1609  // Resolve default props
   1610  if (type && type.defaultProps) {
   1611    var defaultProps = type.defaultProps;
   1612    for (propName in defaultProps) {
   1613      if (props[propName] === undefined) {
   1614        props[propName] = defaultProps[propName];
   1615      }
   1616    }
   1617  }
   1618  return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
   1619 }
   1620 
   1621 /**
   1622 * Return a function that produces ReactElements of a given type.
   1623 * See https://reactjs.org/docs/react-api.html#createfactory
   1624 */
   1625 function createFactory(type) {
   1626  var factory = createElement.bind(null, type);
   1627  // Expose the type on the factory and the prototype so that it can be
   1628  // easily accessed on elements. E.g. `<Foo />.type === Foo`.
   1629  // This should not be named `constructor` since this may not be the function
   1630  // that created the element, and it may not even be a constructor.
   1631  // Legacy hook: remove it
   1632  factory.type = type;
   1633  return factory;
   1634 }
   1635 
   1636 function cloneAndReplaceKey(oldElement, newKey) {
   1637  var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
   1638 
   1639  return newElement;
   1640 }
   1641 
   1642 /**
   1643 * Clone and return a new ReactElement using element as the starting point.
   1644 * See https://reactjs.org/docs/react-api.html#cloneelement
   1645 */
   1646 function cloneElement(element, config, children) {
   1647  !!(element === null || element === undefined) ? reactProdInvariant('267', element) : void 0;
   1648 
   1649  var propName = void 0;
   1650 
   1651  // Original props are copied
   1652  var props = objectAssign({}, element.props);
   1653 
   1654  // Reserved names are extracted
   1655  var key = element.key;
   1656  var ref = element.ref;
   1657  // Self is preserved since the owner is preserved.
   1658  var self = element._self;
   1659  // Source is preserved since cloneElement is unlikely to be targeted by a
   1660  // transpiler, and the original source is probably a better indicator of the
   1661  // true owner.
   1662  var source = element._source;
   1663 
   1664  // Owner will be preserved, unless ref is overridden
   1665  var owner = element._owner;
   1666 
   1667  if (config != null) {
   1668    if (hasValidRef(config)) {
   1669      // Silently steal the ref from the parent.
   1670      ref = config.ref;
   1671      owner = ReactCurrentOwner.current;
   1672    }
   1673    if (hasValidKey(config)) {
   1674      key = '' + config.key;
   1675    }
   1676 
   1677    // Remaining properties override existing props
   1678    var defaultProps = void 0;
   1679    if (element.type && element.type.defaultProps) {
   1680      defaultProps = element.type.defaultProps;
   1681    }
   1682    for (propName in config) {
   1683      if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
   1684        if (config[propName] === undefined && defaultProps !== undefined) {
   1685          // Resolve default props
   1686          props[propName] = defaultProps[propName];
   1687        } else {
   1688          props[propName] = config[propName];
   1689        }
   1690      }
   1691    }
   1692  }
   1693 
   1694  // Children can be more than one argument, and those are transferred onto
   1695  // the newly allocated props object.
   1696  var childrenLength = arguments.length - 2;
   1697  if (childrenLength === 1) {
   1698    props.children = children;
   1699  } else if (childrenLength > 1) {
   1700    var childArray = Array(childrenLength);
   1701    for (var i = 0; i < childrenLength; i++) {
   1702      childArray[i] = arguments[i + 2];
   1703    }
   1704    props.children = childArray;
   1705  }
   1706 
   1707  return ReactElement(element.type, key, ref, self, source, owner, props);
   1708 }
   1709 
   1710 /**
   1711 * Verifies the object is a ReactElement.
   1712 * See https://reactjs.org/docs/react-api.html#isvalidelement
   1713 * @param {?object} object
   1714 * @return {boolean} True if `object` is a ReactElement.
   1715 * @final
   1716 */
   1717 function isValidElement(object) {
   1718  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
   1719 }
   1720 
   1721 var SEPARATOR = '.';
   1722 var SUBSEPARATOR = ':';
   1723 
   1724 /**
   1725 * Escape and wrap key so it is safe to use as a reactid
   1726 *
   1727 * @param {string} key to be escaped.
   1728 * @return {string} the escaped key.
   1729 */
   1730 function escape(key) {
   1731  var escapeRegex = /[=:]/g;
   1732  var escaperLookup = {
   1733    '=': '=0',
   1734    ':': '=2'
   1735  };
   1736  var escapedString = ('' + key).replace(escapeRegex, function (match) {
   1737    return escaperLookup[match];
   1738  });
   1739 
   1740  return '$' + escapedString;
   1741 }
   1742 
   1743 var userProvidedKeyEscapeRegex = /\/+/g;
   1744 function escapeUserProvidedKey(text) {
   1745  return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
   1746 }
   1747 
   1748 var POOL_SIZE = 10;
   1749 var traverseContextPool = [];
   1750 function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
   1751  if (traverseContextPool.length) {
   1752    var traverseContext = traverseContextPool.pop();
   1753    traverseContext.result = mapResult;
   1754    traverseContext.keyPrefix = keyPrefix;
   1755    traverseContext.func = mapFunction;
   1756    traverseContext.context = mapContext;
   1757    traverseContext.count = 0;
   1758    return traverseContext;
   1759  } else {
   1760    return {
   1761      result: mapResult,
   1762      keyPrefix: keyPrefix,
   1763      func: mapFunction,
   1764      context: mapContext,
   1765      count: 0
   1766    };
   1767  }
   1768 }
   1769 
   1770 function releaseTraverseContext(traverseContext) {
   1771  traverseContext.result = null;
   1772  traverseContext.keyPrefix = null;
   1773  traverseContext.func = null;
   1774  traverseContext.context = null;
   1775  traverseContext.count = 0;
   1776  if (traverseContextPool.length < POOL_SIZE) {
   1777    traverseContextPool.push(traverseContext);
   1778  }
   1779 }
   1780 
   1781 /**
   1782 * @param {?*} children Children tree container.
   1783 * @param {!string} nameSoFar Name of the key path so far.
   1784 * @param {!function} callback Callback to invoke with each child found.
   1785 * @param {?*} traverseContext Used to pass information throughout the traversal
   1786 * process.
   1787 * @return {!number} The number of children in this subtree.
   1788 */
   1789 function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
   1790  var type = typeof children;
   1791 
   1792  if (type === 'undefined' || type === 'boolean') {
   1793    // All of the above are perceived as null.
   1794    children = null;
   1795  }
   1796 
   1797  var invokeCallback = false;
   1798 
   1799  if (children === null) {
   1800    invokeCallback = true;
   1801  } else {
   1802    switch (type) {
   1803      case 'string':
   1804      case 'number':
   1805        invokeCallback = true;
   1806        break;
   1807      case 'object':
   1808        switch (children.$$typeof) {
   1809          case REACT_ELEMENT_TYPE:
   1810          case REACT_PORTAL_TYPE:
   1811            invokeCallback = true;
   1812        }
   1813    }
   1814  }
   1815 
   1816  if (invokeCallback) {
   1817    callback(traverseContext, children,
   1818    // If it's the only child, treat the name as if it was wrapped in an array
   1819    // so that it's consistent if the number of children grows.
   1820    nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
   1821    return 1;
   1822  }
   1823 
   1824  var child = void 0;
   1825  var nextName = void 0;
   1826  var subtreeCount = 0; // Count of children found in the current subtree.
   1827  var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
   1828 
   1829  if (Array.isArray(children)) {
   1830    for (var i = 0; i < children.length; i++) {
   1831      child = children[i];
   1832      nextName = nextNamePrefix + getComponentKey(child, i);
   1833      subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
   1834    }
   1835  } else {
   1836    var iteratorFn = getIteratorFn(children);
   1837    if (typeof iteratorFn === 'function') {
   1838      var iterator = iteratorFn.call(children);
   1839      var step = void 0;
   1840      var ii = 0;
   1841      while (!(step = iterator.next()).done) {
   1842        child = step.value;
   1843        nextName = nextNamePrefix + getComponentKey(child, ii++);
   1844        subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
   1845      }
   1846    } else if (type === 'object') {
   1847      var addendum = '';
   1848      var childrenString = '' + children;
   1849      reactProdInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
   1850    }
   1851  }
   1852 
   1853  return subtreeCount;
   1854 }
   1855 
   1856 /**
   1857 * Traverses children that are typically specified as `props.children`, but
   1858 * might also be specified through attributes:
   1859 *
   1860 * - `traverseAllChildren(this.props.children, ...)`
   1861 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
   1862 *
   1863 * The `traverseContext` is an optional argument that is passed through the
   1864 * entire traversal. It can be used to store accumulations or anything else that
   1865 * the callback might find relevant.
   1866 *
   1867 * @param {?*} children Children tree object.
   1868 * @param {!function} callback To invoke upon traversing each child.
   1869 * @param {?*} traverseContext Context for traversal.
   1870 * @return {!number} The number of children in this subtree.
   1871 */
   1872 function traverseAllChildren(children, callback, traverseContext) {
   1873  if (children == null) {
   1874    return 0;
   1875  }
   1876 
   1877  return traverseAllChildrenImpl(children, '', callback, traverseContext);
   1878 }
   1879 
   1880 /**
   1881 * Generate a key string that identifies a component within a set.
   1882 *
   1883 * @param {*} component A component that could contain a manual key.
   1884 * @param {number} index Index that is used if a manual key is not provided.
   1885 * @return {string}
   1886 */
   1887 function getComponentKey(component, index) {
   1888  // Do some typechecking here since we call this blindly. We want to ensure
   1889  // that we don't block potential future ES APIs.
   1890  if (typeof component === 'object' && component !== null && component.key != null) {
   1891    // Explicit key
   1892    return escape(component.key);
   1893  }
   1894  // Implicit key determined by the index in the set
   1895  return index.toString(36);
   1896 }
   1897 
   1898 function forEachSingleChild(bookKeeping, child, name) {
   1899  var func = bookKeeping.func,
   1900      context = bookKeeping.context;
   1901 
   1902  func.call(context, child, bookKeeping.count++);
   1903 }
   1904 
   1905 /**
   1906 * Iterates through children that are typically specified as `props.children`.
   1907 *
   1908 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
   1909 *
   1910 * The provided forEachFunc(child, index) will be called for each
   1911 * leaf child.
   1912 *
   1913 * @param {?*} children Children tree container.
   1914 * @param {function(*, int)} forEachFunc
   1915 * @param {*} forEachContext Context for forEachContext.
   1916 */
   1917 function forEachChildren(children, forEachFunc, forEachContext) {
   1918  if (children == null) {
   1919    return children;
   1920  }
   1921  var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
   1922  traverseAllChildren(children, forEachSingleChild, traverseContext);
   1923  releaseTraverseContext(traverseContext);
   1924 }
   1925 
   1926 function mapSingleChildIntoContext(bookKeeping, child, childKey) {
   1927  var result = bookKeeping.result,
   1928      keyPrefix = bookKeeping.keyPrefix,
   1929      func = bookKeeping.func,
   1930      context = bookKeeping.context;
   1931 
   1932 
   1933  var mappedChild = func.call(context, child, bookKeeping.count++);
   1934  if (Array.isArray(mappedChild)) {
   1935    mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
   1936      return c;
   1937    });
   1938  } else if (mappedChild != null) {
   1939    if (isValidElement(mappedChild)) {
   1940      mappedChild = cloneAndReplaceKey(mappedChild,
   1941      // Keep both the (mapped) and old keys if they differ, just as
   1942      // traverseAllChildren used to do for objects as children
   1943      keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
   1944    }
   1945    result.push(mappedChild);
   1946  }
   1947 }
   1948 
   1949 function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
   1950  var escapedPrefix = '';
   1951  if (prefix != null) {
   1952    escapedPrefix = escapeUserProvidedKey(prefix) + '/';
   1953  }
   1954  var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
   1955  traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
   1956  releaseTraverseContext(traverseContext);
   1957 }
   1958 
   1959 /**
   1960 * Maps children that are typically specified as `props.children`.
   1961 *
   1962 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
   1963 *
   1964 * The provided mapFunction(child, key, index) will be called for each
   1965 * leaf child.
   1966 *
   1967 * @param {?*} children Children tree container.
   1968 * @param {function(*, int)} func The map function.
   1969 * @param {*} context Context for mapFunction.
   1970 * @return {object} Object containing the ordered map of results.
   1971 */
   1972 function mapChildren(children, func, context) {
   1973  if (children == null) {
   1974    return children;
   1975  }
   1976  var result = [];
   1977  mapIntoWithKeyPrefixInternal(children, result, null, func, context);
   1978  return result;
   1979 }
   1980 
   1981 /**
   1982 * Count the number of children that are typically specified as
   1983 * `props.children`.
   1984 *
   1985 * See https://reactjs.org/docs/react-api.html#reactchildrencount
   1986 *
   1987 * @param {?*} children Children tree container.
   1988 * @return {number} The number of children.
   1989 */
   1990 function countChildren(children) {
   1991  return traverseAllChildren(children, function () {
   1992    return null;
   1993  }, null);
   1994 }
   1995 
   1996 /**
   1997 * Flatten a children object (typically specified as `props.children`) and
   1998 * return an array with appropriately re-keyed children.
   1999 *
   2000 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
   2001 */
   2002 function toArray(children) {
   2003  var result = [];
   2004  mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
   2005    return child;
   2006  });
   2007  return result;
   2008 }
   2009 
   2010 /**
   2011 * Returns the first child in a collection of children and verifies that there
   2012 * is only one child in the collection.
   2013 *
   2014 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
   2015 *
   2016 * The current implementation of this function assumes that a single child gets
   2017 * passed without a wrapper, but the purpose of this helper function is to
   2018 * abstract away the particular structure of children.
   2019 *
   2020 * @param {?object} children Child collection structure.
   2021 * @return {ReactElement} The first and only `ReactElement` contained in the
   2022 * structure.
   2023 */
   2024 function onlyChild(children) {
   2025  !isValidElement(children) ? reactProdInvariant('143') : void 0;
   2026  return children;
   2027 }
   2028 
   2029 function createContext(defaultValue, calculateChangedBits) {
   2030  if (calculateChangedBits === undefined) {
   2031    calculateChangedBits = null;
   2032  } else {
   2033    
   2034  }
   2035 
   2036  var context = {
   2037    $$typeof: REACT_CONTEXT_TYPE,
   2038    _calculateChangedBits: calculateChangedBits,
   2039    // As a workaround to support multiple concurrent renderers, we categorize
   2040    // some renderers as primary and others as secondary. We only expect
   2041    // there to be two concurrent renderers at most: React Native (primary) and
   2042    // Fabric (secondary); React DOM (primary) and React ART (secondary).
   2043    // Secondary renderers store their context values on separate fields.
   2044    _currentValue: defaultValue,
   2045    _currentValue2: defaultValue,
   2046    // Used to track how many concurrent renderers this context currently
   2047    // supports within in a single renderer. Such as parallel server rendering.
   2048    _threadCount: 0,
   2049    // These are circular
   2050    Provider: null,
   2051    Consumer: null
   2052  };
   2053 
   2054  context.Provider = {
   2055    $$typeof: REACT_PROVIDER_TYPE,
   2056    _context: context
   2057  };
   2058 
   2059  {
   2060    context.Consumer = context;
   2061  }
   2062 
   2063  return context;
   2064 }
   2065 
   2066 function lazy(ctor) {
   2067  var lazyType = {
   2068    $$typeof: REACT_LAZY_TYPE,
   2069    _ctor: ctor,
   2070    // React uses these fields to store the result.
   2071    _status: -1,
   2072    _result: null
   2073  };
   2074 
   2075  return lazyType;
   2076 }
   2077 
   2078 function forwardRef(render) {
   2079  return {
   2080    $$typeof: REACT_FORWARD_REF_TYPE,
   2081    render: render
   2082  };
   2083 }
   2084 
   2085 function memo(type, compare) {
   2086  return {
   2087    $$typeof: REACT_MEMO_TYPE,
   2088    type: type,
   2089    compare: compare === undefined ? null : compare
   2090  };
   2091 }
   2092 
   2093 function resolveDispatcher() {
   2094  var dispatcher = ReactCurrentDispatcher.current;
   2095  !(dispatcher !== null) ? reactProdInvariant('321') : void 0;
   2096  return dispatcher;
   2097 }
   2098 
   2099 function useContext(Context, unstable_observedBits) {
   2100  var dispatcher = resolveDispatcher();
   2101  return dispatcher.useContext(Context, unstable_observedBits);
   2102 }
   2103 
   2104 function useState(initialState) {
   2105  var dispatcher = resolveDispatcher();
   2106  return dispatcher.useState(initialState);
   2107 }
   2108 
   2109 function useReducer(reducer, initialArg, init) {
   2110  var dispatcher = resolveDispatcher();
   2111  return dispatcher.useReducer(reducer, initialArg, init);
   2112 }
   2113 
   2114 function useRef(initialValue) {
   2115  var dispatcher = resolveDispatcher();
   2116  return dispatcher.useRef(initialValue);
   2117 }
   2118 
   2119 function useEffect(create, inputs) {
   2120  var dispatcher = resolveDispatcher();
   2121  return dispatcher.useEffect(create, inputs);
   2122 }
   2123 
   2124 function useLayoutEffect(create, inputs) {
   2125  var dispatcher = resolveDispatcher();
   2126  return dispatcher.useLayoutEffect(create, inputs);
   2127 }
   2128 
   2129 function useCallback(callback, inputs) {
   2130  var dispatcher = resolveDispatcher();
   2131  return dispatcher.useCallback(callback, inputs);
   2132 }
   2133 
   2134 function useMemo(create, inputs) {
   2135  var dispatcher = resolveDispatcher();
   2136  return dispatcher.useMemo(create, inputs);
   2137 }
   2138 
   2139 function useImperativeHandle(ref, create, inputs) {
   2140  var dispatcher = resolveDispatcher();
   2141  return dispatcher.useImperativeHandle(ref, create, inputs);
   2142 }
   2143 
   2144 function useDebugValue(value, formatterFn) {
   2145  
   2146 }
   2147 
   2148 /**
   2149 * Copyright (c) 2013-present, Facebook, Inc.
   2150 *
   2151 * This source code is licensed under the MIT license found in the
   2152 * LICENSE file in the root directory of this source tree.
   2153 */
   2154 
   2155 /**
   2156 * ReactElementValidator provides a wrapper around a element factory
   2157 * which validates the props passed to the element. This is intended to be
   2158 * used only in DEV and could be replaced by a static type checker for languages
   2159 * that support it.
   2160 */
   2161 
   2162 var React = {
   2163  Children: {
   2164    map: mapChildren,
   2165    forEach: forEachChildren,
   2166    count: countChildren,
   2167    toArray: toArray,
   2168    only: onlyChild
   2169  },
   2170 
   2171  createRef: createRef,
   2172  Component: Component,
   2173  PureComponent: PureComponent,
   2174 
   2175  createContext: createContext,
   2176  forwardRef: forwardRef,
   2177  lazy: lazy,
   2178  memo: memo,
   2179 
   2180  useCallback: useCallback,
   2181  useContext: useContext,
   2182  useEffect: useEffect,
   2183  useImperativeHandle: useImperativeHandle,
   2184  useDebugValue: useDebugValue,
   2185  useLayoutEffect: useLayoutEffect,
   2186  useMemo: useMemo,
   2187  useReducer: useReducer,
   2188  useRef: useRef,
   2189  useState: useState,
   2190 
   2191  Fragment: REACT_FRAGMENT_TYPE,
   2192  StrictMode: REACT_STRICT_MODE_TYPE,
   2193  Suspense: REACT_SUSPENSE_TYPE,
   2194 
   2195  createElement: createElement,
   2196  cloneElement: cloneElement,
   2197  createFactory: createFactory,
   2198  isValidElement: isValidElement,
   2199 
   2200  version: ReactVersion,
   2201 
   2202  unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
   2203  unstable_Profiler: REACT_PROFILER_TYPE,
   2204 
   2205  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
   2206 };
   2207 
   2208 // Note: some APIs are added with feature flags.
   2209 // Make sure that stable builds for open source
   2210 // don't modify the React object to avoid deopts.
   2211 // Also let's not expose their names in stable builds.
   2212 
   2213 if (enableStableConcurrentModeAPIs) {
   2214  React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
   2215  React.Profiler = REACT_PROFILER_TYPE;
   2216  React.unstable_ConcurrentMode = undefined;
   2217  React.unstable_Profiler = undefined;
   2218 }
   2219 
   2220 
   2221 
   2222 var React$2 = ({
   2223 default: React
   2224 });
   2225 
   2226 var React$3 = ( React$2 && React ) || React$2;
   2227 
   2228 // TODO: decide on the top-level export form.
   2229 // This is hacky but makes it work with both Rollup and Jest.
   2230 var react = React$3.default || React$3;
   2231 
   2232 export default react;
   2233 
   2234 const Children = react.Children;
   2235 
   2236 export {
   2237  createFactory, createElement, Component, PureComponent, Children, createRef, cloneElement,
   2238 }