wp/wp-includes/js/dist/vendor/react-dom.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     1 /** @license React v16.8.4
     1 /** @license React v16.9.0
     2  * react-dom.development.js
     2  * react-dom.development.js
     3  *
     3  *
     4  * Copyright (c) Facebook, Inc. and its affiliates.
     4  * Copyright (c) Facebook, Inc. and its affiliates.
     5  *
     5  *
     6  * This source code is licensed under the MIT license found in the
     6  * This source code is licensed under the MIT license found in the
    12 (function (global, factory) {
    12 (function (global, factory) {
    13 	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
    13 	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
    14 	typeof define === 'function' && define.amd ? define(['react'], factory) :
    14 	typeof define === 'function' && define.amd ? define(['react'], factory) :
    15 	(global.ReactDOM = factory(global.React));
    15 	(global.ReactDOM = factory(global.React));
    16 }(this, (function (React) { 'use strict';
    16 }(this, (function (React) { 'use strict';
       
    17 
       
    18 // Do not require this module directly! Use normal `invariant` calls with
       
    19 // template literal strings. The messages will be converted to ReactError during
       
    20 // build, and in production they will be minified.
       
    21 
       
    22 // Do not require this module directly! Use normal `invariant` calls with
       
    23 // template literal strings. The messages will be converted to ReactError during
       
    24 // build, and in production they will be minified.
       
    25 
       
    26 function ReactError(error) {
       
    27   error.name = 'Invariant Violation';
       
    28   return error;
       
    29 }
    17 
    30 
    18 /**
    31 /**
    19  * Use invariant() to assert state which your program assumes to be true.
    32  * Use invariant() to assert state which your program assumes to be true.
    20  *
    33  *
    21  * Provide sprintf-style format (only %s is supported) and arguments
    34  * Provide sprintf-style format (only %s is supported) and arguments
    24  *
    37  *
    25  * The invariant message will be stripped in production, but the invariant
    38  * The invariant message will be stripped in production, but the invariant
    26  * will remain to ensure logic does not differ in production.
    39  * will remain to ensure logic does not differ in production.
    27  */
    40  */
    28 
    41 
    29 var validateFormat = function () {};
    42 (function () {
    30 
    43   if (!React) {
    31 {
    44     {
    32   validateFormat = function (format) {
    45       throw ReactError(Error('ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.'));
    33     if (format === undefined) {
    46     }
    34       throw new Error('invariant requires an error message argument');
    47   }
    35     }
    48 })();
    36   };
    49 
    37 }
    50 /**
    38 
    51  * Injectable ordering of event plugins.
    39 function invariant(condition, format, a, b, c, d, e, f) {
    52  */
    40   validateFormat(format);
    53 var eventPluginOrder = null;
    41 
    54 
    42   if (!condition) {
    55 /**
    43     var error = void 0;
    56  * Injectable mapping from names to event plugin modules.
    44     if (format === undefined) {
    57  */
    45       error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
    58 var namesToPlugins = {};
    46     } else {
    59 
    47       var args = [a, b, c, d, e, f];
    60 /**
    48       var argIndex = 0;
    61  * Recomputes the plugin list using the injected plugins and plugin ordering.
    49       error = new Error(format.replace(/%s/g, function () {
    62  *
    50         return args[argIndex++];
    63  * @private
    51       }));
    64  */
    52       error.name = 'Invariant Violation';
    65 function recomputePluginOrdering() {
    53     }
    66   if (!eventPluginOrder) {
    54 
    67     // Wait until an `eventPluginOrder` is injected.
    55     error.framesToPop = 1; // we don't care about invariant's own frame
    68     return;
    56     throw error;
    69   }
    57   }
    70   for (var pluginName in namesToPlugins) {
    58 }
    71     var pluginModule = namesToPlugins[pluginName];
    59 
    72     var pluginIndex = eventPluginOrder.indexOf(pluginName);
    60 // Relying on the `invariant()` implementation lets us
    73     (function () {
    61 // preserve the format and params in the www builds.
    74       if (!(pluginIndex > -1)) {
    62 
    75         {
    63 !React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
    76           throw ReactError(Error('EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `' + pluginName + '`.'));
       
    77         }
       
    78       }
       
    79     })();
       
    80     if (plugins[pluginIndex]) {
       
    81       continue;
       
    82     }
       
    83     (function () {
       
    84       if (!pluginModule.extractEvents) {
       
    85         {
       
    86           throw ReactError(Error('EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `' + pluginName + '` does not.'));
       
    87         }
       
    88       }
       
    89     })();
       
    90     plugins[pluginIndex] = pluginModule;
       
    91     var publishedEvents = pluginModule.eventTypes;
       
    92     for (var eventName in publishedEvents) {
       
    93       (function () {
       
    94         if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
       
    95           {
       
    96             throw ReactError(Error('EventPluginRegistry: Failed to publish event `' + eventName + '` for plugin `' + pluginName + '`.'));
       
    97           }
       
    98         }
       
    99       })();
       
   100     }
       
   101   }
       
   102 }
       
   103 
       
   104 /**
       
   105  * Publishes an event so that it can be dispatched by the supplied plugin.
       
   106  *
       
   107  * @param {object} dispatchConfig Dispatch configuration for the event.
       
   108  * @param {object} PluginModule Plugin publishing the event.
       
   109  * @return {boolean} True if the event was successfully published.
       
   110  * @private
       
   111  */
       
   112 function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
       
   113   (function () {
       
   114     if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
       
   115       {
       
   116         throw ReactError(Error('EventPluginHub: More than one plugin attempted to publish the same event name, `' + eventName + '`.'));
       
   117       }
       
   118     }
       
   119   })();
       
   120   eventNameDispatchConfigs[eventName] = dispatchConfig;
       
   121 
       
   122   var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
       
   123   if (phasedRegistrationNames) {
       
   124     for (var phaseName in phasedRegistrationNames) {
       
   125       if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
       
   126         var phasedRegistrationName = phasedRegistrationNames[phaseName];
       
   127         publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
       
   128       }
       
   129     }
       
   130     return true;
       
   131   } else if (dispatchConfig.registrationName) {
       
   132     publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
       
   133     return true;
       
   134   }
       
   135   return false;
       
   136 }
       
   137 
       
   138 /**
       
   139  * Publishes a registration name that is used to identify dispatched events.
       
   140  *
       
   141  * @param {string} registrationName Registration name to add.
       
   142  * @param {object} PluginModule Plugin publishing the event.
       
   143  * @private
       
   144  */
       
   145 function publishRegistrationName(registrationName, pluginModule, eventName) {
       
   146   (function () {
       
   147     if (!!registrationNameModules[registrationName]) {
       
   148       {
       
   149         throw ReactError(Error('EventPluginHub: More than one plugin attempted to publish the same registration name, `' + registrationName + '`.'));
       
   150       }
       
   151     }
       
   152   })();
       
   153   registrationNameModules[registrationName] = pluginModule;
       
   154   registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
       
   155 
       
   156   {
       
   157     var lowerCasedName = registrationName.toLowerCase();
       
   158     possibleRegistrationNames[lowerCasedName] = registrationName;
       
   159 
       
   160     if (registrationName === 'onDoubleClick') {
       
   161       possibleRegistrationNames.ondblclick = registrationName;
       
   162     }
       
   163   }
       
   164 }
       
   165 
       
   166 /**
       
   167  * Registers plugins so that they can extract and dispatch events.
       
   168  *
       
   169  * @see {EventPluginHub}
       
   170  */
       
   171 
       
   172 /**
       
   173  * Ordered list of injected plugins.
       
   174  */
       
   175 var plugins = [];
       
   176 
       
   177 /**
       
   178  * Mapping from event name to dispatch config
       
   179  */
       
   180 var eventNameDispatchConfigs = {};
       
   181 
       
   182 /**
       
   183  * Mapping from registration name to plugin module
       
   184  */
       
   185 var registrationNameModules = {};
       
   186 
       
   187 /**
       
   188  * Mapping from registration name to event name
       
   189  */
       
   190 var registrationNameDependencies = {};
       
   191 
       
   192 /**
       
   193  * Mapping from lowercase registration names to the properly cased version,
       
   194  * used to warn in the case of missing event handlers. Available
       
   195  * only in true.
       
   196  * @type {Object}
       
   197  */
       
   198 var possibleRegistrationNames = {};
       
   199 // Trust the developer to only use possibleRegistrationNames in true
       
   200 
       
   201 /**
       
   202  * Injects an ordering of plugins (by plugin name). This allows the ordering
       
   203  * to be decoupled from injection of the actual plugins so that ordering is
       
   204  * always deterministic regardless of packaging, on-the-fly injection, etc.
       
   205  *
       
   206  * @param {array} InjectedEventPluginOrder
       
   207  * @internal
       
   208  * @see {EventPluginHub.injection.injectEventPluginOrder}
       
   209  */
       
   210 function injectEventPluginOrder(injectedEventPluginOrder) {
       
   211   (function () {
       
   212     if (!!eventPluginOrder) {
       
   213       {
       
   214         throw ReactError(Error('EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.'));
       
   215       }
       
   216     }
       
   217   })();
       
   218   // Clone the ordering so it cannot be dynamically mutated.
       
   219   eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
       
   220   recomputePluginOrdering();
       
   221 }
       
   222 
       
   223 /**
       
   224  * Injects plugins to be used by `EventPluginHub`. The plugin names must be
       
   225  * in the ordering injected by `injectEventPluginOrder`.
       
   226  *
       
   227  * Plugins can be injected as part of page initialization or on-the-fly.
       
   228  *
       
   229  * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   230  * @internal
       
   231  * @see {EventPluginHub.injection.injectEventPluginsByName}
       
   232  */
       
   233 function injectEventPluginsByName(injectedNamesToPlugins) {
       
   234   var isOrderingDirty = false;
       
   235   for (var pluginName in injectedNamesToPlugins) {
       
   236     if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
       
   237       continue;
       
   238     }
       
   239     var pluginModule = injectedNamesToPlugins[pluginName];
       
   240     if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
       
   241       (function () {
       
   242         if (!!namesToPlugins[pluginName]) {
       
   243           {
       
   244             throw ReactError(Error('EventPluginRegistry: Cannot inject two different event plugins using the same name, `' + pluginName + '`.'));
       
   245           }
       
   246         }
       
   247       })();
       
   248       namesToPlugins[pluginName] = pluginModule;
       
   249       isOrderingDirty = true;
       
   250     }
       
   251   }
       
   252   if (isOrderingDirty) {
       
   253     recomputePluginOrdering();
       
   254   }
       
   255 }
    64 
   256 
    65 var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
   257 var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
    66   var funcArgs = Array.prototype.slice.call(arguments, 3);
   258   var funcArgs = Array.prototype.slice.call(arguments, 3);
    67   try {
   259   try {
    68     func.apply(context, funcArgs);
   260     func.apply(context, funcArgs);
    99     var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
   291     var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
   100       // If document doesn't exist we know for sure we will crash in this method
   292       // If document doesn't exist we know for sure we will crash in this method
   101       // when we call document.createEvent(). However this can cause confusing
   293       // when we call document.createEvent(). However this can cause confusing
   102       // errors: https://github.com/facebookincubator/create-react-app/issues/3482
   294       // errors: https://github.com/facebookincubator/create-react-app/issues/3482
   103       // So we preemptively throw with a better message instead.
   295       // So we preemptively throw with a better message instead.
   104       !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0;
   296       (function () {
       
   297         if (!(typeof document !== 'undefined')) {
       
   298           {
       
   299             throw ReactError(Error('The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.'));
       
   300           }
       
   301         }
       
   302       })();
   105       var evt = document.createEvent('Event');
   303       var evt = document.createEvent('Event');
   106 
   304 
   107       // Keeps track of whether the user-provided callback threw an error. We
   305       // Keeps track of whether the user-provided callback threw an error. We
   108       // set this to true at the beginning, then set it to false right after
   306       // set this to true at the beginning, then set it to false right after
   109       // calling the function. If the function errors, `didError` will never be
   307       // calling the function. If the function errors, `didError` will never be
   293     var error = caughtError;
   491     var error = caughtError;
   294     hasError = false;
   492     hasError = false;
   295     caughtError = null;
   493     caughtError = null;
   296     return error;
   494     return error;
   297   } else {
   495   } else {
   298     invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
   496     (function () {
   299   }
   497       {
   300 }
   498         {
   301 
   499           throw ReactError(Error('clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'));
   302 /**
   500         }
   303  * Injectable ordering of event plugins.
   501       }
   304  */
   502     })();
   305 var eventPluginOrder = null;
       
   306 
       
   307 /**
       
   308  * Injectable mapping from names to event plugin modules.
       
   309  */
       
   310 var namesToPlugins = {};
       
   311 
       
   312 /**
       
   313  * Recomputes the plugin list using the injected plugins and plugin ordering.
       
   314  *
       
   315  * @private
       
   316  */
       
   317 function recomputePluginOrdering() {
       
   318   if (!eventPluginOrder) {
       
   319     // Wait until an `eventPluginOrder` is injected.
       
   320     return;
       
   321   }
       
   322   for (var pluginName in namesToPlugins) {
       
   323     var pluginModule = namesToPlugins[pluginName];
       
   324     var pluginIndex = eventPluginOrder.indexOf(pluginName);
       
   325     !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
       
   326     if (plugins[pluginIndex]) {
       
   327       continue;
       
   328     }
       
   329     !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
       
   330     plugins[pluginIndex] = pluginModule;
       
   331     var publishedEvents = pluginModule.eventTypes;
       
   332     for (var eventName in publishedEvents) {
       
   333       !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
       
   334     }
       
   335   }
       
   336 }
       
   337 
       
   338 /**
       
   339  * Publishes an event so that it can be dispatched by the supplied plugin.
       
   340  *
       
   341  * @param {object} dispatchConfig Dispatch configuration for the event.
       
   342  * @param {object} PluginModule Plugin publishing the event.
       
   343  * @return {boolean} True if the event was successfully published.
       
   344  * @private
       
   345  */
       
   346 function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
       
   347   !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
       
   348   eventNameDispatchConfigs[eventName] = dispatchConfig;
       
   349 
       
   350   var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
       
   351   if (phasedRegistrationNames) {
       
   352     for (var phaseName in phasedRegistrationNames) {
       
   353       if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
       
   354         var phasedRegistrationName = phasedRegistrationNames[phaseName];
       
   355         publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
       
   356       }
       
   357     }
       
   358     return true;
       
   359   } else if (dispatchConfig.registrationName) {
       
   360     publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
       
   361     return true;
       
   362   }
       
   363   return false;
       
   364 }
       
   365 
       
   366 /**
       
   367  * Publishes a registration name that is used to identify dispatched events.
       
   368  *
       
   369  * @param {string} registrationName Registration name to add.
       
   370  * @param {object} PluginModule Plugin publishing the event.
       
   371  * @private
       
   372  */
       
   373 function publishRegistrationName(registrationName, pluginModule, eventName) {
       
   374   !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
       
   375   registrationNameModules[registrationName] = pluginModule;
       
   376   registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
       
   377 
       
   378   {
       
   379     var lowerCasedName = registrationName.toLowerCase();
       
   380     possibleRegistrationNames[lowerCasedName] = registrationName;
       
   381 
       
   382     if (registrationName === 'onDoubleClick') {
       
   383       possibleRegistrationNames.ondblclick = registrationName;
       
   384     }
       
   385   }
       
   386 }
       
   387 
       
   388 /**
       
   389  * Registers plugins so that they can extract and dispatch events.
       
   390  *
       
   391  * @see {EventPluginHub}
       
   392  */
       
   393 
       
   394 /**
       
   395  * Ordered list of injected plugins.
       
   396  */
       
   397 var plugins = [];
       
   398 
       
   399 /**
       
   400  * Mapping from event name to dispatch config
       
   401  */
       
   402 var eventNameDispatchConfigs = {};
       
   403 
       
   404 /**
       
   405  * Mapping from registration name to plugin module
       
   406  */
       
   407 var registrationNameModules = {};
       
   408 
       
   409 /**
       
   410  * Mapping from registration name to event name
       
   411  */
       
   412 var registrationNameDependencies = {};
       
   413 
       
   414 /**
       
   415  * Mapping from lowercase registration names to the properly cased version,
       
   416  * used to warn in the case of missing event handlers. Available
       
   417  * only in true.
       
   418  * @type {Object}
       
   419  */
       
   420 var possibleRegistrationNames = {};
       
   421 // Trust the developer to only use possibleRegistrationNames in true
       
   422 
       
   423 /**
       
   424  * Injects an ordering of plugins (by plugin name). This allows the ordering
       
   425  * to be decoupled from injection of the actual plugins so that ordering is
       
   426  * always deterministic regardless of packaging, on-the-fly injection, etc.
       
   427  *
       
   428  * @param {array} InjectedEventPluginOrder
       
   429  * @internal
       
   430  * @see {EventPluginHub.injection.injectEventPluginOrder}
       
   431  */
       
   432 function injectEventPluginOrder(injectedEventPluginOrder) {
       
   433   !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
       
   434   // Clone the ordering so it cannot be dynamically mutated.
       
   435   eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
       
   436   recomputePluginOrdering();
       
   437 }
       
   438 
       
   439 /**
       
   440  * Injects plugins to be used by `EventPluginHub`. The plugin names must be
       
   441  * in the ordering injected by `injectEventPluginOrder`.
       
   442  *
       
   443  * Plugins can be injected as part of page initialization or on-the-fly.
       
   444  *
       
   445  * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   446  * @internal
       
   447  * @see {EventPluginHub.injection.injectEventPluginsByName}
       
   448  */
       
   449 function injectEventPluginsByName(injectedNamesToPlugins) {
       
   450   var isOrderingDirty = false;
       
   451   for (var pluginName in injectedNamesToPlugins) {
       
   452     if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
       
   453       continue;
       
   454     }
       
   455     var pluginModule = injectedNamesToPlugins[pluginName];
       
   456     if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
       
   457       !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
       
   458       namesToPlugins[pluginName] = pluginModule;
       
   459       isOrderingDirty = true;
       
   460     }
       
   461   }
       
   462   if (isOrderingDirty) {
       
   463     recomputePluginOrdering();
       
   464   }
   503   }
   465 }
   504 }
   466 
   505 
   467 /**
   506 /**
   468  * Similar to invariant but only logs a warning if the condition is not met.
   507  * Similar to invariant but only logs a warning if the condition is not met.
   613  *
   652  *
   614  * @return {*|array<*>} An accumulation of items.
   653  * @return {*|array<*>} An accumulation of items.
   615  */
   654  */
   616 
   655 
   617 function accumulateInto(current, next) {
   656 function accumulateInto(current, next) {
   618   !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
   657   (function () {
       
   658     if (!(next != null)) {
       
   659       {
       
   660         throw ReactError(Error('accumulateInto(...): Accumulated items must not be null or undefined.'));
       
   661       }
       
   662     }
       
   663   })();
   619 
   664 
   620   if (current == null) {
   665   if (current == null) {
   621     return next;
   666     return next;
   622   }
   667   }
   623 
   668 
   679   }
   724   }
   680 };
   725 };
   681 var executeDispatchesAndReleaseTopLevel = function (e) {
   726 var executeDispatchesAndReleaseTopLevel = function (e) {
   682   return executeDispatchesAndRelease(e);
   727   return executeDispatchesAndRelease(e);
   683 };
   728 };
       
   729 
       
   730 function runEventsInBatch(events) {
       
   731   if (events !== null) {
       
   732     eventQueue = accumulateInto(eventQueue, events);
       
   733   }
       
   734 
       
   735   // Set `eventQueue` to null before processing it so that we can tell if more
       
   736   // events get enqueued while processing.
       
   737   var processingEventQueue = eventQueue;
       
   738   eventQueue = null;
       
   739 
       
   740   if (!processingEventQueue) {
       
   741     return;
       
   742   }
       
   743 
       
   744   forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
       
   745   (function () {
       
   746     if (!!eventQueue) {
       
   747       {
       
   748         throw ReactError(Error('processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.'));
       
   749       }
       
   750     }
       
   751   })();
       
   752   // This would be a good time to rethrow if any of the event handlers threw.
       
   753   rethrowCaughtError();
       
   754 }
   684 
   755 
   685 function isInteractive(tag) {
   756 function isInteractive(tag) {
   686   return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
   757   return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
   687 }
   758 }
   688 
   759 
   765   }
   836   }
   766   listener = props[registrationName];
   837   listener = props[registrationName];
   767   if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
   838   if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
   768     return null;
   839     return null;
   769   }
   840   }
   770   !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
   841   (function () {
       
   842     if (!(!listener || typeof listener === 'function')) {
       
   843       {
       
   844         throw ReactError(Error('Expected `' + registrationName + '` listener to be a function, instead got a value of `' + typeof listener + '` type.'));
       
   845       }
       
   846     }
       
   847   })();
   771   return listener;
   848   return listener;
   772 }
   849 }
   773 
   850 
   774 /**
   851 /**
   775  * Allows registered plugins an opportunity to extract events from top-level
   852  * Allows registered plugins an opportunity to extract events from top-level
   776  * native browser events.
   853  * native browser events.
   777  *
   854  *
   778  * @return {*} An accumulation of synthetic events.
   855  * @return {*} An accumulation of synthetic events.
   779  * @internal
   856  * @internal
   780  */
   857  */
   781 function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
   858 function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
   782   var events = null;
   859   var events = null;
   783   for (var i = 0; i < plugins.length; i++) {
   860   for (var i = 0; i < plugins.length; i++) {
   784     // Not every plugin in the ordering may be loaded at runtime.
   861     // Not every plugin in the ordering may be loaded at runtime.
   785     var possiblePlugin = plugins[i];
   862     var possiblePlugin = plugins[i];
   786     if (possiblePlugin) {
   863     if (possiblePlugin) {
   791     }
   868     }
   792   }
   869   }
   793   return events;
   870   return events;
   794 }
   871 }
   795 
   872 
   796 function runEventsInBatch(events) {
   873 function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
   797   if (events !== null) {
   874   var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
   798     eventQueue = accumulateInto(eventQueue, events);
       
   799   }
       
   800 
       
   801   // Set `eventQueue` to null before processing it so that we can tell if more
       
   802   // events get enqueued while processing.
       
   803   var processingEventQueue = eventQueue;
       
   804   eventQueue = null;
       
   805 
       
   806   if (!processingEventQueue) {
       
   807     return;
       
   808   }
       
   809 
       
   810   forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
       
   811   !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
       
   812   // This would be a good time to rethrow if any of the event handlers threw.
       
   813   rethrowCaughtError();
       
   814 }
       
   815 
       
   816 function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
   817   var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
   818   runEventsInBatch(events);
   875   runEventsInBatch(events);
   819 }
   876 }
   820 
   877 
   821 var FunctionComponent = 0;
   878 var FunctionComponent = 0;
   822 var ClassComponent = 1;
   879 var ClassComponent = 1;
   835 var MemoComponent = 14;
   892 var MemoComponent = 14;
   836 var SimpleMemoComponent = 15;
   893 var SimpleMemoComponent = 15;
   837 var LazyComponent = 16;
   894 var LazyComponent = 16;
   838 var IncompleteClassComponent = 17;
   895 var IncompleteClassComponent = 17;
   839 var DehydratedSuspenseComponent = 18;
   896 var DehydratedSuspenseComponent = 18;
       
   897 var SuspenseListComponent = 19;
       
   898 var FundamentalComponent = 20;
   840 
   899 
   841 var randomKey = Math.random().toString(36).slice(2);
   900 var randomKey = Math.random().toString(36).slice(2);
   842 var internalInstanceKey = '__reactInternalInstance$' + randomKey;
   901 var internalInstanceKey = '__reactInternalInstance$' + randomKey;
   843 var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
   902 var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
   844 
   903 
   901     return inst.stateNode;
   960     return inst.stateNode;
   902   }
   961   }
   903 
   962 
   904   // Without this first invariant, passing a non-DOM-component triggers the next
   963   // Without this first invariant, passing a non-DOM-component triggers the next
   905   // invariant for a missing parent, which is super confusing.
   964   // invariant for a missing parent, which is super confusing.
   906   invariant(false, 'getNodeFromInstance: Invalid argument.');
   965   (function () {
       
   966     {
       
   967       {
       
   968         throw ReactError(Error('getNodeFromInstance: Invalid argument.'));
       
   969       }
       
   970     }
       
   971   })();
   907 }
   972 }
   908 
   973 
   909 function getFiberCurrentPropsFromNode$1(node) {
   974 function getFiberCurrentPropsFromNode$1(node) {
   910   return node[internalEventHandlersKey] || null;
   975   return node[internalEventHandlersKey] || null;
   911 }
   976 }
  1130 
  1195 
  1131 function accumulateDirectDispatches(events) {
  1196 function accumulateDirectDispatches(events) {
  1132   forEachAccumulated(events, accumulateDirectDispatchesSingle);
  1197   forEachAccumulated(events, accumulateDirectDispatchesSingle);
  1133 }
  1198 }
  1134 
  1199 
  1135 var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  1200 var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
  1136 
  1201 
  1137 // Do not uses the below two methods directly!
  1202 // Do not use the below two methods directly!
  1138 // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
  1203 // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
  1139 // (It is the only module that is allowed to access these methods.)
  1204 // (It is the only module that is allowed to access these methods.)
  1140 
  1205 
  1141 function unsafeCastStringToDOMTopLevelType(topLevelType) {
  1206 function unsafeCastStringToDOMTopLevelType(topLevelType) {
  1142   return topLevelType;
  1207   return topLevelType;
  1643   return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
  1708   return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
  1644 }
  1709 }
  1645 
  1710 
  1646 function releasePooledEvent(event) {
  1711 function releasePooledEvent(event) {
  1647   var EventConstructor = this;
  1712   var EventConstructor = this;
  1648   !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
  1713   (function () {
       
  1714     if (!(event instanceof EventConstructor)) {
       
  1715       {
       
  1716         throw ReactError(Error('Trying to release an event instance into a pool of a different type.'));
       
  1717       }
       
  1718     }
       
  1719   })();
  1649   event.destructor();
  1720   event.destructor();
  1650   if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
  1721   if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
  1651     EventConstructor.eventPool.push(event);
  1722     EventConstructor.eventPool.push(event);
  1652   }
  1723   }
  1653 }
  1724 }
  2078   var internalInstance = getInstanceFromNode(target);
  2149   var internalInstance = getInstanceFromNode(target);
  2079   if (!internalInstance) {
  2150   if (!internalInstance) {
  2080     // Unmounted
  2151     // Unmounted
  2081     return;
  2152     return;
  2082   }
  2153   }
  2083   !(typeof restoreImpl === 'function') ? invariant(false, 'setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
  2154   (function () {
       
  2155     if (!(typeof restoreImpl === 'function')) {
       
  2156       {
       
  2157         throw ReactError(Error('setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.'));
       
  2158       }
       
  2159     }
       
  2160   })();
  2084   var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
  2161   var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
  2085   restoreImpl(internalInstance.stateNode, internalInstance.type, props);
  2162   restoreImpl(internalInstance.stateNode, internalInstance.type, props);
  2086 }
  2163 }
  2087 
  2164 
  2088 function setRestoreImplementation(impl) {
  2165 function setRestoreImplementation(impl) {
  2120       restoreStateOfTarget(queuedTargets[i]);
  2197       restoreStateOfTarget(queuedTargets[i]);
  2121     }
  2198     }
  2122   }
  2199   }
  2123 }
  2200 }
  2124 
  2201 
       
  2202 var enableUserTimingAPI = true;
       
  2203 
       
  2204 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
       
  2205 var debugRenderPhaseSideEffects = false;
       
  2206 
       
  2207 // In some cases, StrictMode should also double-render lifecycles.
       
  2208 // This can be confusing for tests though,
       
  2209 // And it can be bad for performance in production.
       
  2210 // This feature flag can be used to control the behavior:
       
  2211 var debugRenderPhaseSideEffectsForStrictMode = true;
       
  2212 
       
  2213 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
       
  2214 // replay the begin phase of a failed component inside invokeGuardedCallback.
       
  2215 var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
       
  2216 
       
  2217 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
       
  2218 var warnAboutDeprecatedLifecycles = true;
       
  2219 
       
  2220 // Gather advanced timing metrics for Profiler subtrees.
       
  2221 var enableProfilerTimer = true;
       
  2222 
       
  2223 // Trace which interactions trigger each commit.
       
  2224 var enableSchedulerTracing = true;
       
  2225 
       
  2226 // Only used in www builds.
       
  2227 var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
       
  2228 
       
  2229 // Only used in www builds.
       
  2230 
       
  2231 
       
  2232 // Only used in www builds.
       
  2233 
       
  2234 
       
  2235 // Disable javascript: URL strings in href for XSS protection.
       
  2236 var disableJavaScriptURLs = false;
       
  2237 
       
  2238 // React Fire: prevent the value and checked attributes from syncing
       
  2239 // with their related DOM properties
       
  2240 var disableInputAttributeSyncing = false;
       
  2241 
       
  2242 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
       
  2243 // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
       
  2244 var enableStableConcurrentModeAPIs = false;
       
  2245 
       
  2246 var warnAboutShorthandPropertyCollision = false;
       
  2247 
       
  2248 // See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
       
  2249 // This is a flag so we can fix warnings in RN core before turning it on
       
  2250 
       
  2251 
       
  2252 // Experimental React Flare event system and event components support.
       
  2253 var enableFlareAPI = false;
       
  2254 
       
  2255 // Experimental Host Component support.
       
  2256 var enableFundamentalAPI = false;
       
  2257 
       
  2258 // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
       
  2259 
       
  2260 
       
  2261 // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
       
  2262 // Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
       
  2263 var warnAboutUnmockedScheduler = false;
       
  2264 // Temporary flag to revert the fix in #15650
       
  2265 var revertPassiveEffectsChange = false;
       
  2266 
       
  2267 // For tests, we flush suspense fallbacks in an act scope;
       
  2268 // *except* in some of our own tests, where we test incremental loading states.
       
  2269 var flushSuspenseFallbacksInTests = true;
       
  2270 
       
  2271 // Changes priority of some events like mousemove to user-blocking priority,
       
  2272 // but without making them discrete. The flag exists in case it causes
       
  2273 // starvation problems.
       
  2274 var enableUserBlockingEvents = false;
       
  2275 
       
  2276 // Add a callback property to suspense to notify which promises are currently
       
  2277 // in the update queue. This allows reporting and tracing of what is causing
       
  2278 // the user to see a loading state.
       
  2279 var enableSuspenseCallback = false;
       
  2280 
       
  2281 // Part of the simplification of React.createElement so we can eventually move
       
  2282 // from React.createElement to React.jsx
       
  2283 // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
       
  2284 var warnAboutDefaultPropsOnFunctionComponents = false;
       
  2285 
       
  2286 var disableLegacyContext = false;
       
  2287 
       
  2288 var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
       
  2289 
  2125 // Used as a way to call batchedUpdates when we don't have a reference to
  2290 // Used as a way to call batchedUpdates when we don't have a reference to
  2126 // the renderer. Such as when we're dispatching events or if third party
  2291 // the renderer. Such as when we're dispatching events or if third party
  2127 // libraries need to call batchedUpdates. Eventually, this API will go away when
  2292 // libraries need to call batchedUpdates. Eventually, this API will go away when
  2128 // everything is batched by default. We'll then have a similar API to opt-out of
  2293 // everything is batched by default. We'll then have a similar API to opt-out of
  2129 // scheduled work and instead do synchronous work.
  2294 // scheduled work and instead do synchronous work.
  2130 
  2295 
  2131 // Defaults
  2296 // Defaults
  2132 var _batchedUpdatesImpl = function (fn, bookkeeping) {
  2297 var batchedUpdatesImpl = function (fn, bookkeeping) {
  2133   return fn(bookkeeping);
  2298   return fn(bookkeeping);
  2134 };
  2299 };
  2135 var _interactiveUpdatesImpl = function (fn, a, b) {
  2300 var discreteUpdatesImpl = function (fn, a, b, c) {
  2136   return fn(a, b);
  2301   return fn(a, b, c);
  2137 };
  2302 };
  2138 var _flushInteractiveUpdatesImpl = function () {};
  2303 var flushDiscreteUpdatesImpl = function () {};
  2139 
  2304 var batchedEventUpdatesImpl = batchedUpdatesImpl;
  2140 var isBatching = false;
  2305 
       
  2306 var isInsideEventHandler = false;
       
  2307 
       
  2308 function finishEventHandler() {
       
  2309   // Here we wait until all updates have propagated, which is important
       
  2310   // when using controlled components within layers:
       
  2311   // https://github.com/facebook/react/issues/1698
       
  2312   // Then we restore state of any controlled component.
       
  2313   var controlledComponentsHavePendingUpdates = needsStateRestore();
       
  2314   if (controlledComponentsHavePendingUpdates) {
       
  2315     // If a controlled event was fired, we may need to restore the state of
       
  2316     // the DOM node back to the controlled value. This is necessary when React
       
  2317     // bails out of the update without touching the DOM.
       
  2318     flushDiscreteUpdatesImpl();
       
  2319     restoreStateIfNeeded();
       
  2320   }
       
  2321 }
       
  2322 
  2141 function batchedUpdates(fn, bookkeeping) {
  2323 function batchedUpdates(fn, bookkeeping) {
  2142   if (isBatching) {
  2324   if (isInsideEventHandler) {
  2143     // If we are currently inside another batch, we need to wait until it
  2325     // If we are currently inside another batch, we need to wait until it
  2144     // fully completes before restoring state.
  2326     // fully completes before restoring state.
  2145     return fn(bookkeeping);
  2327     return fn(bookkeeping);
  2146   }
  2328   }
  2147   isBatching = true;
  2329   isInsideEventHandler = true;
  2148   try {
  2330   try {
  2149     return _batchedUpdatesImpl(fn, bookkeeping);
  2331     return batchedUpdatesImpl(fn, bookkeeping);
  2150   } finally {
  2332   } finally {
  2151     // Here we wait until all updates have propagated, which is important
  2333     isInsideEventHandler = false;
  2152     // when using controlled components within layers:
  2334     finishEventHandler();
  2153     // https://github.com/facebook/react/issues/1698
  2335   }
  2154     // Then we restore state of any controlled component.
  2336 }
  2155     isBatching = false;
  2337 
  2156     var controlledComponentsHavePendingUpdates = needsStateRestore();
  2338 function batchedEventUpdates(fn, a, b) {
  2157     if (controlledComponentsHavePendingUpdates) {
  2339   if (isInsideEventHandler) {
  2158       // If a controlled event was fired, we may need to restore the state of
  2340     // If we are currently inside another batch, we need to wait until it
  2159       // the DOM node back to the controlled value. This is necessary when React
  2341     // fully completes before restoring state.
  2160       // bails out of the update without touching the DOM.
  2342     return fn(a, b);
  2161       _flushInteractiveUpdatesImpl();
  2343   }
  2162       restoreStateIfNeeded();
  2344   isInsideEventHandler = true;
  2163     }
  2345   try {
  2164   }
  2346     return batchedEventUpdatesImpl(fn, a, b);
  2165 }
  2347   } finally {
  2166 
  2348     isInsideEventHandler = false;
  2167 function interactiveUpdates(fn, a, b) {
  2349     finishEventHandler();
  2168   return _interactiveUpdatesImpl(fn, a, b);
  2350   }
  2169 }
  2351 }
  2170 
  2352 
  2171 
  2353 function discreteUpdates(fn, a, b, c) {
  2172 
  2354   var prevIsInsideEventHandler = isInsideEventHandler;
  2173 function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) {
  2355   isInsideEventHandler = true;
  2174   _batchedUpdatesImpl = batchedUpdatesImpl;
  2356   try {
  2175   _interactiveUpdatesImpl = interactiveUpdatesImpl;
  2357     return discreteUpdatesImpl(fn, a, b, c);
  2176   _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl;
  2358   } finally {
       
  2359     isInsideEventHandler = prevIsInsideEventHandler;
       
  2360     if (!isInsideEventHandler) {
       
  2361       finishEventHandler();
       
  2362     }
       
  2363   }
       
  2364 }
       
  2365 
       
  2366 var lastFlushedEventTimeStamp = 0;
       
  2367 function flushDiscreteUpdatesIfNeeded(timeStamp) {
       
  2368   // event.timeStamp isn't overly reliable due to inconsistencies in
       
  2369   // how different browsers have historically provided the time stamp.
       
  2370   // Some browsers provide high-resolution time stamps for all events,
       
  2371   // some provide low-resolution time stamps for all events. FF < 52
       
  2372   // even mixes both time stamps together. Some browsers even report
       
  2373   // negative time stamps or time stamps that are 0 (iOS9) in some cases.
       
  2374   // Given we are only comparing two time stamps with equality (!==),
       
  2375   // we are safe from the resolution differences. If the time stamp is 0
       
  2376   // we bail-out of preventing the flush, which can affect semantics,
       
  2377   // such as if an earlier flush removes or adds event listeners that
       
  2378   // are fired in the subsequent flush. However, this is the same
       
  2379   // behaviour as we had before this change, so the risks are low.
       
  2380   if (!isInsideEventHandler && (!enableFlareAPI || timeStamp === 0 || lastFlushedEventTimeStamp !== timeStamp)) {
       
  2381     lastFlushedEventTimeStamp = timeStamp;
       
  2382     flushDiscreteUpdatesImpl();
       
  2383   }
       
  2384 }
       
  2385 
       
  2386 function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
       
  2387   batchedUpdatesImpl = _batchedUpdatesImpl;
       
  2388   discreteUpdatesImpl = _discreteUpdatesImpl;
       
  2389   flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
       
  2390   batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
  2177 }
  2391 }
  2178 
  2392 
  2179 /**
  2393 /**
  2180  * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  2394  * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  2181  */
  2395  */
  2389 if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
  2603 if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
  2390   ReactSharedInternals.ReactCurrentDispatcher = {
  2604   ReactSharedInternals.ReactCurrentDispatcher = {
  2391     current: null
  2605     current: null
  2392   };
  2606   };
  2393 }
  2607 }
       
  2608 if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
       
  2609   ReactSharedInternals.ReactCurrentBatchConfig = {
       
  2610     suspense: null
       
  2611   };
       
  2612 }
  2394 
  2613 
  2395 var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  2614 var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  2396 
  2615 
  2397 var describeComponentFrame = function (name, source, ownerName) {
  2616 var describeComponentFrame = function (name, source, ownerName) {
  2398   var sourceInfo = '';
  2617   var sourceInfo = '';
  2429 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  2648 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  2430 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  2649 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  2431 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  2650 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  2432 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  2651 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  2433 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
  2652 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
       
  2653 // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
       
  2654 // (unstable) APIs that have been removed. Can we remove the symbols?
  2434 
  2655 
  2435 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  2656 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  2436 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  2657 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  2437 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  2658 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
       
  2659 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  2438 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  2660 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  2439 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  2661 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
       
  2662 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
       
  2663 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
  2440 
  2664 
  2441 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  2665 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  2442 var FAUX_ITERATOR_SYMBOL = '@@iterator';
  2666 var FAUX_ITERATOR_SYMBOL = '@@iterator';
  2443 
  2667 
  2444 function getIteratorFn(maybeIterable) {
  2668 function getIteratorFn(maybeIterable) {
  2480   }
  2704   }
  2481   if (typeof type === 'string') {
  2705   if (typeof type === 'string') {
  2482     return type;
  2706     return type;
  2483   }
  2707   }
  2484   switch (type) {
  2708   switch (type) {
  2485     case REACT_CONCURRENT_MODE_TYPE:
       
  2486       return 'ConcurrentMode';
       
  2487     case REACT_FRAGMENT_TYPE:
  2709     case REACT_FRAGMENT_TYPE:
  2488       return 'Fragment';
  2710       return 'Fragment';
  2489     case REACT_PORTAL_TYPE:
  2711     case REACT_PORTAL_TYPE:
  2490       return 'Portal';
  2712       return 'Portal';
  2491     case REACT_PROFILER_TYPE:
  2713     case REACT_PROFILER_TYPE:
  2492       return 'Profiler';
  2714       return 'Profiler';
  2493     case REACT_STRICT_MODE_TYPE:
  2715     case REACT_STRICT_MODE_TYPE:
  2494       return 'StrictMode';
  2716       return 'StrictMode';
  2495     case REACT_SUSPENSE_TYPE:
  2717     case REACT_SUSPENSE_TYPE:
  2496       return 'Suspense';
  2718       return 'Suspense';
       
  2719     case REACT_SUSPENSE_LIST_TYPE:
       
  2720       return 'SuspenseList';
  2497   }
  2721   }
  2498   if (typeof type === 'object') {
  2722   if (typeof type === 'object') {
  2499     switch (type.$$typeof) {
  2723     switch (type.$$typeof) {
  2500       case REACT_CONTEXT_TYPE:
  2724       case REACT_CONTEXT_TYPE:
  2501         return 'Context.Consumer';
  2725         return 'Context.Consumer';
  2510           var thenable = type;
  2734           var thenable = type;
  2511           var resolvedThenable = refineResolvedLazyComponent(thenable);
  2735           var resolvedThenable = refineResolvedLazyComponent(thenable);
  2512           if (resolvedThenable) {
  2736           if (resolvedThenable) {
  2513             return getComponentName(resolvedThenable);
  2737             return getComponentName(resolvedThenable);
  2514           }
  2738           }
       
  2739           break;
  2515         }
  2740         }
  2516     }
  2741     }
  2517   }
  2742   }
  2518   return null;
  2743   return null;
  2519 }
  2744 }
  2760 
  2985 
  2761 function getPropertyInfo(name) {
  2986 function getPropertyInfo(name) {
  2762   return properties.hasOwnProperty(name) ? properties[name] : null;
  2987   return properties.hasOwnProperty(name) ? properties[name] : null;
  2763 }
  2988 }
  2764 
  2989 
  2765 function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
  2990 function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
  2766   this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
  2991   this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
  2767   this.attributeName = attributeName;
  2992   this.attributeName = attributeName;
  2768   this.attributeNamespace = attributeNamespace;
  2993   this.attributeNamespace = attributeNamespace;
  2769   this.mustUseProperty = mustUseProperty;
  2994   this.mustUseProperty = mustUseProperty;
  2770   this.propertyName = name;
  2995   this.propertyName = name;
  2771   this.type = type;
  2996   this.type = type;
       
  2997   this.sanitizeURL = sanitizeURL;
  2772 }
  2998 }
  2773 
  2999 
  2774 // When adding attributes to this list, be sure to also add them to
  3000 // When adding attributes to this list, be sure to also add them to
  2775 // the `possibleStandardNames` module to ensure casing and incorrect
  3001 // the `possibleStandardNames` module to ensure casing and incorrect
  2776 // name warnings.
  3002 // name warnings.
  2782 // elements (not just inputs). Now that ReactDOMInput assigns to the
  3008 // elements (not just inputs). Now that ReactDOMInput assigns to the
  2783 // defaultValue property -- do we need this?
  3009 // defaultValue property -- do we need this?
  2784 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
  3010 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
  2785   properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
  3011   properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
  2786   name, // attributeName
  3012   name, // attributeName
  2787   null);
  3013   null, // attributeNamespace
  2788 } // attributeNamespace
  3014   false);
       
  3015 } // sanitizeURL
  2789 );
  3016 );
  2790 
  3017 
  2791 // A few React string attributes have a different name.
  3018 // A few React string attributes have a different name.
  2792 // This is a mapping from React prop names to the attribute names.
  3019 // This is a mapping from React prop names to the attribute names.
  2793 [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
  3020 [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
  2794   var name = _ref[0],
  3021   var name = _ref[0],
  2795       attributeName = _ref[1];
  3022       attributeName = _ref[1];
  2796 
  3023 
  2797   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  3024   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  2798   attributeName, // attributeName
  3025   attributeName, // attributeName
  2799   null);
  3026   null, // attributeNamespace
  2800 } // attributeNamespace
  3027   false);
       
  3028 } // sanitizeURL
  2801 );
  3029 );
  2802 
  3030 
  2803 // These are "enumerated" HTML attributes that accept "true" and "false".
  3031 // These are "enumerated" HTML attributes that accept "true" and "false".
  2804 // In React, we let users pass `true` and `false` even though technically
  3032 // In React, we let users pass `true` and `false` even though technically
  2805 // these aren't boolean attributes (they are coerced to strings).
  3033 // these aren't boolean attributes (they are coerced to strings).
  2806 ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
  3034 ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
  2807   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  3035   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  2808   name.toLowerCase(), // attributeName
  3036   name.toLowerCase(), // attributeName
  2809   null);
  3037   null, // attributeNamespace
  2810 } // attributeNamespace
  3038   false);
       
  3039 } // sanitizeURL
  2811 );
  3040 );
  2812 
  3041 
  2813 // These are "enumerated" SVG attributes that accept "true" and "false".
  3042 // These are "enumerated" SVG attributes that accept "true" and "false".
  2814 // In React, we let users pass `true` and `false` even though technically
  3043 // In React, we let users pass `true` and `false` even though technically
  2815 // these aren't boolean attributes (they are coerced to strings).
  3044 // these aren't boolean attributes (they are coerced to strings).
  2816 // Since these are SVG attributes, their attribute names are case-sensitive.
  3045 // Since these are SVG attributes, their attribute names are case-sensitive.
  2817 ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
  3046 ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
  2818   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  3047   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
  2819   name, // attributeName
  3048   name, // attributeName
  2820   null);
  3049   null, // attributeNamespace
  2821 } // attributeNamespace
  3050   false);
       
  3051 } // sanitizeURL
  2822 );
  3052 );
  2823 
  3053 
  2824 // These are HTML boolean attributes.
  3054 // These are HTML boolean attributes.
  2825 ['allowFullScreen', 'async',
  3055 ['allowFullScreen', 'async',
  2826 // Note: there is a special case that prevents it from being written to the DOM
  3056 // Note: there is a special case that prevents it from being written to the DOM
  2827 // on the client side because the browsers are inconsistent. Instead we call focus().
  3057 // on the client side because the browsers are inconsistent. Instead we call focus().
  2828 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
  3058 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
  2829 // Microdata
  3059 // Microdata
  2830 'itemScope'].forEach(function (name) {
  3060 'itemScope'].forEach(function (name) {
  2831   properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
  3061   properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
  2832   name.toLowerCase(), // attributeName
  3062   name.toLowerCase(), // attributeName
  2833   null);
  3063   null, // attributeNamespace
  2834 } // attributeNamespace
  3064   false);
       
  3065 } // sanitizeURL
  2835 );
  3066 );
  2836 
  3067 
  2837 // These are the few React props that we set as DOM properties
  3068 // These are the few React props that we set as DOM properties
  2838 // rather than attributes. These are all booleans.
  3069 // rather than attributes. These are all booleans.
  2839 ['checked',
  3070 ['checked',
  2840 // Note: `option.selected` is not updated if `select.multiple` is
  3071 // Note: `option.selected` is not updated if `select.multiple` is
  2841 // disabled with `removeAttribute`. We have special logic for handling this.
  3072 // disabled with `removeAttribute`. We have special logic for handling this.
  2842 'multiple', 'muted', 'selected'].forEach(function (name) {
  3073 'multiple', 'muted', 'selected'].forEach(function (name) {
  2843   properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
  3074   properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
  2844   name, // attributeName
  3075   name, // attributeName
  2845   null);
  3076   null, // attributeNamespace
  2846 } // attributeNamespace
  3077   false);
       
  3078 } // sanitizeURL
  2847 );
  3079 );
  2848 
  3080 
  2849 // These are HTML attributes that are "overloaded booleans": they behave like
  3081 // These are HTML attributes that are "overloaded booleans": they behave like
  2850 // booleans, but can also accept a string value.
  3082 // booleans, but can also accept a string value.
  2851 ['capture', 'download'].forEach(function (name) {
  3083 ['capture', 'download'].forEach(function (name) {
  2852   properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
  3084   properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
  2853   name, // attributeName
  3085   name, // attributeName
  2854   null);
  3086   null, // attributeNamespace
  2855 } // attributeNamespace
  3087   false);
       
  3088 } // sanitizeURL
  2856 );
  3089 );
  2857 
  3090 
  2858 // These are HTML attributes that must be positive numbers.
  3091 // These are HTML attributes that must be positive numbers.
  2859 ['cols', 'rows', 'size', 'span'].forEach(function (name) {
  3092 ['cols', 'rows', 'size', 'span'].forEach(function (name) {
  2860   properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
  3093   properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
  2861   name, // attributeName
  3094   name, // attributeName
  2862   null);
  3095   null, // attributeNamespace
  2863 } // attributeNamespace
  3096   false);
       
  3097 } // sanitizeURL
  2864 );
  3098 );
  2865 
  3099 
  2866 // These are HTML attributes that must be numbers.
  3100 // These are HTML attributes that must be numbers.
  2867 ['rowSpan', 'start'].forEach(function (name) {
  3101 ['rowSpan', 'start'].forEach(function (name) {
  2868   properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
  3102   properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
  2869   name.toLowerCase(), // attributeName
  3103   name.toLowerCase(), // attributeName
  2870   null);
  3104   null, // attributeNamespace
  2871 } // attributeNamespace
  3105   false);
       
  3106 } // sanitizeURL
  2872 );
  3107 );
  2873 
  3108 
  2874 var CAMELIZE = /[\-\:]([a-z])/g;
  3109 var CAMELIZE = /[\-\:]([a-z])/g;
  2875 var capitalize = function (token) {
  3110 var capitalize = function (token) {
  2876   return token[1].toUpperCase();
  3111   return token[1].toUpperCase();
  2882 // Some of these attributes can be hard to find. This list was created by
  3117 // Some of these attributes can be hard to find. This list was created by
  2883 // scrapping the MDN documentation.
  3118 // scrapping the MDN documentation.
  2884 ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
  3119 ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
  2885   var name = attributeName.replace(CAMELIZE, capitalize);
  3120   var name = attributeName.replace(CAMELIZE, capitalize);
  2886   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  3121   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  2887   attributeName, null);
  3122   attributeName, null, // attributeNamespace
  2888 } // attributeNamespace
  3123   false);
       
  3124 } // sanitizeURL
  2889 );
  3125 );
  2890 
  3126 
  2891 // String SVG attributes with the xlink namespace.
  3127 // String SVG attributes with the xlink namespace.
  2892 ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
  3128 ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
  2893   var name = attributeName.replace(CAMELIZE, capitalize);
  3129   var name = attributeName.replace(CAMELIZE, capitalize);
  2894   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  3130   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  2895   attributeName, 'http://www.w3.org/1999/xlink');
  3131   attributeName, 'http://www.w3.org/1999/xlink', false);
  2896 });
  3132 } // sanitizeURL
       
  3133 );
  2897 
  3134 
  2898 // String SVG attributes with the xml namespace.
  3135 // String SVG attributes with the xml namespace.
  2899 ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
  3136 ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
  2900   var name = attributeName.replace(CAMELIZE, capitalize);
  3137   var name = attributeName.replace(CAMELIZE, capitalize);
  2901   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  3138   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
  2902   attributeName, 'http://www.w3.org/XML/1998/namespace');
  3139   attributeName, 'http://www.w3.org/XML/1998/namespace', false);
  2903 });
  3140 } // sanitizeURL
       
  3141 );
  2904 
  3142 
  2905 // These attribute exists both in HTML and SVG.
  3143 // These attribute exists both in HTML and SVG.
  2906 // The attribute name is case-sensitive in SVG so we can't just use
  3144 // The attribute name is case-sensitive in SVG so we can't just use
  2907 // the React name like we do for attributes that exist only in HTML.
  3145 // the React name like we do for attributes that exist only in HTML.
  2908 ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
  3146 ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
  2909   properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
  3147   properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
  2910   attributeName.toLowerCase(), // attributeName
  3148   attributeName.toLowerCase(), // attributeName
  2911   null);
  3149   null, // attributeNamespace
  2912 } // attributeNamespace
  3150   false);
       
  3151 } // sanitizeURL
  2913 );
  3152 );
       
  3153 
       
  3154 // These attributes accept URLs. These must not allow javascript: URLS.
       
  3155 // These will also need to accept Trusted Types object in the future.
       
  3156 var xlinkHref = 'xlinkHref';
       
  3157 properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
       
  3158 'xlink:href', 'http://www.w3.org/1999/xlink', true);
       
  3159 
       
  3160 ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
       
  3161   properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
       
  3162   attributeName.toLowerCase(), // attributeName
       
  3163   null, // attributeNamespace
       
  3164   true);
       
  3165 } // sanitizeURL
       
  3166 );
       
  3167 
       
  3168 var ReactDebugCurrentFrame$1 = null;
       
  3169 {
       
  3170   ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  3171 }
       
  3172 
       
  3173 // A javascript: URL can contain leading C0 control or \u0020 SPACE,
       
  3174 // and any newline or tab are filtered out as if they're not part of the URL.
       
  3175 // https://url.spec.whatwg.org/#url-parsing
       
  3176 // Tab or newline are defined as \r\n\t:
       
  3177 // https://infra.spec.whatwg.org/#ascii-tab-or-newline
       
  3178 // A C0 control is a code point in the range \u0000 NULL to \u001F
       
  3179 // INFORMATION SEPARATOR ONE, inclusive:
       
  3180 // https://infra.spec.whatwg.org/#c0-control-or-space
       
  3181 
       
  3182 /* eslint-disable max-len */
       
  3183 var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
       
  3184 
       
  3185 var didWarn = false;
       
  3186 
       
  3187 function sanitizeURL(url) {
       
  3188   if (disableJavaScriptURLs) {
       
  3189     (function () {
       
  3190       if (!!isJavaScriptProtocol.test(url)) {
       
  3191         {
       
  3192           throw ReactError(Error('React has blocked a javascript: URL as a security precaution.' + (ReactDebugCurrentFrame$1.getStackAddendum())));
       
  3193         }
       
  3194       }
       
  3195     })();
       
  3196   } else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
       
  3197     didWarn = true;
       
  3198     warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
       
  3199   }
       
  3200 }
  2914 
  3201 
  2915 /**
  3202 /**
  2916  * Get the value for a property on a node. Only used in DEV for SSR validation.
  3203  * Get the value for a property on a node. Only used in DEV for SSR validation.
  2917  * The "expected" argument is used as a hint of what the expected value is.
  3204  * The "expected" argument is used as a hint of what the expected value is.
  2918  * Some properties have multiple equivalent values.
  3205  * Some properties have multiple equivalent values.
  2922     if (propertyInfo.mustUseProperty) {
  3209     if (propertyInfo.mustUseProperty) {
  2923       var propertyName = propertyInfo.propertyName;
  3210       var propertyName = propertyInfo.propertyName;
  2924 
  3211 
  2925       return node[propertyName];
  3212       return node[propertyName];
  2926     } else {
  3213     } else {
       
  3214       if (!disableJavaScriptURLs && propertyInfo.sanitizeURL) {
       
  3215         // If we haven't fully disabled javascript: URLs, and if
       
  3216         // the hydration is successful of a javascript: URL, we
       
  3217         // still want to warn on the client.
       
  3218         sanitizeURL('' + expected);
       
  3219       }
       
  3220 
  2927       var attributeName = propertyInfo.attributeName;
  3221       var attributeName = propertyInfo.attributeName;
  2928 
  3222 
  2929       var stringValue = null;
  3223       var stringValue = null;
  2930 
  3224 
  2931       if (propertyInfo.type === OVERLOADED_BOOLEAN) {
  3225       if (propertyInfo.type === OVERLOADED_BOOLEAN) {
  3049       attributeValue = '';
  3343       attributeValue = '';
  3050     } else {
  3344     } else {
  3051       // `setAttribute` with objects becomes only `[object]` in IE8/9,
  3345       // `setAttribute` with objects becomes only `[object]` in IE8/9,
  3052       // ('' + value) makes it output the correct toString()-value.
  3346       // ('' + value) makes it output the correct toString()-value.
  3053       attributeValue = '' + value;
  3347       attributeValue = '' + value;
       
  3348       if (propertyInfo.sanitizeURL) {
       
  3349         sanitizeURL(attributeValue);
       
  3350       }
  3054     }
  3351     }
  3055     if (attributeNamespace) {
  3352     if (attributeNamespace) {
  3056       node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
  3353       node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
  3057     } else {
  3354     } else {
  3058       node.setAttribute(attributeName, attributeValue);
  3355       node.setAttribute(attributeName, attributeValue);
  3184   }
  3481   }
  3185 }
  3482 }
  3186 
  3483 
  3187 var checkPropTypes_1 = checkPropTypes;
  3484 var checkPropTypes_1 = checkPropTypes;
  3188 
  3485 
  3189 var ReactDebugCurrentFrame$1 = null;
  3486 var ReactDebugCurrentFrame$2 = null;
  3190 
  3487 
  3191 var ReactControlledValuePropTypes = {
  3488 var ReactControlledValuePropTypes = {
  3192   checkPropTypes: null
  3489   checkPropTypes: null
  3193 };
  3490 };
  3194 
  3491 
  3195 {
  3492 {
  3196   ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
  3493   ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
  3197 
  3494 
  3198   var hasReadOnlyValue = {
  3495   var hasReadOnlyValue = {
  3199     button: true,
  3496     button: true,
  3200     checkbox: true,
  3497     checkbox: true,
  3201     image: true,
  3498     image: true,
  3205     submit: true
  3502     submit: true
  3206   };
  3503   };
  3207 
  3504 
  3208   var propTypes = {
  3505   var propTypes = {
  3209     value: function (props, propName, componentName) {
  3506     value: function (props, propName, componentName) {
  3210       if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
  3507       if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
  3211         return null;
  3508         return null;
  3212       }
  3509       }
  3213       return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  3510       return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  3214     },
  3511     },
  3215     checked: function (props, propName, componentName) {
  3512     checked: function (props, propName, componentName) {
  3216       if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
  3513       if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
  3217         return null;
  3514         return null;
  3218       }
  3515       }
  3219       return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  3516       return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  3220     }
  3517     }
  3221   };
  3518   };
  3223   /**
  3520   /**
  3224    * Provide a linked `value` attribute for controlled forms. You should not use
  3521    * Provide a linked `value` attribute for controlled forms. You should not use
  3225    * this outside of the ReactDOM controlled form components.
  3522    * this outside of the ReactDOM controlled form components.
  3226    */
  3523    */
  3227   ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
  3524   ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
  3228     checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
  3525     checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
  3229   };
  3526   };
  3230 }
  3527 }
  3231 
       
  3232 var enableUserTimingAPI = true;
       
  3233 
       
  3234 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
       
  3235 var debugRenderPhaseSideEffects = false;
       
  3236 
       
  3237 // In some cases, StrictMode should also double-render lifecycles.
       
  3238 // This can be confusing for tests though,
       
  3239 // And it can be bad for performance in production.
       
  3240 // This feature flag can be used to control the behavior:
       
  3241 var debugRenderPhaseSideEffectsForStrictMode = true;
       
  3242 
       
  3243 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
       
  3244 // replay the begin phase of a failed component inside invokeGuardedCallback.
       
  3245 var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
       
  3246 
       
  3247 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
       
  3248 var warnAboutDeprecatedLifecycles = false;
       
  3249 
       
  3250 // Gather advanced timing metrics for Profiler subtrees.
       
  3251 var enableProfilerTimer = true;
       
  3252 
       
  3253 // Trace which interactions trigger each commit.
       
  3254 var enableSchedulerTracing = true;
       
  3255 
       
  3256 // Only used in www builds.
       
  3257 var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
       
  3258 
       
  3259 // Only used in www builds.
       
  3260 
       
  3261 
       
  3262 // Only used in www builds.
       
  3263 
       
  3264 
       
  3265 // React Fire: prevent the value and checked attributes from syncing
       
  3266 // with their related DOM properties
       
  3267 var disableInputAttributeSyncing = false;
       
  3268 
       
  3269 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
       
  3270 // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
       
  3271 var enableStableConcurrentModeAPIs = false;
       
  3272 
       
  3273 var warnAboutShorthandPropertyCollision = false;
       
  3274 
  3528 
  3275 // TODO: direct imports like some-package/src/* are bad. Fix me.
  3529 // TODO: direct imports like some-package/src/* are bad. Fix me.
  3276 var didWarnValueDefaultValue = false;
  3530 var didWarnValueDefaultValue = false;
  3277 var didWarnCheckedDefaultChecked = false;
  3531 var didWarnCheckedDefaultChecked = false;
  3278 var didWarnControlledToUncontrolled = false;
  3532 var didWarnControlledToUncontrolled = false;
  3562       // This will throw if radio buttons rendered by different copies of React
  3816       // This will throw if radio buttons rendered by different copies of React
  3563       // and the same name are rendered into the same form (same as #1939).
  3817       // and the same name are rendered into the same form (same as #1939).
  3564       // That's probably okay; we don't support it just as we don't support
  3818       // That's probably okay; we don't support it just as we don't support
  3565       // mixing React radio buttons with non-React ones.
  3819       // mixing React radio buttons with non-React ones.
  3566       var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
  3820       var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
  3567       !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0;
  3821       (function () {
       
  3822         if (!otherProps) {
       
  3823           {
       
  3824             throw ReactError(Error('ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.'));
       
  3825           }
       
  3826         }
       
  3827       })();
  3568 
  3828 
  3569       // We need update the tracked value on the named cousin since the value
  3829       // We need update the tracked value on the named cousin since the value
  3570       // was changed but the input saw no event or value set
  3830       // was changed but the input saw no event or value set
  3571       updateValueIfChanged(otherNode);
  3831       updateValueIfChanged(otherNode);
  3572 
  3832 
  4105   }
  4365   }
  4106 
  4366 
  4107   return true;
  4367   return true;
  4108 }
  4368 }
  4109 
  4369 
       
  4370 var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  4371 
       
  4372 var _ReactInternals$Sched = ReactInternals$1.Scheduler;
       
  4373 var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
       
  4374 var unstable_now = _ReactInternals$Sched.unstable_now;
       
  4375 var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
       
  4376 var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
       
  4377 var unstable_requestPaint = _ReactInternals$Sched.unstable_requestPaint;
       
  4378 var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
       
  4379 var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
       
  4380 var unstable_next = _ReactInternals$Sched.unstable_next;
       
  4381 var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
       
  4382 var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
       
  4383 var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
       
  4384 var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
       
  4385 var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
       
  4386 var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
       
  4387 var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
       
  4388 var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
       
  4389 var unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate;
       
  4390 var unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting;
       
  4391 
       
  4392 var PLUGIN_EVENT_SYSTEM = 1;
       
  4393 var RESPONDER_EVENT_SYSTEM = 1 << 1;
       
  4394 var IS_PASSIVE = 1 << 2;
       
  4395 var IS_ACTIVE = 1 << 3;
       
  4396 var PASSIVE_NOT_SUPPORTED = 1 << 4;
       
  4397 
       
  4398 function createResponderListener(responder, props) {
       
  4399   var eventResponderListener = {
       
  4400     responder: responder,
       
  4401     props: props
       
  4402   };
       
  4403   {
       
  4404     Object.freeze(eventResponderListener);
       
  4405   }
       
  4406   return eventResponderListener;
       
  4407 }
       
  4408 
       
  4409 function isFiberSuspenseAndTimedOut(fiber) {
       
  4410   return fiber.tag === SuspenseComponent && fiber.memoizedState !== null;
       
  4411 }
       
  4412 
       
  4413 function getSuspenseFallbackChild(fiber) {
       
  4414   return fiber.child.sibling.child;
       
  4415 }
       
  4416 
       
  4417 
       
  4418 
       
  4419 
       
  4420 
       
  4421 function createResponderInstance(responder, responderProps, responderState, target, fiber) {
       
  4422   return {
       
  4423     fiber: fiber,
       
  4424     props: responderProps,
       
  4425     responder: responder,
       
  4426     rootEventTypes: null,
       
  4427     state: responderState,
       
  4428     target: target
       
  4429   };
       
  4430 }
       
  4431 
       
  4432 var DiscreteEvent = 0;
       
  4433 var UserBlockingEvent = 1;
       
  4434 var ContinuousEvent = 2;
       
  4435 
       
  4436 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
  4437 // CommonJS interop named imports.
       
  4438 var UserBlockingPriority$1 = unstable_UserBlockingPriority;
       
  4439 var runWithPriority$1 = unstable_runWithPriority;
       
  4440 
       
  4441 
       
  4442 var listenToResponderEventTypesImpl = void 0;
       
  4443 
       
  4444 function setListenToResponderEventTypes(_listenToResponderEventTypesImpl) {
       
  4445   listenToResponderEventTypesImpl = _listenToResponderEventTypesImpl;
       
  4446 }
       
  4447 
       
  4448 var activeTimeouts = new Map();
       
  4449 var rootEventTypesToEventResponderInstances = new Map();
       
  4450 var ownershipChangeListeners = new Set();
       
  4451 
       
  4452 var globalOwner = null;
       
  4453 
       
  4454 var currentTimeStamp = 0;
       
  4455 var currentTimers = new Map();
       
  4456 var currentInstance = null;
       
  4457 var currentEventQueue = null;
       
  4458 var currentEventQueuePriority = ContinuousEvent;
       
  4459 var currentTimerIDCounter = 0;
       
  4460 var currentDocument = null;
       
  4461 
       
  4462 var eventResponderContext = {
       
  4463   dispatchEvent: function (eventValue, eventListener, eventPriority) {
       
  4464     validateResponderContext();
       
  4465     validateEventValue(eventValue);
       
  4466     if (eventPriority < currentEventQueuePriority) {
       
  4467       currentEventQueuePriority = eventPriority;
       
  4468     }
       
  4469     currentEventQueue.push(createEventQueueItem(eventValue, eventListener));
       
  4470   },
       
  4471   isTargetWithinResponder: function (target) {
       
  4472     validateResponderContext();
       
  4473     if (target != null) {
       
  4474       var fiber = getClosestInstanceFromNode(target);
       
  4475       var responderFiber = currentInstance.fiber;
       
  4476 
       
  4477       while (fiber !== null) {
       
  4478         if (fiber === responderFiber || fiber.alternate === responderFiber) {
       
  4479           return true;
       
  4480         }
       
  4481         fiber = fiber.return;
       
  4482       }
       
  4483     }
       
  4484     return false;
       
  4485   },
       
  4486   isTargetWithinResponderScope: function (target) {
       
  4487     validateResponderContext();
       
  4488     var componentInstance = currentInstance;
       
  4489     var responder = componentInstance.responder;
       
  4490 
       
  4491     if (target != null) {
       
  4492       var fiber = getClosestInstanceFromNode(target);
       
  4493       var responderFiber = currentInstance.fiber;
       
  4494 
       
  4495       while (fiber !== null) {
       
  4496         if (fiber === responderFiber || fiber.alternate === responderFiber) {
       
  4497           return true;
       
  4498         }
       
  4499         if (doesFiberHaveResponder(fiber, responder)) {
       
  4500           return false;
       
  4501         }
       
  4502         fiber = fiber.return;
       
  4503       }
       
  4504     }
       
  4505     return false;
       
  4506   },
       
  4507   isTargetWithinNode: function (childTarget, parentTarget) {
       
  4508     validateResponderContext();
       
  4509     var childFiber = getClosestInstanceFromNode(childTarget);
       
  4510     var parentFiber = getClosestInstanceFromNode(parentTarget);
       
  4511     var parentAlternateFiber = parentFiber.alternate;
       
  4512 
       
  4513     var node = childFiber;
       
  4514     while (node !== null) {
       
  4515       if (node === parentFiber || node === parentAlternateFiber) {
       
  4516         return true;
       
  4517       }
       
  4518       node = node.return;
       
  4519     }
       
  4520     return false;
       
  4521   },
       
  4522   addRootEventTypes: function (rootEventTypes) {
       
  4523     validateResponderContext();
       
  4524     var activeDocument = getActiveDocument();
       
  4525     listenToResponderEventTypesImpl(rootEventTypes, activeDocument);
       
  4526     for (var i = 0; i < rootEventTypes.length; i++) {
       
  4527       var rootEventType = rootEventTypes[i];
       
  4528       var eventResponderInstance = currentInstance;
       
  4529       registerRootEventType(rootEventType, eventResponderInstance);
       
  4530     }
       
  4531   },
       
  4532   removeRootEventTypes: function (rootEventTypes) {
       
  4533     validateResponderContext();
       
  4534     for (var i = 0; i < rootEventTypes.length; i++) {
       
  4535       var rootEventType = rootEventTypes[i];
       
  4536       var rootEventResponders = rootEventTypesToEventResponderInstances.get(rootEventType);
       
  4537       var rootEventTypesSet = currentInstance.rootEventTypes;
       
  4538       if (rootEventTypesSet !== null) {
       
  4539         rootEventTypesSet.delete(rootEventType);
       
  4540       }
       
  4541       if (rootEventResponders !== undefined) {
       
  4542         rootEventResponders.delete(currentInstance);
       
  4543       }
       
  4544     }
       
  4545   },
       
  4546   hasOwnership: function () {
       
  4547     validateResponderContext();
       
  4548     return globalOwner === currentInstance;
       
  4549   },
       
  4550   requestGlobalOwnership: function () {
       
  4551     validateResponderContext();
       
  4552     if (globalOwner !== null) {
       
  4553       return false;
       
  4554     }
       
  4555     globalOwner = currentInstance;
       
  4556     triggerOwnershipListeners();
       
  4557     return true;
       
  4558   },
       
  4559   releaseOwnership: function () {
       
  4560     validateResponderContext();
       
  4561     return releaseOwnershipForEventResponderInstance(currentInstance);
       
  4562   },
       
  4563   setTimeout: function (func, delay) {
       
  4564     validateResponderContext();
       
  4565     if (currentTimers === null) {
       
  4566       currentTimers = new Map();
       
  4567     }
       
  4568     var timeout = currentTimers.get(delay);
       
  4569 
       
  4570     var timerId = currentTimerIDCounter++;
       
  4571     if (timeout === undefined) {
       
  4572       var _timers = new Map();
       
  4573       var _id = setTimeout(function () {
       
  4574         processTimers(_timers, delay);
       
  4575       }, delay);
       
  4576       timeout = {
       
  4577         id: _id,
       
  4578         timers: _timers
       
  4579       };
       
  4580       currentTimers.set(delay, timeout);
       
  4581     }
       
  4582     timeout.timers.set(timerId, {
       
  4583       instance: currentInstance,
       
  4584       func: func,
       
  4585       id: timerId,
       
  4586       timeStamp: currentTimeStamp
       
  4587     });
       
  4588     activeTimeouts.set(timerId, timeout);
       
  4589     return timerId;
       
  4590   },
       
  4591   clearTimeout: function (timerId) {
       
  4592     validateResponderContext();
       
  4593     var timeout = activeTimeouts.get(timerId);
       
  4594 
       
  4595     if (timeout !== undefined) {
       
  4596       var _timers2 = timeout.timers;
       
  4597       _timers2.delete(timerId);
       
  4598       if (_timers2.size === 0) {
       
  4599         clearTimeout(timeout.id);
       
  4600       }
       
  4601     }
       
  4602   },
       
  4603   getFocusableElementsInScope: function (deep) {
       
  4604     validateResponderContext();
       
  4605     var focusableElements = [];
       
  4606     var eventResponderInstance = currentInstance;
       
  4607     var currentResponder = eventResponderInstance.responder;
       
  4608     var focusScopeFiber = eventResponderInstance.fiber;
       
  4609     if (deep) {
       
  4610       var deepNode = focusScopeFiber.return;
       
  4611       while (deepNode !== null) {
       
  4612         if (doesFiberHaveResponder(deepNode, currentResponder)) {
       
  4613           focusScopeFiber = deepNode;
       
  4614         }
       
  4615         deepNode = deepNode.return;
       
  4616       }
       
  4617     }
       
  4618     var child = focusScopeFiber.child;
       
  4619 
       
  4620     if (child !== null) {
       
  4621       collectFocusableElements(child, focusableElements);
       
  4622     }
       
  4623     return focusableElements;
       
  4624   },
       
  4625 
       
  4626   getActiveDocument: getActiveDocument,
       
  4627   objectAssign: _assign,
       
  4628   getTimeStamp: function () {
       
  4629     validateResponderContext();
       
  4630     return currentTimeStamp;
       
  4631   },
       
  4632   isTargetWithinHostComponent: function (target, elementType) {
       
  4633     validateResponderContext();
       
  4634     var fiber = getClosestInstanceFromNode(target);
       
  4635 
       
  4636     while (fiber !== null) {
       
  4637       if (fiber.tag === HostComponent && fiber.type === elementType) {
       
  4638         return true;
       
  4639       }
       
  4640       fiber = fiber.return;
       
  4641     }
       
  4642     return false;
       
  4643   },
       
  4644 
       
  4645   enqueueStateRestore: enqueueStateRestore
       
  4646 };
       
  4647 
       
  4648 function validateEventValue(eventValue) {
       
  4649   if (typeof eventValue === 'object' && eventValue !== null) {
       
  4650     var target = eventValue.target,
       
  4651         type = eventValue.type,
       
  4652         _timeStamp = eventValue.timeStamp;
       
  4653 
       
  4654 
       
  4655     if (target == null || type == null || _timeStamp == null) {
       
  4656       throw new Error('context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.');
       
  4657     }
       
  4658     var showWarning = function (name) {
       
  4659       {
       
  4660         warning$1(false, '%s is not available on event objects created from event responder modules (React Flare). ' + 'Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.%s }`', name, name);
       
  4661       }
       
  4662     };
       
  4663     eventValue.preventDefault = function () {
       
  4664       {
       
  4665         showWarning('preventDefault()');
       
  4666       }
       
  4667     };
       
  4668     eventValue.stopPropagation = function () {
       
  4669       {
       
  4670         showWarning('stopPropagation()');
       
  4671       }
       
  4672     };
       
  4673     eventValue.isDefaultPrevented = function () {
       
  4674       {
       
  4675         showWarning('isDefaultPrevented()');
       
  4676       }
       
  4677     };
       
  4678     eventValue.isPropagationStopped = function () {
       
  4679       {
       
  4680         showWarning('isPropagationStopped()');
       
  4681       }
       
  4682     };
       
  4683     // $FlowFixMe: we don't need value, Flow thinks we do
       
  4684     Object.defineProperty(eventValue, 'nativeEvent', {
       
  4685       get: function () {
       
  4686         {
       
  4687           showWarning('nativeEvent');
       
  4688         }
       
  4689       }
       
  4690     });
       
  4691   }
       
  4692 }
       
  4693 
       
  4694 function collectFocusableElements(node, focusableElements) {
       
  4695   if (isFiberSuspenseAndTimedOut(node)) {
       
  4696     var fallbackChild = getSuspenseFallbackChild(node);
       
  4697     if (fallbackChild !== null) {
       
  4698       collectFocusableElements(fallbackChild, focusableElements);
       
  4699     }
       
  4700   } else {
       
  4701     if (isFiberHostComponentFocusable(node)) {
       
  4702       focusableElements.push(node.stateNode);
       
  4703     } else {
       
  4704       var child = node.child;
       
  4705 
       
  4706       if (child !== null) {
       
  4707         collectFocusableElements(child, focusableElements);
       
  4708       }
       
  4709     }
       
  4710   }
       
  4711   var sibling = node.sibling;
       
  4712 
       
  4713   if (sibling !== null) {
       
  4714     collectFocusableElements(sibling, focusableElements);
       
  4715   }
       
  4716 }
       
  4717 
       
  4718 function createEventQueueItem(value, listener) {
       
  4719   return {
       
  4720     value: value,
       
  4721     listener: listener
       
  4722   };
       
  4723 }
       
  4724 
       
  4725 function doesFiberHaveResponder(fiber, responder) {
       
  4726   if (fiber.tag === HostComponent) {
       
  4727     var dependencies = fiber.dependencies;
       
  4728     if (dependencies !== null) {
       
  4729       var respondersMap = dependencies.responders;
       
  4730       if (respondersMap !== null && respondersMap.has(responder)) {
       
  4731         return true;
       
  4732       }
       
  4733     }
       
  4734   }
       
  4735   return false;
       
  4736 }
       
  4737 
       
  4738 function getActiveDocument() {
       
  4739   return currentDocument;
       
  4740 }
       
  4741 
       
  4742 function releaseOwnershipForEventResponderInstance(eventResponderInstance) {
       
  4743   if (globalOwner === eventResponderInstance) {
       
  4744     globalOwner = null;
       
  4745     triggerOwnershipListeners();
       
  4746     return true;
       
  4747   }
       
  4748   return false;
       
  4749 }
       
  4750 
       
  4751 function isFiberHostComponentFocusable(fiber) {
       
  4752   if (fiber.tag !== HostComponent) {
       
  4753     return false;
       
  4754   }
       
  4755   var type = fiber.type,
       
  4756       memoizedProps = fiber.memoizedProps;
       
  4757 
       
  4758   if (memoizedProps.tabIndex === -1 || memoizedProps.disabled) {
       
  4759     return false;
       
  4760   }
       
  4761   if (memoizedProps.tabIndex === 0 || memoizedProps.contentEditable === true) {
       
  4762     return true;
       
  4763   }
       
  4764   if (type === 'a' || type === 'area') {
       
  4765     return !!memoizedProps.href && memoizedProps.rel !== 'ignore';
       
  4766   }
       
  4767   if (type === 'input') {
       
  4768     return memoizedProps.type !== 'hidden' && memoizedProps.type !== 'file';
       
  4769   }
       
  4770   return type === 'button' || type === 'textarea' || type === 'object' || type === 'select' || type === 'iframe' || type === 'embed';
       
  4771 }
       
  4772 
       
  4773 function processTimers(timers, delay) {
       
  4774   var timersArr = Array.from(timers.values());
       
  4775   currentEventQueuePriority = ContinuousEvent;
       
  4776   try {
       
  4777     for (var i = 0; i < timersArr.length; i++) {
       
  4778       var _timersArr$i = timersArr[i],
       
  4779           _instance = _timersArr$i.instance,
       
  4780           _func = _timersArr$i.func,
       
  4781           _id2 = _timersArr$i.id,
       
  4782           _timeStamp2 = _timersArr$i.timeStamp;
       
  4783 
       
  4784       currentInstance = _instance;
       
  4785       currentEventQueue = [];
       
  4786       currentTimeStamp = _timeStamp2 + delay;
       
  4787       try {
       
  4788         _func();
       
  4789       } finally {
       
  4790         activeTimeouts.delete(_id2);
       
  4791       }
       
  4792     }
       
  4793     processEventQueue();
       
  4794   } finally {
       
  4795     currentTimers = null;
       
  4796     currentInstance = null;
       
  4797     currentEventQueue = null;
       
  4798     currentTimeStamp = 0;
       
  4799   }
       
  4800 }
       
  4801 
       
  4802 function createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, passive, passiveSupported) {
       
  4803   var _ref = nativeEvent,
       
  4804       pointerType = _ref.pointerType;
       
  4805 
       
  4806   var eventPointerType = '';
       
  4807   var pointerId = null;
       
  4808 
       
  4809   if (pointerType !== undefined) {
       
  4810     eventPointerType = pointerType;
       
  4811     pointerId = nativeEvent.pointerId;
       
  4812   } else if (nativeEvent.key !== undefined) {
       
  4813     eventPointerType = 'keyboard';
       
  4814   } else if (nativeEvent.button !== undefined) {
       
  4815     eventPointerType = 'mouse';
       
  4816   } else if (nativeEvent.changedTouches !== undefined) {
       
  4817     eventPointerType = 'touch';
       
  4818   }
       
  4819 
       
  4820   return {
       
  4821     nativeEvent: nativeEvent,
       
  4822     passive: passive,
       
  4823     passiveSupported: passiveSupported,
       
  4824     pointerId: pointerId,
       
  4825     pointerType: eventPointerType,
       
  4826     responderTarget: null,
       
  4827     target: nativeEventTarget,
       
  4828     type: topLevelType
       
  4829   };
       
  4830 }
       
  4831 
       
  4832 function processEvents(eventQueue) {
       
  4833   for (var i = 0, length = eventQueue.length; i < length; i++) {
       
  4834     var _eventQueue$i = eventQueue[i],
       
  4835         _value = _eventQueue$i.value,
       
  4836         _listener = _eventQueue$i.listener;
       
  4837 
       
  4838     var type = typeof _value === 'object' && _value !== null ? _value.type : '';
       
  4839     invokeGuardedCallbackAndCatchFirstError(type, _listener, undefined, _value);
       
  4840   }
       
  4841 }
       
  4842 
       
  4843 function processEventQueue() {
       
  4844   var eventQueue = currentEventQueue;
       
  4845   if (eventQueue.length === 0) {
       
  4846     return;
       
  4847   }
       
  4848   switch (currentEventQueuePriority) {
       
  4849     case DiscreteEvent:
       
  4850       {
       
  4851         flushDiscreteUpdatesIfNeeded(currentTimeStamp);
       
  4852         discreteUpdates(function () {
       
  4853           batchedEventUpdates(processEvents, eventQueue);
       
  4854         });
       
  4855         break;
       
  4856       }
       
  4857     case UserBlockingEvent:
       
  4858       {
       
  4859         if (enableUserBlockingEvents) {
       
  4860           runWithPriority$1(UserBlockingPriority$1, batchedEventUpdates.bind(null, processEvents, eventQueue));
       
  4861         } else {
       
  4862           batchedEventUpdates(processEvents, eventQueue);
       
  4863         }
       
  4864         break;
       
  4865       }
       
  4866     case ContinuousEvent:
       
  4867       {
       
  4868         batchedEventUpdates(processEvents, eventQueue);
       
  4869         break;
       
  4870       }
       
  4871   }
       
  4872 }
       
  4873 
       
  4874 function responderEventTypesContainType(eventTypes, type) {
       
  4875   for (var i = 0, len = eventTypes.length; i < len; i++) {
       
  4876     if (eventTypes[i] === type) {
       
  4877       return true;
       
  4878     }
       
  4879   }
       
  4880   return false;
       
  4881 }
       
  4882 
       
  4883 function validateResponderTargetEventTypes(eventType, responder) {
       
  4884   var targetEventTypes = responder.targetEventTypes;
       
  4885   // Validate the target event type exists on the responder
       
  4886 
       
  4887   if (targetEventTypes !== null) {
       
  4888     return responderEventTypesContainType(targetEventTypes, eventType);
       
  4889   }
       
  4890   return false;
       
  4891 }
       
  4892 
       
  4893 function validateOwnership(responderInstance) {
       
  4894   return globalOwner === null || globalOwner === responderInstance;
       
  4895 }
       
  4896 
       
  4897 function traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
  4898   var isPassiveEvent = (eventSystemFlags & IS_PASSIVE) !== 0;
       
  4899   var isPassiveSupported = (eventSystemFlags & PASSIVE_NOT_SUPPORTED) === 0;
       
  4900   var isPassive = isPassiveEvent || !isPassiveSupported;
       
  4901   var eventType = isPassive ? topLevelType : topLevelType + '_active';
       
  4902 
       
  4903   // Trigger event responders in this order:
       
  4904   // - Bubble target responder phase
       
  4905   // - Root responder phase
       
  4906 
       
  4907   var visitedResponders = new Set();
       
  4908   var responderEvent = createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, isPassiveEvent, isPassiveSupported);
       
  4909   var node = targetFiber;
       
  4910   while (node !== null) {
       
  4911     var _node = node,
       
  4912         dependencies = _node.dependencies,
       
  4913         tag = _node.tag;
       
  4914 
       
  4915     if (tag === HostComponent && dependencies !== null) {
       
  4916       var respondersMap = dependencies.responders;
       
  4917       if (respondersMap !== null) {
       
  4918         var responderInstances = Array.from(respondersMap.values());
       
  4919         for (var i = 0, length = responderInstances.length; i < length; i++) {
       
  4920           var responderInstance = responderInstances[i];
       
  4921 
       
  4922           if (validateOwnership(responderInstance)) {
       
  4923             var props = responderInstance.props,
       
  4924                 responder = responderInstance.responder,
       
  4925                 state = responderInstance.state,
       
  4926                 target = responderInstance.target;
       
  4927 
       
  4928             if (!visitedResponders.has(responder) && validateResponderTargetEventTypes(eventType, responder)) {
       
  4929               visitedResponders.add(responder);
       
  4930               var onEvent = responder.onEvent;
       
  4931               if (onEvent !== null) {
       
  4932                 currentInstance = responderInstance;
       
  4933                 responderEvent.responderTarget = target;
       
  4934                 onEvent(responderEvent, eventResponderContext, props, state);
       
  4935               }
       
  4936             }
       
  4937           }
       
  4938         }
       
  4939       }
       
  4940     }
       
  4941     node = node.return;
       
  4942   }
       
  4943   // Root phase
       
  4944   var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(eventType);
       
  4945   if (rootEventResponderInstances !== undefined) {
       
  4946     var _responderInstances = Array.from(rootEventResponderInstances);
       
  4947 
       
  4948     for (var _i = 0; _i < _responderInstances.length; _i++) {
       
  4949       var _responderInstance = _responderInstances[_i];
       
  4950       if (!validateOwnership(_responderInstance)) {
       
  4951         continue;
       
  4952       }
       
  4953       var _props = _responderInstance.props,
       
  4954           _responder = _responderInstance.responder,
       
  4955           _state = _responderInstance.state,
       
  4956           _target = _responderInstance.target;
       
  4957 
       
  4958       var onRootEvent = _responder.onRootEvent;
       
  4959       if (onRootEvent !== null) {
       
  4960         currentInstance = _responderInstance;
       
  4961         responderEvent.responderTarget = _target;
       
  4962         onRootEvent(responderEvent, eventResponderContext, _props, _state);
       
  4963       }
       
  4964     }
       
  4965   }
       
  4966 }
       
  4967 
       
  4968 function triggerOwnershipListeners() {
       
  4969   var listeningInstances = Array.from(ownershipChangeListeners);
       
  4970   var previousInstance = currentInstance;
       
  4971   var previousEventQueuePriority = currentEventQueuePriority;
       
  4972   var previousEventQueue = currentEventQueue;
       
  4973   try {
       
  4974     for (var i = 0; i < listeningInstances.length; i++) {
       
  4975       var _instance2 = listeningInstances[i];
       
  4976       var props = _instance2.props,
       
  4977           responder = _instance2.responder,
       
  4978           state = _instance2.state;
       
  4979 
       
  4980       currentInstance = _instance2;
       
  4981       currentEventQueuePriority = ContinuousEvent;
       
  4982       currentEventQueue = [];
       
  4983       var onOwnershipChange = responder.onOwnershipChange;
       
  4984       if (onOwnershipChange !== null) {
       
  4985         onOwnershipChange(eventResponderContext, props, state);
       
  4986       }
       
  4987     }
       
  4988     processEventQueue();
       
  4989   } finally {
       
  4990     currentInstance = previousInstance;
       
  4991     currentEventQueue = previousEventQueue;
       
  4992     currentEventQueuePriority = previousEventQueuePriority;
       
  4993   }
       
  4994 }
       
  4995 
       
  4996 function mountEventResponder(responder, responderInstance, props, state) {
       
  4997   if (responder.onOwnershipChange !== null) {
       
  4998     ownershipChangeListeners.add(responderInstance);
       
  4999   }
       
  5000   var onMount = responder.onMount;
       
  5001   if (onMount !== null) {
       
  5002     currentEventQueuePriority = ContinuousEvent;
       
  5003     currentInstance = responderInstance;
       
  5004     currentEventQueue = [];
       
  5005     try {
       
  5006       onMount(eventResponderContext, props, state);
       
  5007       processEventQueue();
       
  5008     } finally {
       
  5009       currentEventQueue = null;
       
  5010       currentInstance = null;
       
  5011       currentTimers = null;
       
  5012     }
       
  5013   }
       
  5014 }
       
  5015 
       
  5016 function unmountEventResponder(responderInstance) {
       
  5017   var responder = responderInstance.responder;
       
  5018   var onUnmount = responder.onUnmount;
       
  5019   if (onUnmount !== null) {
       
  5020     var props = responderInstance.props,
       
  5021         state = responderInstance.state;
       
  5022 
       
  5023     currentEventQueue = [];
       
  5024     currentEventQueuePriority = ContinuousEvent;
       
  5025     currentInstance = responderInstance;
       
  5026     try {
       
  5027       onUnmount(eventResponderContext, props, state);
       
  5028       processEventQueue();
       
  5029     } finally {
       
  5030       currentEventQueue = null;
       
  5031       currentInstance = null;
       
  5032       currentTimers = null;
       
  5033     }
       
  5034   }
       
  5035   releaseOwnershipForEventResponderInstance(responderInstance);
       
  5036   if (responder.onOwnershipChange !== null) {
       
  5037     ownershipChangeListeners.delete(responderInstance);
       
  5038   }
       
  5039   var rootEventTypesSet = responderInstance.rootEventTypes;
       
  5040   if (rootEventTypesSet !== null) {
       
  5041     var rootEventTypes = Array.from(rootEventTypesSet);
       
  5042 
       
  5043     for (var i = 0; i < rootEventTypes.length; i++) {
       
  5044       var topLevelEventType = rootEventTypes[i];
       
  5045       var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(topLevelEventType);
       
  5046       if (rootEventResponderInstances !== undefined) {
       
  5047         rootEventResponderInstances.delete(responderInstance);
       
  5048       }
       
  5049     }
       
  5050   }
       
  5051 }
       
  5052 
       
  5053 function validateResponderContext() {
       
  5054   (function () {
       
  5055     if (!(currentInstance !== null)) {
       
  5056       {
       
  5057         throw ReactError(Error('An event responder context was used outside of an event cycle. Use context.setTimeout() to use asynchronous responder context outside of event cycle .'));
       
  5058       }
       
  5059     }
       
  5060   })();
       
  5061 }
       
  5062 
       
  5063 function dispatchEventForResponderEventSystem(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
  5064   if (enableFlareAPI) {
       
  5065     var previousEventQueue = currentEventQueue;
       
  5066     var previousInstance = currentInstance;
       
  5067     var previousTimers = currentTimers;
       
  5068     var previousTimeStamp = currentTimeStamp;
       
  5069     var previousDocument = currentDocument;
       
  5070     var previousEventQueuePriority = currentEventQueuePriority;
       
  5071     currentTimers = null;
       
  5072     currentEventQueue = [];
       
  5073     currentEventQueuePriority = ContinuousEvent;
       
  5074     // nodeType 9 is DOCUMENT_NODE
       
  5075     currentDocument = nativeEventTarget.nodeType === 9 ? nativeEventTarget : nativeEventTarget.ownerDocument;
       
  5076     // We might want to control timeStamp another way here
       
  5077     currentTimeStamp = nativeEvent.timeStamp;
       
  5078     try {
       
  5079       traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags);
       
  5080       processEventQueue();
       
  5081     } finally {
       
  5082       currentTimers = previousTimers;
       
  5083       currentInstance = previousInstance;
       
  5084       currentEventQueue = previousEventQueue;
       
  5085       currentTimeStamp = previousTimeStamp;
       
  5086       currentDocument = previousDocument;
       
  5087       currentEventQueuePriority = previousEventQueuePriority;
       
  5088     }
       
  5089   }
       
  5090 }
       
  5091 
       
  5092 function addRootEventTypesForResponderInstance(responderInstance, rootEventTypes) {
       
  5093   for (var i = 0; i < rootEventTypes.length; i++) {
       
  5094     var rootEventType = rootEventTypes[i];
       
  5095     registerRootEventType(rootEventType, responderInstance);
       
  5096   }
       
  5097 }
       
  5098 
       
  5099 function registerRootEventType(rootEventType, eventResponderInstance) {
       
  5100   var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(rootEventType);
       
  5101   if (rootEventResponderInstances === undefined) {
       
  5102     rootEventResponderInstances = new Set();
       
  5103     rootEventTypesToEventResponderInstances.set(rootEventType, rootEventResponderInstances);
       
  5104   }
       
  5105   var rootEventTypesSet = eventResponderInstance.rootEventTypes;
       
  5106   if (rootEventTypesSet === null) {
       
  5107     rootEventTypesSet = eventResponderInstance.rootEventTypes = new Set();
       
  5108   }
       
  5109   (function () {
       
  5110     if (!!rootEventTypesSet.has(rootEventType)) {
       
  5111       {
       
  5112         throw ReactError(Error('addRootEventTypes() found a duplicate root event type of "' + rootEventType + '". This might be because the event type exists in the event responder "rootEventTypes" array or because of a previous addRootEventTypes() using this root event type.'));
       
  5113       }
       
  5114     }
       
  5115   })();
       
  5116   rootEventTypesSet.add(rootEventType);
       
  5117   rootEventResponderInstances.add(eventResponderInstance);
       
  5118 }
       
  5119 
  4110 /**
  5120 /**
  4111  * `ReactInstanceMap` maintains a mapping from a public facing stateful
  5121  * `ReactInstanceMap` maintains a mapping from a public facing stateful
  4112  * instance (key) and the internal representation (value). This allows public
  5122  * instance (key) and the internal representation (value). This allows public
  4113  * methods to accept the user facing instance as an argument and map them back
  5123  * methods to accept the user facing instance as an argument and map them back
  4114  * to internal methods.
  5124  * to internal methods.
  4217   }
  5227   }
  4218   return isFiberMountedImpl(fiber) === MOUNTED;
  5228   return isFiberMountedImpl(fiber) === MOUNTED;
  4219 }
  5229 }
  4220 
  5230 
  4221 function assertIsMounted(fiber) {
  5231 function assertIsMounted(fiber) {
  4222   !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
  5232   (function () {
       
  5233     if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
       
  5234       {
       
  5235         throw ReactError(Error('Unable to find node on an unmounted component.'));
       
  5236       }
       
  5237     }
       
  5238   })();
  4223 }
  5239 }
  4224 
  5240 
  4225 function findCurrentFiberUsingSlowPath(fiber) {
  5241 function findCurrentFiberUsingSlowPath(fiber) {
  4226   var alternate = fiber.alternate;
  5242   var alternate = fiber.alternate;
  4227   if (!alternate) {
  5243   if (!alternate) {
  4228     // If there is no alternate, then we only need to check if it is mounted.
  5244     // If there is no alternate, then we only need to check if it is mounted.
  4229     var state = isFiberMountedImpl(fiber);
  5245     var state = isFiberMountedImpl(fiber);
  4230     !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
  5246     (function () {
       
  5247       if (!(state !== UNMOUNTED)) {
       
  5248         {
       
  5249           throw ReactError(Error('Unable to find node on an unmounted component.'));
       
  5250         }
       
  5251       }
       
  5252     })();
  4231     if (state === MOUNTING) {
  5253     if (state === MOUNTING) {
  4232       return null;
  5254       return null;
  4233     }
  5255     }
  4234     return fiber;
  5256     return fiber;
  4235   }
  5257   }
  4238   // special cases and we'll deal with them.
  5260   // special cases and we'll deal with them.
  4239   var a = fiber;
  5261   var a = fiber;
  4240   var b = alternate;
  5262   var b = alternate;
  4241   while (true) {
  5263   while (true) {
  4242     var parentA = a.return;
  5264     var parentA = a.return;
  4243     var parentB = parentA ? parentA.alternate : null;
  5265     if (parentA === null) {
  4244     if (!parentA || !parentB) {
       
  4245       // We're at the root.
  5266       // We're at the root.
       
  5267       break;
       
  5268     }
       
  5269     var parentB = parentA.alternate;
       
  5270     if (parentB === null) {
       
  5271       // There is no alternate. This is an unusual case. Currently, it only
       
  5272       // happens when a Suspense component is hidden. An extra fragment fiber
       
  5273       // is inserted in between the Suspense fiber and its children. Skip
       
  5274       // over this extra fragment fiber and proceed to the next parent.
       
  5275       var nextParent = parentA.return;
       
  5276       if (nextParent !== null) {
       
  5277         a = b = nextParent;
       
  5278         continue;
       
  5279       }
       
  5280       // If there's no parent, we're at the root.
  4246       break;
  5281       break;
  4247     }
  5282     }
  4248 
  5283 
  4249     // If both copies of the parent fiber point to the same child, we can
  5284     // If both copies of the parent fiber point to the same child, we can
  4250     // assume that the child is current. This happens when we bailout on low
  5285     // assume that the child is current. This happens when we bailout on low
  4264         }
  5299         }
  4265         child = child.sibling;
  5300         child = child.sibling;
  4266       }
  5301       }
  4267       // We should never have an alternate for any mounting node. So the only
  5302       // We should never have an alternate for any mounting node. So the only
  4268       // way this could possibly happen is if this was unmounted, if at all.
  5303       // way this could possibly happen is if this was unmounted, if at all.
  4269       invariant(false, 'Unable to find node on an unmounted component.');
  5304       (function () {
       
  5305         {
       
  5306           {
       
  5307             throw ReactError(Error('Unable to find node on an unmounted component.'));
       
  5308           }
       
  5309         }
       
  5310       })();
  4270     }
  5311     }
  4271 
  5312 
  4272     if (a.return !== b.return) {
  5313     if (a.return !== b.return) {
  4273       // The return pointer of A and the return pointer of B point to different
  5314       // The return pointer of A and the return pointer of B point to different
  4274       // fibers. We assume that return pointers never criss-cross, so A must
  5315       // fibers. We assume that return pointers never criss-cross, so A must
  4315             a = parentA;
  5356             a = parentA;
  4316             break;
  5357             break;
  4317           }
  5358           }
  4318           _child = _child.sibling;
  5359           _child = _child.sibling;
  4319         }
  5360         }
  4320         !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0;
  5361         (function () {
  4321       }
  5362           if (!didFindChild) {
  4322     }
  5363             {
  4323 
  5364               throw ReactError(Error('Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.'));
  4324     !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0;
  5365             }
       
  5366           }
       
  5367         })();
       
  5368       }
       
  5369     }
       
  5370 
       
  5371     (function () {
       
  5372       if (!(a.alternate === b)) {
       
  5373         {
       
  5374           throw ReactError(Error('Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.'));
       
  5375         }
       
  5376       }
       
  5377     })();
  4325   }
  5378   }
  4326   // If the root is not a host container, we're in a disconnected tree. I.e.
  5379   // If the root is not a host container, we're in a disconnected tree. I.e.
  4327   // unmounted.
  5380   // unmounted.
  4328   !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
  5381   (function () {
       
  5382     if (!(a.tag === HostRoot)) {
       
  5383       {
       
  5384         throw ReactError(Error('Unable to find node on an unmounted component.'));
       
  5385       }
       
  5386     }
       
  5387   })();
  4329   if (a.stateNode.current === a) {
  5388   if (a.stateNode.current === a) {
  4330     // We've determined that A is the current branch.
  5389     // We've determined that A is the current branch.
  4331     return fiber;
  5390     return fiber;
  4332   }
  5391   }
  4333   // Otherwise B has to be current branch.
  5392   // Otherwise B has to be current branch.
  4374   }
  5433   }
  4375 
  5434 
  4376   // Next we'll drill down this component to find the first HostComponent/Text.
  5435   // Next we'll drill down this component to find the first HostComponent/Text.
  4377   var node = currentParent;
  5436   var node = currentParent;
  4378   while (true) {
  5437   while (true) {
  4379     if (node.tag === HostComponent || node.tag === HostText) {
  5438     if (node.tag === HostComponent || node.tag === HostText || node.tag === FundamentalComponent) {
  4380       return node;
  5439       return node;
  4381     } else if (node.child && node.tag !== HostPortal) {
  5440     } else if (node.child && node.tag !== HostPortal) {
  4382       node.child.return = node;
  5441       node.child.return = node;
  4383       node = node.child;
  5442       node = node.child;
  4384       continue;
  5443       continue;
  4404   element.addEventListener(eventType, listener, false);
  5463   element.addEventListener(eventType, listener, false);
  4405 }
  5464 }
  4406 
  5465 
  4407 function addEventCaptureListener(element, eventType, listener) {
  5466 function addEventCaptureListener(element, eventType, listener) {
  4408   element.addEventListener(eventType, listener, true);
  5467   element.addEventListener(eventType, listener, true);
       
  5468 }
       
  5469 
       
  5470 function addEventCaptureListenerWithPassiveFlag(element, eventType, listener, passive) {
       
  5471   element.addEventListener(eventType, listener, {
       
  5472     capture: true,
       
  5473     passive: passive
       
  5474   });
  4409 }
  5475 }
  4410 
  5476 
  4411 /**
  5477 /**
  4412  * @interface Event
  5478  * @interface Event
  4413  * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  5479  * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  4701  * topLevelEventsToDispatchConfig = new Map([
  5767  * topLevelEventsToDispatchConfig = new Map([
  4702  *   [TOP_ABORT, { sameConfig }],
  5768  *   [TOP_ABORT, { sameConfig }],
  4703  * ]);
  5769  * ]);
  4704  */
  5770  */
  4705 
  5771 
  4706 var interactiveEventTypeNames = [[TOP_BLUR, 'blur'], [TOP_CANCEL, 'cancel'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_AUX_CLICK, 'auxClick'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_START, 'dragStart'], [TOP_DROP, 'drop'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_INVALID, 'invalid'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_POINTER_CANCEL, 'pointerCancel'], [TOP_POINTER_DOWN, 'pointerDown'], [TOP_POINTER_UP, 'pointerUp'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_RESET, 'reset'], [TOP_SEEKED, 'seeked'], [TOP_SUBMIT, 'submit'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_START, 'touchStart'], [TOP_VOLUME_CHANGE, 'volumeChange']];
  5772 var eventTuples = [
  4707 var nonInteractiveEventTypeNames = [[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_DRAG, 'drag'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_LOAD_START, 'loadStart'], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_PLAYING, 'playing'], [TOP_POINTER_MOVE, 'pointerMove'], [TOP_POINTER_OUT, 'pointerOut'], [TOP_POINTER_OVER, 'pointerOver'], [TOP_PROGRESS, 'progress'], [TOP_SCROLL, 'scroll'], [TOP_SEEKING, 'seeking'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']];
  5773 // Discrete events
       
  5774 [TOP_BLUR, 'blur', DiscreteEvent], [TOP_CANCEL, 'cancel', DiscreteEvent], [TOP_CLICK, 'click', DiscreteEvent], [TOP_CLOSE, 'close', DiscreteEvent], [TOP_CONTEXT_MENU, 'contextMenu', DiscreteEvent], [TOP_COPY, 'copy', DiscreteEvent], [TOP_CUT, 'cut', DiscreteEvent], [TOP_AUX_CLICK, 'auxClick', DiscreteEvent], [TOP_DOUBLE_CLICK, 'doubleClick', DiscreteEvent], [TOP_DRAG_END, 'dragEnd', DiscreteEvent], [TOP_DRAG_START, 'dragStart', DiscreteEvent], [TOP_DROP, 'drop', DiscreteEvent], [TOP_FOCUS, 'focus', DiscreteEvent], [TOP_INPUT, 'input', DiscreteEvent], [TOP_INVALID, 'invalid', DiscreteEvent], [TOP_KEY_DOWN, 'keyDown', DiscreteEvent], [TOP_KEY_PRESS, 'keyPress', DiscreteEvent], [TOP_KEY_UP, 'keyUp', DiscreteEvent], [TOP_MOUSE_DOWN, 'mouseDown', DiscreteEvent], [TOP_MOUSE_UP, 'mouseUp', DiscreteEvent], [TOP_PASTE, 'paste', DiscreteEvent], [TOP_PAUSE, 'pause', DiscreteEvent], [TOP_PLAY, 'play', DiscreteEvent], [TOP_POINTER_CANCEL, 'pointerCancel', DiscreteEvent], [TOP_POINTER_DOWN, 'pointerDown', DiscreteEvent], [TOP_POINTER_UP, 'pointerUp', DiscreteEvent], [TOP_RATE_CHANGE, 'rateChange', DiscreteEvent], [TOP_RESET, 'reset', DiscreteEvent], [TOP_SEEKED, 'seeked', DiscreteEvent], [TOP_SUBMIT, 'submit', DiscreteEvent], [TOP_TOUCH_CANCEL, 'touchCancel', DiscreteEvent], [TOP_TOUCH_END, 'touchEnd', DiscreteEvent], [TOP_TOUCH_START, 'touchStart', DiscreteEvent], [TOP_VOLUME_CHANGE, 'volumeChange', DiscreteEvent],
       
  5775 
       
  5776 // User-blocking events
       
  5777 [TOP_DRAG, 'drag', UserBlockingEvent], [TOP_DRAG_ENTER, 'dragEnter', UserBlockingEvent], [TOP_DRAG_EXIT, 'dragExit', UserBlockingEvent], [TOP_DRAG_LEAVE, 'dragLeave', UserBlockingEvent], [TOP_DRAG_OVER, 'dragOver', UserBlockingEvent], [TOP_MOUSE_MOVE, 'mouseMove', UserBlockingEvent], [TOP_MOUSE_OUT, 'mouseOut', UserBlockingEvent], [TOP_MOUSE_OVER, 'mouseOver', UserBlockingEvent], [TOP_POINTER_MOVE, 'pointerMove', UserBlockingEvent], [TOP_POINTER_OUT, 'pointerOut', UserBlockingEvent], [TOP_POINTER_OVER, 'pointerOver', UserBlockingEvent], [TOP_SCROLL, 'scroll', UserBlockingEvent], [TOP_TOGGLE, 'toggle', UserBlockingEvent], [TOP_TOUCH_MOVE, 'touchMove', UserBlockingEvent], [TOP_WHEEL, 'wheel', UserBlockingEvent],
       
  5778 
       
  5779 // Continuous events
       
  5780 [TOP_ABORT, 'abort', ContinuousEvent], [TOP_ANIMATION_END, 'animationEnd', ContinuousEvent], [TOP_ANIMATION_ITERATION, 'animationIteration', ContinuousEvent], [TOP_ANIMATION_START, 'animationStart', ContinuousEvent], [TOP_CAN_PLAY, 'canPlay', ContinuousEvent], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough', ContinuousEvent], [TOP_DURATION_CHANGE, 'durationChange', ContinuousEvent], [TOP_EMPTIED, 'emptied', ContinuousEvent], [TOP_ENCRYPTED, 'encrypted', ContinuousEvent], [TOP_ENDED, 'ended', ContinuousEvent], [TOP_ERROR, 'error', ContinuousEvent], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture', ContinuousEvent], [TOP_LOAD, 'load', ContinuousEvent], [TOP_LOADED_DATA, 'loadedData', ContinuousEvent], [TOP_LOADED_METADATA, 'loadedMetadata', ContinuousEvent], [TOP_LOAD_START, 'loadStart', ContinuousEvent], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture', ContinuousEvent], [TOP_PLAYING, 'playing', ContinuousEvent], [TOP_PROGRESS, 'progress', ContinuousEvent], [TOP_SEEKING, 'seeking', ContinuousEvent], [TOP_STALLED, 'stalled', ContinuousEvent], [TOP_SUSPEND, 'suspend', ContinuousEvent], [TOP_TIME_UPDATE, 'timeUpdate', ContinuousEvent], [TOP_TRANSITION_END, 'transitionEnd', ContinuousEvent], [TOP_WAITING, 'waiting', ContinuousEvent]];
  4708 
  5781 
  4709 var eventTypes$4 = {};
  5782 var eventTypes$4 = {};
  4710 var topLevelEventsToDispatchConfig = {};
  5783 var topLevelEventsToDispatchConfig = {};
  4711 
  5784 
  4712 function addEventTypeNameToConfig(_ref, isInteractive) {
  5785 for (var i = 0; i < eventTuples.length; i++) {
  4713   var topEvent = _ref[0],
  5786   var eventTuple = eventTuples[i];
  4714       event = _ref[1];
  5787   var topEvent = eventTuple[0];
       
  5788   var event = eventTuple[1];
       
  5789   var eventPriority = eventTuple[2];
  4715 
  5790 
  4716   var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  5791   var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  4717   var onEvent = 'on' + capitalizedEvent;
  5792   var onEvent = 'on' + capitalizedEvent;
  4718 
  5793 
  4719   var type = {
  5794   var config = {
  4720     phasedRegistrationNames: {
  5795     phasedRegistrationNames: {
  4721       bubbled: onEvent,
  5796       bubbled: onEvent,
  4722       captured: onEvent + 'Capture'
  5797       captured: onEvent + 'Capture'
  4723     },
  5798     },
  4724     dependencies: [topEvent],
  5799     dependencies: [topEvent],
  4725     isInteractive: isInteractive
  5800     eventPriority: eventPriority
  4726   };
  5801   };
  4727   eventTypes$4[event] = type;
  5802   eventTypes$4[event] = config;
  4728   topLevelEventsToDispatchConfig[topEvent] = type;
  5803   topLevelEventsToDispatchConfig[topEvent] = config;
  4729 }
  5804 }
  4730 
       
  4731 interactiveEventTypeNames.forEach(function (eventTuple) {
       
  4732   addEventTypeNameToConfig(eventTuple, true);
       
  4733 });
       
  4734 nonInteractiveEventTypeNames.forEach(function (eventTuple) {
       
  4735   addEventTypeNameToConfig(eventTuple, false);
       
  4736 });
       
  4737 
  5805 
  4738 // Only used in DEV for exhaustiveness validation.
  5806 // Only used in DEV for exhaustiveness validation.
  4739 var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
  5807 var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
  4740 
  5808 
  4741 var SimpleEventPlugin = {
  5809 var SimpleEventPlugin = {
  4742   eventTypes: eventTypes$4,
  5810   eventTypes: eventTypes$4,
  4743 
  5811 
  4744   isInteractiveTopLevelEventType: function (topLevelType) {
  5812   getEventPriority: function (topLevelType) {
  4745     var config = topLevelEventsToDispatchConfig[topLevelType];
  5813     var config = topLevelEventsToDispatchConfig[topLevelType];
  4746     return config !== undefined && config.isInteractive === true;
  5814     return config !== undefined ? config.eventPriority : ContinuousEvent;
  4747   },
  5815   },
  4748 
  5816 
  4749 
  5817 
  4750   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  5818   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  4751     var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  5819     var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  4849     accumulateTwoPhaseDispatches(event);
  5917     accumulateTwoPhaseDispatches(event);
  4850     return event;
  5918     return event;
  4851   }
  5919   }
  4852 };
  5920 };
  4853 
  5921 
  4854 var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType;
  5922 var passiveBrowserEventsSupported = false;
       
  5923 
       
  5924 // Check if browser support events with passive listeners
       
  5925 // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
       
  5926 if (enableFlareAPI && canUseDOM) {
       
  5927   try {
       
  5928     var options = {};
       
  5929     // $FlowFixMe: Ignore Flow complaining about needing a value
       
  5930     Object.defineProperty(options, 'passive', {
       
  5931       get: function () {
       
  5932         passiveBrowserEventsSupported = true;
       
  5933       }
       
  5934     });
       
  5935     window.addEventListener('test', options, options);
       
  5936     window.removeEventListener('test', options, options);
       
  5937   } catch (e) {
       
  5938     passiveBrowserEventsSupported = false;
       
  5939   }
       
  5940 }
       
  5941 
       
  5942 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
  5943 // CommonJS interop named imports.
       
  5944 var UserBlockingPriority = unstable_UserBlockingPriority;
       
  5945 var runWithPriority = unstable_runWithPriority;
       
  5946 var getEventPriority = SimpleEventPlugin.getEventPriority;
  4855 
  5947 
  4856 
  5948 
  4857 var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
  5949 var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
  4858 var callbackBookkeepingPool = [];
  5950 var callbackBookkeepingPool = [];
  4859 
  5951 
  4911   // event handlers, because event handlers can modify the DOM, leading to
  6003   // event handlers, because event handlers can modify the DOM, leading to
  4912   // inconsistencies with ReactMount's node cache. See #1105.
  6004   // inconsistencies with ReactMount's node cache. See #1105.
  4913   var ancestor = targetInst;
  6005   var ancestor = targetInst;
  4914   do {
  6006   do {
  4915     if (!ancestor) {
  6007     if (!ancestor) {
  4916       bookKeeping.ancestors.push(ancestor);
  6008       var _ancestors = bookKeeping.ancestors;
       
  6009       _ancestors.push(ancestor);
  4917       break;
  6010       break;
  4918     }
  6011     }
  4919     var root = findRootContainerNode(ancestor);
  6012     var root = findRootContainerNode(ancestor);
  4920     if (!root) {
  6013     if (!root) {
  4921       break;
  6014       break;
  4924     ancestor = getClosestInstanceFromNode(root);
  6017     ancestor = getClosestInstanceFromNode(root);
  4925   } while (ancestor);
  6018   } while (ancestor);
  4926 
  6019 
  4927   for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  6020   for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  4928     targetInst = bookKeeping.ancestors[i];
  6021     targetInst = bookKeeping.ancestors[i];
  4929     runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  6022     var eventTarget = getEventTarget(bookKeeping.nativeEvent);
       
  6023     var _topLevelType = bookKeeping.topLevelType;
       
  6024     var _nativeEvent = bookKeeping.nativeEvent;
       
  6025 
       
  6026     runExtractedPluginEventsInBatch(_topLevelType, targetInst, _nativeEvent, eventTarget);
  4930   }
  6027   }
  4931 }
  6028 }
  4932 
  6029 
  4933 // TODO: can we stop exporting these?
  6030 // TODO: can we stop exporting these?
  4934 var _enabled = true;
  6031 var _enabled = true;
  4939 
  6036 
  4940 function isEnabled() {
  6037 function isEnabled() {
  4941   return _enabled;
  6038   return _enabled;
  4942 }
  6039 }
  4943 
  6040 
  4944 /**
       
  4945  * Traps top-level events by using event bubbling.
       
  4946  *
       
  4947  * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  4948  * @param {object} element Element on which to attach listener.
       
  4949  * @return {?object} An object with a remove function which will forcefully
       
  4950  *                  remove the listener.
       
  4951  * @internal
       
  4952  */
       
  4953 function trapBubbledEvent(topLevelType, element) {
  6041 function trapBubbledEvent(topLevelType, element) {
  4954   if (!element) {
  6042   trapEventForPluginEventSystem(element, topLevelType, false);
  4955     return null;
  6043 }
  4956   }
  6044 
  4957   var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
       
  4958 
       
  4959   addEventBubbleListener(element, getRawEventName(topLevelType),
       
  4960   // Check if interactive and wrap in interactiveUpdates
       
  4961   dispatch.bind(null, topLevelType));
       
  4962 }
       
  4963 
       
  4964 /**
       
  4965  * Traps a top-level event by using event capturing.
       
  4966  *
       
  4967  * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  4968  * @param {object} element Element on which to attach listener.
       
  4969  * @return {?object} An object with a remove function which will forcefully
       
  4970  *                  remove the listener.
       
  4971  * @internal
       
  4972  */
       
  4973 function trapCapturedEvent(topLevelType, element) {
  6045 function trapCapturedEvent(topLevelType, element) {
  4974   if (!element) {
  6046   trapEventForPluginEventSystem(element, topLevelType, true);
  4975     return null;
  6047 }
  4976   }
  6048 
  4977   var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
  6049 function trapEventForResponderEventSystem(element, topLevelType, passive) {
  4978 
  6050   if (enableFlareAPI) {
  4979   addEventCaptureListener(element, getRawEventName(topLevelType),
  6051     var rawEventName = getRawEventName(topLevelType);
  4980   // Check if interactive and wrap in interactiveUpdates
  6052     var eventFlags = RESPONDER_EVENT_SYSTEM;
  4981   dispatch.bind(null, topLevelType));
  6053 
  4982 }
  6054     // If passive option is not supported, then the event will be
  4983 
  6055     // active and not passive, but we flag it as using not being
  4984 function dispatchInteractiveEvent(topLevelType, nativeEvent) {
  6056     // supported too. This way the responder event plugins know,
  4985   interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);
  6057     // and can provide polyfills if needed.
  4986 }
  6058     if (passive) {
  4987 
  6059       if (passiveBrowserEventsSupported) {
  4988 function dispatchEvent(topLevelType, nativeEvent) {
  6060         eventFlags |= IS_PASSIVE;
       
  6061       } else {
       
  6062         eventFlags |= IS_ACTIVE;
       
  6063         eventFlags |= PASSIVE_NOT_SUPPORTED;
       
  6064         passive = false;
       
  6065       }
       
  6066     } else {
       
  6067       eventFlags |= IS_ACTIVE;
       
  6068     }
       
  6069     // Check if interactive and wrap in discreteUpdates
       
  6070     var listener = dispatchEvent.bind(null, topLevelType, eventFlags);
       
  6071     if (passiveBrowserEventsSupported) {
       
  6072       addEventCaptureListenerWithPassiveFlag(element, rawEventName, listener, passive);
       
  6073     } else {
       
  6074       addEventCaptureListener(element, rawEventName, listener);
       
  6075     }
       
  6076   }
       
  6077 }
       
  6078 
       
  6079 function trapEventForPluginEventSystem(element, topLevelType, capture) {
       
  6080   var listener = void 0;
       
  6081   switch (getEventPriority(topLevelType)) {
       
  6082     case DiscreteEvent:
       
  6083       listener = dispatchDiscreteEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
       
  6084       break;
       
  6085     case UserBlockingEvent:
       
  6086       listener = dispatchUserBlockingUpdate.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
       
  6087       break;
       
  6088     case ContinuousEvent:
       
  6089     default:
       
  6090       listener = dispatchEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
       
  6091       break;
       
  6092   }
       
  6093 
       
  6094   var rawEventName = getRawEventName(topLevelType);
       
  6095   if (capture) {
       
  6096     addEventCaptureListener(element, rawEventName, listener);
       
  6097   } else {
       
  6098     addEventBubbleListener(element, rawEventName, listener);
       
  6099   }
       
  6100 }
       
  6101 
       
  6102 function dispatchDiscreteEvent(topLevelType, eventSystemFlags, nativeEvent) {
       
  6103   flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp);
       
  6104   discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, nativeEvent);
       
  6105 }
       
  6106 
       
  6107 function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, nativeEvent) {
       
  6108   if (enableUserBlockingEvents) {
       
  6109     runWithPriority(UserBlockingPriority, dispatchEvent.bind(null, topLevelType, eventSystemFlags, nativeEvent));
       
  6110   } else {
       
  6111     dispatchEvent(topLevelType, eventSystemFlags, nativeEvent);
       
  6112   }
       
  6113 }
       
  6114 
       
  6115 function dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) {
       
  6116   var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
       
  6117 
       
  6118   try {
       
  6119     // Event queue being processed in the same cycle allows
       
  6120     // `preventDefault`.
       
  6121     batchedEventUpdates(handleTopLevel, bookKeeping);
       
  6122   } finally {
       
  6123     releaseTopLevelCallbackBookKeeping(bookKeeping);
       
  6124   }
       
  6125 }
       
  6126 
       
  6127 function dispatchEvent(topLevelType, eventSystemFlags, nativeEvent) {
  4989   if (!_enabled) {
  6128   if (!_enabled) {
  4990     return;
  6129     return;
  4991   }
  6130   }
  4992 
       
  4993   var nativeEventTarget = getEventTarget(nativeEvent);
  6131   var nativeEventTarget = getEventTarget(nativeEvent);
  4994   var targetInst = getClosestInstanceFromNode(nativeEventTarget);
  6132   var targetInst = getClosestInstanceFromNode(nativeEventTarget);
       
  6133 
  4995   if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
  6134   if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
  4996     // If we get an event (ex: img onload) before committing that
  6135     // If we get an event (ex: img onload) before committing that
  4997     // component's mount, ignore it for now (that is, treat it as if it was an
  6136     // component's mount, ignore it for now (that is, treat it as if it was an
  4998     // event on a non-React tree). We might also consider queueing events and
  6137     // event on a non-React tree). We might also consider queueing events and
  4999     // dispatching them after the mount.
  6138     // dispatching them after the mount.
  5000     targetInst = null;
  6139     targetInst = null;
  5001   }
  6140   }
  5002 
  6141 
  5003   var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
  6142   if (enableFlareAPI) {
  5004 
  6143     if (eventSystemFlags === PLUGIN_EVENT_SYSTEM) {
  5005   try {
  6144       dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
  5006     // Event queue being processed in the same cycle allows
  6145     } else {
  5007     // `preventDefault`.
  6146       // React Flare event system
  5008     batchedUpdates(handleTopLevel, bookKeeping);
  6147       dispatchEventForResponderEventSystem(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
  5009   } finally {
  6148     }
  5010     releaseTopLevelCallbackBookKeeping(bookKeeping);
  6149   } else {
       
  6150     dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
  5011   }
  6151   }
  5012 }
  6152 }
  5013 
  6153 
  5014 /**
  6154 /**
  5015  * Summary of `ReactBrowserEventEmitter` event handling:
  6155  * Summary of `ReactBrowserEventEmitter` event handling:
  5065  * +-------------+   .
  6205  * +-------------+   .
  5066  *                   .
  6206  *                   .
  5067  *    React Core     .  General Purpose Event Plugin System
  6207  *    React Core     .  General Purpose Event Plugin System
  5068  */
  6208  */
  5069 
  6209 
  5070 var alreadyListeningTo = {};
  6210 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
  5071 var reactTopListenersCounter = 0;
  6211 var elementListeningSets = new PossiblyWeakMap();
  5072 
  6212 
  5073 /**
  6213 function getListeningSetForElement(element) {
  5074  * To ensure no conflicts with other potential React instances on the page
  6214   var listeningSet = elementListeningSets.get(element);
  5075  */
  6215   if (listeningSet === undefined) {
  5076 var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2);
  6216     listeningSet = new Set();
  5077 
  6217     elementListeningSets.set(element, listeningSet);
  5078 function getListeningForDocument(mountAt) {
  6218   }
  5079   // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  6219   return listeningSet;
  5080   // directly.
       
  5081   if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
       
  5082     mountAt[topListenersIDKey] = reactTopListenersCounter++;
       
  5083     alreadyListeningTo[mountAt[topListenersIDKey]] = {};
       
  5084   }
       
  5085   return alreadyListeningTo[mountAt[topListenersIDKey]];
       
  5086 }
  6220 }
  5087 
  6221 
  5088 /**
  6222 /**
  5089  * We listen for bubbled touch events on the document object.
  6223  * We listen for bubbled touch events on the document object.
  5090  *
  6224  *
  5105  *
  6239  *
  5106  * @param {string} registrationName Name of listener (e.g. `onClick`).
  6240  * @param {string} registrationName Name of listener (e.g. `onClick`).
  5107  * @param {object} mountAt Container where to mount the listener
  6241  * @param {object} mountAt Container where to mount the listener
  5108  */
  6242  */
  5109 function listenTo(registrationName, mountAt) {
  6243 function listenTo(registrationName, mountAt) {
  5110   var isListening = getListeningForDocument(mountAt);
  6244   var listeningSet = getListeningSetForElement(mountAt);
  5111   var dependencies = registrationNameDependencies[registrationName];
  6245   var dependencies = registrationNameDependencies[registrationName];
  5112 
  6246 
  5113   for (var i = 0; i < dependencies.length; i++) {
  6247   for (var i = 0; i < dependencies.length; i++) {
  5114     var dependency = dependencies[i];
  6248     var dependency = dependencies[i];
  5115     if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  6249     if (!listeningSet.has(dependency)) {
  5116       switch (dependency) {
  6250       switch (dependency) {
  5117         case TOP_SCROLL:
  6251         case TOP_SCROLL:
  5118           trapCapturedEvent(TOP_SCROLL, mountAt);
  6252           trapCapturedEvent(TOP_SCROLL, mountAt);
  5119           break;
  6253           break;
  5120         case TOP_FOCUS:
  6254         case TOP_FOCUS:
  5121         case TOP_BLUR:
  6255         case TOP_BLUR:
  5122           trapCapturedEvent(TOP_FOCUS, mountAt);
  6256           trapCapturedEvent(TOP_FOCUS, mountAt);
  5123           trapCapturedEvent(TOP_BLUR, mountAt);
  6257           trapCapturedEvent(TOP_BLUR, mountAt);
  5124           // We set the flag for a single dependency later in this function,
  6258           // We set the flag for a single dependency later in this function,
  5125           // but this ensures we mark both as attached rather than just one.
  6259           // but this ensures we mark both as attached rather than just one.
  5126           isListening[TOP_BLUR] = true;
  6260           listeningSet.add(TOP_BLUR);
  5127           isListening[TOP_FOCUS] = true;
  6261           listeningSet.add(TOP_FOCUS);
  5128           break;
  6262           break;
  5129         case TOP_CANCEL:
  6263         case TOP_CANCEL:
  5130         case TOP_CLOSE:
  6264         case TOP_CLOSE:
  5131           if (isEventSupported(getRawEventName(dependency))) {
  6265           if (isEventSupported(getRawEventName(dependency))) {
  5132             trapCapturedEvent(dependency, mountAt);
  6266             trapCapturedEvent(dependency, mountAt);
  5145           if (!isMediaEvent) {
  6279           if (!isMediaEvent) {
  5146             trapBubbledEvent(dependency, mountAt);
  6280             trapBubbledEvent(dependency, mountAt);
  5147           }
  6281           }
  5148           break;
  6282           break;
  5149       }
  6283       }
  5150       isListening[dependency] = true;
  6284       listeningSet.add(dependency);
  5151     }
  6285     }
  5152   }
  6286   }
  5153 }
  6287 }
  5154 
  6288 
  5155 function isListeningToAllDependencies(registrationName, mountAt) {
  6289 function isListeningToAllDependencies(registrationName, mountAt) {
  5156   var isListening = getListeningForDocument(mountAt);
  6290   var listeningSet = getListeningSetForElement(mountAt);
  5157   var dependencies = registrationNameDependencies[registrationName];
  6291   var dependencies = registrationNameDependencies[registrationName];
       
  6292 
  5158   for (var i = 0; i < dependencies.length; i++) {
  6293   for (var i = 0; i < dependencies.length; i++) {
  5159     var dependency = dependencies[i];
  6294     var dependency = dependencies[i];
  5160     if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  6295     if (!listeningSet.has(dependency)) {
  5161       return false;
  6296       return false;
  5162     }
  6297     }
  5163   }
  6298   }
  5164   return true;
  6299   return true;
  5165 }
  6300 }
  5433 
  6568 
  5434 function isInDocument(node) {
  6569 function isInDocument(node) {
  5435   return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
  6570   return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
  5436 }
  6571 }
  5437 
  6572 
       
  6573 function isSameOriginFrame(iframe) {
       
  6574   try {
       
  6575     // Accessing the contentDocument of a HTMLIframeElement can cause the browser
       
  6576     // to throw, e.g. if it has a cross-origin src attribute.
       
  6577     // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g:
       
  6578     // iframe.contentDocument.defaultView;
       
  6579     // A safety way is to access one of the cross origin properties: Window or Location
       
  6580     // Which might result in "SecurityError" DOM Exception and it is compatible to Safari.
       
  6581     // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
       
  6582 
       
  6583     return typeof iframe.contentWindow.location.href === 'string';
       
  6584   } catch (err) {
       
  6585     return false;
       
  6586   }
       
  6587 }
       
  6588 
  5438 function getActiveElementDeep() {
  6589 function getActiveElementDeep() {
  5439   var win = window;
  6590   var win = window;
  5440   var element = getActiveElement();
  6591   var element = getActiveElement();
  5441   while (element instanceof win.HTMLIFrameElement) {
  6592   while (element instanceof win.HTMLIFrameElement) {
  5442     // Accessing the contentDocument of a HTMLIframeElement can cause the browser
  6593     if (isSameOriginFrame(element)) {
  5443     // to throw, e.g. if it has a cross-origin src attribute
  6594       win = element.contentWindow;
  5444     try {
  6595     } else {
  5445       win = element.contentDocument.defaultView;
       
  5446     } catch (e) {
       
  5447       return element;
  6596       return element;
  5448     }
  6597     }
  5449     element = getActiveElement(win.document);
  6598     element = getActiveElement(win.document);
  5450   }
  6599   }
  5451   return element;
  6600   return element;
  5740   ChangeEventPlugin: ChangeEventPlugin,
  6889   ChangeEventPlugin: ChangeEventPlugin,
  5741   SelectEventPlugin: SelectEventPlugin,
  6890   SelectEventPlugin: SelectEventPlugin,
  5742   BeforeInputEventPlugin: BeforeInputEventPlugin
  6891   BeforeInputEventPlugin: BeforeInputEventPlugin
  5743 });
  6892 });
  5744 
  6893 
       
  6894 function endsWith(subject, search) {
       
  6895   var length = subject.length;
       
  6896   return subject.substring(length - search.length, length) === search;
       
  6897 }
       
  6898 
  5745 var didWarnSelectedSetOnOption = false;
  6899 var didWarnSelectedSetOnOption = false;
  5746 var didWarnInvalidChild = false;
  6900 var didWarnInvalidChild = false;
  5747 
  6901 
  5748 function flattenChildren(children) {
  6902 function flattenChildren(children) {
  5749   var content = '';
  6903   var content = '';
  5996  * `defaultValue` if specified, or the children content (deprecated).
  7150  * `defaultValue` if specified, or the children content (deprecated).
  5997  */
  7151  */
  5998 
  7152 
  5999 function getHostProps$3(element, props) {
  7153 function getHostProps$3(element, props) {
  6000   var node = element;
  7154   var node = element;
  6001   !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
  7155   (function () {
       
  7156     if (!(props.dangerouslySetInnerHTML == null)) {
       
  7157       {
       
  7158         throw ReactError(Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.'));
       
  7159       }
       
  7160     }
       
  7161   })();
  6002 
  7162 
  6003   // Always set children to the same thing. In IE9, the selection range will
  7163   // Always set children to the same thing. In IE9, the selection range will
  6004   // get reset if `textContent` is mutated.  We could add a check in setTextContent
  7164   // get reset if `textContent` is mutated.  We could add a check in setTextContent
  6005   // to only set the value if/when the value differs from the node value (which would
  7165   // to only set the value if/when the value differs from the node value (which would
  6006   // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
  7166   // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
  6034     var children = props.children;
  7194     var children = props.children;
  6035     if (children != null) {
  7195     if (children != null) {
  6036       {
  7196       {
  6037         warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
  7197         warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
  6038       }
  7198       }
  6039       !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
  7199       (function () {
       
  7200         if (!(defaultValue == null)) {
       
  7201           {
       
  7202             throw ReactError(Error('If you supply `defaultValue` on a <textarea>, do not pass children.'));
       
  7203           }
       
  7204         }
       
  7205       })();
  6040       if (Array.isArray(children)) {
  7206       if (Array.isArray(children)) {
  6041         !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
  7207         (function () {
       
  7208           if (!(children.length <= 1)) {
       
  7209             {
       
  7210               throw ReactError(Error('<textarea> can only have at most one child.'));
       
  7211             }
       
  7212           }
       
  7213         })();
  6042         children = children[0];
  7214         children = children[0];
  6043       }
  7215       }
  6044 
  7216 
  6045       defaultValue = children;
  7217       defaultValue = children;
  6046     }
  7218     }
  6488         continue;
  7660         continue;
  6489       }
  7661       }
  6490       var styleValue = styles[styleName];
  7662       var styleValue = styles[styleName];
  6491       if (styleValue != null) {
  7663       if (styleValue != null) {
  6492         var isCustomProperty = styleName.indexOf('--') === 0;
  7664         var isCustomProperty = styleName.indexOf('--') === 0;
  6493         serialized += delimiter + hyphenateStyleName(styleName) + ':';
  7665         serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':';
  6494         serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
  7666         serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
  6495 
  7667 
  6496         delimiter = ';';
  7668         delimiter = ';';
  6497       }
  7669       }
  6498     }
  7670     }
  6625 
  7797 
  6626 // TODO: We can remove this if we add invariantWithStack()
  7798 // TODO: We can remove this if we add invariantWithStack()
  6627 // or add stack by default to invariants where possible.
  7799 // or add stack by default to invariants where possible.
  6628 var HTML$1 = '__html';
  7800 var HTML$1 = '__html';
  6629 
  7801 
  6630 var ReactDebugCurrentFrame$2 = null;
  7802 var ReactDebugCurrentFrame$3 = null;
  6631 {
  7803 {
  6632   ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
  7804   ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
  6633 }
  7805 }
  6634 
  7806 
  6635 function assertValidProps(tag, props) {
  7807 function assertValidProps(tag, props) {
  6636   if (!props) {
  7808   if (!props) {
  6637     return;
  7809     return;
  6638   }
  7810   }
  6639   // Note the use of `==` which checks for null or undefined.
  7811   // Note the use of `==` which checks for null or undefined.
  6640   if (voidElementTags[tag]) {
  7812   if (voidElementTags[tag]) {
  6641     !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
  7813     (function () {
       
  7814       if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
       
  7815         {
       
  7816           throw ReactError(Error(tag + ' is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.' + (ReactDebugCurrentFrame$3.getStackAddendum())));
       
  7817         }
       
  7818       }
       
  7819     })();
  6642   }
  7820   }
  6643   if (props.dangerouslySetInnerHTML != null) {
  7821   if (props.dangerouslySetInnerHTML != null) {
  6644     !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
  7822     (function () {
  6645     !(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
  7823       if (!(props.children == null)) {
       
  7824         {
       
  7825           throw ReactError(Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.'));
       
  7826         }
       
  7827       }
       
  7828     })();
       
  7829     (function () {
       
  7830       if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML)) {
       
  7831         {
       
  7832           throw ReactError(Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.'));
       
  7833         }
       
  7834       }
       
  7835     })();
  6646   }
  7836   }
  6647   {
  7837   {
  6648     !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
  7838     !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
  6649   }
  7839   }
  6650   !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
  7840   (function () {
       
  7841     if (!(props.style == null || typeof props.style === 'object')) {
       
  7842       {
       
  7843         throw ReactError(Error('The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.' + (ReactDebugCurrentFrame$3.getStackAddendum())));
       
  7844       }
       
  7845     }
       
  7846   })();
  6651 }
  7847 }
  6652 
  7848 
  6653 function isCustomComponent(tagName, props) {
  7849 function isCustomComponent(tagName, props) {
  6654   if (tagName.indexOf('-') === -1) {
  7850   if (tagName.indexOf('-') === -1) {
  6655     return typeof props.is === 'string';
  7851     return typeof props.is === 'string';
  6720   defaultchecked: 'defaultChecked',
  7916   defaultchecked: 'defaultChecked',
  6721   defaultvalue: 'defaultValue',
  7917   defaultvalue: 'defaultValue',
  6722   defer: 'defer',
  7918   defer: 'defer',
  6723   dir: 'dir',
  7919   dir: 'dir',
  6724   disabled: 'disabled',
  7920   disabled: 'disabled',
       
  7921   disablepictureinpicture: 'disablePictureInPicture',
  6725   download: 'download',
  7922   download: 'download',
  6726   draggable: 'draggable',
  7923   draggable: 'draggable',
  6727   enctype: 'encType',
  7924   enctype: 'encType',
  6728   for: 'htmlFor',
  7925   for: 'htmlFor',
  6729   form: 'form',
  7926   form: 'form',
  7478 var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
  8675 var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
  7479 var AUTOFOCUS = 'autoFocus';
  8676 var AUTOFOCUS = 'autoFocus';
  7480 var CHILDREN = 'children';
  8677 var CHILDREN = 'children';
  7481 var STYLE$1 = 'style';
  8678 var STYLE$1 = 'style';
  7482 var HTML = '__html';
  8679 var HTML = '__html';
       
  8680 var LISTENERS = 'listeners';
  7483 
  8681 
  7484 var HTML_NAMESPACE = Namespaces.html;
  8682 var HTML_NAMESPACE = Namespaces.html;
  7485 
  8683 
  7486 
  8684 
  7487 var warnedUnknownTags = void 0;
  8685 var warnedUnknownTags = void 0;
  7659           setTextContent(domElement, nextProp);
  8857           setTextContent(domElement, nextProp);
  7660         }
  8858         }
  7661       } else if (typeof nextProp === 'number') {
  8859       } else if (typeof nextProp === 'number') {
  7662         setTextContent(domElement, '' + nextProp);
  8860         setTextContent(domElement, '' + nextProp);
  7663       }
  8861       }
  7664     } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  8862     } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  7665       // Noop
  8863       // Noop
  7666     } else if (propKey === AUTOFOCUS) {
  8864     } else if (propKey === AUTOFOCUS) {
  7667       // We polyfill it separately on the client during commit.
  8865       // We polyfill it separately on the client during commit.
  7668       // We could have excluded it in the property list instead of
  8866       // We could have excluded it in the property list instead of
  7669       // adding a special case here, but then it wouldn't be emitted
  8867       // adding a special case here, but then it wouldn't be emitted
  7731     } else {
  8929     } else {
  7732       // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
  8930       // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
  7733       // See discussion in https://github.com/facebook/react/pull/6896
  8931       // See discussion in https://github.com/facebook/react/pull/6896
  7734       // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  8932       // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  7735       domElement = ownerDocument.createElement(type);
  8933       domElement = ownerDocument.createElement(type);
  7736       // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple`
  8934       // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size`
  7737       // attribute on `select`s needs to be added before `option`s are inserted. This prevents
  8935       // attributes on `select`s needs to be added before `option`s are inserted.
  7738       // a bug where the `select` does not scroll to the correct option because singular
  8936       // This prevents:
  7739       // `select` elements automatically pick the first item.
  8937       // - a bug where the `select` does not scroll to the correct option because singular
       
  8938       //  `select` elements automatically pick the first item #13222
       
  8939       // - a bug where the `select` set the first item as selected despite the `size` attribute #14239
  7740       // See https://github.com/facebook/react/issues/13222
  8940       // See https://github.com/facebook/react/issues/13222
  7741       if (type === 'select' && props.multiple) {
  8941       // and https://github.com/facebook/react/issues/14239
       
  8942       if (type === 'select') {
  7742         var node = domElement;
  8943         var node = domElement;
  7743         node.multiple = true;
  8944         if (props.multiple) {
       
  8945           node.multiple = true;
       
  8946         } else if (props.size) {
       
  8947           // Setting a size greater than 1 causes a select to behave like `multiple=true`, where
       
  8948           // it is possible that no option is selected.
       
  8949           //
       
  8950           // This is only necessary when a select in "single selection mode".
       
  8951           node.size = props.size;
       
  8952         }
  7744       }
  8953       }
  7745     }
  8954     }
  7746   } else {
  8955   } else {
  7747     domElement = ownerDocument.createElementNS(namespaceURI, type);
  8956     domElement = ownerDocument.createElementNS(namespaceURI, type);
  7748   }
  8957   }
  7776   // TODO: Make sure that we check isMounted before firing any of these events.
  8985   // TODO: Make sure that we check isMounted before firing any of these events.
  7777   var props = void 0;
  8986   var props = void 0;
  7778   switch (tag) {
  8987   switch (tag) {
  7779     case 'iframe':
  8988     case 'iframe':
  7780     case 'object':
  8989     case 'object':
       
  8990     case 'embed':
  7781       trapBubbledEvent(TOP_LOAD, domElement);
  8991       trapBubbledEvent(TOP_LOAD, domElement);
  7782       props = rawProps;
  8992       props = rawProps;
  7783       break;
  8993       break;
  7784     case 'video':
  8994     case 'video':
  7785     case 'audio':
  8995     case 'audio':
  7933           styleUpdates[styleName] = '';
  9143           styleUpdates[styleName] = '';
  7934         }
  9144         }
  7935       }
  9145       }
  7936     } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
  9146     } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
  7937       // Noop. This is handled by the clear text mechanism.
  9147       // Noop. This is handled by the clear text mechanism.
  7938     } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  9148     } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  7939       // Noop
  9149       // Noop
  7940     } else if (propKey === AUTOFOCUS) {
  9150     } else if (propKey === AUTOFOCUS) {
  7941       // Noop. It doesn't work on updates anyway.
  9151       // Noop. It doesn't work on updates anyway.
  7942     } else if (registrationNameModules.hasOwnProperty(propKey)) {
  9152     } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7943       // This is a special case. If any listener updates we need to ensure
  9153       // This is a special case. If any listener updates we need to ensure
  8008       }
  9218       }
  8009     } else if (propKey === CHILDREN) {
  9219     } else if (propKey === CHILDREN) {
  8010       if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
  9220       if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
  8011         (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
  9221         (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
  8012       }
  9222       }
  8013     } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  9223     } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  8014       // Noop
  9224       // Noop
  8015     } else if (registrationNameModules.hasOwnProperty(propKey)) {
  9225     } else if (registrationNameModules.hasOwnProperty(propKey)) {
  8016       if (nextProp != null) {
  9226       if (nextProp != null) {
  8017         // We eagerly listen to this even though we haven't committed yet.
  9227         // We eagerly listen to this even though we haven't committed yet.
  8018         if (true && typeof nextProp !== 'function') {
  9228         if (true && typeof nextProp !== 'function') {
  8102 
  9312 
  8103   // TODO: Make sure that we check isMounted before firing any of these events.
  9313   // TODO: Make sure that we check isMounted before firing any of these events.
  8104   switch (tag) {
  9314   switch (tag) {
  8105     case 'iframe':
  9315     case 'iframe':
  8106     case 'object':
  9316     case 'object':
       
  9317     case 'embed':
  8107       trapBubbledEvent(TOP_LOAD, domElement);
  9318       trapBubbledEvent(TOP_LOAD, domElement);
  8108       break;
  9319       break;
  8109     case 'video':
  9320     case 'video':
  8110     case 'audio':
  9321     case 'audio':
  8111       // Create listener for each media event
  9322       // Create listener for each media event
  8226       // Validate that the properties correspond to their expected values.
  9437       // Validate that the properties correspond to their expected values.
  8227       var serverValue = void 0;
  9438       var serverValue = void 0;
  8228       var propertyInfo = getPropertyInfo(propKey);
  9439       var propertyInfo = getPropertyInfo(propKey);
  8229       if (suppressHydrationWarning) {
  9440       if (suppressHydrationWarning) {
  8230         // Don't bother comparing. We're ignoring all these warnings.
  9441         // Don't bother comparing. We're ignoring all these warnings.
  8231       } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
  9442       } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
  8232       // Controlled attributes are not validated
  9443       // Controlled attributes are not validated
  8233       // TODO: Only ignore them on controlled tags.
  9444       // TODO: Only ignore them on controlled tags.
  8234       propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
  9445       propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
  8235         // Noop
  9446         // Noop
  8236       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  9447       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  8408       restoreControlledState$2(domElement, props);
  9619       restoreControlledState$2(domElement, props);
  8409       return;
  9620       return;
  8410   }
  9621   }
  8411 }
  9622 }
  8412 
  9623 
       
  9624 function listenToEventResponderEventTypes(eventTypes, element) {
       
  9625   if (enableFlareAPI) {
       
  9626     // Get the listening Set for this element. We use this to track
       
  9627     // what events we're listening to.
       
  9628     var listeningSet = getListeningSetForElement(element);
       
  9629 
       
  9630     // Go through each target event type of the event responder
       
  9631     for (var i = 0, length = eventTypes.length; i < length; ++i) {
       
  9632       var eventType = eventTypes[i];
       
  9633       var isPassive = !endsWith(eventType, '_active');
       
  9634       var eventKey = isPassive ? eventType + '_passive' : eventType;
       
  9635       var targetEventType = isPassive ? eventType : eventType.substring(0, eventType.length - 7);
       
  9636       if (!listeningSet.has(eventKey)) {
       
  9637         trapEventForResponderEventSystem(element, targetEventType, isPassive);
       
  9638         listeningSet.add(eventKey);
       
  9639       }
       
  9640     }
       
  9641   }
       
  9642 }
       
  9643 
       
  9644 // We can remove this once the event API is stable and out of a flag
       
  9645 if (enableFlareAPI) {
       
  9646   setListenToResponderEventTypes(listenToEventResponderEventTypes);
       
  9647 }
       
  9648 
  8413 // TODO: direct imports like some-package/src/* are bad. Fix me.
  9649 // TODO: direct imports like some-package/src/* are bad. Fix me.
  8414 var validateDOMNesting = function () {};
  9650 var validateDOMNesting = function () {};
  8415 var updatedAncestorInfo = function () {};
  9651 var updatedAncestorInfo = function () {};
  8416 
  9652 
  8417 {
  9653 {
  8540       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  9776       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  8541       case 'head':
  9777       case 'head':
  8542         return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  9778         return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  8543       // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  9779       // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  8544       case 'html':
  9780       case 'html':
  8545         return tag === 'head' || tag === 'body';
  9781         return tag === 'head' || tag === 'body' || tag === 'frameset';
       
  9782       case 'frameset':
       
  9783         return tag === 'frame';
  8546       case '#document':
  9784       case '#document':
  8547         return tag === 'html';
  9785         return tag === 'html';
  8548     }
  9786     }
  8549 
  9787 
  8550     // Probably in the "in body" parsing mode, so we outlaw only tag combos
  9788     // Probably in the "in body" parsing mode, so we outlaw only tag combos
  8565 
  9803 
  8566       case 'body':
  9804       case 'body':
  8567       case 'caption':
  9805       case 'caption':
  8568       case 'col':
  9806       case 'col':
  8569       case 'colgroup':
  9807       case 'colgroup':
       
  9808       case 'frameset':
  8570       case 'frame':
  9809       case 'frame':
  8571       case 'head':
  9810       case 'head':
  8572       case 'html':
  9811       case 'html':
  8573       case 'tbody':
  9812       case 'tbody':
  8574       case 'td':
  9813       case 'td':
  8651     }
  9890     }
  8652 
  9891 
  8653     return null;
  9892     return null;
  8654   };
  9893   };
  8655 
  9894 
  8656   var didWarn = {};
  9895   var didWarn$1 = {};
  8657 
  9896 
  8658   validateDOMNesting = function (childTag, childText, ancestorInfo) {
  9897   validateDOMNesting = function (childTag, childText, ancestorInfo) {
  8659     ancestorInfo = ancestorInfo || emptyAncestorInfo;
  9898     ancestorInfo = ancestorInfo || emptyAncestorInfo;
  8660     var parentInfo = ancestorInfo.current;
  9899     var parentInfo = ancestorInfo.current;
  8661     var parentTag = parentInfo && parentInfo.tag;
  9900     var parentTag = parentInfo && parentInfo.tag;
  8674 
  9913 
  8675     var ancestorTag = invalidParentOrAncestor.tag;
  9914     var ancestorTag = invalidParentOrAncestor.tag;
  8676     var addendum = getCurrentFiberStackInDev();
  9915     var addendum = getCurrentFiberStackInDev();
  8677 
  9916 
  8678     var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
  9917     var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
  8679     if (didWarn[warnKey]) {
  9918     if (didWarn$1[warnKey]) {
  8680       return;
  9919       return;
  8681     }
  9920     }
  8682     didWarn[warnKey] = true;
  9921     didWarn$1[warnKey] = true;
  8683 
  9922 
  8684     var tagDisplayName = childTag;
  9923     var tagDisplayName = childTag;
  8685     var whitespaceInfo = '';
  9924     var whitespaceInfo = '';
  8686     if (childTag === '#text') {
  9925     if (childTag === '#text') {
  8687       if (/\S/.test(childText)) {
  9926       if (/\S/.test(childText)) {
  8704       warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
  9943       warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
  8705     }
  9944     }
  8706   };
  9945   };
  8707 }
  9946 }
  8708 
  9947 
  8709 var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  8710 
       
  8711 var _ReactInternals$Sched = ReactInternals$1.Scheduler;
       
  8712 var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
       
  8713 var unstable_now = _ReactInternals$Sched.unstable_now;
       
  8714 var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
       
  8715 var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
       
  8716 var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
       
  8717 var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
       
  8718 var unstable_next = _ReactInternals$Sched.unstable_next;
       
  8719 var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
       
  8720 var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
       
  8721 var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
       
  8722 var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
       
  8723 var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
       
  8724 var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
       
  8725 var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
       
  8726 var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
       
  8727 
       
  8728 // Renderers that don't support persistence
  9948 // Renderers that don't support persistence
  8729 // can re-export everything from this module.
  9949 // can re-export everything from this module.
  8730 
  9950 
  8731 function shim() {
  9951 function shim() {
  8732   invariant(false, 'The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.');
  9952   (function () {
       
  9953     {
       
  9954       {
       
  9955         throw ReactError(Error('The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.'));
       
  9956       }
       
  9957     }
       
  9958   })();
  8733 }
  9959 }
  8734 
  9960 
  8735 // Persistence (when unsupported)
  9961 // Persistence (when unsupported)
  8736 var supportsPersistence = false;
  9962 var supportsPersistence = false;
  8737 var cloneInstance = shim;
  9963 var cloneInstance = shim;
       
  9964 var cloneFundamentalInstance = shim;
  8738 var createContainerChildSet = shim;
  9965 var createContainerChildSet = shim;
  8739 var appendChildToContainerChildSet = shim;
  9966 var appendChildToContainerChildSet = shim;
  8740 var finalizeContainerChildren = shim;
  9967 var finalizeContainerChildren = shim;
  8741 var replaceContainerChildren = shim;
  9968 var replaceContainerChildren = shim;
  8742 var cloneHiddenInstance = shim;
  9969 var cloneHiddenInstance = shim;
  8743 var cloneUnhiddenInstance = shim;
  9970 var cloneHiddenTextInstance = shim;
  8744 var createHiddenTextInstance = shim;
       
  8745 
  9971 
  8746 var SUPPRESS_HYDRATION_WARNING = void 0;
  9972 var SUPPRESS_HYDRATION_WARNING = void 0;
  8747 {
  9973 {
  8748   SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
  9974   SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
  8749 }
  9975 }
  8750 
  9976 
  8751 var SUSPENSE_START_DATA = '$';
  9977 var SUSPENSE_START_DATA = '$';
  8752 var SUSPENSE_END_DATA = '/$';
  9978 var SUSPENSE_END_DATA = '/$';
       
  9979 var SUSPENSE_PENDING_START_DATA = '$?';
       
  9980 var SUSPENSE_FALLBACK_START_DATA = '$!';
  8753 
  9981 
  8754 var STYLE = 'style';
  9982 var STYLE = 'style';
  8755 
  9983 
  8756 var eventsEnabled = null;
  9984 var eventsEnabled = null;
  8757 var selectionInformation = null;
  9985 var selectionInformation = null;
  8882   precacheFiberNode(internalInstanceHandle, textNode);
 10110   precacheFiberNode(internalInstanceHandle, textNode);
  8883   return textNode;
 10111   return textNode;
  8884 }
 10112 }
  8885 
 10113 
  8886 var isPrimaryRenderer = true;
 10114 var isPrimaryRenderer = true;
       
 10115 var warnsIfNotActing = true;
  8887 // This initialization code may run even on server environments
 10116 // This initialization code may run even on server environments
  8888 // if a component just imports ReactDOM (e.g. for findDOMNode).
 10117 // if a component just imports ReactDOM (e.g. for findDOMNode).
  8889 // Some environments might not have setTimeout or clearTimeout.
 10118 // Some environments might not have setTimeout or clearTimeout.
  8890 var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
 10119 var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
  8891 var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
 10120 var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
  8892 var noTimeout = -1;
 10121 var noTimeout = -1;
  8893 var schedulePassiveEffects = unstable_scheduleCallback;
       
  8894 var cancelPassiveEffects = unstable_cancelCallback;
       
  8895 
 10122 
  8896 // -------------------
 10123 // -------------------
  8897 //     Mutation
 10124 //     Mutation
  8898 // -------------------
 10125 // -------------------
  8899 
 10126 
  8995           parentInstance.removeChild(nextNode);
 10222           parentInstance.removeChild(nextNode);
  8996           return;
 10223           return;
  8997         } else {
 10224         } else {
  8998           depth--;
 10225           depth--;
  8999         }
 10226         }
  9000       } else if (data === SUSPENSE_START_DATA) {
 10227       } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) {
  9001         depth++;
 10228         depth++;
  9002       }
 10229       }
  9003     }
 10230     }
  9004     node = nextNode;
 10231     node = nextNode;
  9005   } while (node);
 10232   } while (node);
  9018 
 10245 
  9019 function hideInstance(instance) {
 10246 function hideInstance(instance) {
  9020   // TODO: Does this work for all element types? What about MathML? Should we
 10247   // TODO: Does this work for all element types? What about MathML? Should we
  9021   // pass host context to this method?
 10248   // pass host context to this method?
  9022   instance = instance;
 10249   instance = instance;
  9023   instance.style.display = 'none';
 10250   var style = instance.style;
       
 10251   if (typeof style.setProperty === 'function') {
       
 10252     style.setProperty('display', 'none', 'important');
       
 10253   } else {
       
 10254     style.display = 'none';
       
 10255   }
  9024 }
 10256 }
  9025 
 10257 
  9026 function hideTextInstance(textInstance) {
 10258 function hideTextInstance(textInstance) {
  9027   textInstance.nodeValue = '';
 10259   textInstance.nodeValue = '';
  9028 }
 10260 }
  9068   }
 10300   }
  9069   // This has now been refined to a suspense node.
 10301   // This has now been refined to a suspense node.
  9070   return instance;
 10302   return instance;
  9071 }
 10303 }
  9072 
 10304 
       
 10305 function isSuspenseInstancePending(instance) {
       
 10306   return instance.data === SUSPENSE_PENDING_START_DATA;
       
 10307 }
       
 10308 
       
 10309 function isSuspenseInstanceFallback(instance) {
       
 10310   return instance.data === SUSPENSE_FALLBACK_START_DATA;
       
 10311 }
       
 10312 
       
 10313 function registerSuspenseInstanceRetry(instance, callback) {
       
 10314   instance._reactRetry = callback;
       
 10315 }
       
 10316 
       
 10317 function getNextHydratable(node) {
       
 10318   // Skip non-hydratable nodes.
       
 10319   for (; node != null; node = node.nextSibling) {
       
 10320     var nodeType = node.nodeType;
       
 10321     if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
       
 10322       break;
       
 10323     }
       
 10324     if (enableSuspenseServerRenderer) {
       
 10325       if (nodeType === COMMENT_NODE) {
       
 10326         break;
       
 10327       }
       
 10328       var nodeData = node.data;
       
 10329       if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) {
       
 10330         break;
       
 10331       }
       
 10332     }
       
 10333   }
       
 10334   return node;
       
 10335 }
       
 10336 
  9073 function getNextHydratableSibling(instance) {
 10337 function getNextHydratableSibling(instance) {
  9074   var node = instance.nextSibling;
 10338   return getNextHydratable(instance.nextSibling);
  9075   // Skip non-hydratable nodes.
       
  9076   while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || node.nodeType !== COMMENT_NODE || node.data !== SUSPENSE_START_DATA)) {
       
  9077     node = node.nextSibling;
       
  9078   }
       
  9079   return node;
       
  9080 }
 10339 }
  9081 
 10340 
  9082 function getFirstHydratableChild(parentInstance) {
 10341 function getFirstHydratableChild(parentInstance) {
  9083   var next = parentInstance.firstChild;
 10342   return getNextHydratable(parentInstance.firstChild);
  9084   // Skip non-hydratable nodes.
       
  9085   while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || next.nodeType !== COMMENT_NODE || next.data !== SUSPENSE_START_DATA)) {
       
  9086     next = next.nextSibling;
       
  9087   }
       
  9088   return next;
       
  9089 }
 10343 }
  9090 
 10344 
  9091 function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
 10345 function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
  9092   precacheFiberNode(internalInstanceHandle, instance);
 10346   precacheFiberNode(internalInstanceHandle, instance);
  9093   // TODO: Possibly defer this until the commit phase where all the events
 10347   // TODO: Possibly defer this until the commit phase where all the events
  9194 }
 10448 }
  9195 
 10449 
  9196 function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
 10450 function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
  9197   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
 10451   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
  9198     // TODO: warnForInsertedHydratedSuspense(parentInstance);
 10452     // TODO: warnForInsertedHydratedSuspense(parentInstance);
       
 10453   }
       
 10454 }
       
 10455 
       
 10456 function mountResponderInstance(responder, responderInstance, responderProps, responderState, instance, rootContainerInstance) {
       
 10457   // Listen to events
       
 10458   var doc = rootContainerInstance.ownerDocument;
       
 10459   var documentBody = doc.body || doc;
       
 10460   var _ref = responder,
       
 10461       rootEventTypes = _ref.rootEventTypes,
       
 10462       targetEventTypes = _ref.targetEventTypes;
       
 10463 
       
 10464   if (targetEventTypes !== null) {
       
 10465     listenToEventResponderEventTypes(targetEventTypes, documentBody);
       
 10466   }
       
 10467   if (rootEventTypes !== null) {
       
 10468     addRootEventTypesForResponderInstance(responderInstance, rootEventTypes);
       
 10469     listenToEventResponderEventTypes(rootEventTypes, documentBody);
       
 10470   }
       
 10471   mountEventResponder(responder, responderInstance, responderProps, responderState);
       
 10472   return responderInstance;
       
 10473 }
       
 10474 
       
 10475 function unmountResponderInstance(responderInstance) {
       
 10476   if (enableFlareAPI) {
       
 10477     // TODO stop listening to targetEventTypes
       
 10478     unmountEventResponder(responderInstance);
       
 10479   }
       
 10480 }
       
 10481 
       
 10482 function getFundamentalComponentInstance(fundamentalInstance) {
       
 10483   if (enableFundamentalAPI) {
       
 10484     var currentFiber = fundamentalInstance.currentFiber,
       
 10485         impl = fundamentalInstance.impl,
       
 10486         _props = fundamentalInstance.props,
       
 10487         state = fundamentalInstance.state;
       
 10488 
       
 10489     var instance = impl.getInstance(null, _props, state);
       
 10490     precacheFiberNode(currentFiber, instance);
       
 10491     return instance;
       
 10492   }
       
 10493   // Because of the flag above, this gets around the Flow error;
       
 10494   return null;
       
 10495 }
       
 10496 
       
 10497 function mountFundamentalComponent(fundamentalInstance) {
       
 10498   if (enableFundamentalAPI) {
       
 10499     var impl = fundamentalInstance.impl,
       
 10500         instance = fundamentalInstance.instance,
       
 10501         _props2 = fundamentalInstance.props,
       
 10502         state = fundamentalInstance.state;
       
 10503 
       
 10504     var onMount = impl.onMount;
       
 10505     if (onMount !== undefined) {
       
 10506       onMount(null, instance, _props2, state);
       
 10507     }
       
 10508   }
       
 10509 }
       
 10510 
       
 10511 function shouldUpdateFundamentalComponent(fundamentalInstance) {
       
 10512   if (enableFundamentalAPI) {
       
 10513     var impl = fundamentalInstance.impl,
       
 10514         prevProps = fundamentalInstance.prevProps,
       
 10515         _props3 = fundamentalInstance.props,
       
 10516         state = fundamentalInstance.state;
       
 10517 
       
 10518     var shouldUpdate = impl.shouldUpdate;
       
 10519     if (shouldUpdate !== undefined) {
       
 10520       return shouldUpdate(null, prevProps, _props3, state);
       
 10521     }
       
 10522   }
       
 10523   return true;
       
 10524 }
       
 10525 
       
 10526 function updateFundamentalComponent(fundamentalInstance) {
       
 10527   if (enableFundamentalAPI) {
       
 10528     var impl = fundamentalInstance.impl,
       
 10529         instance = fundamentalInstance.instance,
       
 10530         prevProps = fundamentalInstance.prevProps,
       
 10531         _props4 = fundamentalInstance.props,
       
 10532         state = fundamentalInstance.state;
       
 10533 
       
 10534     var onUpdate = impl.onUpdate;
       
 10535     if (onUpdate !== undefined) {
       
 10536       onUpdate(null, instance, prevProps, _props4, state);
       
 10537     }
       
 10538   }
       
 10539 }
       
 10540 
       
 10541 function unmountFundamentalComponent(fundamentalInstance) {
       
 10542   if (enableFundamentalAPI) {
       
 10543     var impl = fundamentalInstance.impl,
       
 10544         instance = fundamentalInstance.instance,
       
 10545         _props5 = fundamentalInstance.props,
       
 10546         state = fundamentalInstance.state;
       
 10547 
       
 10548     var onUnmount = impl.onUnmount;
       
 10549     if (onUnmount !== undefined) {
       
 10550       onUnmount(null, instance, _props5, state);
       
 10551     }
  9199   }
 10552   }
  9200 }
 10553 }
  9201 
 10554 
  9202 // Prefix measurements so that it's possible to filter them.
 10555 // Prefix measurements so that it's possible to filter them.
  9203 // Longer prefixes are hard to read in DevTools.
 10556 // Longer prefixes are hard to read in DevTools.
  9390       beginMark('(Waiting for async callback...)');
 10743       beginMark('(Waiting for async callback...)');
  9391     }
 10744     }
  9392   }
 10745   }
  9393 }
 10746 }
  9394 
 10747 
  9395 function stopRequestCallbackTimer(didExpire, expirationTime) {
 10748 function stopRequestCallbackTimer(didExpire) {
  9396   if (enableUserTimingAPI) {
 10749   if (enableUserTimingAPI) {
  9397     if (supportsUserTiming) {
 10750     if (supportsUserTiming) {
  9398       isWaitingForCallback = false;
 10751       isWaitingForCallback = false;
  9399       var warning = didExpire ? 'React was blocked by main thread' : null;
 10752       var warning = didExpire ? 'Update expired; will flush synchronously' : null;
  9400       endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning);
 10753       endMark('(Waiting for async callback...)', '(Waiting for async callback...)', warning);
  9401     }
 10754     }
  9402   }
 10755   }
  9403 }
 10756 }
  9404 
 10757 
  9405 function startWorkTimer(fiber) {
 10758 function startWorkTimer(fiber) {
  9671   {
 11024   {
  9672     fiberStack[index] = fiber;
 11025     fiberStack[index] = fiber;
  9673   }
 11026   }
  9674 
 11027 
  9675   cursor.current = value;
 11028   cursor.current = value;
  9676 }
       
  9677 
       
  9678 function checkThatStackIsEmpty() {
       
  9679   {
       
  9680     if (index !== -1) {
       
  9681       warningWithoutStack$1(false, 'Expected an empty stack. Something was not reset properly.');
       
  9682     }
       
  9683   }
       
  9684 }
       
  9685 
       
  9686 function resetStackAfterFatalErrorInDev() {
       
  9687   {
       
  9688     index = -1;
       
  9689     valueStack.length = 0;
       
  9690     fiberStack.length = 0;
       
  9691   }
       
  9692 }
 11029 }
  9693 
 11030 
  9694 var warnedAboutMissingGetChildContext = void 0;
 11031 var warnedAboutMissingGetChildContext = void 0;
  9695 
 11032 
  9696 {
 11033 {
  9710 // We use this to get access to the parent context after we have already
 11047 // We use this to get access to the parent context after we have already
  9711 // pushed the next context provider, and now need to merge their contexts.
 11048 // pushed the next context provider, and now need to merge their contexts.
  9712 var previousContext = emptyContextObject;
 11049 var previousContext = emptyContextObject;
  9713 
 11050 
  9714 function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
 11051 function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
  9715   if (didPushOwnContextIfProvider && isContextProvider(Component)) {
 11052   if (disableLegacyContext) {
  9716     // If the fiber is a context provider itself, when we read its context
 11053     return emptyContextObject;
  9717     // we may have already pushed its own child context on the stack. A context
 11054   } else {
  9718     // provider should not "see" its own child context. Therefore we read the
 11055     if (didPushOwnContextIfProvider && isContextProvider(Component)) {
  9719     // previous (parent) context instead for a context provider.
 11056       // If the fiber is a context provider itself, when we read its context
  9720     return previousContext;
 11057       // we may have already pushed its own child context on the stack. A context
  9721   }
 11058       // provider should not "see" its own child context. Therefore we read the
  9722   return contextStackCursor.current;
 11059       // previous (parent) context instead for a context provider.
       
 11060       return previousContext;
       
 11061     }
       
 11062     return contextStackCursor.current;
       
 11063   }
  9723 }
 11064 }
  9724 
 11065 
  9725 function cacheContext(workInProgress, unmaskedContext, maskedContext) {
 11066 function cacheContext(workInProgress, unmaskedContext, maskedContext) {
  9726   var instance = workInProgress.stateNode;
 11067   if (disableLegacyContext) {
  9727   instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
 11068     return;
  9728   instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
 11069   } else {
       
 11070     var instance = workInProgress.stateNode;
       
 11071     instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
       
 11072     instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
       
 11073   }
  9729 }
 11074 }
  9730 
 11075 
  9731 function getMaskedContext(workInProgress, unmaskedContext) {
 11076 function getMaskedContext(workInProgress, unmaskedContext) {
  9732   var type = workInProgress.type;
 11077   if (disableLegacyContext) {
  9733   var contextTypes = type.contextTypes;
       
  9734   if (!contextTypes) {
       
  9735     return emptyContextObject;
 11078     return emptyContextObject;
  9736   }
 11079   } else {
  9737 
 11080     var type = workInProgress.type;
  9738   // Avoid recreating masked context unless unmasked context has changed.
 11081     var contextTypes = type.contextTypes;
  9739   // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
 11082     if (!contextTypes) {
  9740   // This may trigger infinite loops if componentWillReceiveProps calls setState.
 11083       return emptyContextObject;
  9741   var instance = workInProgress.stateNode;
 11084     }
  9742   if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
 11085 
  9743     return instance.__reactInternalMemoizedMaskedChildContext;
 11086     // Avoid recreating masked context unless unmasked context has changed.
  9744   }
 11087     // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
  9745 
 11088     // This may trigger infinite loops if componentWillReceiveProps calls setState.
  9746   var context = {};
 11089     var instance = workInProgress.stateNode;
  9747   for (var key in contextTypes) {
 11090     if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
  9748     context[key] = unmaskedContext[key];
 11091       return instance.__reactInternalMemoizedMaskedChildContext;
  9749   }
 11092     }
  9750 
 11093 
  9751   {
 11094     var context = {};
  9752     var name = getComponentName(type) || 'Unknown';
 11095     for (var key in contextTypes) {
  9753     checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
 11096       context[key] = unmaskedContext[key];
  9754   }
 11097     }
  9755 
 11098 
  9756   // Cache unmasked context so we can avoid recreating masked context unless necessary.
 11099     {
  9757   // Context is created before the class component is instantiated so check for instance.
 11100       var name = getComponentName(type) || 'Unknown';
  9758   if (instance) {
 11101       checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
  9759     cacheContext(workInProgress, unmaskedContext, context);
 11102     }
  9760   }
 11103 
  9761 
 11104     // Cache unmasked context so we can avoid recreating masked context unless necessary.
  9762   return context;
 11105     // Context is created before the class component is instantiated so check for instance.
       
 11106     if (instance) {
       
 11107       cacheContext(workInProgress, unmaskedContext, context);
       
 11108     }
       
 11109 
       
 11110     return context;
       
 11111   }
  9763 }
 11112 }
  9764 
 11113 
  9765 function hasContextChanged() {
 11114 function hasContextChanged() {
  9766   return didPerformWorkStackCursor.current;
 11115   if (disableLegacyContext) {
       
 11116     return false;
       
 11117   } else {
       
 11118     return didPerformWorkStackCursor.current;
       
 11119   }
  9767 }
 11120 }
  9768 
 11121 
  9769 function isContextProvider(type) {
 11122 function isContextProvider(type) {
  9770   var childContextTypes = type.childContextTypes;
 11123   if (disableLegacyContext) {
  9771   return childContextTypes !== null && childContextTypes !== undefined;
 11124     return false;
       
 11125   } else {
       
 11126     var childContextTypes = type.childContextTypes;
       
 11127     return childContextTypes !== null && childContextTypes !== undefined;
       
 11128   }
  9772 }
 11129 }
  9773 
 11130 
  9774 function popContext(fiber) {
 11131 function popContext(fiber) {
  9775   pop(didPerformWorkStackCursor, fiber);
 11132   if (disableLegacyContext) {
  9776   pop(contextStackCursor, fiber);
 11133     return;
       
 11134   } else {
       
 11135     pop(didPerformWorkStackCursor, fiber);
       
 11136     pop(contextStackCursor, fiber);
       
 11137   }
  9777 }
 11138 }
  9778 
 11139 
  9779 function popTopLevelContextObject(fiber) {
 11140 function popTopLevelContextObject(fiber) {
  9780   pop(didPerformWorkStackCursor, fiber);
 11141   if (disableLegacyContext) {
  9781   pop(contextStackCursor, fiber);
 11142     return;
       
 11143   } else {
       
 11144     pop(didPerformWorkStackCursor, fiber);
       
 11145     pop(contextStackCursor, fiber);
       
 11146   }
  9782 }
 11147 }
  9783 
 11148 
  9784 function pushTopLevelContextObject(fiber, context, didChange) {
 11149 function pushTopLevelContextObject(fiber, context, didChange) {
  9785   !(contextStackCursor.current === emptyContextObject) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 11150   if (disableLegacyContext) {
  9786 
 11151     return;
  9787   push(contextStackCursor, context, fiber);
 11152   } else {
  9788   push(didPerformWorkStackCursor, didChange, fiber);
 11153     (function () {
       
 11154       if (!(contextStackCursor.current === emptyContextObject)) {
       
 11155         {
       
 11156           throw ReactError(Error('Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.'));
       
 11157         }
       
 11158       }
       
 11159     })();
       
 11160 
       
 11161     push(contextStackCursor, context, fiber);
       
 11162     push(didPerformWorkStackCursor, didChange, fiber);
       
 11163   }
  9789 }
 11164 }
  9790 
 11165 
  9791 function processChildContext(fiber, type, parentContext) {
 11166 function processChildContext(fiber, type, parentContext) {
  9792   var instance = fiber.stateNode;
 11167   if (disableLegacyContext) {
  9793   var childContextTypes = type.childContextTypes;
 11168     return parentContext;
  9794 
 11169   } else {
  9795   // TODO (bvaughn) Replace this behavior with an invariant() in the future.
 11170     var instance = fiber.stateNode;
  9796   // It has only been added in Fiber to match the (unintentional) behavior in Stack.
 11171     var childContextTypes = type.childContextTypes;
  9797   if (typeof instance.getChildContext !== 'function') {
 11172 
       
 11173     // TODO (bvaughn) Replace this behavior with an invariant() in the future.
       
 11174     // It has only been added in Fiber to match the (unintentional) behavior in Stack.
       
 11175     if (typeof instance.getChildContext !== 'function') {
       
 11176       {
       
 11177         var componentName = getComponentName(type) || 'Unknown';
       
 11178 
       
 11179         if (!warnedAboutMissingGetChildContext[componentName]) {
       
 11180           warnedAboutMissingGetChildContext[componentName] = true;
       
 11181           warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
       
 11182         }
       
 11183       }
       
 11184       return parentContext;
       
 11185     }
       
 11186 
       
 11187     var childContext = void 0;
  9798     {
 11188     {
  9799       var componentName = getComponentName(type) || 'Unknown';
 11189       setCurrentPhase('getChildContext');
  9800 
 11190     }
  9801       if (!warnedAboutMissingGetChildContext[componentName]) {
 11191     startPhaseTimer(fiber, 'getChildContext');
  9802         warnedAboutMissingGetChildContext[componentName] = true;
 11192     childContext = instance.getChildContext();
  9803         warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
 11193     stopPhaseTimer();
  9804       }
 11194     {
  9805     }
 11195       setCurrentPhase(null);
  9806     return parentContext;
 11196     }
  9807   }
 11197     for (var contextKey in childContext) {
  9808 
 11198       (function () {
  9809   var childContext = void 0;
 11199         if (!(contextKey in childContextTypes)) {
  9810   {
 11200           {
  9811     setCurrentPhase('getChildContext');
 11201             throw ReactError(Error((getComponentName(type) || 'Unknown') + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.'));
  9812   }
 11202           }
  9813   startPhaseTimer(fiber, 'getChildContext');
 11203         }
  9814   childContext = instance.getChildContext();
 11204       })();
  9815   stopPhaseTimer();
 11205     }
  9816   {
 11206     {
  9817     setCurrentPhase(null);
 11207       var name = getComponentName(type) || 'Unknown';
  9818   }
 11208       checkPropTypes_1(childContextTypes, childContext, 'child context', name,
  9819   for (var contextKey in childContext) {
 11209       // In practice, there is one case in which we won't get a stack. It's when
  9820     !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(type) || 'Unknown', contextKey) : void 0;
 11210       // somebody calls unstable_renderSubtreeIntoContainer() and we process
  9821   }
 11211       // context from the parent component instance. The stack will be missing
  9822   {
 11212       // because it's outside of the reconciliation, and so the pointer has not
  9823     var name = getComponentName(type) || 'Unknown';
 11213       // been set. This is rare and doesn't matter. We'll also remove that API.
  9824     checkPropTypes_1(childContextTypes, childContext, 'child context', name,
 11214       getCurrentFiberStackInDev);
  9825     // In practice, there is one case in which we won't get a stack. It's when
 11215     }
  9826     // somebody calls unstable_renderSubtreeIntoContainer() and we process
 11216 
  9827     // context from the parent component instance. The stack will be missing
 11217     return _assign({}, parentContext, childContext);
  9828     // because it's outside of the reconciliation, and so the pointer has not
 11218   }
  9829     // been set. This is rare and doesn't matter. We'll also remove that API.
       
  9830     getCurrentFiberStackInDev);
       
  9831   }
       
  9832 
       
  9833   return _assign({}, parentContext, childContext);
       
  9834 }
 11219 }
  9835 
 11220 
  9836 function pushContextProvider(workInProgress) {
 11221 function pushContextProvider(workInProgress) {
  9837   var instance = workInProgress.stateNode;
 11222   if (disableLegacyContext) {
  9838   // We push the context as early as possible to ensure stack integrity.
 11223     return false;
  9839   // If the instance does not exist yet, we will push null at first,
 11224   } else {
  9840   // and replace it on the stack later when invalidating the context.
 11225     var instance = workInProgress.stateNode;
  9841   var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
 11226     // We push the context as early as possible to ensure stack integrity.
  9842 
 11227     // If the instance does not exist yet, we will push null at first,
  9843   // Remember the parent context so we can merge with it later.
 11228     // and replace it on the stack later when invalidating the context.
  9844   // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
 11229     var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
  9845   previousContext = contextStackCursor.current;
 11230 
  9846   push(contextStackCursor, memoizedMergedChildContext, workInProgress);
 11231     // Remember the parent context so we can merge with it later.
  9847   push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
 11232     // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
  9848 
 11233     previousContext = contextStackCursor.current;
  9849   return true;
 11234     push(contextStackCursor, memoizedMergedChildContext, workInProgress);
       
 11235     push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
       
 11236 
       
 11237     return true;
       
 11238   }
  9850 }
 11239 }
  9851 
 11240 
  9852 function invalidateContextProvider(workInProgress, type, didChange) {
 11241 function invalidateContextProvider(workInProgress, type, didChange) {
  9853   var instance = workInProgress.stateNode;
 11242   if (disableLegacyContext) {
  9854   !instance ? invariant(false, 'Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 11243     return;
  9855 
       
  9856   if (didChange) {
       
  9857     // Merge parent and own context.
       
  9858     // Skip this if we're not updating due to sCU.
       
  9859     // This avoids unnecessarily recomputing memoized values.
       
  9860     var mergedContext = processChildContext(workInProgress, type, previousContext);
       
  9861     instance.__reactInternalMemoizedMergedChildContext = mergedContext;
       
  9862 
       
  9863     // Replace the old (or empty) context with the new one.
       
  9864     // It is important to unwind the context in the reverse order.
       
  9865     pop(didPerformWorkStackCursor, workInProgress);
       
  9866     pop(contextStackCursor, workInProgress);
       
  9867     // Now push the new context and mark that it has changed.
       
  9868     push(contextStackCursor, mergedContext, workInProgress);
       
  9869     push(didPerformWorkStackCursor, didChange, workInProgress);
       
  9870   } else {
 11244   } else {
  9871     pop(didPerformWorkStackCursor, workInProgress);
 11245     var instance = workInProgress.stateNode;
  9872     push(didPerformWorkStackCursor, didChange, workInProgress);
 11246     (function () {
       
 11247       if (!instance) {
       
 11248         {
       
 11249           throw ReactError(Error('Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.'));
       
 11250         }
       
 11251       }
       
 11252     })();
       
 11253 
       
 11254     if (didChange) {
       
 11255       // Merge parent and own context.
       
 11256       // Skip this if we're not updating due to sCU.
       
 11257       // This avoids unnecessarily recomputing memoized values.
       
 11258       var mergedContext = processChildContext(workInProgress, type, previousContext);
       
 11259       instance.__reactInternalMemoizedMergedChildContext = mergedContext;
       
 11260 
       
 11261       // Replace the old (or empty) context with the new one.
       
 11262       // It is important to unwind the context in the reverse order.
       
 11263       pop(didPerformWorkStackCursor, workInProgress);
       
 11264       pop(contextStackCursor, workInProgress);
       
 11265       // Now push the new context and mark that it has changed.
       
 11266       push(contextStackCursor, mergedContext, workInProgress);
       
 11267       push(didPerformWorkStackCursor, didChange, workInProgress);
       
 11268     } else {
       
 11269       pop(didPerformWorkStackCursor, workInProgress);
       
 11270       push(didPerformWorkStackCursor, didChange, workInProgress);
       
 11271     }
  9873   }
 11272   }
  9874 }
 11273 }
  9875 
 11274 
  9876 function findCurrentUnmaskedContext(fiber) {
 11275 function findCurrentUnmaskedContext(fiber) {
  9877   // Currently this is only used with renderSubtreeIntoContainer; not sure if it
 11276   if (disableLegacyContext) {
  9878   // makes sense elsewhere
 11277     return emptyContextObject;
  9879   !(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 11278   } else {
  9880 
 11279     // Currently this is only used with renderSubtreeIntoContainer; not sure if it
  9881   var node = fiber;
 11280     // makes sense elsewhere
  9882   do {
 11281     (function () {
  9883     switch (node.tag) {
 11282       if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
  9884       case HostRoot:
       
  9885         return node.stateNode.context;
       
  9886       case ClassComponent:
       
  9887         {
 11283         {
  9888           var Component = node.type;
 11284           throw ReactError(Error('Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.'));
  9889           if (isContextProvider(Component)) {
 11285         }
  9890             return node.stateNode.__reactInternalMemoizedMergedChildContext;
 11286       }
       
 11287     })();
       
 11288 
       
 11289     var node = fiber;
       
 11290     do {
       
 11291       switch (node.tag) {
       
 11292         case HostRoot:
       
 11293           return node.stateNode.context;
       
 11294         case ClassComponent:
       
 11295           {
       
 11296             var Component = node.type;
       
 11297             if (isContextProvider(Component)) {
       
 11298               return node.stateNode.__reactInternalMemoizedMergedChildContext;
       
 11299             }
       
 11300             break;
  9891           }
 11301           }
  9892           break;
 11302       }
  9893         }
 11303       node = node.return;
  9894     }
 11304     } while (node !== null);
  9895     node = node.return;
 11305     (function () {
  9896   } while (node !== null);
 11306       {
  9897   invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.');
 11307         {
  9898 }
 11308           throw ReactError(Error('Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.'));
  9899 
 11309         }
  9900 var onCommitFiberRoot = null;
 11310       }
  9901 var onCommitFiberUnmount = null;
 11311     })();
  9902 var hasLoggedError = false;
 11312   }
  9903 
 11313 }
  9904 function catchErrors(fn) {
 11314 
  9905   return function (arg) {
 11315 var LegacyRoot = 0;
       
 11316 var BatchedRoot = 1;
       
 11317 var ConcurrentRoot = 2;
       
 11318 
       
 11319 var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
 11320 
       
 11321 var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing;
       
 11322 var __interactionsRef = _ReactInternals$Sched$1.__interactionsRef;
       
 11323 var __subscriberRef = _ReactInternals$Sched$1.__subscriberRef;
       
 11324 var unstable_clear = _ReactInternals$Sched$1.unstable_clear;
       
 11325 var unstable_getCurrent = _ReactInternals$Sched$1.unstable_getCurrent;
       
 11326 var unstable_getThreadID = _ReactInternals$Sched$1.unstable_getThreadID;
       
 11327 var unstable_subscribe = _ReactInternals$Sched$1.unstable_subscribe;
       
 11328 var unstable_trace = _ReactInternals$Sched$1.unstable_trace;
       
 11329 var unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe;
       
 11330 var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
       
 11331 
       
 11332 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
 11333 // CommonJS interop named imports.
       
 11334 var Scheduler_runWithPriority = unstable_runWithPriority;
       
 11335 var Scheduler_scheduleCallback = unstable_scheduleCallback;
       
 11336 var Scheduler_cancelCallback = unstable_cancelCallback;
       
 11337 var Scheduler_shouldYield = unstable_shouldYield;
       
 11338 var Scheduler_requestPaint = unstable_requestPaint;
       
 11339 var Scheduler_now = unstable_now;
       
 11340 var Scheduler_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
       
 11341 var Scheduler_ImmediatePriority = unstable_ImmediatePriority;
       
 11342 var Scheduler_UserBlockingPriority = unstable_UserBlockingPriority;
       
 11343 var Scheduler_NormalPriority = unstable_NormalPriority;
       
 11344 var Scheduler_LowPriority = unstable_LowPriority;
       
 11345 var Scheduler_IdlePriority = unstable_IdlePriority;
       
 11346 
       
 11347 
       
 11348 if (enableSchedulerTracing) {
       
 11349   // Provide explicit error message when production+profiling bundle of e.g.
       
 11350   // react-dom is used with production (non-profiling) bundle of
       
 11351   // scheduler/tracing
       
 11352   (function () {
       
 11353     if (!(__interactionsRef != null && __interactionsRef.current != null)) {
       
 11354       {
       
 11355         throw ReactError(Error('It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling'));
       
 11356       }
       
 11357     }
       
 11358   })();
       
 11359 }
       
 11360 
       
 11361 var fakeCallbackNode = {};
       
 11362 
       
 11363 // Except for NoPriority, these correspond to Scheduler priorities. We use
       
 11364 // ascending numbers so we can compare them like numbers. They start at 90 to
       
 11365 // avoid clashing with Scheduler's priorities.
       
 11366 var ImmediatePriority = 99;
       
 11367 var UserBlockingPriority$2 = 98;
       
 11368 var NormalPriority = 97;
       
 11369 var LowPriority = 96;
       
 11370 var IdlePriority = 95;
       
 11371 // NoPriority is the absence of priority. Also React-only.
       
 11372 var NoPriority = 90;
       
 11373 
       
 11374 var shouldYield = Scheduler_shouldYield;
       
 11375 var requestPaint =
       
 11376 // Fall back gracefully if we're running an older version of Scheduler.
       
 11377 Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {};
       
 11378 
       
 11379 var syncQueue = null;
       
 11380 var immediateQueueCallbackNode = null;
       
 11381 var isFlushingSyncQueue = false;
       
 11382 var initialTimeMs = Scheduler_now();
       
 11383 
       
 11384 // If the initial timestamp is reasonably small, use Scheduler's `now` directly.
       
 11385 // This will be the case for modern browsers that support `performance.now`. In
       
 11386 // older browsers, Scheduler falls back to `Date.now`, which returns a Unix
       
 11387 // timestamp. In that case, subtract the module initialization time to simulate
       
 11388 // the behavior of performance.now and keep our times small enough to fit
       
 11389 // within 32 bits.
       
 11390 // TODO: Consider lifting this into Scheduler.
       
 11391 var now = initialTimeMs < 10000 ? Scheduler_now : function () {
       
 11392   return Scheduler_now() - initialTimeMs;
       
 11393 };
       
 11394 
       
 11395 function getCurrentPriorityLevel() {
       
 11396   switch (Scheduler_getCurrentPriorityLevel()) {
       
 11397     case Scheduler_ImmediatePriority:
       
 11398       return ImmediatePriority;
       
 11399     case Scheduler_UserBlockingPriority:
       
 11400       return UserBlockingPriority$2;
       
 11401     case Scheduler_NormalPriority:
       
 11402       return NormalPriority;
       
 11403     case Scheduler_LowPriority:
       
 11404       return LowPriority;
       
 11405     case Scheduler_IdlePriority:
       
 11406       return IdlePriority;
       
 11407     default:
       
 11408       (function () {
       
 11409         {
       
 11410           {
       
 11411             throw ReactError(Error('Unknown priority level.'));
       
 11412           }
       
 11413         }
       
 11414       })();
       
 11415   }
       
 11416 }
       
 11417 
       
 11418 function reactPriorityToSchedulerPriority(reactPriorityLevel) {
       
 11419   switch (reactPriorityLevel) {
       
 11420     case ImmediatePriority:
       
 11421       return Scheduler_ImmediatePriority;
       
 11422     case UserBlockingPriority$2:
       
 11423       return Scheduler_UserBlockingPriority;
       
 11424     case NormalPriority:
       
 11425       return Scheduler_NormalPriority;
       
 11426     case LowPriority:
       
 11427       return Scheduler_LowPriority;
       
 11428     case IdlePriority:
       
 11429       return Scheduler_IdlePriority;
       
 11430     default:
       
 11431       (function () {
       
 11432         {
       
 11433           {
       
 11434             throw ReactError(Error('Unknown priority level.'));
       
 11435           }
       
 11436         }
       
 11437       })();
       
 11438   }
       
 11439 }
       
 11440 
       
 11441 function runWithPriority$2(reactPriorityLevel, fn) {
       
 11442   var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
       
 11443   return Scheduler_runWithPriority(priorityLevel, fn);
       
 11444 }
       
 11445 
       
 11446 function scheduleCallback(reactPriorityLevel, callback, options) {
       
 11447   var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
       
 11448   return Scheduler_scheduleCallback(priorityLevel, callback, options);
       
 11449 }
       
 11450 
       
 11451 function scheduleSyncCallback(callback) {
       
 11452   // Push this callback into an internal queue. We'll flush these either in
       
 11453   // the next tick, or earlier if something calls `flushSyncCallbackQueue`.
       
 11454   if (syncQueue === null) {
       
 11455     syncQueue = [callback];
       
 11456     // Flush the queue in the next tick, at the earliest.
       
 11457     immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
       
 11458   } else {
       
 11459     // Push onto existing queue. Don't need to schedule a callback because
       
 11460     // we already scheduled one when we created the queue.
       
 11461     syncQueue.push(callback);
       
 11462   }
       
 11463   return fakeCallbackNode;
       
 11464 }
       
 11465 
       
 11466 function cancelCallback(callbackNode) {
       
 11467   if (callbackNode !== fakeCallbackNode) {
       
 11468     Scheduler_cancelCallback(callbackNode);
       
 11469   }
       
 11470 }
       
 11471 
       
 11472 function flushSyncCallbackQueue() {
       
 11473   if (immediateQueueCallbackNode !== null) {
       
 11474     Scheduler_cancelCallback(immediateQueueCallbackNode);
       
 11475   }
       
 11476   flushSyncCallbackQueueImpl();
       
 11477 }
       
 11478 
       
 11479 function flushSyncCallbackQueueImpl() {
       
 11480   if (!isFlushingSyncQueue && syncQueue !== null) {
       
 11481     // Prevent re-entrancy.
       
 11482     isFlushingSyncQueue = true;
       
 11483     var i = 0;
  9906     try {
 11484     try {
  9907       return fn(arg);
 11485       var _isSync = true;
  9908     } catch (err) {
 11486       var queue = syncQueue;
  9909       if (true && !hasLoggedError) {
 11487       runWithPriority$2(ImmediatePriority, function () {
  9910         hasLoggedError = true;
 11488         for (; i < queue.length; i++) {
  9911         warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
 11489           var callback = queue[i];
  9912       }
 11490           do {
  9913     }
 11491             callback = callback(_isSync);
  9914   };
 11492           } while (callback !== null);
  9915 }
 11493         }
  9916 
 11494       });
  9917 var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
 11495       syncQueue = null;
  9918 
 11496     } catch (error) {
  9919 function injectInternals(internals) {
 11497       // If something throws, leave the remaining callbacks on the queue.
  9920   if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
 11498       if (syncQueue !== null) {
  9921     // No DevTools
 11499         syncQueue = syncQueue.slice(i + 1);
  9922     return false;
 11500       }
  9923   }
 11501       // Resume flushing in the next tick
  9924   var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
 11502       Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
  9925   if (hook.isDisabled) {
 11503       throw error;
  9926     // This isn't a real property on the hook, but it can be set to opt out
 11504     } finally {
  9927     // of DevTools integration and associated warnings and logs.
 11505       isFlushingSyncQueue = false;
  9928     // https://github.com/facebook/react/issues/3877
 11506     }
  9929     return true;
 11507   }
  9930   }
 11508 }
  9931   if (!hook.supportsFiber) {
 11509 
  9932     {
 11510 var NoMode = 0;
  9933       warningWithoutStack$1(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
 11511 var StrictMode = 1;
  9934     }
 11512 // TODO: Remove BatchedMode and ConcurrentMode by reading from the root
  9935     // DevTools exists, even though it doesn't support Fiber.
 11513 // tag instead
  9936     return true;
 11514 var BatchedMode = 2;
  9937   }
 11515 var ConcurrentMode = 4;
  9938   try {
 11516 var ProfileMode = 8;
  9939     var rendererID = hook.inject(internals);
       
  9940     // We have successfully injected, so now it is safe to set up hooks.
       
  9941     onCommitFiberRoot = catchErrors(function (root) {
       
  9942       return hook.onCommitFiberRoot(rendererID, root);
       
  9943     });
       
  9944     onCommitFiberUnmount = catchErrors(function (fiber) {
       
  9945       return hook.onCommitFiberUnmount(rendererID, fiber);
       
  9946     });
       
  9947   } catch (err) {
       
  9948     // Catch all errors because it is unsafe to throw during initialization.
       
  9949     {
       
  9950       warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
       
  9951     }
       
  9952   }
       
  9953   // DevTools exists
       
  9954   return true;
       
  9955 }
       
  9956 
       
  9957 function onCommitRoot(root) {
       
  9958   if (typeof onCommitFiberRoot === 'function') {
       
  9959     onCommitFiberRoot(root);
       
  9960   }
       
  9961 }
       
  9962 
       
  9963 function onCommitUnmount(fiber) {
       
  9964   if (typeof onCommitFiberUnmount === 'function') {
       
  9965     onCommitFiberUnmount(fiber);
       
  9966   }
       
  9967 }
       
  9968 
 11517 
  9969 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
 11518 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
  9970 // Math.pow(2, 30) - 1
 11519 // Math.pow(2, 30) - 1
  9971 // 0b111111111111111111111111111111
 11520 // 0b111111111111111111111111111111
  9972 var maxSigned31BitInt = 1073741823;
 11521 var MAX_SIGNED_31_BIT_INT = 1073741823;
  9973 
 11522 
  9974 var NoWork = 0;
 11523 var NoWork = 0;
  9975 var Never = 1;
 11524 var Never = 1;
  9976 var Sync = maxSigned31BitInt;
 11525 var Sync = MAX_SIGNED_31_BIT_INT;
       
 11526 var Batched = Sync - 1;
  9977 
 11527 
  9978 var UNIT_SIZE = 10;
 11528 var UNIT_SIZE = 10;
  9979 var MAGIC_NUMBER_OFFSET = maxSigned31BitInt - 1;
 11529 var MAGIC_NUMBER_OFFSET = Batched - 1;
  9980 
 11530 
  9981 // 1 unit of expiration time represents 10ms.
 11531 // 1 unit of expiration time represents 10ms.
  9982 function msToExpirationTime(ms) {
 11532 function msToExpirationTime(ms) {
  9983   // Always add an offset so that we don't clash with the magic number for NoWork.
 11533   // Always add an offset so that we don't clash with the magic number for NoWork.
  9984   return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
 11534   return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
  9994 
 11544 
  9995 function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
 11545 function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
  9996   return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
 11546   return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
  9997 }
 11547 }
  9998 
 11548 
       
 11549 // TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update
       
 11550 // the names to reflect.
  9999 var LOW_PRIORITY_EXPIRATION = 5000;
 11551 var LOW_PRIORITY_EXPIRATION = 5000;
 10000 var LOW_PRIORITY_BATCH_SIZE = 250;
 11552 var LOW_PRIORITY_BATCH_SIZE = 250;
 10001 
 11553 
 10002 function computeAsyncExpiration(currentTime) {
 11554 function computeAsyncExpiration(currentTime) {
 10003   return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
 11555   return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
       
 11556 }
       
 11557 
       
 11558 function computeSuspenseExpiration(currentTime, timeoutMs) {
       
 11559   // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time?
       
 11560   return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE);
 10004 }
 11561 }
 10005 
 11562 
 10006 // We intentionally set a higher expiration time for interactive updates in
 11563 // We intentionally set a higher expiration time for interactive updates in
 10007 // dev than in production.
 11564 // dev than in production.
 10008 //
 11565 //
 10019 
 11576 
 10020 function computeInteractiveExpiration(currentTime) {
 11577 function computeInteractiveExpiration(currentTime) {
 10021   return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
 11578   return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
 10022 }
 11579 }
 10023 
 11580 
 10024 var NoContext = 0;
 11581 function inferPriorityFromExpirationTime(currentTime, expirationTime) {
 10025 var ConcurrentMode = 1;
 11582   if (expirationTime === Sync) {
 10026 var StrictMode = 2;
 11583     return ImmediatePriority;
 10027 var ProfileMode = 4;
 11584   }
 10028 
 11585   if (expirationTime === Never) {
 10029 var hasBadMapPolyfill = void 0;
 11586     return IdlePriority;
 10030 
 11587   }
 10031 {
 11588   var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime);
 10032   hasBadMapPolyfill = false;
 11589   if (msUntil <= 0) {
 10033   try {
 11590     return ImmediatePriority;
 10034     var nonExtensibleObject = Object.preventExtensions({});
 11591   }
 10035     var testMap = new Map([[nonExtensibleObject, null]]);
 11592   if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) {
 10036     var testSet = new Set([nonExtensibleObject]);
 11593     return UserBlockingPriority$2;
 10037     // This is necessary for Rollup to not consider these unused.
 11594   }
 10038     // https://github.com/rollup/rollup/issues/1771
 11595   if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) {
 10039     // TODO: we can remove these if Rollup fixes the bug.
 11596     return NormalPriority;
 10040     testMap.set(0, 0);
 11597   }
 10041     testSet.add(0);
 11598 
 10042   } catch (e) {
 11599   // TODO: Handle LowPriority
 10043     // TODO: Consider warning about bad polyfills
 11600 
 10044     hasBadMapPolyfill = true;
 11601   // Assume anything lower has idle priority
 10045   }
 11602   return IdlePriority;
 10046 }
       
 10047 
       
 10048 // A Fiber is work on a Component that needs to be done or was done. There can
       
 10049 // be more than one per component.
       
 10050 
       
 10051 
       
 10052 var debugCounter = void 0;
       
 10053 
       
 10054 {
       
 10055   debugCounter = 1;
       
 10056 }
       
 10057 
       
 10058 function FiberNode(tag, pendingProps, key, mode) {
       
 10059   // Instance
       
 10060   this.tag = tag;
       
 10061   this.key = key;
       
 10062   this.elementType = null;
       
 10063   this.type = null;
       
 10064   this.stateNode = null;
       
 10065 
       
 10066   // Fiber
       
 10067   this.return = null;
       
 10068   this.child = null;
       
 10069   this.sibling = null;
       
 10070   this.index = 0;
       
 10071 
       
 10072   this.ref = null;
       
 10073 
       
 10074   this.pendingProps = pendingProps;
       
 10075   this.memoizedProps = null;
       
 10076   this.updateQueue = null;
       
 10077   this.memoizedState = null;
       
 10078   this.contextDependencies = null;
       
 10079 
       
 10080   this.mode = mode;
       
 10081 
       
 10082   // Effects
       
 10083   this.effectTag = NoEffect;
       
 10084   this.nextEffect = null;
       
 10085 
       
 10086   this.firstEffect = null;
       
 10087   this.lastEffect = null;
       
 10088 
       
 10089   this.expirationTime = NoWork;
       
 10090   this.childExpirationTime = NoWork;
       
 10091 
       
 10092   this.alternate = null;
       
 10093 
       
 10094   if (enableProfilerTimer) {
       
 10095     // Note: The following is done to avoid a v8 performance cliff.
       
 10096     //
       
 10097     // Initializing the fields below to smis and later updating them with
       
 10098     // double values will cause Fibers to end up having separate shapes.
       
 10099     // This behavior/bug has something to do with Object.preventExtension().
       
 10100     // Fortunately this only impacts DEV builds.
       
 10101     // Unfortunately it makes React unusably slow for some applications.
       
 10102     // To work around this, initialize the fields below with doubles.
       
 10103     //
       
 10104     // Learn more about this here:
       
 10105     // https://github.com/facebook/react/issues/14365
       
 10106     // https://bugs.chromium.org/p/v8/issues/detail?id=8538
       
 10107     this.actualDuration = Number.NaN;
       
 10108     this.actualStartTime = Number.NaN;
       
 10109     this.selfBaseDuration = Number.NaN;
       
 10110     this.treeBaseDuration = Number.NaN;
       
 10111 
       
 10112     // It's okay to replace the initial doubles with smis after initialization.
       
 10113     // This won't trigger the performance cliff mentioned above,
       
 10114     // and it simplifies other profiler code (including DevTools).
       
 10115     this.actualDuration = 0;
       
 10116     this.actualStartTime = -1;
       
 10117     this.selfBaseDuration = 0;
       
 10118     this.treeBaseDuration = 0;
       
 10119   }
       
 10120 
       
 10121   {
       
 10122     this._debugID = debugCounter++;
       
 10123     this._debugSource = null;
       
 10124     this._debugOwner = null;
       
 10125     this._debugIsCurrentlyTiming = false;
       
 10126     this._debugHookTypes = null;
       
 10127     if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
       
 10128       Object.preventExtensions(this);
       
 10129     }
       
 10130   }
       
 10131 }
       
 10132 
       
 10133 // This is a constructor function, rather than a POJO constructor, still
       
 10134 // please ensure we do the following:
       
 10135 // 1) Nobody should add any instance methods on this. Instance methods can be
       
 10136 //    more difficult to predict when they get optimized and they are almost
       
 10137 //    never inlined properly in static compilers.
       
 10138 // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
       
 10139 //    always know when it is a fiber.
       
 10140 // 3) We might want to experiment with using numeric keys since they are easier
       
 10141 //    to optimize in a non-JIT environment.
       
 10142 // 4) We can easily go from a constructor to a createFiber object literal if that
       
 10143 //    is faster.
       
 10144 // 5) It should be easy to port this to a C struct and keep a C implementation
       
 10145 //    compatible.
       
 10146 var createFiber = function (tag, pendingProps, key, mode) {
       
 10147   // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
       
 10148   return new FiberNode(tag, pendingProps, key, mode);
       
 10149 };
       
 10150 
       
 10151 function shouldConstruct(Component) {
       
 10152   var prototype = Component.prototype;
       
 10153   return !!(prototype && prototype.isReactComponent);
       
 10154 }
       
 10155 
       
 10156 function isSimpleFunctionComponent(type) {
       
 10157   return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
       
 10158 }
       
 10159 
       
 10160 function resolveLazyComponentTag(Component) {
       
 10161   if (typeof Component === 'function') {
       
 10162     return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
       
 10163   } else if (Component !== undefined && Component !== null) {
       
 10164     var $$typeof = Component.$$typeof;
       
 10165     if ($$typeof === REACT_FORWARD_REF_TYPE) {
       
 10166       return ForwardRef;
       
 10167     }
       
 10168     if ($$typeof === REACT_MEMO_TYPE) {
       
 10169       return MemoComponent;
       
 10170     }
       
 10171   }
       
 10172   return IndeterminateComponent;
       
 10173 }
       
 10174 
       
 10175 // This is used to create an alternate fiber to do work on.
       
 10176 function createWorkInProgress(current, pendingProps, expirationTime) {
       
 10177   var workInProgress = current.alternate;
       
 10178   if (workInProgress === null) {
       
 10179     // We use a double buffering pooling technique because we know that we'll
       
 10180     // only ever need at most two versions of a tree. We pool the "other" unused
       
 10181     // node that we're free to reuse. This is lazily created to avoid allocating
       
 10182     // extra objects for things that are never updated. It also allow us to
       
 10183     // reclaim the extra memory if needed.
       
 10184     workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
       
 10185     workInProgress.elementType = current.elementType;
       
 10186     workInProgress.type = current.type;
       
 10187     workInProgress.stateNode = current.stateNode;
       
 10188 
       
 10189     {
       
 10190       // DEV-only fields
       
 10191       workInProgress._debugID = current._debugID;
       
 10192       workInProgress._debugSource = current._debugSource;
       
 10193       workInProgress._debugOwner = current._debugOwner;
       
 10194       workInProgress._debugHookTypes = current._debugHookTypes;
       
 10195     }
       
 10196 
       
 10197     workInProgress.alternate = current;
       
 10198     current.alternate = workInProgress;
       
 10199   } else {
       
 10200     workInProgress.pendingProps = pendingProps;
       
 10201 
       
 10202     // We already have an alternate.
       
 10203     // Reset the effect tag.
       
 10204     workInProgress.effectTag = NoEffect;
       
 10205 
       
 10206     // The effect list is no longer valid.
       
 10207     workInProgress.nextEffect = null;
       
 10208     workInProgress.firstEffect = null;
       
 10209     workInProgress.lastEffect = null;
       
 10210 
       
 10211     if (enableProfilerTimer) {
       
 10212       // We intentionally reset, rather than copy, actualDuration & actualStartTime.
       
 10213       // This prevents time from endlessly accumulating in new commits.
       
 10214       // This has the downside of resetting values for different priority renders,
       
 10215       // But works for yielding (the common case) and should support resuming.
       
 10216       workInProgress.actualDuration = 0;
       
 10217       workInProgress.actualStartTime = -1;
       
 10218     }
       
 10219   }
       
 10220 
       
 10221   workInProgress.childExpirationTime = current.childExpirationTime;
       
 10222   workInProgress.expirationTime = current.expirationTime;
       
 10223 
       
 10224   workInProgress.child = current.child;
       
 10225   workInProgress.memoizedProps = current.memoizedProps;
       
 10226   workInProgress.memoizedState = current.memoizedState;
       
 10227   workInProgress.updateQueue = current.updateQueue;
       
 10228   workInProgress.contextDependencies = current.contextDependencies;
       
 10229 
       
 10230   // These will be overridden during the parent's reconciliation
       
 10231   workInProgress.sibling = current.sibling;
       
 10232   workInProgress.index = current.index;
       
 10233   workInProgress.ref = current.ref;
       
 10234 
       
 10235   if (enableProfilerTimer) {
       
 10236     workInProgress.selfBaseDuration = current.selfBaseDuration;
       
 10237     workInProgress.treeBaseDuration = current.treeBaseDuration;
       
 10238   }
       
 10239 
       
 10240   return workInProgress;
       
 10241 }
       
 10242 
       
 10243 function createHostRootFiber(isConcurrent) {
       
 10244   var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext;
       
 10245 
       
 10246   if (enableProfilerTimer && isDevToolsPresent) {
       
 10247     // Always collect profile timings when DevTools are present.
       
 10248     // This enables DevTools to start capturing timing at any point–
       
 10249     // Without some nodes in the tree having empty base times.
       
 10250     mode |= ProfileMode;
       
 10251   }
       
 10252 
       
 10253   return createFiber(HostRoot, null, null, mode);
       
 10254 }
       
 10255 
       
 10256 function createFiberFromTypeAndProps(type, // React$ElementType
       
 10257 key, pendingProps, owner, mode, expirationTime) {
       
 10258   var fiber = void 0;
       
 10259 
       
 10260   var fiberTag = IndeterminateComponent;
       
 10261   // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
       
 10262   var resolvedType = type;
       
 10263   if (typeof type === 'function') {
       
 10264     if (shouldConstruct(type)) {
       
 10265       fiberTag = ClassComponent;
       
 10266     }
       
 10267   } else if (typeof type === 'string') {
       
 10268     fiberTag = HostComponent;
       
 10269   } else {
       
 10270     getTag: switch (type) {
       
 10271       case REACT_FRAGMENT_TYPE:
       
 10272         return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
       
 10273       case REACT_CONCURRENT_MODE_TYPE:
       
 10274         return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
       
 10275       case REACT_STRICT_MODE_TYPE:
       
 10276         return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
       
 10277       case REACT_PROFILER_TYPE:
       
 10278         return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
       
 10279       case REACT_SUSPENSE_TYPE:
       
 10280         return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
       
 10281       default:
       
 10282         {
       
 10283           if (typeof type === 'object' && type !== null) {
       
 10284             switch (type.$$typeof) {
       
 10285               case REACT_PROVIDER_TYPE:
       
 10286                 fiberTag = ContextProvider;
       
 10287                 break getTag;
       
 10288               case REACT_CONTEXT_TYPE:
       
 10289                 // This is a consumer
       
 10290                 fiberTag = ContextConsumer;
       
 10291                 break getTag;
       
 10292               case REACT_FORWARD_REF_TYPE:
       
 10293                 fiberTag = ForwardRef;
       
 10294                 break getTag;
       
 10295               case REACT_MEMO_TYPE:
       
 10296                 fiberTag = MemoComponent;
       
 10297                 break getTag;
       
 10298               case REACT_LAZY_TYPE:
       
 10299                 fiberTag = LazyComponent;
       
 10300                 resolvedType = null;
       
 10301                 break getTag;
       
 10302             }
       
 10303           }
       
 10304           var info = '';
       
 10305           {
       
 10306             if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
       
 10307               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.';
       
 10308             }
       
 10309             var ownerName = owner ? getComponentName(owner.type) : null;
       
 10310             if (ownerName) {
       
 10311               info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 10312             }
       
 10313           }
       
 10314           invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info);
       
 10315         }
       
 10316     }
       
 10317   }
       
 10318 
       
 10319   fiber = createFiber(fiberTag, pendingProps, key, mode);
       
 10320   fiber.elementType = type;
       
 10321   fiber.type = resolvedType;
       
 10322   fiber.expirationTime = expirationTime;
       
 10323 
       
 10324   return fiber;
       
 10325 }
       
 10326 
       
 10327 function createFiberFromElement(element, mode, expirationTime) {
       
 10328   var owner = null;
       
 10329   {
       
 10330     owner = element._owner;
       
 10331   }
       
 10332   var type = element.type;
       
 10333   var key = element.key;
       
 10334   var pendingProps = element.props;
       
 10335   var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
       
 10336   {
       
 10337     fiber._debugSource = element._source;
       
 10338     fiber._debugOwner = element._owner;
       
 10339   }
       
 10340   return fiber;
       
 10341 }
       
 10342 
       
 10343 function createFiberFromFragment(elements, mode, expirationTime, key) {
       
 10344   var fiber = createFiber(Fragment, elements, key, mode);
       
 10345   fiber.expirationTime = expirationTime;
       
 10346   return fiber;
       
 10347 }
       
 10348 
       
 10349 function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
       
 10350   {
       
 10351     if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
       
 10352       warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
       
 10353     }
       
 10354   }
       
 10355 
       
 10356   var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
       
 10357   // TODO: The Profiler fiber shouldn't have a type. It has a tag.
       
 10358   fiber.elementType = REACT_PROFILER_TYPE;
       
 10359   fiber.type = REACT_PROFILER_TYPE;
       
 10360   fiber.expirationTime = expirationTime;
       
 10361 
       
 10362   return fiber;
       
 10363 }
       
 10364 
       
 10365 function createFiberFromMode(pendingProps, mode, expirationTime, key) {
       
 10366   var fiber = createFiber(Mode, pendingProps, key, mode);
       
 10367 
       
 10368   // TODO: The Mode fiber shouldn't have a type. It has a tag.
       
 10369   var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
       
 10370   fiber.elementType = type;
       
 10371   fiber.type = type;
       
 10372 
       
 10373   fiber.expirationTime = expirationTime;
       
 10374   return fiber;
       
 10375 }
       
 10376 
       
 10377 function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
       
 10378   var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
       
 10379 
       
 10380   // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
       
 10381   var type = REACT_SUSPENSE_TYPE;
       
 10382   fiber.elementType = type;
       
 10383   fiber.type = type;
       
 10384 
       
 10385   fiber.expirationTime = expirationTime;
       
 10386   return fiber;
       
 10387 }
       
 10388 
       
 10389 function createFiberFromText(content, mode, expirationTime) {
       
 10390   var fiber = createFiber(HostText, content, null, mode);
       
 10391   fiber.expirationTime = expirationTime;
       
 10392   return fiber;
       
 10393 }
       
 10394 
       
 10395 function createFiberFromHostInstanceForDeletion() {
       
 10396   var fiber = createFiber(HostComponent, null, null, NoContext);
       
 10397   // TODO: These should not need a type.
       
 10398   fiber.elementType = 'DELETED';
       
 10399   fiber.type = 'DELETED';
       
 10400   return fiber;
       
 10401 }
       
 10402 
       
 10403 function createFiberFromPortal(portal, mode, expirationTime) {
       
 10404   var pendingProps = portal.children !== null ? portal.children : [];
       
 10405   var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
       
 10406   fiber.expirationTime = expirationTime;
       
 10407   fiber.stateNode = {
       
 10408     containerInfo: portal.containerInfo,
       
 10409     pendingChildren: null, // Used by persistent updates
       
 10410     implementation: portal.implementation
       
 10411   };
       
 10412   return fiber;
       
 10413 }
       
 10414 
       
 10415 // Used for stashing WIP properties to replay failed work in DEV.
       
 10416 function assignFiberPropertiesInDEV(target, source) {
       
 10417   if (target === null) {
       
 10418     // This Fiber's initial properties will always be overwritten.
       
 10419     // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
       
 10420     target = createFiber(IndeterminateComponent, null, null, NoContext);
       
 10421   }
       
 10422 
       
 10423   // This is intentionally written as a list of all properties.
       
 10424   // We tried to use Object.assign() instead but this is called in
       
 10425   // the hottest path, and Object.assign() was too slow:
       
 10426   // https://github.com/facebook/react/issues/12502
       
 10427   // This code is DEV-only so size is not a concern.
       
 10428 
       
 10429   target.tag = source.tag;
       
 10430   target.key = source.key;
       
 10431   target.elementType = source.elementType;
       
 10432   target.type = source.type;
       
 10433   target.stateNode = source.stateNode;
       
 10434   target.return = source.return;
       
 10435   target.child = source.child;
       
 10436   target.sibling = source.sibling;
       
 10437   target.index = source.index;
       
 10438   target.ref = source.ref;
       
 10439   target.pendingProps = source.pendingProps;
       
 10440   target.memoizedProps = source.memoizedProps;
       
 10441   target.updateQueue = source.updateQueue;
       
 10442   target.memoizedState = source.memoizedState;
       
 10443   target.contextDependencies = source.contextDependencies;
       
 10444   target.mode = source.mode;
       
 10445   target.effectTag = source.effectTag;
       
 10446   target.nextEffect = source.nextEffect;
       
 10447   target.firstEffect = source.firstEffect;
       
 10448   target.lastEffect = source.lastEffect;
       
 10449   target.expirationTime = source.expirationTime;
       
 10450   target.childExpirationTime = source.childExpirationTime;
       
 10451   target.alternate = source.alternate;
       
 10452   if (enableProfilerTimer) {
       
 10453     target.actualDuration = source.actualDuration;
       
 10454     target.actualStartTime = source.actualStartTime;
       
 10455     target.selfBaseDuration = source.selfBaseDuration;
       
 10456     target.treeBaseDuration = source.treeBaseDuration;
       
 10457   }
       
 10458   target._debugID = source._debugID;
       
 10459   target._debugSource = source._debugSource;
       
 10460   target._debugOwner = source._debugOwner;
       
 10461   target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
       
 10462   target._debugHookTypes = source._debugHookTypes;
       
 10463   return target;
       
 10464 }
       
 10465 
       
 10466 var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
 10467 
       
 10468 var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing;
       
 10469 var __interactionsRef = _ReactInternals$Sched$1.__interactionsRef;
       
 10470 var __subscriberRef = _ReactInternals$Sched$1.__subscriberRef;
       
 10471 var unstable_clear = _ReactInternals$Sched$1.unstable_clear;
       
 10472 var unstable_getCurrent = _ReactInternals$Sched$1.unstable_getCurrent;
       
 10473 var unstable_getThreadID = _ReactInternals$Sched$1.unstable_getThreadID;
       
 10474 var unstable_subscribe = _ReactInternals$Sched$1.unstable_subscribe;
       
 10475 var unstable_trace = _ReactInternals$Sched$1.unstable_trace;
       
 10476 var unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe;
       
 10477 var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
       
 10478 
       
 10479 // TODO: This should be lifted into the renderer.
       
 10480 
       
 10481 
       
 10482 // The following attributes are only used by interaction tracing builds.
       
 10483 // They enable interactions to be associated with their async work,
       
 10484 // And expose interaction metadata to the React DevTools Profiler plugin.
       
 10485 // Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
       
 10486 
       
 10487 
       
 10488 // Exported FiberRoot type includes all properties,
       
 10489 // To avoid requiring potentially error-prone :any casts throughout the project.
       
 10490 // Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
       
 10491 // The types are defined separately within this file to ensure they stay in sync.
       
 10492 // (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
       
 10493 
       
 10494 
       
 10495 function createFiberRoot(containerInfo, isConcurrent, hydrate) {
       
 10496   // Cyclic construction. This cheats the type system right now because
       
 10497   // stateNode is any.
       
 10498   var uninitializedFiber = createHostRootFiber(isConcurrent);
       
 10499 
       
 10500   var root = void 0;
       
 10501   if (enableSchedulerTracing) {
       
 10502     root = {
       
 10503       current: uninitializedFiber,
       
 10504       containerInfo: containerInfo,
       
 10505       pendingChildren: null,
       
 10506 
       
 10507       earliestPendingTime: NoWork,
       
 10508       latestPendingTime: NoWork,
       
 10509       earliestSuspendedTime: NoWork,
       
 10510       latestSuspendedTime: NoWork,
       
 10511       latestPingedTime: NoWork,
       
 10512 
       
 10513       pingCache: null,
       
 10514 
       
 10515       didError: false,
       
 10516 
       
 10517       pendingCommitExpirationTime: NoWork,
       
 10518       finishedWork: null,
       
 10519       timeoutHandle: noTimeout,
       
 10520       context: null,
       
 10521       pendingContext: null,
       
 10522       hydrate: hydrate,
       
 10523       nextExpirationTimeToWorkOn: NoWork,
       
 10524       expirationTime: NoWork,
       
 10525       firstBatch: null,
       
 10526       nextScheduledRoot: null,
       
 10527 
       
 10528       interactionThreadID: unstable_getThreadID(),
       
 10529       memoizedInteractions: new Set(),
       
 10530       pendingInteractionMap: new Map()
       
 10531     };
       
 10532   } else {
       
 10533     root = {
       
 10534       current: uninitializedFiber,
       
 10535       containerInfo: containerInfo,
       
 10536       pendingChildren: null,
       
 10537 
       
 10538       pingCache: null,
       
 10539 
       
 10540       earliestPendingTime: NoWork,
       
 10541       latestPendingTime: NoWork,
       
 10542       earliestSuspendedTime: NoWork,
       
 10543       latestSuspendedTime: NoWork,
       
 10544       latestPingedTime: NoWork,
       
 10545 
       
 10546       didError: false,
       
 10547 
       
 10548       pendingCommitExpirationTime: NoWork,
       
 10549       finishedWork: null,
       
 10550       timeoutHandle: noTimeout,
       
 10551       context: null,
       
 10552       pendingContext: null,
       
 10553       hydrate: hydrate,
       
 10554       nextExpirationTimeToWorkOn: NoWork,
       
 10555       expirationTime: NoWork,
       
 10556       firstBatch: null,
       
 10557       nextScheduledRoot: null
       
 10558     };
       
 10559   }
       
 10560 
       
 10561   uninitializedFiber.stateNode = root;
       
 10562 
       
 10563   // The reason for the way the Flow types are structured in this file,
       
 10564   // Is to avoid needing :any casts everywhere interaction tracing fields are used.
       
 10565   // Unfortunately that requires an :any cast for non-interaction tracing capable builds.
       
 10566   // $FlowFixMe Remove this :any cast and replace it with something better.
       
 10567   return root;
       
 10568 }
 11603 }
 10569 
 11604 
 10570 /**
 11605 /**
 10571  * Forked from fbjs/warning:
 11606  * Forked from fbjs/warning:
 10572  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
 11607  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
 10619 }
 11654 }
 10620 
 11655 
 10621 var lowPriorityWarning$1 = lowPriorityWarning;
 11656 var lowPriorityWarning$1 = lowPriorityWarning;
 10622 
 11657 
 10623 var ReactStrictModeWarnings = {
 11658 var ReactStrictModeWarnings = {
 10624   discardPendingWarnings: function () {},
 11659   recordUnsafeLifecycleWarnings: function (fiber, instance) {},
 10625   flushPendingDeprecationWarnings: function () {},
       
 10626   flushPendingUnsafeLifecycleWarnings: function () {},
 11660   flushPendingUnsafeLifecycleWarnings: function () {},
 10627   recordDeprecationWarnings: function (fiber, instance) {},
       
 10628   recordUnsafeLifecycleWarnings: function (fiber, instance) {},
       
 10629   recordLegacyContextWarning: function (fiber, instance) {},
 11661   recordLegacyContextWarning: function (fiber, instance) {},
 10630   flushLegacyContextWarning: function () {}
 11662   flushLegacyContextWarning: function () {},
       
 11663   discardPendingWarnings: function () {}
 10631 };
 11664 };
 10632 
 11665 
 10633 {
 11666 {
 10634   var LIFECYCLE_SUGGESTIONS = {
 11667   var findStrictRoot = function (fiber) {
 10635     UNSAFE_componentWillMount: 'componentDidMount',
 11668     var maybeStrictRoot = null;
 10636     UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps',
 11669 
 10637     UNSAFE_componentWillUpdate: 'componentDidUpdate'
 11670     var node = fiber;
       
 11671     while (node !== null) {
       
 11672       if (node.mode & StrictMode) {
       
 11673         maybeStrictRoot = node;
       
 11674       }
       
 11675       node = node.return;
       
 11676     }
       
 11677 
       
 11678     return maybeStrictRoot;
 10638   };
 11679   };
 10639 
       
 10640   var pendingComponentWillMountWarnings = [];
       
 10641   var pendingComponentWillReceivePropsWarnings = [];
       
 10642   var pendingComponentWillUpdateWarnings = [];
       
 10643   var pendingUnsafeLifecycleWarnings = new Map();
       
 10644   var pendingLegacyContextWarning = new Map();
       
 10645 
       
 10646   // Tracks components we have already warned about.
       
 10647   var didWarnAboutDeprecatedLifecycles = new Set();
       
 10648   var didWarnAboutUnsafeLifecycles = new Set();
       
 10649   var didWarnAboutLegacyContext = new Set();
       
 10650 
 11680 
 10651   var setToSortedString = function (set) {
 11681   var setToSortedString = function (set) {
 10652     var array = [];
 11682     var array = [];
 10653     set.forEach(function (value) {
 11683     set.forEach(function (value) {
 10654       array.push(value);
 11684       array.push(value);
 10655     });
 11685     });
 10656     return array.sort().join(', ');
 11686     return array.sort().join(', ');
 10657   };
 11687   };
 10658 
 11688 
 10659   ReactStrictModeWarnings.discardPendingWarnings = function () {
 11689   var pendingComponentWillMountWarnings = [];
 10660     pendingComponentWillMountWarnings = [];
 11690   var pendingUNSAFE_ComponentWillMountWarnings = [];
 10661     pendingComponentWillReceivePropsWarnings = [];
 11691   var pendingComponentWillReceivePropsWarnings = [];
 10662     pendingComponentWillUpdateWarnings = [];
 11692   var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
 10663     pendingUnsafeLifecycleWarnings = new Map();
 11693   var pendingComponentWillUpdateWarnings = [];
 10664     pendingLegacyContextWarning = new Map();
 11694   var pendingUNSAFE_ComponentWillUpdateWarnings = [];
 10665   };
 11695 
 10666 
 11696   // Tracks components we have already warned about.
 10667   ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
 11697   var didWarnAboutUnsafeLifecycles = new Set();
 10668     pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) {
 11698 
 10669       var lifecyclesWarningMessages = [];
 11699   ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
 10670 
       
 10671       Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) {
       
 10672         var lifecycleWarnings = lifecycleWarningsMap[lifecycle];
       
 10673         if (lifecycleWarnings.length > 0) {
       
 10674           var componentNames = new Set();
       
 10675           lifecycleWarnings.forEach(function (fiber) {
       
 10676             componentNames.add(getComponentName(fiber.type) || 'Component');
       
 10677             didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 10678           });
       
 10679 
       
 10680           var formatted = lifecycle.replace('UNSAFE_', '');
       
 10681           var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
       
 10682           var sortedComponentNames = setToSortedString(componentNames);
       
 10683 
       
 10684           lifecyclesWarningMessages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames));
       
 10685         }
       
 10686       });
       
 10687 
       
 10688       if (lifecyclesWarningMessages.length > 0) {
       
 10689         var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
       
 10690 
       
 10691         warningWithoutStack$1(false, 'Unsafe lifecycle methods were found within a strict-mode tree:%s' + '\n\n%s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, lifecyclesWarningMessages.join('\n\n'));
       
 10692       }
       
 10693     });
       
 10694 
       
 10695     pendingUnsafeLifecycleWarnings = new Map();
       
 10696   };
       
 10697 
       
 10698   var findStrictRoot = function (fiber) {
       
 10699     var maybeStrictRoot = null;
       
 10700 
       
 10701     var node = fiber;
       
 10702     while (node !== null) {
       
 10703       if (node.mode & StrictMode) {
       
 10704         maybeStrictRoot = node;
       
 10705       }
       
 10706       node = node.return;
       
 10707     }
       
 10708 
       
 10709     return maybeStrictRoot;
       
 10710   };
       
 10711 
       
 10712   ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () {
       
 10713     if (pendingComponentWillMountWarnings.length > 0) {
       
 10714       var uniqueNames = new Set();
       
 10715       pendingComponentWillMountWarnings.forEach(function (fiber) {
       
 10716         uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 10717         didWarnAboutDeprecatedLifecycles.add(fiber.type);
       
 10718       });
       
 10719 
       
 10720       var sortedNames = setToSortedString(uniqueNames);
       
 10721 
       
 10722       lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames);
       
 10723 
       
 10724       pendingComponentWillMountWarnings = [];
       
 10725     }
       
 10726 
       
 10727     if (pendingComponentWillReceivePropsWarnings.length > 0) {
       
 10728       var _uniqueNames = new Set();
       
 10729       pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 10730         _uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 10731         didWarnAboutDeprecatedLifecycles.add(fiber.type);
       
 10732       });
       
 10733 
       
 10734       var _sortedNames = setToSortedString(_uniqueNames);
       
 10735 
       
 10736       lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames);
       
 10737 
       
 10738       pendingComponentWillReceivePropsWarnings = [];
       
 10739     }
       
 10740 
       
 10741     if (pendingComponentWillUpdateWarnings.length > 0) {
       
 10742       var _uniqueNames2 = new Set();
       
 10743       pendingComponentWillUpdateWarnings.forEach(function (fiber) {
       
 10744         _uniqueNames2.add(getComponentName(fiber.type) || 'Component');
       
 10745         didWarnAboutDeprecatedLifecycles.add(fiber.type);
       
 10746       });
       
 10747 
       
 10748       var _sortedNames2 = setToSortedString(_uniqueNames2);
       
 10749 
       
 10750       lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2);
       
 10751 
       
 10752       pendingComponentWillUpdateWarnings = [];
       
 10753     }
       
 10754   };
       
 10755 
       
 10756   ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) {
       
 10757     // Dedup strategy: Warn once per component.
 11700     // Dedup strategy: Warn once per component.
 10758     if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) {
 11701     if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
 10759       return;
 11702       return;
 10760     }
 11703     }
 10761 
 11704 
       
 11705     if (typeof instance.componentWillMount === 'function' &&
 10762     // Don't warn about react-lifecycles-compat polyfilled components.
 11706     // Don't warn about react-lifecycles-compat polyfilled components.
 10763     if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
 11707     instance.componentWillMount.__suppressDeprecationWarning !== true) {
 10764       pendingComponentWillMountWarnings.push(fiber);
 11708       pendingComponentWillMountWarnings.push(fiber);
 10765     }
 11709     }
       
 11710 
       
 11711     if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11712       pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
       
 11713     }
       
 11714 
 10766     if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
 11715     if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
 10767       pendingComponentWillReceivePropsWarnings.push(fiber);
 11716       pendingComponentWillReceivePropsWarnings.push(fiber);
 10768     }
 11717     }
       
 11718 
       
 11719     if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11720       pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
       
 11721     }
       
 11722 
 10769     if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
 11723     if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
 10770       pendingComponentWillUpdateWarnings.push(fiber);
 11724       pendingComponentWillUpdateWarnings.push(fiber);
 10771     }
 11725     }
       
 11726 
       
 11727     if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11728       pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
       
 11729     }
 10772   };
 11730   };
 10773 
 11731 
 10774   ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
 11732   ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
 10775     var strictRoot = findStrictRoot(fiber);
 11733     // We do an initial pass to gather component names
 10776     if (strictRoot === null) {
 11734     var componentWillMountUniqueNames = new Set();
 10777       warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
 11735     if (pendingComponentWillMountWarnings.length > 0) {
 10778       return;
 11736       pendingComponentWillMountWarnings.forEach(function (fiber) {
 10779     }
 11737         componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
 10780 
 11738         didWarnAboutUnsafeLifecycles.add(fiber.type);
 10781     // Dedup strategy: Warn once per component.
       
 10782     // This is difficult to track any other way since component names
       
 10783     // are often vague and are likely to collide between 3rd party libraries.
       
 10784     // An expand property is probably okay to use here since it's DEV-only,
       
 10785     // and will only be set in the event of serious warnings.
       
 10786     if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
       
 10787       return;
       
 10788     }
       
 10789 
       
 10790     var warningsForRoot = void 0;
       
 10791     if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) {
       
 10792       warningsForRoot = {
       
 10793         UNSAFE_componentWillMount: [],
       
 10794         UNSAFE_componentWillReceiveProps: [],
       
 10795         UNSAFE_componentWillUpdate: []
       
 10796       };
       
 10797 
       
 10798       pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot);
       
 10799     } else {
       
 10800       warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot);
       
 10801     }
       
 10802 
       
 10803     var unsafeLifecycles = [];
       
 10804     if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillMount === 'function') {
       
 10805       unsafeLifecycles.push('UNSAFE_componentWillMount');
       
 10806     }
       
 10807     if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 10808       unsafeLifecycles.push('UNSAFE_componentWillReceiveProps');
       
 10809     }
       
 10810     if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 10811       unsafeLifecycles.push('UNSAFE_componentWillUpdate');
       
 10812     }
       
 10813 
       
 10814     if (unsafeLifecycles.length > 0) {
       
 10815       unsafeLifecycles.forEach(function (lifecycle) {
       
 10816         warningsForRoot[lifecycle].push(fiber);
       
 10817       });
 11739       });
       
 11740       pendingComponentWillMountWarnings = [];
       
 11741     }
       
 11742 
       
 11743     var UNSAFE_componentWillMountUniqueNames = new Set();
       
 11744     if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
       
 11745       pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) {
       
 11746         UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11747         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11748       });
       
 11749       pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11750     }
       
 11751 
       
 11752     var componentWillReceivePropsUniqueNames = new Set();
       
 11753     if (pendingComponentWillReceivePropsWarnings.length > 0) {
       
 11754       pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 11755         componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11756         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11757       });
       
 11758 
       
 11759       pendingComponentWillReceivePropsWarnings = [];
       
 11760     }
       
 11761 
       
 11762     var UNSAFE_componentWillReceivePropsUniqueNames = new Set();
       
 11763     if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
       
 11764       pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 11765         UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11766         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11767       });
       
 11768 
       
 11769       pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11770     }
       
 11771 
       
 11772     var componentWillUpdateUniqueNames = new Set();
       
 11773     if (pendingComponentWillUpdateWarnings.length > 0) {
       
 11774       pendingComponentWillUpdateWarnings.forEach(function (fiber) {
       
 11775         componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11776         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11777       });
       
 11778 
       
 11779       pendingComponentWillUpdateWarnings = [];
       
 11780     }
       
 11781 
       
 11782     var UNSAFE_componentWillUpdateUniqueNames = new Set();
       
 11783     if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
       
 11784       pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) {
       
 11785         UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11786         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11787       });
       
 11788 
       
 11789       pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11790     }
       
 11791 
       
 11792     // Finally, we flush all the warnings
       
 11793     // UNSAFE_ ones before the deprecated ones, since they'll be 'louder'
       
 11794     if (UNSAFE_componentWillMountUniqueNames.size > 0) {
       
 11795       var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
       
 11796       warningWithoutStack$1(false, 'Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames);
       
 11797     }
       
 11798 
       
 11799     if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
       
 11800       var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
       
 11801       warningWithoutStack$1(false, 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames);
       
 11802     }
       
 11803 
       
 11804     if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
       
 11805       var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
       
 11806       warningWithoutStack$1(false, 'Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2);
       
 11807     }
       
 11808 
       
 11809     if (componentWillMountUniqueNames.size > 0) {
       
 11810       var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
       
 11811 
       
 11812       lowPriorityWarning$1(false, 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3);
       
 11813     }
       
 11814 
       
 11815     if (componentWillReceivePropsUniqueNames.size > 0) {
       
 11816       var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
       
 11817 
       
 11818       lowPriorityWarning$1(false, 'componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4);
       
 11819     }
       
 11820 
       
 11821     if (componentWillUpdateUniqueNames.size > 0) {
       
 11822       var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
       
 11823 
       
 11824       lowPriorityWarning$1(false, 'componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5);
 10818     }
 11825     }
 10819   };
 11826   };
       
 11827 
       
 11828   var pendingLegacyContextWarning = new Map();
       
 11829 
       
 11830   // Tracks components we have already warned about.
       
 11831   var didWarnAboutLegacyContext = new Set();
 10820 
 11832 
 10821   ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
 11833   ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
 10822     var strictRoot = findStrictRoot(fiber);
 11834     var strictRoot = findStrictRoot(fiber);
 10823     if (strictRoot === null) {
 11835     if (strictRoot === null) {
 10824       warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
 11836       warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
 10850       });
 11862       });
 10851 
 11863 
 10852       var sortedNames = setToSortedString(uniqueNames);
 11864       var sortedNames = setToSortedString(uniqueNames);
 10853       var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
 11865       var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
 10854 
 11866 
 10855       warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, sortedNames);
 11867       warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-legacy-context', strictRootComponentStack, sortedNames);
 10856     });
 11868     });
 10857   };
 11869   };
 10858 }
 11870 
 10859 
 11871   ReactStrictModeWarnings.discardPendingWarnings = function () {
 10860 // This lets us hook into Fiber to debug what it's doing.
 11872     pendingComponentWillMountWarnings = [];
 10861 // See https://github.com/facebook/react/pull/8033.
 11873     pendingUNSAFE_ComponentWillMountWarnings = [];
 10862 // This is not part of the public API, not even for React DevTools.
 11874     pendingComponentWillReceivePropsWarnings = [];
 10863 // You may only inject a debugTool if you work on React Fiber itself.
 11875     pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
 10864 var ReactFiberInstrumentation = {
 11876     pendingComponentWillUpdateWarnings = [];
 10865   debugTool: null
 11877     pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11878     pendingLegacyContextWarning = new Map();
       
 11879   };
       
 11880 }
       
 11881 
       
 11882 // Resolves type to a family.
       
 11883 
       
 11884 
       
 11885 // Used by React Refresh runtime through DevTools Global Hook.
       
 11886 
       
 11887 
       
 11888 var resolveFamily = null;
       
 11889 // $FlowFixMe Flow gets confused by a WeakSet feature check below.
       
 11890 var failedBoundaries = null;
       
 11891 
       
 11892 var setRefreshHandler = function (handler) {
       
 11893   {
       
 11894     resolveFamily = handler;
       
 11895   }
 10866 };
 11896 };
 10867 
 11897 
 10868 var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
 11898 function resolveFunctionForHotReloading(type) {
 10869 
 11899   {
 10870 // TODO: Offscreen updates should never suspend. However, a promise that
 11900     if (resolveFamily === null) {
 10871 // suspended inside an offscreen subtree should be able to ping at the priority
 11901       // Hot reloading is disabled.
 10872 // of the outer render.
 11902       return type;
 10873 
 11903     }
 10874 function markPendingPriorityLevel(root, expirationTime) {
 11904     var family = resolveFamily(type);
 10875   // If there's a gap between completing a failed root and retrying it,
 11905     if (family === undefined) {
 10876   // additional updates may be scheduled. Clear `didError`, in case the update
 11906       return type;
 10877   // is sufficient to fix the error.
 11907     }
 10878   root.didError = false;
 11908     // Use the latest known implementation.
 10879 
 11909     return family.current;
 10880   // Update the latest and earliest pending times
 11910   }
 10881   var earliestPendingTime = root.earliestPendingTime;
 11911 }
 10882   if (earliestPendingTime === NoWork) {
 11912 
 10883     // No other pending updates.
 11913 function resolveClassForHotReloading(type) {
 10884     root.earliestPendingTime = root.latestPendingTime = expirationTime;
 11914   // No implementation differences.
 10885   } else {
 11915   return resolveFunctionForHotReloading(type);
 10886     if (earliestPendingTime < expirationTime) {
 11916 }
 10887       // This is the earliest pending update.
 11917 
 10888       root.earliestPendingTime = expirationTime;
 11918 function resolveForwardRefForHotReloading(type) {
       
 11919   {
       
 11920     if (resolveFamily === null) {
       
 11921       // Hot reloading is disabled.
       
 11922       return type;
       
 11923     }
       
 11924     var family = resolveFamily(type);
       
 11925     if (family === undefined) {
       
 11926       // Check if we're dealing with a real forwardRef. Don't want to crash early.
       
 11927       if (type !== null && type !== undefined && typeof type.render === 'function') {
       
 11928         // ForwardRef is special because its resolved .type is an object,
       
 11929         // but it's possible that we only have its inner render function in the map.
       
 11930         // If that inner render function is different, we'll build a new forwardRef type.
       
 11931         var currentRender = resolveFunctionForHotReloading(type.render);
       
 11932         if (type.render !== currentRender) {
       
 11933           var syntheticType = {
       
 11934             $$typeof: REACT_FORWARD_REF_TYPE,
       
 11935             render: currentRender
       
 11936           };
       
 11937           if (type.displayName !== undefined) {
       
 11938             syntheticType.displayName = type.displayName;
       
 11939           }
       
 11940           return syntheticType;
       
 11941         }
       
 11942       }
       
 11943       return type;
       
 11944     }
       
 11945     // Use the latest known implementation.
       
 11946     return family.current;
       
 11947   }
       
 11948 }
       
 11949 
       
 11950 function isCompatibleFamilyForHotReloading(fiber, element) {
       
 11951   {
       
 11952     if (resolveFamily === null) {
       
 11953       // Hot reloading is disabled.
       
 11954       return false;
       
 11955     }
       
 11956 
       
 11957     var prevType = fiber.elementType;
       
 11958     var nextType = element.type;
       
 11959 
       
 11960     // If we got here, we know types aren't === equal.
       
 11961     var needsCompareFamilies = false;
       
 11962 
       
 11963     var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
       
 11964 
       
 11965     switch (fiber.tag) {
       
 11966       case ClassComponent:
       
 11967         {
       
 11968           if (typeof nextType === 'function') {
       
 11969             needsCompareFamilies = true;
       
 11970           }
       
 11971           break;
       
 11972         }
       
 11973       case FunctionComponent:
       
 11974         {
       
 11975           if (typeof nextType === 'function') {
       
 11976             needsCompareFamilies = true;
       
 11977           } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11978             // We don't know the inner type yet.
       
 11979             // We're going to assume that the lazy inner type is stable,
       
 11980             // and so it is sufficient to avoid reconciling it away.
       
 11981             // We're not going to unwrap or actually use the new lazy type.
       
 11982             needsCompareFamilies = true;
       
 11983           }
       
 11984           break;
       
 11985         }
       
 11986       case ForwardRef:
       
 11987         {
       
 11988           if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
       
 11989             needsCompareFamilies = true;
       
 11990           } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11991             needsCompareFamilies = true;
       
 11992           }
       
 11993           break;
       
 11994         }
       
 11995       case MemoComponent:
       
 11996       case SimpleMemoComponent:
       
 11997         {
       
 11998           if ($$typeofNextType === REACT_MEMO_TYPE) {
       
 11999             // TODO: if it was but can no longer be simple,
       
 12000             // we shouldn't set this.
       
 12001             needsCompareFamilies = true;
       
 12002           } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 12003             needsCompareFamilies = true;
       
 12004           }
       
 12005           break;
       
 12006         }
       
 12007       default:
       
 12008         return false;
       
 12009     }
       
 12010 
       
 12011     // Check if both types have a family and it's the same one.
       
 12012     if (needsCompareFamilies) {
       
 12013       // Note: memo() and forwardRef() we'll compare outer rather than inner type.
       
 12014       // This means both of them need to be registered to preserve state.
       
 12015       // If we unwrapped and compared the inner types for wrappers instead,
       
 12016       // then we would risk falsely saying two separate memo(Foo)
       
 12017       // calls are equivalent because they wrap the same Foo function.
       
 12018       var prevFamily = resolveFamily(prevType);
       
 12019       if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
       
 12020         return true;
       
 12021       }
       
 12022     }
       
 12023     return false;
       
 12024   }
       
 12025 }
       
 12026 
       
 12027 function markFailedErrorBoundaryForHotReloading(fiber) {
       
 12028   {
       
 12029     if (resolveFamily === null) {
       
 12030       // Hot reloading is disabled.
       
 12031       return;
       
 12032     }
       
 12033     if (typeof WeakSet !== 'function') {
       
 12034       return;
       
 12035     }
       
 12036     if (failedBoundaries === null) {
       
 12037       failedBoundaries = new WeakSet();
       
 12038     }
       
 12039     failedBoundaries.add(fiber);
       
 12040   }
       
 12041 }
       
 12042 
       
 12043 var scheduleRefresh = function (root, update) {
       
 12044   {
       
 12045     if (resolveFamily === null) {
       
 12046       // Hot reloading is disabled.
       
 12047       return;
       
 12048     }
       
 12049     var _staleFamilies = update.staleFamilies,
       
 12050         _updatedFamilies = update.updatedFamilies;
       
 12051 
       
 12052     flushPassiveEffects();
       
 12053     flushSync(function () {
       
 12054       scheduleFibersWithFamiliesRecursively(root.current, _updatedFamilies, _staleFamilies);
       
 12055     });
       
 12056   }
       
 12057 };
       
 12058 
       
 12059 var scheduleRoot = function (root, element) {
       
 12060   {
       
 12061     if (root.context !== emptyContextObject) {
       
 12062       // Super edge case: root has a legacy _renderSubtree context
       
 12063       // but we don't know the parentComponent so we can't pass it.
       
 12064       // Just ignore. We'll delete this with _renderSubtree code path later.
       
 12065       return;
       
 12066     }
       
 12067     flushPassiveEffects();
       
 12068     updateContainerAtExpirationTime(element, root, null, Sync, null);
       
 12069   }
       
 12070 };
       
 12071 
       
 12072 function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
       
 12073   {
       
 12074     var alternate = fiber.alternate,
       
 12075         child = fiber.child,
       
 12076         sibling = fiber.sibling,
       
 12077         tag = fiber.tag,
       
 12078         type = fiber.type;
       
 12079 
       
 12080 
       
 12081     var candidateType = null;
       
 12082     switch (tag) {
       
 12083       case FunctionComponent:
       
 12084       case SimpleMemoComponent:
       
 12085       case ClassComponent:
       
 12086         candidateType = type;
       
 12087         break;
       
 12088       case ForwardRef:
       
 12089         candidateType = type.render;
       
 12090         break;
       
 12091       default:
       
 12092         break;
       
 12093     }
       
 12094 
       
 12095     if (resolveFamily === null) {
       
 12096       throw new Error('Expected resolveFamily to be set during hot reload.');
       
 12097     }
       
 12098 
       
 12099     var needsRender = false;
       
 12100     var needsRemount = false;
       
 12101     if (candidateType !== null) {
       
 12102       var family = resolveFamily(candidateType);
       
 12103       if (family !== undefined) {
       
 12104         if (staleFamilies.has(family)) {
       
 12105           needsRemount = true;
       
 12106         } else if (updatedFamilies.has(family)) {
       
 12107           needsRender = true;
       
 12108         }
       
 12109       }
       
 12110     }
       
 12111     if (failedBoundaries !== null) {
       
 12112       if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
       
 12113         needsRemount = true;
       
 12114       }
       
 12115     }
       
 12116 
       
 12117     if (needsRemount) {
       
 12118       fiber._debugNeedsRemount = true;
       
 12119     }
       
 12120     if (needsRemount || needsRender) {
       
 12121       scheduleWork(fiber, Sync);
       
 12122     }
       
 12123     if (child !== null && !needsRemount) {
       
 12124       scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
       
 12125     }
       
 12126     if (sibling !== null) {
       
 12127       scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
       
 12128     }
       
 12129   }
       
 12130 }
       
 12131 
       
 12132 var findHostInstancesForRefresh = function (root, families) {
       
 12133   {
       
 12134     var hostInstances = new Set();
       
 12135     var types = new Set(families.map(function (family) {
       
 12136       return family.current;
       
 12137     }));
       
 12138     findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances);
       
 12139     return hostInstances;
       
 12140   }
       
 12141 };
       
 12142 
       
 12143 function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
       
 12144   {
       
 12145     var child = fiber.child,
       
 12146         sibling = fiber.sibling,
       
 12147         tag = fiber.tag,
       
 12148         type = fiber.type;
       
 12149 
       
 12150 
       
 12151     var candidateType = null;
       
 12152     switch (tag) {
       
 12153       case FunctionComponent:
       
 12154       case SimpleMemoComponent:
       
 12155       case ClassComponent:
       
 12156         candidateType = type;
       
 12157         break;
       
 12158       case ForwardRef:
       
 12159         candidateType = type.render;
       
 12160         break;
       
 12161       default:
       
 12162         break;
       
 12163     }
       
 12164 
       
 12165     var didMatch = false;
       
 12166     if (candidateType !== null) {
       
 12167       if (types.has(candidateType)) {
       
 12168         didMatch = true;
       
 12169       }
       
 12170     }
       
 12171 
       
 12172     if (didMatch) {
       
 12173       // We have a match. This only drills down to the closest host components.
       
 12174       // There's no need to search deeper because for the purpose of giving
       
 12175       // visual feedback, "flashing" outermost parent rectangles is sufficient.
       
 12176       findHostInstancesForFiberShallowly(fiber, hostInstances);
 10889     } else {
 12177     } else {
 10890       var latestPendingTime = root.latestPendingTime;
 12178       // If there's no match, maybe there will be one further down in the child tree.
 10891       if (latestPendingTime > expirationTime) {
 12179       if (child !== null) {
 10892         // This is the latest pending update
 12180         findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
 10893         root.latestPendingTime = expirationTime;
 12181       }
 10894       }
 12182     }
 10895     }
 12183 
 10896   }
 12184     if (sibling !== null) {
 10897   findNextExpirationTimeToWorkOn(expirationTime, root);
 12185       findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
 10898 }
 12186     }
 10899 
 12187   }
 10900 function markCommittedPriorityLevels(root, earliestRemainingTime) {
 12188 }
 10901   root.didError = false;
 12189 
 10902 
 12190 function findHostInstancesForFiberShallowly(fiber, hostInstances) {
 10903   if (earliestRemainingTime === NoWork) {
 12191   {
 10904     // Fast path. There's no remaining work. Clear everything.
 12192     var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
 10905     root.earliestPendingTime = NoWork;
 12193     if (foundHostInstances) {
 10906     root.latestPendingTime = NoWork;
 12194       return;
 10907     root.earliestSuspendedTime = NoWork;
 12195     }
 10908     root.latestSuspendedTime = NoWork;
 12196     // If we didn't find any host children, fallback to closest host parent.
 10909     root.latestPingedTime = NoWork;
 12197     var node = fiber;
 10910     findNextExpirationTimeToWorkOn(NoWork, root);
 12198     while (true) {
 10911     return;
 12199       switch (node.tag) {
 10912   }
 12200         case HostComponent:
 10913 
 12201           hostInstances.add(node.stateNode);
 10914   if (earliestRemainingTime < root.latestPingedTime) {
 12202           return;
 10915     root.latestPingedTime = NoWork;
 12203         case HostPortal:
 10916   }
 12204           hostInstances.add(node.stateNode.containerInfo);
 10917 
 12205           return;
 10918   // Let's see if the previous latest known pending level was just flushed.
 12206         case HostRoot:
 10919   var latestPendingTime = root.latestPendingTime;
 12207           hostInstances.add(node.stateNode.containerInfo);
 10920   if (latestPendingTime !== NoWork) {
 12208           return;
 10921     if (latestPendingTime > earliestRemainingTime) {
 12209       }
 10922       // We've flushed all the known pending levels.
 12210       if (node.return === null) {
 10923       root.earliestPendingTime = root.latestPendingTime = NoWork;
 12211         throw new Error('Expected to reach root first.');
 10924     } else {
 12212       }
 10925       var earliestPendingTime = root.earliestPendingTime;
 12213       node = node.return;
 10926       if (earliestPendingTime > earliestRemainingTime) {
 12214     }
 10927         // We've flushed the earliest known pending level. Set this to the
 12215   }
 10928         // latest pending time.
 12216 }
 10929         root.earliestPendingTime = root.latestPendingTime;
 12217 
 10930       }
 12218 function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
 10931     }
 12219   {
 10932   }
 12220     var node = fiber;
 10933 
 12221     var foundHostInstances = false;
 10934   // Now let's handle the earliest remaining level in the whole tree. We need to
 12222     while (true) {
 10935   // decide whether to treat it as a pending level or as suspended. Check
 12223       if (node.tag === HostComponent) {
 10936   // it falls within the range of known suspended levels.
 12224         // We got a match.
 10937 
 12225         foundHostInstances = true;
 10938   var earliestSuspendedTime = root.earliestSuspendedTime;
 12226         hostInstances.add(node.stateNode);
 10939   if (earliestSuspendedTime === NoWork) {
 12227         // There may still be more, so keep searching.
 10940     // There's no suspended work. Treat the earliest remaining level as a
 12228       } else if (node.child !== null) {
 10941     // pending level.
 12229         node.child.return = node;
 10942     markPendingPriorityLevel(root, earliestRemainingTime);
 12230         node = node.child;
 10943     findNextExpirationTimeToWorkOn(NoWork, root);
 12231         continue;
 10944     return;
 12232       }
 10945   }
 12233       if (node === fiber) {
 10946 
 12234         return foundHostInstances;
 10947   var latestSuspendedTime = root.latestSuspendedTime;
 12235       }
 10948   if (earliestRemainingTime < latestSuspendedTime) {
 12236       while (node.sibling === null) {
 10949     // The earliest remaining level is later than all the suspended work. That
 12237         if (node.return === null || node.return === fiber) {
 10950     // means we've flushed all the suspended work.
 12238           return foundHostInstances;
 10951     root.earliestSuspendedTime = NoWork;
 12239         }
 10952     root.latestSuspendedTime = NoWork;
 12240         node = node.return;
 10953     root.latestPingedTime = NoWork;
 12241       }
 10954 
 12242       node.sibling.return = node.return;
 10955     // There's no suspended work. Treat the earliest remaining level as a
 12243       node = node.sibling;
 10956     // pending level.
 12244     }
 10957     markPendingPriorityLevel(root, earliestRemainingTime);
 12245   }
 10958     findNextExpirationTimeToWorkOn(NoWork, root);
 12246   return false;
 10959     return;
       
 10960   }
       
 10961 
       
 10962   if (earliestRemainingTime > earliestSuspendedTime) {
       
 10963     // The earliest remaining time is earlier than all the suspended work.
       
 10964     // Treat it as a pending update.
       
 10965     markPendingPriorityLevel(root, earliestRemainingTime);
       
 10966     findNextExpirationTimeToWorkOn(NoWork, root);
       
 10967     return;
       
 10968   }
       
 10969 
       
 10970   // The earliest remaining time falls within the range of known suspended
       
 10971   // levels. We should treat this as suspended work.
       
 10972   findNextExpirationTimeToWorkOn(NoWork, root);
       
 10973 }
       
 10974 
       
 10975 function hasLowerPriorityWork(root, erroredExpirationTime) {
       
 10976   var latestPendingTime = root.latestPendingTime;
       
 10977   var latestSuspendedTime = root.latestSuspendedTime;
       
 10978   var latestPingedTime = root.latestPingedTime;
       
 10979   return latestPendingTime !== NoWork && latestPendingTime < erroredExpirationTime || latestSuspendedTime !== NoWork && latestSuspendedTime < erroredExpirationTime || latestPingedTime !== NoWork && latestPingedTime < erroredExpirationTime;
       
 10980 }
       
 10981 
       
 10982 function isPriorityLevelSuspended(root, expirationTime) {
       
 10983   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 10984   var latestSuspendedTime = root.latestSuspendedTime;
       
 10985   return earliestSuspendedTime !== NoWork && expirationTime <= earliestSuspendedTime && expirationTime >= latestSuspendedTime;
       
 10986 }
       
 10987 
       
 10988 function markSuspendedPriorityLevel(root, suspendedTime) {
       
 10989   root.didError = false;
       
 10990   clearPing(root, suspendedTime);
       
 10991 
       
 10992   // First, check the known pending levels and update them if needed.
       
 10993   var earliestPendingTime = root.earliestPendingTime;
       
 10994   var latestPendingTime = root.latestPendingTime;
       
 10995   if (earliestPendingTime === suspendedTime) {
       
 10996     if (latestPendingTime === suspendedTime) {
       
 10997       // Both known pending levels were suspended. Clear them.
       
 10998       root.earliestPendingTime = root.latestPendingTime = NoWork;
       
 10999     } else {
       
 11000       // The earliest pending level was suspended. Clear by setting it to the
       
 11001       // latest pending level.
       
 11002       root.earliestPendingTime = latestPendingTime;
       
 11003     }
       
 11004   } else if (latestPendingTime === suspendedTime) {
       
 11005     // The latest pending level was suspended. Clear by setting it to the
       
 11006     // latest pending level.
       
 11007     root.latestPendingTime = earliestPendingTime;
       
 11008   }
       
 11009 
       
 11010   // Finally, update the known suspended levels.
       
 11011   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 11012   var latestSuspendedTime = root.latestSuspendedTime;
       
 11013   if (earliestSuspendedTime === NoWork) {
       
 11014     // No other suspended levels.
       
 11015     root.earliestSuspendedTime = root.latestSuspendedTime = suspendedTime;
       
 11016   } else {
       
 11017     if (earliestSuspendedTime < suspendedTime) {
       
 11018       // This is the earliest suspended level.
       
 11019       root.earliestSuspendedTime = suspendedTime;
       
 11020     } else if (latestSuspendedTime > suspendedTime) {
       
 11021       // This is the latest suspended level
       
 11022       root.latestSuspendedTime = suspendedTime;
       
 11023     }
       
 11024   }
       
 11025 
       
 11026   findNextExpirationTimeToWorkOn(suspendedTime, root);
       
 11027 }
       
 11028 
       
 11029 function markPingedPriorityLevel(root, pingedTime) {
       
 11030   root.didError = false;
       
 11031 
       
 11032   // TODO: When we add back resuming, we need to ensure the progressed work
       
 11033   // is thrown out and not reused during the restarted render. One way to
       
 11034   // invalidate the progressed work is to restart at expirationTime + 1.
       
 11035   var latestPingedTime = root.latestPingedTime;
       
 11036   if (latestPingedTime === NoWork || latestPingedTime > pingedTime) {
       
 11037     root.latestPingedTime = pingedTime;
       
 11038   }
       
 11039   findNextExpirationTimeToWorkOn(pingedTime, root);
       
 11040 }
       
 11041 
       
 11042 function clearPing(root, completedTime) {
       
 11043   var latestPingedTime = root.latestPingedTime;
       
 11044   if (latestPingedTime >= completedTime) {
       
 11045     root.latestPingedTime = NoWork;
       
 11046   }
       
 11047 }
       
 11048 
       
 11049 function findEarliestOutstandingPriorityLevel(root, renderExpirationTime) {
       
 11050   var earliestExpirationTime = renderExpirationTime;
       
 11051 
       
 11052   var earliestPendingTime = root.earliestPendingTime;
       
 11053   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 11054   if (earliestPendingTime > earliestExpirationTime) {
       
 11055     earliestExpirationTime = earliestPendingTime;
       
 11056   }
       
 11057   if (earliestSuspendedTime > earliestExpirationTime) {
       
 11058     earliestExpirationTime = earliestSuspendedTime;
       
 11059   }
       
 11060   return earliestExpirationTime;
       
 11061 }
       
 11062 
       
 11063 function didExpireAtExpirationTime(root, currentTime) {
       
 11064   var expirationTime = root.expirationTime;
       
 11065   if (expirationTime !== NoWork && currentTime <= expirationTime) {
       
 11066     // The root has expired. Flush all work up to the current time.
       
 11067     root.nextExpirationTimeToWorkOn = currentTime;
       
 11068   }
       
 11069 }
       
 11070 
       
 11071 function findNextExpirationTimeToWorkOn(completedExpirationTime, root) {
       
 11072   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 11073   var latestSuspendedTime = root.latestSuspendedTime;
       
 11074   var earliestPendingTime = root.earliestPendingTime;
       
 11075   var latestPingedTime = root.latestPingedTime;
       
 11076 
       
 11077   // Work on the earliest pending time. Failing that, work on the latest
       
 11078   // pinged time.
       
 11079   var nextExpirationTimeToWorkOn = earliestPendingTime !== NoWork ? earliestPendingTime : latestPingedTime;
       
 11080 
       
 11081   // If there is no pending or pinged work, check if there's suspended work
       
 11082   // that's lower priority than what we just completed.
       
 11083   if (nextExpirationTimeToWorkOn === NoWork && (completedExpirationTime === NoWork || latestSuspendedTime < completedExpirationTime)) {
       
 11084     // The lowest priority suspended work is the work most likely to be
       
 11085     // committed next. Let's start rendering it again, so that if it times out,
       
 11086     // it's ready to commit.
       
 11087     nextExpirationTimeToWorkOn = latestSuspendedTime;
       
 11088   }
       
 11089 
       
 11090   var expirationTime = nextExpirationTimeToWorkOn;
       
 11091   if (expirationTime !== NoWork && earliestSuspendedTime > expirationTime) {
       
 11092     // Expire using the earliest known expiration time.
       
 11093     expirationTime = earliestSuspendedTime;
       
 11094   }
       
 11095 
       
 11096   root.nextExpirationTimeToWorkOn = nextExpirationTimeToWorkOn;
       
 11097   root.expirationTime = expirationTime;
       
 11098 }
 12247 }
 11099 
 12248 
 11100 function resolveDefaultProps(Component, baseProps) {
 12249 function resolveDefaultProps(Component, baseProps) {
 11101   if (Component && Component.defaultProps) {
 12250   if (Component && Component.defaultProps) {
 11102     // Resolve default props. Taken from ReactElement
 12251     // Resolve default props. Taken from ReactElement
 11164         throw _thenable;
 12313         throw _thenable;
 11165       }
 12314       }
 11166   }
 12315   }
 11167 }
 12316 }
 11168 
 12317 
 11169 var fakeInternalInstance = {};
       
 11170 var isArray$1 = Array.isArray;
       
 11171 
       
 11172 // React.Component uses a shared frozen object by default.
       
 11173 // We'll use it to determine whether we need to initialize legacy refs.
       
 11174 var emptyRefsObject = new React.Component().refs;
       
 11175 
       
 11176 var didWarnAboutStateAssignmentForComponent = void 0;
       
 11177 var didWarnAboutUninitializedState = void 0;
       
 11178 var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
       
 11179 var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
       
 11180 var didWarnAboutUndefinedDerivedState = void 0;
       
 11181 var warnOnUndefinedDerivedState = void 0;
       
 11182 var warnOnInvalidCallback$1 = void 0;
       
 11183 var didWarnAboutDirectlyAssigningPropsToState = void 0;
       
 11184 var didWarnAboutContextTypeAndContextTypes = void 0;
       
 11185 var didWarnAboutInvalidateContextType = void 0;
       
 11186 
       
 11187 {
       
 11188   didWarnAboutStateAssignmentForComponent = new Set();
       
 11189   didWarnAboutUninitializedState = new Set();
       
 11190   didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
       
 11191   didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
       
 11192   didWarnAboutDirectlyAssigningPropsToState = new Set();
       
 11193   didWarnAboutUndefinedDerivedState = new Set();
       
 11194   didWarnAboutContextTypeAndContextTypes = new Set();
       
 11195   didWarnAboutInvalidateContextType = new Set();
       
 11196 
       
 11197   var didWarnOnInvalidCallback = new Set();
       
 11198 
       
 11199   warnOnInvalidCallback$1 = function (callback, callerName) {
       
 11200     if (callback === null || typeof callback === 'function') {
       
 11201       return;
       
 11202     }
       
 11203     var key = callerName + '_' + callback;
       
 11204     if (!didWarnOnInvalidCallback.has(key)) {
       
 11205       didWarnOnInvalidCallback.add(key);
       
 11206       warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
       
 11207     }
       
 11208   };
       
 11209 
       
 11210   warnOnUndefinedDerivedState = function (type, partialState) {
       
 11211     if (partialState === undefined) {
       
 11212       var componentName = getComponentName(type) || 'Component';
       
 11213       if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
       
 11214         didWarnAboutUndefinedDerivedState.add(componentName);
       
 11215         warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
       
 11216       }
       
 11217     }
       
 11218   };
       
 11219 
       
 11220   // This is so gross but it's at least non-critical and can be removed if
       
 11221   // it causes problems. This is meant to give a nicer error message for
       
 11222   // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
       
 11223   // ...)) which otherwise throws a "_processChildContext is not a function"
       
 11224   // exception.
       
 11225   Object.defineProperty(fakeInternalInstance, '_processChildContext', {
       
 11226     enumerable: false,
       
 11227     value: function () {
       
 11228       invariant(false, '_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).');
       
 11229     }
       
 11230   });
       
 11231   Object.freeze(fakeInternalInstance);
       
 11232 }
       
 11233 
       
 11234 function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
       
 11235   var prevState = workInProgress.memoizedState;
       
 11236 
       
 11237   {
       
 11238     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 11239       // Invoke the function an extra time to help detect side-effects.
       
 11240       getDerivedStateFromProps(nextProps, prevState);
       
 11241     }
       
 11242   }
       
 11243 
       
 11244   var partialState = getDerivedStateFromProps(nextProps, prevState);
       
 11245 
       
 11246   {
       
 11247     warnOnUndefinedDerivedState(ctor, partialState);
       
 11248   }
       
 11249   // Merge the partial state and the previous state.
       
 11250   var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
       
 11251   workInProgress.memoizedState = memoizedState;
       
 11252 
       
 11253   // Once the update queue is empty, persist the derived state onto the
       
 11254   // base state.
       
 11255   var updateQueue = workInProgress.updateQueue;
       
 11256   if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
       
 11257     updateQueue.baseState = memoizedState;
       
 11258   }
       
 11259 }
       
 11260 
       
 11261 var classComponentUpdater = {
       
 11262   isMounted: isMounted,
       
 11263   enqueueSetState: function (inst, payload, callback) {
       
 11264     var fiber = get(inst);
       
 11265     var currentTime = requestCurrentTime();
       
 11266     var expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 11267 
       
 11268     var update = createUpdate(expirationTime);
       
 11269     update.payload = payload;
       
 11270     if (callback !== undefined && callback !== null) {
       
 11271       {
       
 11272         warnOnInvalidCallback$1(callback, 'setState');
       
 11273       }
       
 11274       update.callback = callback;
       
 11275     }
       
 11276 
       
 11277     flushPassiveEffects();
       
 11278     enqueueUpdate(fiber, update);
       
 11279     scheduleWork(fiber, expirationTime);
       
 11280   },
       
 11281   enqueueReplaceState: function (inst, payload, callback) {
       
 11282     var fiber = get(inst);
       
 11283     var currentTime = requestCurrentTime();
       
 11284     var expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 11285 
       
 11286     var update = createUpdate(expirationTime);
       
 11287     update.tag = ReplaceState;
       
 11288     update.payload = payload;
       
 11289 
       
 11290     if (callback !== undefined && callback !== null) {
       
 11291       {
       
 11292         warnOnInvalidCallback$1(callback, 'replaceState');
       
 11293       }
       
 11294       update.callback = callback;
       
 11295     }
       
 11296 
       
 11297     flushPassiveEffects();
       
 11298     enqueueUpdate(fiber, update);
       
 11299     scheduleWork(fiber, expirationTime);
       
 11300   },
       
 11301   enqueueForceUpdate: function (inst, callback) {
       
 11302     var fiber = get(inst);
       
 11303     var currentTime = requestCurrentTime();
       
 11304     var expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 11305 
       
 11306     var update = createUpdate(expirationTime);
       
 11307     update.tag = ForceUpdate;
       
 11308 
       
 11309     if (callback !== undefined && callback !== null) {
       
 11310       {
       
 11311         warnOnInvalidCallback$1(callback, 'forceUpdate');
       
 11312       }
       
 11313       update.callback = callback;
       
 11314     }
       
 11315 
       
 11316     flushPassiveEffects();
       
 11317     enqueueUpdate(fiber, update);
       
 11318     scheduleWork(fiber, expirationTime);
       
 11319   }
       
 11320 };
       
 11321 
       
 11322 function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
       
 11323   var instance = workInProgress.stateNode;
       
 11324   if (typeof instance.shouldComponentUpdate === 'function') {
       
 11325     startPhaseTimer(workInProgress, 'shouldComponentUpdate');
       
 11326     var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
       
 11327     stopPhaseTimer();
       
 11328 
       
 11329     {
       
 11330       !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
       
 11331     }
       
 11332 
       
 11333     return shouldUpdate;
       
 11334   }
       
 11335 
       
 11336   if (ctor.prototype && ctor.prototype.isPureReactComponent) {
       
 11337     return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
       
 11338   }
       
 11339 
       
 11340   return true;
       
 11341 }
       
 11342 
       
 11343 function checkClassInstance(workInProgress, ctor, newProps) {
       
 11344   var instance = workInProgress.stateNode;
       
 11345   {
       
 11346     var name = getComponentName(ctor) || 'Component';
       
 11347     var renderPresent = instance.render;
       
 11348 
       
 11349     if (!renderPresent) {
       
 11350       if (ctor.prototype && typeof ctor.prototype.render === 'function') {
       
 11351         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
       
 11352       } else {
       
 11353         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
       
 11354       }
       
 11355     }
       
 11356 
       
 11357     var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
       
 11358     !noGetInitialStateOnES6 ? warningWithoutStack$1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
       
 11359     var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
       
 11360     !noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
       
 11361     var noInstancePropTypes = !instance.propTypes;
       
 11362     !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
       
 11363     var noInstanceContextType = !instance.contextType;
       
 11364     !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
       
 11365     var noInstanceContextTypes = !instance.contextTypes;
       
 11366     !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
       
 11367 
       
 11368     if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
       
 11369       didWarnAboutContextTypeAndContextTypes.add(ctor);
       
 11370       warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
       
 11371     }
       
 11372 
       
 11373     var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
       
 11374     !noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
       
 11375     if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
       
 11376       warningWithoutStack$1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
       
 11377     }
       
 11378     var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
       
 11379     !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
       
 11380     var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
       
 11381     !noComponentDidReceiveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
       
 11382     var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
       
 11383     !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
       
 11384     var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
       
 11385     !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
       
 11386     var hasMutatedProps = instance.props !== newProps;
       
 11387     !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
       
 11388     var noInstanceDefaultProps = !instance.defaultProps;
       
 11389     !noInstanceDefaultProps ? warningWithoutStack$1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
       
 11390 
       
 11391     if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
       
 11392       didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
       
 11393       warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
       
 11394     }
       
 11395 
       
 11396     var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
       
 11397     !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
       
 11398     var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
       
 11399     !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
       
 11400     var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
       
 11401     !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
       
 11402     var _state = instance.state;
       
 11403     if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
       
 11404       warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
       
 11405     }
       
 11406     if (typeof instance.getChildContext === 'function') {
       
 11407       !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
       
 11408     }
       
 11409   }
       
 11410 }
       
 11411 
       
 11412 function adoptClassInstance(workInProgress, instance) {
       
 11413   instance.updater = classComponentUpdater;
       
 11414   workInProgress.stateNode = instance;
       
 11415   // The instance needs access to the fiber so that it can schedule updates
       
 11416   set(instance, workInProgress);
       
 11417   {
       
 11418     instance._reactInternalInstance = fakeInternalInstance;
       
 11419   }
       
 11420 }
       
 11421 
       
 11422 function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
       
 11423   var isLegacyContextConsumer = false;
       
 11424   var unmaskedContext = emptyContextObject;
       
 11425   var context = null;
       
 11426   var contextType = ctor.contextType;
       
 11427   if (typeof contextType === 'object' && contextType !== null) {
       
 11428     {
       
 11429       if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
       
 11430         didWarnAboutInvalidateContextType.add(ctor);
       
 11431         warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext(). ' + 'Did you accidentally pass the Context.Provider instead?', getComponentName(ctor) || 'Component');
       
 11432       }
       
 11433     }
       
 11434 
       
 11435     context = readContext(contextType);
       
 11436   } else {
       
 11437     unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11438     var contextTypes = ctor.contextTypes;
       
 11439     isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
       
 11440     context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
       
 11441   }
       
 11442 
       
 11443   // Instantiate twice to help detect side-effects.
       
 11444   {
       
 11445     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 11446       new ctor(props, context); // eslint-disable-line no-new
       
 11447     }
       
 11448   }
       
 11449 
       
 11450   var instance = new ctor(props, context);
       
 11451   var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
       
 11452   adoptClassInstance(workInProgress, instance);
       
 11453 
       
 11454   {
       
 11455     if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
       
 11456       var componentName = getComponentName(ctor) || 'Component';
       
 11457       if (!didWarnAboutUninitializedState.has(componentName)) {
       
 11458         didWarnAboutUninitializedState.add(componentName);
       
 11459         warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
       
 11460       }
       
 11461     }
       
 11462 
       
 11463     // If new component APIs are defined, "unsafe" lifecycles won't be called.
       
 11464     // Warn about these lifecycles if they are present.
       
 11465     // Don't warn about react-lifecycles-compat polyfilled methods though.
       
 11466     if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11467       var foundWillMountName = null;
       
 11468       var foundWillReceivePropsName = null;
       
 11469       var foundWillUpdateName = null;
       
 11470       if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 11471         foundWillMountName = 'componentWillMount';
       
 11472       } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11473         foundWillMountName = 'UNSAFE_componentWillMount';
       
 11474       }
       
 11475       if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 11476         foundWillReceivePropsName = 'componentWillReceiveProps';
       
 11477       } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11478         foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
       
 11479       }
       
 11480       if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 11481         foundWillUpdateName = 'componentWillUpdate';
       
 11482       } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11483         foundWillUpdateName = 'UNSAFE_componentWillUpdate';
       
 11484       }
       
 11485       if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
       
 11486         var _componentName = getComponentName(ctor) || 'Component';
       
 11487         var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
       
 11488         if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
       
 11489           didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
       
 11490           warningWithoutStack$1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n  ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n  ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n  ' + foundWillUpdateName : '');
       
 11491         }
       
 11492       }
       
 11493     }
       
 11494   }
       
 11495 
       
 11496   // Cache unmasked context so we can avoid recreating masked context unless necessary.
       
 11497   // ReactFiberContext usually updates this cache but can't for newly-created instances.
       
 11498   if (isLegacyContextConsumer) {
       
 11499     cacheContext(workInProgress, unmaskedContext, context);
       
 11500   }
       
 11501 
       
 11502   return instance;
       
 11503 }
       
 11504 
       
 11505 function callComponentWillMount(workInProgress, instance) {
       
 11506   startPhaseTimer(workInProgress, 'componentWillMount');
       
 11507   var oldState = instance.state;
       
 11508 
       
 11509   if (typeof instance.componentWillMount === 'function') {
       
 11510     instance.componentWillMount();
       
 11511   }
       
 11512   if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11513     instance.UNSAFE_componentWillMount();
       
 11514   }
       
 11515 
       
 11516   stopPhaseTimer();
       
 11517 
       
 11518   if (oldState !== instance.state) {
       
 11519     {
       
 11520       warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
       
 11521     }
       
 11522     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 11523   }
       
 11524 }
       
 11525 
       
 11526 function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
       
 11527   var oldState = instance.state;
       
 11528   startPhaseTimer(workInProgress, 'componentWillReceiveProps');
       
 11529   if (typeof instance.componentWillReceiveProps === 'function') {
       
 11530     instance.componentWillReceiveProps(newProps, nextContext);
       
 11531   }
       
 11532   if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11533     instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
       
 11534   }
       
 11535   stopPhaseTimer();
       
 11536 
       
 11537   if (instance.state !== oldState) {
       
 11538     {
       
 11539       var componentName = getComponentName(workInProgress.type) || 'Component';
       
 11540       if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
       
 11541         didWarnAboutStateAssignmentForComponent.add(componentName);
       
 11542         warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
       
 11543       }
       
 11544     }
       
 11545     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 11546   }
       
 11547 }
       
 11548 
       
 11549 // Invokes the mount life-cycles on a previously never rendered instance.
       
 11550 function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 11551   {
       
 11552     checkClassInstance(workInProgress, ctor, newProps);
       
 11553   }
       
 11554 
       
 11555   var instance = workInProgress.stateNode;
       
 11556   instance.props = newProps;
       
 11557   instance.state = workInProgress.memoizedState;
       
 11558   instance.refs = emptyRefsObject;
       
 11559 
       
 11560   var contextType = ctor.contextType;
       
 11561   if (typeof contextType === 'object' && contextType !== null) {
       
 11562     instance.context = readContext(contextType);
       
 11563   } else {
       
 11564     var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11565     instance.context = getMaskedContext(workInProgress, unmaskedContext);
       
 11566   }
       
 11567 
       
 11568   {
       
 11569     if (instance.state === newProps) {
       
 11570       var componentName = getComponentName(ctor) || 'Component';
       
 11571       if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
       
 11572         didWarnAboutDirectlyAssigningPropsToState.add(componentName);
       
 11573         warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
       
 11574       }
       
 11575     }
       
 11576 
       
 11577     if (workInProgress.mode & StrictMode) {
       
 11578       ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
       
 11579 
       
 11580       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
       
 11581     }
       
 11582 
       
 11583     if (warnAboutDeprecatedLifecycles) {
       
 11584       ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
       
 11585     }
       
 11586   }
       
 11587 
       
 11588   var updateQueue = workInProgress.updateQueue;
       
 11589   if (updateQueue !== null) {
       
 11590     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11591     instance.state = workInProgress.memoizedState;
       
 11592   }
       
 11593 
       
 11594   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 11595   if (typeof getDerivedStateFromProps === 'function') {
       
 11596     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 11597     instance.state = workInProgress.memoizedState;
       
 11598   }
       
 11599 
       
 11600   // In order to support react-lifecycles-compat polyfilled components,
       
 11601   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11602   if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 11603     callComponentWillMount(workInProgress, instance);
       
 11604     // If we had additional state updates during this life-cycle, let's
       
 11605     // process them now.
       
 11606     updateQueue = workInProgress.updateQueue;
       
 11607     if (updateQueue !== null) {
       
 11608       processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11609       instance.state = workInProgress.memoizedState;
       
 11610     }
       
 11611   }
       
 11612 
       
 11613   if (typeof instance.componentDidMount === 'function') {
       
 11614     workInProgress.effectTag |= Update;
       
 11615   }
       
 11616 }
       
 11617 
       
 11618 function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 11619   var instance = workInProgress.stateNode;
       
 11620 
       
 11621   var oldProps = workInProgress.memoizedProps;
       
 11622   instance.props = oldProps;
       
 11623 
       
 11624   var oldContext = instance.context;
       
 11625   var contextType = ctor.contextType;
       
 11626   var nextContext = void 0;
       
 11627   if (typeof contextType === 'object' && contextType !== null) {
       
 11628     nextContext = readContext(contextType);
       
 11629   } else {
       
 11630     var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11631     nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
       
 11632   }
       
 11633 
       
 11634   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 11635   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 11636 
       
 11637   // Note: During these life-cycles, instance.props/instance.state are what
       
 11638   // ever the previously attempted to render - not the "current". However,
       
 11639   // during componentDidUpdate we pass the "current" props.
       
 11640 
       
 11641   // In order to support react-lifecycles-compat polyfilled components,
       
 11642   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11643   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 11644     if (oldProps !== newProps || oldContext !== nextContext) {
       
 11645       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 11646     }
       
 11647   }
       
 11648 
       
 11649   resetHasForceUpdateBeforeProcessing();
       
 11650 
       
 11651   var oldState = workInProgress.memoizedState;
       
 11652   var newState = instance.state = oldState;
       
 11653   var updateQueue = workInProgress.updateQueue;
       
 11654   if (updateQueue !== null) {
       
 11655     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11656     newState = workInProgress.memoizedState;
       
 11657   }
       
 11658   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 11659     // If an update was already in progress, we should schedule an Update
       
 11660     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11661     if (typeof instance.componentDidMount === 'function') {
       
 11662       workInProgress.effectTag |= Update;
       
 11663     }
       
 11664     return false;
       
 11665   }
       
 11666 
       
 11667   if (typeof getDerivedStateFromProps === 'function') {
       
 11668     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 11669     newState = workInProgress.memoizedState;
       
 11670   }
       
 11671 
       
 11672   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 11673 
       
 11674   if (shouldUpdate) {
       
 11675     // In order to support react-lifecycles-compat polyfilled components,
       
 11676     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11677     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 11678       startPhaseTimer(workInProgress, 'componentWillMount');
       
 11679       if (typeof instance.componentWillMount === 'function') {
       
 11680         instance.componentWillMount();
       
 11681       }
       
 11682       if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11683         instance.UNSAFE_componentWillMount();
       
 11684       }
       
 11685       stopPhaseTimer();
       
 11686     }
       
 11687     if (typeof instance.componentDidMount === 'function') {
       
 11688       workInProgress.effectTag |= Update;
       
 11689     }
       
 11690   } else {
       
 11691     // If an update was already in progress, we should schedule an Update
       
 11692     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11693     if (typeof instance.componentDidMount === 'function') {
       
 11694       workInProgress.effectTag |= Update;
       
 11695     }
       
 11696 
       
 11697     // If shouldComponentUpdate returned false, we should still update the
       
 11698     // memoized state to indicate that this work can be reused.
       
 11699     workInProgress.memoizedProps = newProps;
       
 11700     workInProgress.memoizedState = newState;
       
 11701   }
       
 11702 
       
 11703   // Update the existing instance's state, props, and context pointers even
       
 11704   // if shouldComponentUpdate returns false.
       
 11705   instance.props = newProps;
       
 11706   instance.state = newState;
       
 11707   instance.context = nextContext;
       
 11708 
       
 11709   return shouldUpdate;
       
 11710 }
       
 11711 
       
 11712 // Invokes the update life-cycles and returns false if it shouldn't rerender.
       
 11713 function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
       
 11714   var instance = workInProgress.stateNode;
       
 11715 
       
 11716   var oldProps = workInProgress.memoizedProps;
       
 11717   instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
       
 11718 
       
 11719   var oldContext = instance.context;
       
 11720   var contextType = ctor.contextType;
       
 11721   var nextContext = void 0;
       
 11722   if (typeof contextType === 'object' && contextType !== null) {
       
 11723     nextContext = readContext(contextType);
       
 11724   } else {
       
 11725     var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11726     nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
       
 11727   }
       
 11728 
       
 11729   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 11730   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 11731 
       
 11732   // Note: During these life-cycles, instance.props/instance.state are what
       
 11733   // ever the previously attempted to render - not the "current". However,
       
 11734   // during componentDidUpdate we pass the "current" props.
       
 11735 
       
 11736   // In order to support react-lifecycles-compat polyfilled components,
       
 11737   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11738   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 11739     if (oldProps !== newProps || oldContext !== nextContext) {
       
 11740       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 11741     }
       
 11742   }
       
 11743 
       
 11744   resetHasForceUpdateBeforeProcessing();
       
 11745 
       
 11746   var oldState = workInProgress.memoizedState;
       
 11747   var newState = instance.state = oldState;
       
 11748   var updateQueue = workInProgress.updateQueue;
       
 11749   if (updateQueue !== null) {
       
 11750     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11751     newState = workInProgress.memoizedState;
       
 11752   }
       
 11753 
       
 11754   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 11755     // If an update was already in progress, we should schedule an Update
       
 11756     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11757     if (typeof instance.componentDidUpdate === 'function') {
       
 11758       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11759         workInProgress.effectTag |= Update;
       
 11760       }
       
 11761     }
       
 11762     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11763       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11764         workInProgress.effectTag |= Snapshot;
       
 11765       }
       
 11766     }
       
 11767     return false;
       
 11768   }
       
 11769 
       
 11770   if (typeof getDerivedStateFromProps === 'function') {
       
 11771     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 11772     newState = workInProgress.memoizedState;
       
 11773   }
       
 11774 
       
 11775   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 11776 
       
 11777   if (shouldUpdate) {
       
 11778     // In order to support react-lifecycles-compat polyfilled components,
       
 11779     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11780     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
       
 11781       startPhaseTimer(workInProgress, 'componentWillUpdate');
       
 11782       if (typeof instance.componentWillUpdate === 'function') {
       
 11783         instance.componentWillUpdate(newProps, newState, nextContext);
       
 11784       }
       
 11785       if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11786         instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
       
 11787       }
       
 11788       stopPhaseTimer();
       
 11789     }
       
 11790     if (typeof instance.componentDidUpdate === 'function') {
       
 11791       workInProgress.effectTag |= Update;
       
 11792     }
       
 11793     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11794       workInProgress.effectTag |= Snapshot;
       
 11795     }
       
 11796   } else {
       
 11797     // If an update was already in progress, we should schedule an Update
       
 11798     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11799     if (typeof instance.componentDidUpdate === 'function') {
       
 11800       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11801         workInProgress.effectTag |= Update;
       
 11802       }
       
 11803     }
       
 11804     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11805       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11806         workInProgress.effectTag |= Snapshot;
       
 11807       }
       
 11808     }
       
 11809 
       
 11810     // If shouldComponentUpdate returned false, we should still update the
       
 11811     // memoized props/state to indicate that this work can be reused.
       
 11812     workInProgress.memoizedProps = newProps;
       
 11813     workInProgress.memoizedState = newState;
       
 11814   }
       
 11815 
       
 11816   // Update the existing instance's state, props, and context pointers even
       
 11817   // if shouldComponentUpdate returns false.
       
 11818   instance.props = newProps;
       
 11819   instance.state = newState;
       
 11820   instance.context = nextContext;
       
 11821 
       
 11822   return shouldUpdate;
       
 11823 }
       
 11824 
       
 11825 var didWarnAboutMaps = void 0;
       
 11826 var didWarnAboutGenerators = void 0;
       
 11827 var didWarnAboutStringRefInStrictMode = void 0;
       
 11828 var ownerHasKeyUseWarning = void 0;
       
 11829 var ownerHasFunctionTypeWarning = void 0;
       
 11830 var warnForMissingKey = function (child) {};
       
 11831 
       
 11832 {
       
 11833   didWarnAboutMaps = false;
       
 11834   didWarnAboutGenerators = false;
       
 11835   didWarnAboutStringRefInStrictMode = {};
       
 11836 
       
 11837   /**
       
 11838    * Warn if there's no key explicitly set on dynamic arrays of children or
       
 11839    * object keys are not valid. This allows us to keep track of children between
       
 11840    * updates.
       
 11841    */
       
 11842   ownerHasKeyUseWarning = {};
       
 11843   ownerHasFunctionTypeWarning = {};
       
 11844 
       
 11845   warnForMissingKey = function (child) {
       
 11846     if (child === null || typeof child !== 'object') {
       
 11847       return;
       
 11848     }
       
 11849     if (!child._store || child._store.validated || child.key != null) {
       
 11850       return;
       
 11851     }
       
 11852     !(typeof child._store === 'object') ? invariant(false, 'React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 11853     child._store.validated = true;
       
 11854 
       
 11855     var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
       
 11856     if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
       
 11857       return;
       
 11858     }
       
 11859     ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
       
 11860 
       
 11861     warning$1(false, 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
       
 11862   };
       
 11863 }
       
 11864 
       
 11865 var isArray = Array.isArray;
       
 11866 
       
 11867 function coerceRef(returnFiber, current$$1, element) {
       
 11868   var mixedRef = element.ref;
       
 11869   if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
       
 11870     {
       
 11871       if (returnFiber.mode & StrictMode) {
       
 11872         var componentName = getComponentName(returnFiber.type) || 'Component';
       
 11873         if (!didWarnAboutStringRefInStrictMode[componentName]) {
       
 11874           warningWithoutStack$1(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackByFiberInDevAndProd(returnFiber));
       
 11875           didWarnAboutStringRefInStrictMode[componentName] = true;
       
 11876         }
       
 11877       }
       
 11878     }
       
 11879 
       
 11880     if (element._owner) {
       
 11881       var owner = element._owner;
       
 11882       var inst = void 0;
       
 11883       if (owner) {
       
 11884         var ownerFiber = owner;
       
 11885         !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs. Did you mean to use React.forwardRef()?') : void 0;
       
 11886         inst = ownerFiber.stateNode;
       
 11887       }
       
 11888       !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0;
       
 11889       var stringRef = '' + mixedRef;
       
 11890       // Check if previous string ref matches new string ref
       
 11891       if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
       
 11892         return current$$1.ref;
       
 11893       }
       
 11894       var ref = function (value) {
       
 11895         var refs = inst.refs;
       
 11896         if (refs === emptyRefsObject) {
       
 11897           // This is a lazy pooled frozen object, so we need to initialize.
       
 11898           refs = inst.refs = {};
       
 11899         }
       
 11900         if (value === null) {
       
 11901           delete refs[stringRef];
       
 11902         } else {
       
 11903           refs[stringRef] = value;
       
 11904         }
       
 11905       };
       
 11906       ref._stringRef = stringRef;
       
 11907       return ref;
       
 11908     } else {
       
 11909       !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function, a string, an object returned by React.createRef(), or null.') : void 0;
       
 11910       !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0;
       
 11911     }
       
 11912   }
       
 11913   return mixedRef;
       
 11914 }
       
 11915 
       
 11916 function throwOnInvalidObjectType(returnFiber, newChild) {
       
 11917   if (returnFiber.type !== 'textarea') {
       
 11918     var addendum = '';
       
 11919     {
       
 11920       addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
       
 11921     }
       
 11922     invariant(false, 'Objects are not valid as a React child (found: %s).%s', Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild, addendum);
       
 11923   }
       
 11924 }
       
 11925 
       
 11926 function warnOnFunctionType() {
       
 11927   var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
       
 11928 
       
 11929   if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
       
 11930     return;
       
 11931   }
       
 11932   ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
       
 11933 
       
 11934   warning$1(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
       
 11935 }
       
 11936 
       
 11937 // This wrapper function exists because I expect to clone the code in each path
       
 11938 // to be able to optimize each path individually by branching early. This needs
       
 11939 // a compiler or we can do it manually. Helpers that don't need this branching
       
 11940 // live outside of this function.
       
 11941 function ChildReconciler(shouldTrackSideEffects) {
       
 11942   function deleteChild(returnFiber, childToDelete) {
       
 11943     if (!shouldTrackSideEffects) {
       
 11944       // Noop.
       
 11945       return;
       
 11946     }
       
 11947     // Deletions are added in reversed order so we add it to the front.
       
 11948     // At this point, the return fiber's effect list is empty except for
       
 11949     // deletions, so we can just append the deletion to the list. The remaining
       
 11950     // effects aren't added until the complete phase. Once we implement
       
 11951     // resuming, this may not be true.
       
 11952     var last = returnFiber.lastEffect;
       
 11953     if (last !== null) {
       
 11954       last.nextEffect = childToDelete;
       
 11955       returnFiber.lastEffect = childToDelete;
       
 11956     } else {
       
 11957       returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 11958     }
       
 11959     childToDelete.nextEffect = null;
       
 11960     childToDelete.effectTag = Deletion;
       
 11961   }
       
 11962 
       
 11963   function deleteRemainingChildren(returnFiber, currentFirstChild) {
       
 11964     if (!shouldTrackSideEffects) {
       
 11965       // Noop.
       
 11966       return null;
       
 11967     }
       
 11968 
       
 11969     // TODO: For the shouldClone case, this could be micro-optimized a bit by
       
 11970     // assuming that after the first child we've already added everything.
       
 11971     var childToDelete = currentFirstChild;
       
 11972     while (childToDelete !== null) {
       
 11973       deleteChild(returnFiber, childToDelete);
       
 11974       childToDelete = childToDelete.sibling;
       
 11975     }
       
 11976     return null;
       
 11977   }
       
 11978 
       
 11979   function mapRemainingChildren(returnFiber, currentFirstChild) {
       
 11980     // Add the remaining children to a temporary map so that we can find them by
       
 11981     // keys quickly. Implicit (null) keys get added to this set with their index
       
 11982     var existingChildren = new Map();
       
 11983 
       
 11984     var existingChild = currentFirstChild;
       
 11985     while (existingChild !== null) {
       
 11986       if (existingChild.key !== null) {
       
 11987         existingChildren.set(existingChild.key, existingChild);
       
 11988       } else {
       
 11989         existingChildren.set(existingChild.index, existingChild);
       
 11990       }
       
 11991       existingChild = existingChild.sibling;
       
 11992     }
       
 11993     return existingChildren;
       
 11994   }
       
 11995 
       
 11996   function useFiber(fiber, pendingProps, expirationTime) {
       
 11997     // We currently set sibling to null and index to 0 here because it is easy
       
 11998     // to forget to do before returning it. E.g. for the single child case.
       
 11999     var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
       
 12000     clone.index = 0;
       
 12001     clone.sibling = null;
       
 12002     return clone;
       
 12003   }
       
 12004 
       
 12005   function placeChild(newFiber, lastPlacedIndex, newIndex) {
       
 12006     newFiber.index = newIndex;
       
 12007     if (!shouldTrackSideEffects) {
       
 12008       // Noop.
       
 12009       return lastPlacedIndex;
       
 12010     }
       
 12011     var current$$1 = newFiber.alternate;
       
 12012     if (current$$1 !== null) {
       
 12013       var oldIndex = current$$1.index;
       
 12014       if (oldIndex < lastPlacedIndex) {
       
 12015         // This is a move.
       
 12016         newFiber.effectTag = Placement;
       
 12017         return lastPlacedIndex;
       
 12018       } else {
       
 12019         // This item can stay in place.
       
 12020         return oldIndex;
       
 12021       }
       
 12022     } else {
       
 12023       // This is an insertion.
       
 12024       newFiber.effectTag = Placement;
       
 12025       return lastPlacedIndex;
       
 12026     }
       
 12027   }
       
 12028 
       
 12029   function placeSingleChild(newFiber) {
       
 12030     // This is simpler for the single child case. We only need to do a
       
 12031     // placement for inserting new children.
       
 12032     if (shouldTrackSideEffects && newFiber.alternate === null) {
       
 12033       newFiber.effectTag = Placement;
       
 12034     }
       
 12035     return newFiber;
       
 12036   }
       
 12037 
       
 12038   function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
       
 12039     if (current$$1 === null || current$$1.tag !== HostText) {
       
 12040       // Insert
       
 12041       var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 12042       created.return = returnFiber;
       
 12043       return created;
       
 12044     } else {
       
 12045       // Update
       
 12046       var existing = useFiber(current$$1, textContent, expirationTime);
       
 12047       existing.return = returnFiber;
       
 12048       return existing;
       
 12049     }
       
 12050   }
       
 12051 
       
 12052   function updateElement(returnFiber, current$$1, element, expirationTime) {
       
 12053     if (current$$1 !== null && current$$1.elementType === element.type) {
       
 12054       // Move based on index
       
 12055       var existing = useFiber(current$$1, element.props, expirationTime);
       
 12056       existing.ref = coerceRef(returnFiber, current$$1, element);
       
 12057       existing.return = returnFiber;
       
 12058       {
       
 12059         existing._debugSource = element._source;
       
 12060         existing._debugOwner = element._owner;
       
 12061       }
       
 12062       return existing;
       
 12063     } else {
       
 12064       // Insert
       
 12065       var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 12066       created.ref = coerceRef(returnFiber, current$$1, element);
       
 12067       created.return = returnFiber;
       
 12068       return created;
       
 12069     }
       
 12070   }
       
 12071 
       
 12072   function updatePortal(returnFiber, current$$1, portal, expirationTime) {
       
 12073     if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
       
 12074       // Insert
       
 12075       var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 12076       created.return = returnFiber;
       
 12077       return created;
       
 12078     } else {
       
 12079       // Update
       
 12080       var existing = useFiber(current$$1, portal.children || [], expirationTime);
       
 12081       existing.return = returnFiber;
       
 12082       return existing;
       
 12083     }
       
 12084   }
       
 12085 
       
 12086   function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
       
 12087     if (current$$1 === null || current$$1.tag !== Fragment) {
       
 12088       // Insert
       
 12089       var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
       
 12090       created.return = returnFiber;
       
 12091       return created;
       
 12092     } else {
       
 12093       // Update
       
 12094       var existing = useFiber(current$$1, fragment, expirationTime);
       
 12095       existing.return = returnFiber;
       
 12096       return existing;
       
 12097     }
       
 12098   }
       
 12099 
       
 12100   function createChild(returnFiber, newChild, expirationTime) {
       
 12101     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12102       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 12103       // we can continue to replace it without aborting even if it is not a text
       
 12104       // node.
       
 12105       var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
       
 12106       created.return = returnFiber;
       
 12107       return created;
       
 12108     }
       
 12109 
       
 12110     if (typeof newChild === 'object' && newChild !== null) {
       
 12111       switch (newChild.$$typeof) {
       
 12112         case REACT_ELEMENT_TYPE:
       
 12113           {
       
 12114             var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
       
 12115             _created.ref = coerceRef(returnFiber, null, newChild);
       
 12116             _created.return = returnFiber;
       
 12117             return _created;
       
 12118           }
       
 12119         case REACT_PORTAL_TYPE:
       
 12120           {
       
 12121             var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
       
 12122             _created2.return = returnFiber;
       
 12123             return _created2;
       
 12124           }
       
 12125       }
       
 12126 
       
 12127       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 12128         var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
       
 12129         _created3.return = returnFiber;
       
 12130         return _created3;
       
 12131       }
       
 12132 
       
 12133       throwOnInvalidObjectType(returnFiber, newChild);
       
 12134     }
       
 12135 
       
 12136     {
       
 12137       if (typeof newChild === 'function') {
       
 12138         warnOnFunctionType();
       
 12139       }
       
 12140     }
       
 12141 
       
 12142     return null;
       
 12143   }
       
 12144 
       
 12145   function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
       
 12146     // Update the fiber if the keys match, otherwise return null.
       
 12147 
       
 12148     var key = oldFiber !== null ? oldFiber.key : null;
       
 12149 
       
 12150     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12151       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 12152       // we can continue to replace it without aborting even if it is not a text
       
 12153       // node.
       
 12154       if (key !== null) {
       
 12155         return null;
       
 12156       }
       
 12157       return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
       
 12158     }
       
 12159 
       
 12160     if (typeof newChild === 'object' && newChild !== null) {
       
 12161       switch (newChild.$$typeof) {
       
 12162         case REACT_ELEMENT_TYPE:
       
 12163           {
       
 12164             if (newChild.key === key) {
       
 12165               if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 12166                 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
       
 12167               }
       
 12168               return updateElement(returnFiber, oldFiber, newChild, expirationTime);
       
 12169             } else {
       
 12170               return null;
       
 12171             }
       
 12172           }
       
 12173         case REACT_PORTAL_TYPE:
       
 12174           {
       
 12175             if (newChild.key === key) {
       
 12176               return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
       
 12177             } else {
       
 12178               return null;
       
 12179             }
       
 12180           }
       
 12181       }
       
 12182 
       
 12183       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 12184         if (key !== null) {
       
 12185           return null;
       
 12186         }
       
 12187 
       
 12188         return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
       
 12189       }
       
 12190 
       
 12191       throwOnInvalidObjectType(returnFiber, newChild);
       
 12192     }
       
 12193 
       
 12194     {
       
 12195       if (typeof newChild === 'function') {
       
 12196         warnOnFunctionType();
       
 12197       }
       
 12198     }
       
 12199 
       
 12200     return null;
       
 12201   }
       
 12202 
       
 12203   function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
       
 12204     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12205       // Text nodes don't have keys, so we neither have to check the old nor
       
 12206       // new node for the key. If both are text nodes, they match.
       
 12207       var matchedFiber = existingChildren.get(newIdx) || null;
       
 12208       return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
       
 12209     }
       
 12210 
       
 12211     if (typeof newChild === 'object' && newChild !== null) {
       
 12212       switch (newChild.$$typeof) {
       
 12213         case REACT_ELEMENT_TYPE:
       
 12214           {
       
 12215             var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 12216             if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 12217               return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
       
 12218             }
       
 12219             return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
       
 12220           }
       
 12221         case REACT_PORTAL_TYPE:
       
 12222           {
       
 12223             var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 12224             return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
       
 12225           }
       
 12226       }
       
 12227 
       
 12228       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 12229         var _matchedFiber3 = existingChildren.get(newIdx) || null;
       
 12230         return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
       
 12231       }
       
 12232 
       
 12233       throwOnInvalidObjectType(returnFiber, newChild);
       
 12234     }
       
 12235 
       
 12236     {
       
 12237       if (typeof newChild === 'function') {
       
 12238         warnOnFunctionType();
       
 12239       }
       
 12240     }
       
 12241 
       
 12242     return null;
       
 12243   }
       
 12244 
       
 12245   /**
       
 12246    * Warns if there is a duplicate or missing key
       
 12247    */
       
 12248   function warnOnInvalidKey(child, knownKeys) {
       
 12249     {
       
 12250       if (typeof child !== 'object' || child === null) {
       
 12251         return knownKeys;
       
 12252       }
       
 12253       switch (child.$$typeof) {
       
 12254         case REACT_ELEMENT_TYPE:
       
 12255         case REACT_PORTAL_TYPE:
       
 12256           warnForMissingKey(child);
       
 12257           var key = child.key;
       
 12258           if (typeof key !== 'string') {
       
 12259             break;
       
 12260           }
       
 12261           if (knownKeys === null) {
       
 12262             knownKeys = new Set();
       
 12263             knownKeys.add(key);
       
 12264             break;
       
 12265           }
       
 12266           if (!knownKeys.has(key)) {
       
 12267             knownKeys.add(key);
       
 12268             break;
       
 12269           }
       
 12270           warning$1(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
       
 12271           break;
       
 12272         default:
       
 12273           break;
       
 12274       }
       
 12275     }
       
 12276     return knownKeys;
       
 12277   }
       
 12278 
       
 12279   function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
       
 12280     // This algorithm can't optimize by searching from both ends since we
       
 12281     // don't have backpointers on fibers. I'm trying to see how far we can get
       
 12282     // with that model. If it ends up not being worth the tradeoffs, we can
       
 12283     // add it later.
       
 12284 
       
 12285     // Even with a two ended optimization, we'd want to optimize for the case
       
 12286     // where there are few changes and brute force the comparison instead of
       
 12287     // going for the Map. It'd like to explore hitting that path first in
       
 12288     // forward-only mode and only go for the Map once we notice that we need
       
 12289     // lots of look ahead. This doesn't handle reversal as well as two ended
       
 12290     // search but that's unusual. Besides, for the two ended optimization to
       
 12291     // work on Iterables, we'd need to copy the whole set.
       
 12292 
       
 12293     // In this first iteration, we'll just live with hitting the bad case
       
 12294     // (adding everything to a Map) in for every insert/move.
       
 12295 
       
 12296     // If you change this code, also update reconcileChildrenIterator() which
       
 12297     // uses the same algorithm.
       
 12298 
       
 12299     {
       
 12300       // First, validate keys.
       
 12301       var knownKeys = null;
       
 12302       for (var i = 0; i < newChildren.length; i++) {
       
 12303         var child = newChildren[i];
       
 12304         knownKeys = warnOnInvalidKey(child, knownKeys);
       
 12305       }
       
 12306     }
       
 12307 
       
 12308     var resultingFirstChild = null;
       
 12309     var previousNewFiber = null;
       
 12310 
       
 12311     var oldFiber = currentFirstChild;
       
 12312     var lastPlacedIndex = 0;
       
 12313     var newIdx = 0;
       
 12314     var nextOldFiber = null;
       
 12315     for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
       
 12316       if (oldFiber.index > newIdx) {
       
 12317         nextOldFiber = oldFiber;
       
 12318         oldFiber = null;
       
 12319       } else {
       
 12320         nextOldFiber = oldFiber.sibling;
       
 12321       }
       
 12322       var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
       
 12323       if (newFiber === null) {
       
 12324         // TODO: This breaks on empty slots like null children. That's
       
 12325         // unfortunate because it triggers the slow path all the time. We need
       
 12326         // a better way to communicate whether this was a miss or null,
       
 12327         // boolean, undefined, etc.
       
 12328         if (oldFiber === null) {
       
 12329           oldFiber = nextOldFiber;
       
 12330         }
       
 12331         break;
       
 12332       }
       
 12333       if (shouldTrackSideEffects) {
       
 12334         if (oldFiber && newFiber.alternate === null) {
       
 12335           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 12336           // need to delete the existing child.
       
 12337           deleteChild(returnFiber, oldFiber);
       
 12338         }
       
 12339       }
       
 12340       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 12341       if (previousNewFiber === null) {
       
 12342         // TODO: Move out of the loop. This only happens for the first run.
       
 12343         resultingFirstChild = newFiber;
       
 12344       } else {
       
 12345         // TODO: Defer siblings if we're not at the right index for this slot.
       
 12346         // I.e. if we had null values before, then we want to defer this
       
 12347         // for each null value. However, we also don't want to call updateSlot
       
 12348         // with the previous one.
       
 12349         previousNewFiber.sibling = newFiber;
       
 12350       }
       
 12351       previousNewFiber = newFiber;
       
 12352       oldFiber = nextOldFiber;
       
 12353     }
       
 12354 
       
 12355     if (newIdx === newChildren.length) {
       
 12356       // We've reached the end of the new children. We can delete the rest.
       
 12357       deleteRemainingChildren(returnFiber, oldFiber);
       
 12358       return resultingFirstChild;
       
 12359     }
       
 12360 
       
 12361     if (oldFiber === null) {
       
 12362       // If we don't have any more existing children we can choose a fast path
       
 12363       // since the rest will all be insertions.
       
 12364       for (; newIdx < newChildren.length; newIdx++) {
       
 12365         var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
       
 12366         if (!_newFiber) {
       
 12367           continue;
       
 12368         }
       
 12369         lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
       
 12370         if (previousNewFiber === null) {
       
 12371           // TODO: Move out of the loop. This only happens for the first run.
       
 12372           resultingFirstChild = _newFiber;
       
 12373         } else {
       
 12374           previousNewFiber.sibling = _newFiber;
       
 12375         }
       
 12376         previousNewFiber = _newFiber;
       
 12377       }
       
 12378       return resultingFirstChild;
       
 12379     }
       
 12380 
       
 12381     // Add all children to a key map for quick lookups.
       
 12382     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 12383 
       
 12384     // Keep scanning and use the map to restore deleted items as moves.
       
 12385     for (; newIdx < newChildren.length; newIdx++) {
       
 12386       var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
       
 12387       if (_newFiber2) {
       
 12388         if (shouldTrackSideEffects) {
       
 12389           if (_newFiber2.alternate !== null) {
       
 12390             // The new fiber is a work in progress, but if there exists a
       
 12391             // current, that means that we reused the fiber. We need to delete
       
 12392             // it from the child list so that we don't add it to the deletion
       
 12393             // list.
       
 12394             existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
       
 12395           }
       
 12396         }
       
 12397         lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
       
 12398         if (previousNewFiber === null) {
       
 12399           resultingFirstChild = _newFiber2;
       
 12400         } else {
       
 12401           previousNewFiber.sibling = _newFiber2;
       
 12402         }
       
 12403         previousNewFiber = _newFiber2;
       
 12404       }
       
 12405     }
       
 12406 
       
 12407     if (shouldTrackSideEffects) {
       
 12408       // Any existing children that weren't consumed above were deleted. We need
       
 12409       // to add them to the deletion list.
       
 12410       existingChildren.forEach(function (child) {
       
 12411         return deleteChild(returnFiber, child);
       
 12412       });
       
 12413     }
       
 12414 
       
 12415     return resultingFirstChild;
       
 12416   }
       
 12417 
       
 12418   function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
       
 12419     // This is the same implementation as reconcileChildrenArray(),
       
 12420     // but using the iterator instead.
       
 12421 
       
 12422     var iteratorFn = getIteratorFn(newChildrenIterable);
       
 12423     !(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 12424 
       
 12425     {
       
 12426       // We don't support rendering Generators because it's a mutation.
       
 12427       // See https://github.com/facebook/react/issues/12995
       
 12428       if (typeof Symbol === 'function' &&
       
 12429       // $FlowFixMe Flow doesn't know about toStringTag
       
 12430       newChildrenIterable[Symbol.toStringTag] === 'Generator') {
       
 12431         !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
       
 12432         didWarnAboutGenerators = true;
       
 12433       }
       
 12434 
       
 12435       // Warn about using Maps as children
       
 12436       if (newChildrenIterable.entries === iteratorFn) {
       
 12437         !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;
       
 12438         didWarnAboutMaps = true;
       
 12439       }
       
 12440 
       
 12441       // First, validate keys.
       
 12442       // We'll get a different iterator later for the main pass.
       
 12443       var _newChildren = iteratorFn.call(newChildrenIterable);
       
 12444       if (_newChildren) {
       
 12445         var knownKeys = null;
       
 12446         var _step = _newChildren.next();
       
 12447         for (; !_step.done; _step = _newChildren.next()) {
       
 12448           var child = _step.value;
       
 12449           knownKeys = warnOnInvalidKey(child, knownKeys);
       
 12450         }
       
 12451       }
       
 12452     }
       
 12453 
       
 12454     var newChildren = iteratorFn.call(newChildrenIterable);
       
 12455     !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0;
       
 12456 
       
 12457     var resultingFirstChild = null;
       
 12458     var previousNewFiber = null;
       
 12459 
       
 12460     var oldFiber = currentFirstChild;
       
 12461     var lastPlacedIndex = 0;
       
 12462     var newIdx = 0;
       
 12463     var nextOldFiber = null;
       
 12464 
       
 12465     var step = newChildren.next();
       
 12466     for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
       
 12467       if (oldFiber.index > newIdx) {
       
 12468         nextOldFiber = oldFiber;
       
 12469         oldFiber = null;
       
 12470       } else {
       
 12471         nextOldFiber = oldFiber.sibling;
       
 12472       }
       
 12473       var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
       
 12474       if (newFiber === null) {
       
 12475         // TODO: This breaks on empty slots like null children. That's
       
 12476         // unfortunate because it triggers the slow path all the time. We need
       
 12477         // a better way to communicate whether this was a miss or null,
       
 12478         // boolean, undefined, etc.
       
 12479         if (!oldFiber) {
       
 12480           oldFiber = nextOldFiber;
       
 12481         }
       
 12482         break;
       
 12483       }
       
 12484       if (shouldTrackSideEffects) {
       
 12485         if (oldFiber && newFiber.alternate === null) {
       
 12486           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 12487           // need to delete the existing child.
       
 12488           deleteChild(returnFiber, oldFiber);
       
 12489         }
       
 12490       }
       
 12491       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 12492       if (previousNewFiber === null) {
       
 12493         // TODO: Move out of the loop. This only happens for the first run.
       
 12494         resultingFirstChild = newFiber;
       
 12495       } else {
       
 12496         // TODO: Defer siblings if we're not at the right index for this slot.
       
 12497         // I.e. if we had null values before, then we want to defer this
       
 12498         // for each null value. However, we also don't want to call updateSlot
       
 12499         // with the previous one.
       
 12500         previousNewFiber.sibling = newFiber;
       
 12501       }
       
 12502       previousNewFiber = newFiber;
       
 12503       oldFiber = nextOldFiber;
       
 12504     }
       
 12505 
       
 12506     if (step.done) {
       
 12507       // We've reached the end of the new children. We can delete the rest.
       
 12508       deleteRemainingChildren(returnFiber, oldFiber);
       
 12509       return resultingFirstChild;
       
 12510     }
       
 12511 
       
 12512     if (oldFiber === null) {
       
 12513       // If we don't have any more existing children we can choose a fast path
       
 12514       // since the rest will all be insertions.
       
 12515       for (; !step.done; newIdx++, step = newChildren.next()) {
       
 12516         var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
       
 12517         if (_newFiber3 === null) {
       
 12518           continue;
       
 12519         }
       
 12520         lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
       
 12521         if (previousNewFiber === null) {
       
 12522           // TODO: Move out of the loop. This only happens for the first run.
       
 12523           resultingFirstChild = _newFiber3;
       
 12524         } else {
       
 12525           previousNewFiber.sibling = _newFiber3;
       
 12526         }
       
 12527         previousNewFiber = _newFiber3;
       
 12528       }
       
 12529       return resultingFirstChild;
       
 12530     }
       
 12531 
       
 12532     // Add all children to a key map for quick lookups.
       
 12533     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 12534 
       
 12535     // Keep scanning and use the map to restore deleted items as moves.
       
 12536     for (; !step.done; newIdx++, step = newChildren.next()) {
       
 12537       var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
       
 12538       if (_newFiber4 !== null) {
       
 12539         if (shouldTrackSideEffects) {
       
 12540           if (_newFiber4.alternate !== null) {
       
 12541             // The new fiber is a work in progress, but if there exists a
       
 12542             // current, that means that we reused the fiber. We need to delete
       
 12543             // it from the child list so that we don't add it to the deletion
       
 12544             // list.
       
 12545             existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
       
 12546           }
       
 12547         }
       
 12548         lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
       
 12549         if (previousNewFiber === null) {
       
 12550           resultingFirstChild = _newFiber4;
       
 12551         } else {
       
 12552           previousNewFiber.sibling = _newFiber4;
       
 12553         }
       
 12554         previousNewFiber = _newFiber4;
       
 12555       }
       
 12556     }
       
 12557 
       
 12558     if (shouldTrackSideEffects) {
       
 12559       // Any existing children that weren't consumed above were deleted. We need
       
 12560       // to add them to the deletion list.
       
 12561       existingChildren.forEach(function (child) {
       
 12562         return deleteChild(returnFiber, child);
       
 12563       });
       
 12564     }
       
 12565 
       
 12566     return resultingFirstChild;
       
 12567   }
       
 12568 
       
 12569   function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
       
 12570     // There's no need to check for keys on text nodes since we don't have a
       
 12571     // way to define them.
       
 12572     if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
       
 12573       // We already have an existing node so let's just update it and delete
       
 12574       // the rest.
       
 12575       deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
       
 12576       var existing = useFiber(currentFirstChild, textContent, expirationTime);
       
 12577       existing.return = returnFiber;
       
 12578       return existing;
       
 12579     }
       
 12580     // The existing first child is not a text node so we need to create one
       
 12581     // and delete the existing ones.
       
 12582     deleteRemainingChildren(returnFiber, currentFirstChild);
       
 12583     var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 12584     created.return = returnFiber;
       
 12585     return created;
       
 12586   }
       
 12587 
       
 12588   function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
       
 12589     var key = element.key;
       
 12590     var child = currentFirstChild;
       
 12591     while (child !== null) {
       
 12592       // TODO: If key === null and child.key === null, then this only applies to
       
 12593       // the first item in the list.
       
 12594       if (child.key === key) {
       
 12595         if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
       
 12596           deleteRemainingChildren(returnFiber, child.sibling);
       
 12597           var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
       
 12598           existing.ref = coerceRef(returnFiber, child, element);
       
 12599           existing.return = returnFiber;
       
 12600           {
       
 12601             existing._debugSource = element._source;
       
 12602             existing._debugOwner = element._owner;
       
 12603           }
       
 12604           return existing;
       
 12605         } else {
       
 12606           deleteRemainingChildren(returnFiber, child);
       
 12607           break;
       
 12608         }
       
 12609       } else {
       
 12610         deleteChild(returnFiber, child);
       
 12611       }
       
 12612       child = child.sibling;
       
 12613     }
       
 12614 
       
 12615     if (element.type === REACT_FRAGMENT_TYPE) {
       
 12616       var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
       
 12617       created.return = returnFiber;
       
 12618       return created;
       
 12619     } else {
       
 12620       var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 12621       _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
       
 12622       _created4.return = returnFiber;
       
 12623       return _created4;
       
 12624     }
       
 12625   }
       
 12626 
       
 12627   function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
       
 12628     var key = portal.key;
       
 12629     var child = currentFirstChild;
       
 12630     while (child !== null) {
       
 12631       // TODO: If key === null and child.key === null, then this only applies to
       
 12632       // the first item in the list.
       
 12633       if (child.key === key) {
       
 12634         if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
       
 12635           deleteRemainingChildren(returnFiber, child.sibling);
       
 12636           var existing = useFiber(child, portal.children || [], expirationTime);
       
 12637           existing.return = returnFiber;
       
 12638           return existing;
       
 12639         } else {
       
 12640           deleteRemainingChildren(returnFiber, child);
       
 12641           break;
       
 12642         }
       
 12643       } else {
       
 12644         deleteChild(returnFiber, child);
       
 12645       }
       
 12646       child = child.sibling;
       
 12647     }
       
 12648 
       
 12649     var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 12650     created.return = returnFiber;
       
 12651     return created;
       
 12652   }
       
 12653 
       
 12654   // This API will tag the children with the side-effect of the reconciliation
       
 12655   // itself. They will be added to the side-effect list as we pass through the
       
 12656   // children and the parent.
       
 12657   function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
       
 12658     // This function is not recursive.
       
 12659     // If the top level item is an array, we treat it as a set of children,
       
 12660     // not as a fragment. Nested arrays on the other hand will be treated as
       
 12661     // fragment nodes. Recursion happens at the normal flow.
       
 12662 
       
 12663     // Handle top level unkeyed fragments as if they were arrays.
       
 12664     // This leads to an ambiguity between <>{[...]}</> and <>...</>.
       
 12665     // We treat the ambiguous cases above the same.
       
 12666     var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
       
 12667     if (isUnkeyedTopLevelFragment) {
       
 12668       newChild = newChild.props.children;
       
 12669     }
       
 12670 
       
 12671     // Handle object types
       
 12672     var isObject = typeof newChild === 'object' && newChild !== null;
       
 12673 
       
 12674     if (isObject) {
       
 12675       switch (newChild.$$typeof) {
       
 12676         case REACT_ELEMENT_TYPE:
       
 12677           return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
       
 12678         case REACT_PORTAL_TYPE:
       
 12679           return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
       
 12680       }
       
 12681     }
       
 12682 
       
 12683     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12684       return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
       
 12685     }
       
 12686 
       
 12687     if (isArray(newChild)) {
       
 12688       return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
       
 12689     }
       
 12690 
       
 12691     if (getIteratorFn(newChild)) {
       
 12692       return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
       
 12693     }
       
 12694 
       
 12695     if (isObject) {
       
 12696       throwOnInvalidObjectType(returnFiber, newChild);
       
 12697     }
       
 12698 
       
 12699     {
       
 12700       if (typeof newChild === 'function') {
       
 12701         warnOnFunctionType();
       
 12702       }
       
 12703     }
       
 12704     if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
       
 12705       // If the new child is undefined, and the return fiber is a composite
       
 12706       // component, throw an error. If Fiber return types are disabled,
       
 12707       // we already threw above.
       
 12708       switch (returnFiber.tag) {
       
 12709         case ClassComponent:
       
 12710           {
       
 12711             {
       
 12712               var instance = returnFiber.stateNode;
       
 12713               if (instance.render._isMockFunction) {
       
 12714                 // We allow auto-mocks to proceed as if they're returning null.
       
 12715                 break;
       
 12716               }
       
 12717             }
       
 12718           }
       
 12719         // Intentionally fall through to the next case, which handles both
       
 12720         // functions and classes
       
 12721         // eslint-disable-next-lined no-fallthrough
       
 12722         case FunctionComponent:
       
 12723           {
       
 12724             var Component = returnFiber.type;
       
 12725             invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component');
       
 12726           }
       
 12727       }
       
 12728     }
       
 12729 
       
 12730     // Remaining cases are all treated as empty.
       
 12731     return deleteRemainingChildren(returnFiber, currentFirstChild);
       
 12732   }
       
 12733 
       
 12734   return reconcileChildFibers;
       
 12735 }
       
 12736 
       
 12737 var reconcileChildFibers = ChildReconciler(true);
       
 12738 var mountChildFibers = ChildReconciler(false);
       
 12739 
       
 12740 function cloneChildFibers(current$$1, workInProgress) {
       
 12741   !(current$$1 === null || workInProgress.child === current$$1.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0;
       
 12742 
       
 12743   if (workInProgress.child === null) {
       
 12744     return;
       
 12745   }
       
 12746 
       
 12747   var currentChild = workInProgress.child;
       
 12748   var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 12749   workInProgress.child = newChild;
       
 12750 
       
 12751   newChild.return = workInProgress;
       
 12752   while (currentChild.sibling !== null) {
       
 12753     currentChild = currentChild.sibling;
       
 12754     newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 12755     newChild.return = workInProgress;
       
 12756   }
       
 12757   newChild.sibling = null;
       
 12758 }
       
 12759 
       
 12760 var NO_CONTEXT = {};
       
 12761 
       
 12762 var contextStackCursor$1 = createCursor(NO_CONTEXT);
       
 12763 var contextFiberStackCursor = createCursor(NO_CONTEXT);
       
 12764 var rootInstanceStackCursor = createCursor(NO_CONTEXT);
       
 12765 
       
 12766 function requiredContext(c) {
       
 12767   !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 12768   return c;
       
 12769 }
       
 12770 
       
 12771 function getRootHostContainer() {
       
 12772   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 12773   return rootInstance;
       
 12774 }
       
 12775 
       
 12776 function pushHostContainer(fiber, nextRootInstance) {
       
 12777   // Push current root instance onto the stack;
       
 12778   // This allows us to reset root when portals are popped.
       
 12779   push(rootInstanceStackCursor, nextRootInstance, fiber);
       
 12780   // Track the context and the Fiber that provided it.
       
 12781   // This enables us to pop only Fibers that provide unique contexts.
       
 12782   push(contextFiberStackCursor, fiber, fiber);
       
 12783 
       
 12784   // Finally, we need to push the host context to the stack.
       
 12785   // However, we can't just call getRootHostContext() and push it because
       
 12786   // we'd have a different number of entries on the stack depending on
       
 12787   // whether getRootHostContext() throws somewhere in renderer code or not.
       
 12788   // So we push an empty value first. This lets us safely unwind on errors.
       
 12789   push(contextStackCursor$1, NO_CONTEXT, fiber);
       
 12790   var nextRootContext = getRootHostContext(nextRootInstance);
       
 12791   // Now that we know this function doesn't throw, replace it.
       
 12792   pop(contextStackCursor$1, fiber);
       
 12793   push(contextStackCursor$1, nextRootContext, fiber);
       
 12794 }
       
 12795 
       
 12796 function popHostContainer(fiber) {
       
 12797   pop(contextStackCursor$1, fiber);
       
 12798   pop(contextFiberStackCursor, fiber);
       
 12799   pop(rootInstanceStackCursor, fiber);
       
 12800 }
       
 12801 
       
 12802 function getHostContext() {
       
 12803   var context = requiredContext(contextStackCursor$1.current);
       
 12804   return context;
       
 12805 }
       
 12806 
       
 12807 function pushHostContext(fiber) {
       
 12808   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 12809   var context = requiredContext(contextStackCursor$1.current);
       
 12810   var nextContext = getChildHostContext(context, fiber.type, rootInstance);
       
 12811 
       
 12812   // Don't push this Fiber's context unless it's unique.
       
 12813   if (context === nextContext) {
       
 12814     return;
       
 12815   }
       
 12816 
       
 12817   // Track the context and the Fiber that provided it.
       
 12818   // This enables us to pop only Fibers that provide unique contexts.
       
 12819   push(contextFiberStackCursor, fiber, fiber);
       
 12820   push(contextStackCursor$1, nextContext, fiber);
       
 12821 }
       
 12822 
       
 12823 function popHostContext(fiber) {
       
 12824   // Do not pop unless this Fiber provided the current context.
       
 12825   // pushHostContext() only pushes Fibers that provide unique contexts.
       
 12826   if (contextFiberStackCursor.current !== fiber) {
       
 12827     return;
       
 12828   }
       
 12829 
       
 12830   pop(contextStackCursor$1, fiber);
       
 12831   pop(contextFiberStackCursor, fiber);
       
 12832 }
       
 12833 
       
 12834 var NoEffect$1 = /*             */0;
       
 12835 var UnmountSnapshot = /*      */2;
       
 12836 var UnmountMutation = /*      */4;
       
 12837 var MountMutation = /*        */8;
       
 12838 var UnmountLayout = /*        */16;
       
 12839 var MountLayout = /*          */32;
       
 12840 var MountPassive = /*         */64;
       
 12841 var UnmountPassive = /*       */128;
       
 12842 
       
 12843 var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
       
 12844 
       
 12845 
       
 12846 var didWarnAboutMismatchedHooksForComponent = void 0;
       
 12847 {
       
 12848   didWarnAboutMismatchedHooksForComponent = new Set();
       
 12849 }
       
 12850 
       
 12851 // These are set right before calling the component.
       
 12852 var renderExpirationTime = NoWork;
       
 12853 // The work-in-progress fiber. I've named it differently to distinguish it from
       
 12854 // the work-in-progress hook.
       
 12855 var currentlyRenderingFiber$1 = null;
       
 12856 
       
 12857 // Hooks are stored as a linked list on the fiber's memoizedState field. The
       
 12858 // current hook list is the list that belongs to the current fiber. The
       
 12859 // work-in-progress hook list is a new list that will be added to the
       
 12860 // work-in-progress fiber.
       
 12861 var currentHook = null;
       
 12862 var nextCurrentHook = null;
       
 12863 var firstWorkInProgressHook = null;
       
 12864 var workInProgressHook = null;
       
 12865 var nextWorkInProgressHook = null;
       
 12866 
       
 12867 var remainingExpirationTime = NoWork;
       
 12868 var componentUpdateQueue = null;
       
 12869 var sideEffectTag = 0;
       
 12870 
       
 12871 // Updates scheduled during render will trigger an immediate re-render at the
       
 12872 // end of the current pass. We can't store these updates on the normal queue,
       
 12873 // because if the work is aborted, they should be discarded. Because this is
       
 12874 // a relatively rare case, we also don't want to add an additional field to
       
 12875 // either the hook or queue object types. So we store them in a lazily create
       
 12876 // map of queue -> render-phase updates, which are discarded once the component
       
 12877 // completes without re-rendering.
       
 12878 
       
 12879 // Whether an update was scheduled during the currently executing render pass.
       
 12880 var didScheduleRenderPhaseUpdate = false;
       
 12881 // Lazily created map of render-phase updates
       
 12882 var renderPhaseUpdates = null;
       
 12883 // Counter to prevent infinite loops.
       
 12884 var numberOfReRenders = 0;
       
 12885 var RE_RENDER_LIMIT = 25;
       
 12886 
       
 12887 // In DEV, this is the name of the currently executing primitive hook
       
 12888 var currentHookNameInDev = null;
       
 12889 
       
 12890 // In DEV, this list ensures that hooks are called in the same order between renders.
       
 12891 // The list stores the order of hooks used during the initial render (mount).
       
 12892 // Subsequent renders (updates) reference this list.
       
 12893 var hookTypesDev = null;
       
 12894 var hookTypesUpdateIndexDev = -1;
       
 12895 
       
 12896 function mountHookTypesDev() {
       
 12897   {
       
 12898     var hookName = currentHookNameInDev;
       
 12899 
       
 12900     if (hookTypesDev === null) {
       
 12901       hookTypesDev = [hookName];
       
 12902     } else {
       
 12903       hookTypesDev.push(hookName);
       
 12904     }
       
 12905   }
       
 12906 }
       
 12907 
       
 12908 function updateHookTypesDev() {
       
 12909   {
       
 12910     var hookName = currentHookNameInDev;
       
 12911 
       
 12912     if (hookTypesDev !== null) {
       
 12913       hookTypesUpdateIndexDev++;
       
 12914       if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
       
 12915         warnOnHookMismatchInDev(hookName);
       
 12916       }
       
 12917     }
       
 12918   }
       
 12919 }
       
 12920 
       
 12921 function warnOnHookMismatchInDev(currentHookName) {
       
 12922   {
       
 12923     var componentName = getComponentName(currentlyRenderingFiber$1.type);
       
 12924     if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
       
 12925       didWarnAboutMismatchedHooksForComponent.add(componentName);
       
 12926 
       
 12927       if (hookTypesDev !== null) {
       
 12928         var table = '';
       
 12929 
       
 12930         var secondColumnStart = 30;
       
 12931 
       
 12932         for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
       
 12933           var oldHookName = hookTypesDev[i];
       
 12934           var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
       
 12935 
       
 12936           var row = i + 1 + '. ' + oldHookName;
       
 12937 
       
 12938           // Extra space so second column lines up
       
 12939           // lol @ IE not supporting String#repeat
       
 12940           while (row.length < secondColumnStart) {
       
 12941             row += ' ';
       
 12942           }
       
 12943 
       
 12944           row += newHookName + '\n';
       
 12945 
       
 12946           table += row;
       
 12947         }
       
 12948 
       
 12949         warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + '   Previous render            Next render\n' + '   ------------------------------------------------------\n' + '%s' + '   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
       
 12950       }
       
 12951     }
       
 12952   }
       
 12953 }
       
 12954 
       
 12955 function throwInvalidHookError() {
       
 12956   invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)');
       
 12957 }
       
 12958 
       
 12959 function areHookInputsEqual(nextDeps, prevDeps) {
       
 12960   if (prevDeps === null) {
       
 12961     {
       
 12962       warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
       
 12963     }
       
 12964     return false;
       
 12965   }
       
 12966 
       
 12967   {
       
 12968     // Don't bother comparing lengths in prod because these arrays should be
       
 12969     // passed inline.
       
 12970     if (nextDeps.length !== prevDeps.length) {
       
 12971       warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
       
 12972     }
       
 12973   }
       
 12974   for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
       
 12975     if (is(nextDeps[i], prevDeps[i])) {
       
 12976       continue;
       
 12977     }
       
 12978     return false;
       
 12979   }
       
 12980   return true;
       
 12981 }
       
 12982 
       
 12983 function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
       
 12984   renderExpirationTime = nextRenderExpirationTime;
       
 12985   currentlyRenderingFiber$1 = workInProgress;
       
 12986   nextCurrentHook = current !== null ? current.memoizedState : null;
       
 12987 
       
 12988   {
       
 12989     hookTypesDev = current !== null ? current._debugHookTypes : null;
       
 12990     hookTypesUpdateIndexDev = -1;
       
 12991   }
       
 12992 
       
 12993   // The following should have already been reset
       
 12994   // currentHook = null;
       
 12995   // workInProgressHook = null;
       
 12996 
       
 12997   // remainingExpirationTime = NoWork;
       
 12998   // componentUpdateQueue = null;
       
 12999 
       
 13000   // didScheduleRenderPhaseUpdate = false;
       
 13001   // renderPhaseUpdates = null;
       
 13002   // numberOfReRenders = 0;
       
 13003   // sideEffectTag = 0;
       
 13004 
       
 13005   // TODO Warn if no hooks are used at all during mount, then some are used during update.
       
 13006   // Currently we will identify the update render as a mount because nextCurrentHook === null.
       
 13007   // This is tricky because it's valid for certain types of components (e.g. React.lazy)
       
 13008 
       
 13009   // Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
       
 13010   // Non-stateful hooks (e.g. context) don't get added to memoizedState,
       
 13011   // so nextCurrentHook would be null during updates and mounts.
       
 13012   {
       
 13013     if (nextCurrentHook !== null) {
       
 13014       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 13015     } else if (hookTypesDev !== null) {
       
 13016       // This dispatcher handles an edge case where a component is updating,
       
 13017       // but no stateful hooks have been used.
       
 13018       // We want to match the production code behavior (which will use HooksDispatcherOnMount),
       
 13019       // but with the extra DEV validation to ensure hooks ordering hasn't changed.
       
 13020       // This dispatcher does that.
       
 13021       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
       
 13022     } else {
       
 13023       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
       
 13024     }
       
 13025   }
       
 13026 
       
 13027   var children = Component(props, refOrContext);
       
 13028 
       
 13029   if (didScheduleRenderPhaseUpdate) {
       
 13030     do {
       
 13031       didScheduleRenderPhaseUpdate = false;
       
 13032       numberOfReRenders += 1;
       
 13033 
       
 13034       // Start over from the beginning of the list
       
 13035       nextCurrentHook = current !== null ? current.memoizedState : null;
       
 13036       nextWorkInProgressHook = firstWorkInProgressHook;
       
 13037 
       
 13038       currentHook = null;
       
 13039       workInProgressHook = null;
       
 13040       componentUpdateQueue = null;
       
 13041 
       
 13042       {
       
 13043         // Also validate hook order for cascading updates.
       
 13044         hookTypesUpdateIndexDev = -1;
       
 13045       }
       
 13046 
       
 13047       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 13048 
       
 13049       children = Component(props, refOrContext);
       
 13050     } while (didScheduleRenderPhaseUpdate);
       
 13051 
       
 13052     renderPhaseUpdates = null;
       
 13053     numberOfReRenders = 0;
       
 13054   }
       
 13055 
       
 13056   // We can assume the previous dispatcher is always this one, since we set it
       
 13057   // at the beginning of the render phase and there's no re-entrancy.
       
 13058   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 13059 
       
 13060   var renderedWork = currentlyRenderingFiber$1;
       
 13061 
       
 13062   renderedWork.memoizedState = firstWorkInProgressHook;
       
 13063   renderedWork.expirationTime = remainingExpirationTime;
       
 13064   renderedWork.updateQueue = componentUpdateQueue;
       
 13065   renderedWork.effectTag |= sideEffectTag;
       
 13066 
       
 13067   {
       
 13068     renderedWork._debugHookTypes = hookTypesDev;
       
 13069   }
       
 13070 
       
 13071   // This check uses currentHook so that it works the same in DEV and prod bundles.
       
 13072   // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
       
 13073   var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
       
 13074 
       
 13075   renderExpirationTime = NoWork;
       
 13076   currentlyRenderingFiber$1 = null;
       
 13077 
       
 13078   currentHook = null;
       
 13079   nextCurrentHook = null;
       
 13080   firstWorkInProgressHook = null;
       
 13081   workInProgressHook = null;
       
 13082   nextWorkInProgressHook = null;
       
 13083 
       
 13084   {
       
 13085     currentHookNameInDev = null;
       
 13086     hookTypesDev = null;
       
 13087     hookTypesUpdateIndexDev = -1;
       
 13088   }
       
 13089 
       
 13090   remainingExpirationTime = NoWork;
       
 13091   componentUpdateQueue = null;
       
 13092   sideEffectTag = 0;
       
 13093 
       
 13094   // These were reset above
       
 13095   // didScheduleRenderPhaseUpdate = false;
       
 13096   // renderPhaseUpdates = null;
       
 13097   // numberOfReRenders = 0;
       
 13098 
       
 13099   !!didRenderTooFewHooks ? invariant(false, 'Rendered fewer hooks than expected. This may be caused by an accidental early return statement.') : void 0;
       
 13100 
       
 13101   return children;
       
 13102 }
       
 13103 
       
 13104 function bailoutHooks(current, workInProgress, expirationTime) {
       
 13105   workInProgress.updateQueue = current.updateQueue;
       
 13106   workInProgress.effectTag &= ~(Passive | Update);
       
 13107   if (current.expirationTime <= expirationTime) {
       
 13108     current.expirationTime = NoWork;
       
 13109   }
       
 13110 }
       
 13111 
       
 13112 function resetHooks() {
       
 13113   // We can assume the previous dispatcher is always this one, since we set it
       
 13114   // at the beginning of the render phase and there's no re-entrancy.
       
 13115   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 13116 
       
 13117   // This is used to reset the state of this module when a component throws.
       
 13118   // It's also called inside mountIndeterminateComponent if we determine the
       
 13119   // component is a module-style component.
       
 13120   renderExpirationTime = NoWork;
       
 13121   currentlyRenderingFiber$1 = null;
       
 13122 
       
 13123   currentHook = null;
       
 13124   nextCurrentHook = null;
       
 13125   firstWorkInProgressHook = null;
       
 13126   workInProgressHook = null;
       
 13127   nextWorkInProgressHook = null;
       
 13128 
       
 13129   {
       
 13130     hookTypesDev = null;
       
 13131     hookTypesUpdateIndexDev = -1;
       
 13132 
       
 13133     currentHookNameInDev = null;
       
 13134   }
       
 13135 
       
 13136   remainingExpirationTime = NoWork;
       
 13137   componentUpdateQueue = null;
       
 13138   sideEffectTag = 0;
       
 13139 
       
 13140   didScheduleRenderPhaseUpdate = false;
       
 13141   renderPhaseUpdates = null;
       
 13142   numberOfReRenders = 0;
       
 13143 }
       
 13144 
       
 13145 function mountWorkInProgressHook() {
       
 13146   var hook = {
       
 13147     memoizedState: null,
       
 13148 
       
 13149     baseState: null,
       
 13150     queue: null,
       
 13151     baseUpdate: null,
       
 13152 
       
 13153     next: null
       
 13154   };
       
 13155 
       
 13156   if (workInProgressHook === null) {
       
 13157     // This is the first hook in the list
       
 13158     firstWorkInProgressHook = workInProgressHook = hook;
       
 13159   } else {
       
 13160     // Append to the end of the list
       
 13161     workInProgressHook = workInProgressHook.next = hook;
       
 13162   }
       
 13163   return workInProgressHook;
       
 13164 }
       
 13165 
       
 13166 function updateWorkInProgressHook() {
       
 13167   // This function is used both for updates and for re-renders triggered by a
       
 13168   // render phase update. It assumes there is either a current hook we can
       
 13169   // clone, or a work-in-progress hook from a previous render pass that we can
       
 13170   // use as a base. When we reach the end of the base list, we must switch to
       
 13171   // the dispatcher used for mounts.
       
 13172   if (nextWorkInProgressHook !== null) {
       
 13173     // There's already a work-in-progress. Reuse it.
       
 13174     workInProgressHook = nextWorkInProgressHook;
       
 13175     nextWorkInProgressHook = workInProgressHook.next;
       
 13176 
       
 13177     currentHook = nextCurrentHook;
       
 13178     nextCurrentHook = currentHook !== null ? currentHook.next : null;
       
 13179   } else {
       
 13180     // Clone from the current hook.
       
 13181     !(nextCurrentHook !== null) ? invariant(false, 'Rendered more hooks than during the previous render.') : void 0;
       
 13182     currentHook = nextCurrentHook;
       
 13183 
       
 13184     var newHook = {
       
 13185       memoizedState: currentHook.memoizedState,
       
 13186 
       
 13187       baseState: currentHook.baseState,
       
 13188       queue: currentHook.queue,
       
 13189       baseUpdate: currentHook.baseUpdate,
       
 13190 
       
 13191       next: null
       
 13192     };
       
 13193 
       
 13194     if (workInProgressHook === null) {
       
 13195       // This is the first hook in the list.
       
 13196       workInProgressHook = firstWorkInProgressHook = newHook;
       
 13197     } else {
       
 13198       // Append to the end of the list.
       
 13199       workInProgressHook = workInProgressHook.next = newHook;
       
 13200     }
       
 13201     nextCurrentHook = currentHook.next;
       
 13202   }
       
 13203   return workInProgressHook;
       
 13204 }
       
 13205 
       
 13206 function createFunctionComponentUpdateQueue() {
       
 13207   return {
       
 13208     lastEffect: null
       
 13209   };
       
 13210 }
       
 13211 
       
 13212 function basicStateReducer(state, action) {
       
 13213   return typeof action === 'function' ? action(state) : action;
       
 13214 }
       
 13215 
       
 13216 function mountReducer(reducer, initialArg, init) {
       
 13217   var hook = mountWorkInProgressHook();
       
 13218   var initialState = void 0;
       
 13219   if (init !== undefined) {
       
 13220     initialState = init(initialArg);
       
 13221   } else {
       
 13222     initialState = initialArg;
       
 13223   }
       
 13224   hook.memoizedState = hook.baseState = initialState;
       
 13225   var queue = hook.queue = {
       
 13226     last: null,
       
 13227     dispatch: null,
       
 13228     eagerReducer: reducer,
       
 13229     eagerState: initialState
       
 13230   };
       
 13231   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 13232   // Flow doesn't know this is non-null, but we do.
       
 13233   currentlyRenderingFiber$1, queue);
       
 13234   return [hook.memoizedState, dispatch];
       
 13235 }
       
 13236 
       
 13237 function updateReducer(reducer, initialArg, init) {
       
 13238   var hook = updateWorkInProgressHook();
       
 13239   var queue = hook.queue;
       
 13240   !(queue !== null) ? invariant(false, 'Should have a queue. This is likely a bug in React. Please file an issue.') : void 0;
       
 13241 
       
 13242   if (numberOfReRenders > 0) {
       
 13243     // This is a re-render. Apply the new render phase updates to the previous
       
 13244     var _dispatch = queue.dispatch;
       
 13245     if (renderPhaseUpdates !== null) {
       
 13246       // Render phase updates are stored in a map of queue -> linked list
       
 13247       var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 13248       if (firstRenderPhaseUpdate !== undefined) {
       
 13249         renderPhaseUpdates.delete(queue);
       
 13250         var newState = hook.memoizedState;
       
 13251         var update = firstRenderPhaseUpdate;
       
 13252         do {
       
 13253           // Process this render phase update. We don't have to check the
       
 13254           // priority because it will always be the same as the current
       
 13255           // render's.
       
 13256           var _action = update.action;
       
 13257           newState = reducer(newState, _action);
       
 13258           update = update.next;
       
 13259         } while (update !== null);
       
 13260 
       
 13261         // Mark that the fiber performed work, but only if the new state is
       
 13262         // different from the current state.
       
 13263         if (!is(newState, hook.memoizedState)) {
       
 13264           markWorkInProgressReceivedUpdate();
       
 13265         }
       
 13266 
       
 13267         hook.memoizedState = newState;
       
 13268         // Don't persist the state accumlated from the render phase updates to
       
 13269         // the base state unless the queue is empty.
       
 13270         // TODO: Not sure if this is the desired semantics, but it's what we
       
 13271         // do for gDSFP. I can't remember why.
       
 13272         if (hook.baseUpdate === queue.last) {
       
 13273           hook.baseState = newState;
       
 13274         }
       
 13275 
       
 13276         queue.eagerReducer = reducer;
       
 13277         queue.eagerState = newState;
       
 13278 
       
 13279         return [newState, _dispatch];
       
 13280       }
       
 13281     }
       
 13282     return [hook.memoizedState, _dispatch];
       
 13283   }
       
 13284 
       
 13285   // The last update in the entire queue
       
 13286   var last = queue.last;
       
 13287   // The last update that is part of the base state.
       
 13288   var baseUpdate = hook.baseUpdate;
       
 13289   var baseState = hook.baseState;
       
 13290 
       
 13291   // Find the first unprocessed update.
       
 13292   var first = void 0;
       
 13293   if (baseUpdate !== null) {
       
 13294     if (last !== null) {
       
 13295       // For the first update, the queue is a circular linked list where
       
 13296       // `queue.last.next = queue.first`. Once the first update commits, and
       
 13297       // the `baseUpdate` is no longer empty, we can unravel the list.
       
 13298       last.next = null;
       
 13299     }
       
 13300     first = baseUpdate.next;
       
 13301   } else {
       
 13302     first = last !== null ? last.next : null;
       
 13303   }
       
 13304   if (first !== null) {
       
 13305     var _newState = baseState;
       
 13306     var newBaseState = null;
       
 13307     var newBaseUpdate = null;
       
 13308     var prevUpdate = baseUpdate;
       
 13309     var _update = first;
       
 13310     var didSkip = false;
       
 13311     do {
       
 13312       var updateExpirationTime = _update.expirationTime;
       
 13313       if (updateExpirationTime < renderExpirationTime) {
       
 13314         // Priority is insufficient. Skip this update. If this is the first
       
 13315         // skipped update, the previous update/state is the new base
       
 13316         // update/state.
       
 13317         if (!didSkip) {
       
 13318           didSkip = true;
       
 13319           newBaseUpdate = prevUpdate;
       
 13320           newBaseState = _newState;
       
 13321         }
       
 13322         // Update the remaining priority in the queue.
       
 13323         if (updateExpirationTime > remainingExpirationTime) {
       
 13324           remainingExpirationTime = updateExpirationTime;
       
 13325         }
       
 13326       } else {
       
 13327         // Process this update.
       
 13328         if (_update.eagerReducer === reducer) {
       
 13329           // If this update was processed eagerly, and its reducer matches the
       
 13330           // current reducer, we can use the eagerly computed state.
       
 13331           _newState = _update.eagerState;
       
 13332         } else {
       
 13333           var _action2 = _update.action;
       
 13334           _newState = reducer(_newState, _action2);
       
 13335         }
       
 13336       }
       
 13337       prevUpdate = _update;
       
 13338       _update = _update.next;
       
 13339     } while (_update !== null && _update !== first);
       
 13340 
       
 13341     if (!didSkip) {
       
 13342       newBaseUpdate = prevUpdate;
       
 13343       newBaseState = _newState;
       
 13344     }
       
 13345 
       
 13346     // Mark that the fiber performed work, but only if the new state is
       
 13347     // different from the current state.
       
 13348     if (!is(_newState, hook.memoizedState)) {
       
 13349       markWorkInProgressReceivedUpdate();
       
 13350     }
       
 13351 
       
 13352     hook.memoizedState = _newState;
       
 13353     hook.baseUpdate = newBaseUpdate;
       
 13354     hook.baseState = newBaseState;
       
 13355 
       
 13356     queue.eagerReducer = reducer;
       
 13357     queue.eagerState = _newState;
       
 13358   }
       
 13359 
       
 13360   var dispatch = queue.dispatch;
       
 13361   return [hook.memoizedState, dispatch];
       
 13362 }
       
 13363 
       
 13364 function mountState(initialState) {
       
 13365   var hook = mountWorkInProgressHook();
       
 13366   if (typeof initialState === 'function') {
       
 13367     initialState = initialState();
       
 13368   }
       
 13369   hook.memoizedState = hook.baseState = initialState;
       
 13370   var queue = hook.queue = {
       
 13371     last: null,
       
 13372     dispatch: null,
       
 13373     eagerReducer: basicStateReducer,
       
 13374     eagerState: initialState
       
 13375   };
       
 13376   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 13377   // Flow doesn't know this is non-null, but we do.
       
 13378   currentlyRenderingFiber$1, queue);
       
 13379   return [hook.memoizedState, dispatch];
       
 13380 }
       
 13381 
       
 13382 function updateState(initialState) {
       
 13383   return updateReducer(basicStateReducer, initialState);
       
 13384 }
       
 13385 
       
 13386 function pushEffect(tag, create, destroy, deps) {
       
 13387   var effect = {
       
 13388     tag: tag,
       
 13389     create: create,
       
 13390     destroy: destroy,
       
 13391     deps: deps,
       
 13392     // Circular
       
 13393     next: null
       
 13394   };
       
 13395   if (componentUpdateQueue === null) {
       
 13396     componentUpdateQueue = createFunctionComponentUpdateQueue();
       
 13397     componentUpdateQueue.lastEffect = effect.next = effect;
       
 13398   } else {
       
 13399     var _lastEffect = componentUpdateQueue.lastEffect;
       
 13400     if (_lastEffect === null) {
       
 13401       componentUpdateQueue.lastEffect = effect.next = effect;
       
 13402     } else {
       
 13403       var firstEffect = _lastEffect.next;
       
 13404       _lastEffect.next = effect;
       
 13405       effect.next = firstEffect;
       
 13406       componentUpdateQueue.lastEffect = effect;
       
 13407     }
       
 13408   }
       
 13409   return effect;
       
 13410 }
       
 13411 
       
 13412 function mountRef(initialValue) {
       
 13413   var hook = mountWorkInProgressHook();
       
 13414   var ref = { current: initialValue };
       
 13415   {
       
 13416     Object.seal(ref);
       
 13417   }
       
 13418   hook.memoizedState = ref;
       
 13419   return ref;
       
 13420 }
       
 13421 
       
 13422 function updateRef(initialValue) {
       
 13423   var hook = updateWorkInProgressHook();
       
 13424   return hook.memoizedState;
       
 13425 }
       
 13426 
       
 13427 function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 13428   var hook = mountWorkInProgressHook();
       
 13429   var nextDeps = deps === undefined ? null : deps;
       
 13430   sideEffectTag |= fiberEffectTag;
       
 13431   hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);
       
 13432 }
       
 13433 
       
 13434 function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 13435   var hook = updateWorkInProgressHook();
       
 13436   var nextDeps = deps === undefined ? null : deps;
       
 13437   var destroy = undefined;
       
 13438 
       
 13439   if (currentHook !== null) {
       
 13440     var prevEffect = currentHook.memoizedState;
       
 13441     destroy = prevEffect.destroy;
       
 13442     if (nextDeps !== null) {
       
 13443       var prevDeps = prevEffect.deps;
       
 13444       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 13445         pushEffect(NoEffect$1, create, destroy, nextDeps);
       
 13446         return;
       
 13447       }
       
 13448     }
       
 13449   }
       
 13450 
       
 13451   sideEffectTag |= fiberEffectTag;
       
 13452   hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);
       
 13453 }
       
 13454 
       
 13455 function mountEffect(create, deps) {
       
 13456   return mountEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 13457 }
       
 13458 
       
 13459 function updateEffect(create, deps) {
       
 13460   return updateEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 13461 }
       
 13462 
       
 13463 function mountLayoutEffect(create, deps) {
       
 13464   return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 13465 }
       
 13466 
       
 13467 function updateLayoutEffect(create, deps) {
       
 13468   return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 13469 }
       
 13470 
       
 13471 function imperativeHandleEffect(create, ref) {
       
 13472   if (typeof ref === 'function') {
       
 13473     var refCallback = ref;
       
 13474     var _inst = create();
       
 13475     refCallback(_inst);
       
 13476     return function () {
       
 13477       refCallback(null);
       
 13478     };
       
 13479   } else if (ref !== null && ref !== undefined) {
       
 13480     var refObject = ref;
       
 13481     {
       
 13482       !refObject.hasOwnProperty('current') ? warning$1(false, 'Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}') : void 0;
       
 13483     }
       
 13484     var _inst2 = create();
       
 13485     refObject.current = _inst2;
       
 13486     return function () {
       
 13487       refObject.current = null;
       
 13488     };
       
 13489   }
       
 13490 }
       
 13491 
       
 13492 function mountImperativeHandle(ref, create, deps) {
       
 13493   {
       
 13494     !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
       
 13495   }
       
 13496 
       
 13497   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 13498   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 13499 
       
 13500   return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 13501 }
       
 13502 
       
 13503 function updateImperativeHandle(ref, create, deps) {
       
 13504   {
       
 13505     !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
       
 13506   }
       
 13507 
       
 13508   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 13509   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 13510 
       
 13511   return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 13512 }
       
 13513 
       
 13514 function mountDebugValue(value, formatterFn) {
       
 13515   // This hook is normally a no-op.
       
 13516   // The react-debug-hooks package injects its own implementation
       
 13517   // so that e.g. DevTools can display custom hook values.
       
 13518 }
       
 13519 
       
 13520 var updateDebugValue = mountDebugValue;
       
 13521 
       
 13522 function mountCallback(callback, deps) {
       
 13523   var hook = mountWorkInProgressHook();
       
 13524   var nextDeps = deps === undefined ? null : deps;
       
 13525   hook.memoizedState = [callback, nextDeps];
       
 13526   return callback;
       
 13527 }
       
 13528 
       
 13529 function updateCallback(callback, deps) {
       
 13530   var hook = updateWorkInProgressHook();
       
 13531   var nextDeps = deps === undefined ? null : deps;
       
 13532   var prevState = hook.memoizedState;
       
 13533   if (prevState !== null) {
       
 13534     if (nextDeps !== null) {
       
 13535       var prevDeps = prevState[1];
       
 13536       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 13537         return prevState[0];
       
 13538       }
       
 13539     }
       
 13540   }
       
 13541   hook.memoizedState = [callback, nextDeps];
       
 13542   return callback;
       
 13543 }
       
 13544 
       
 13545 function mountMemo(nextCreate, deps) {
       
 13546   var hook = mountWorkInProgressHook();
       
 13547   var nextDeps = deps === undefined ? null : deps;
       
 13548   var nextValue = nextCreate();
       
 13549   hook.memoizedState = [nextValue, nextDeps];
       
 13550   return nextValue;
       
 13551 }
       
 13552 
       
 13553 function updateMemo(nextCreate, deps) {
       
 13554   var hook = updateWorkInProgressHook();
       
 13555   var nextDeps = deps === undefined ? null : deps;
       
 13556   var prevState = hook.memoizedState;
       
 13557   if (prevState !== null) {
       
 13558     // Assume these are defined. If they're not, areHookInputsEqual will warn.
       
 13559     if (nextDeps !== null) {
       
 13560       var prevDeps = prevState[1];
       
 13561       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 13562         return prevState[0];
       
 13563       }
       
 13564     }
       
 13565   }
       
 13566   var nextValue = nextCreate();
       
 13567   hook.memoizedState = [nextValue, nextDeps];
       
 13568   return nextValue;
       
 13569 }
       
 13570 
       
 13571 // in a test-like environment, we want to warn if dispatchAction()
       
 13572 // is called outside of a batchedUpdates/TestUtils.act(...) call.
       
 13573 var shouldWarnForUnbatchedSetState = false;
       
 13574 
       
 13575 {
       
 13576   // jest isn't a 'global', it's just exposed to tests via a wrapped function
       
 13577   // further, this isn't a test file, so flow doesn't recognize the symbol. So...
       
 13578   // $FlowExpectedError - because requirements don't give a damn about your type sigs.
       
 13579   if ('undefined' !== typeof jest) {
       
 13580     shouldWarnForUnbatchedSetState = true;
       
 13581   }
       
 13582 }
       
 13583 
       
 13584 function dispatchAction(fiber, queue, action) {
       
 13585   !(numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
       
 13586 
       
 13587   {
       
 13588     !(arguments.length <= 3) ? warning$1(false, "State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().') : void 0;
       
 13589   }
       
 13590 
       
 13591   var alternate = fiber.alternate;
       
 13592   if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
       
 13593     // This is a render phase update. Stash it in a lazily-created map of
       
 13594     // queue -> linked list of updates. After this render pass, we'll restart
       
 13595     // and apply the stashed updates on top of the work-in-progress hook.
       
 13596     didScheduleRenderPhaseUpdate = true;
       
 13597     var update = {
       
 13598       expirationTime: renderExpirationTime,
       
 13599       action: action,
       
 13600       eagerReducer: null,
       
 13601       eagerState: null,
       
 13602       next: null
       
 13603     };
       
 13604     if (renderPhaseUpdates === null) {
       
 13605       renderPhaseUpdates = new Map();
       
 13606     }
       
 13607     var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 13608     if (firstRenderPhaseUpdate === undefined) {
       
 13609       renderPhaseUpdates.set(queue, update);
       
 13610     } else {
       
 13611       // Append the update to the end of the list.
       
 13612       var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
       
 13613       while (lastRenderPhaseUpdate.next !== null) {
       
 13614         lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
       
 13615       }
       
 13616       lastRenderPhaseUpdate.next = update;
       
 13617     }
       
 13618   } else {
       
 13619     flushPassiveEffects();
       
 13620 
       
 13621     var currentTime = requestCurrentTime();
       
 13622     var _expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 13623 
       
 13624     var _update2 = {
       
 13625       expirationTime: _expirationTime,
       
 13626       action: action,
       
 13627       eagerReducer: null,
       
 13628       eagerState: null,
       
 13629       next: null
       
 13630     };
       
 13631 
       
 13632     // Append the update to the end of the list.
       
 13633     var _last = queue.last;
       
 13634     if (_last === null) {
       
 13635       // This is the first update. Create a circular list.
       
 13636       _update2.next = _update2;
       
 13637     } else {
       
 13638       var first = _last.next;
       
 13639       if (first !== null) {
       
 13640         // Still circular.
       
 13641         _update2.next = first;
       
 13642       }
       
 13643       _last.next = _update2;
       
 13644     }
       
 13645     queue.last = _update2;
       
 13646 
       
 13647     if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
       
 13648       // The queue is currently empty, which means we can eagerly compute the
       
 13649       // next state before entering the render phase. If the new state is the
       
 13650       // same as the current state, we may be able to bail out entirely.
       
 13651       var _eagerReducer = queue.eagerReducer;
       
 13652       if (_eagerReducer !== null) {
       
 13653         var prevDispatcher = void 0;
       
 13654         {
       
 13655           prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13656           ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13657         }
       
 13658         try {
       
 13659           var currentState = queue.eagerState;
       
 13660           var _eagerState = _eagerReducer(currentState, action);
       
 13661           // Stash the eagerly computed state, and the reducer used to compute
       
 13662           // it, on the update object. If the reducer hasn't changed by the
       
 13663           // time we enter the render phase, then the eager state can be used
       
 13664           // without calling the reducer again.
       
 13665           _update2.eagerReducer = _eagerReducer;
       
 13666           _update2.eagerState = _eagerState;
       
 13667           if (is(_eagerState, currentState)) {
       
 13668             // Fast path. We can bail out without scheduling React to re-render.
       
 13669             // It's still possible that we'll need to rebase this update later,
       
 13670             // if the component re-renders for a different reason and by that
       
 13671             // time the reducer has changed.
       
 13672             return;
       
 13673           }
       
 13674         } catch (error) {
       
 13675           // Suppress the error. It will throw again in the render phase.
       
 13676         } finally {
       
 13677           {
       
 13678             ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13679           }
       
 13680         }
       
 13681       }
       
 13682     }
       
 13683     {
       
 13684       if (shouldWarnForUnbatchedSetState === true) {
       
 13685         warnIfNotCurrentlyBatchingInDev(fiber);
       
 13686       }
       
 13687     }
       
 13688     scheduleWork(fiber, _expirationTime);
       
 13689   }
       
 13690 }
       
 13691 
       
 13692 var ContextOnlyDispatcher = {
       
 13693   readContext: readContext,
       
 13694 
       
 13695   useCallback: throwInvalidHookError,
       
 13696   useContext: throwInvalidHookError,
       
 13697   useEffect: throwInvalidHookError,
       
 13698   useImperativeHandle: throwInvalidHookError,
       
 13699   useLayoutEffect: throwInvalidHookError,
       
 13700   useMemo: throwInvalidHookError,
       
 13701   useReducer: throwInvalidHookError,
       
 13702   useRef: throwInvalidHookError,
       
 13703   useState: throwInvalidHookError,
       
 13704   useDebugValue: throwInvalidHookError
       
 13705 };
       
 13706 
       
 13707 var HooksDispatcherOnMountInDEV = null;
       
 13708 var HooksDispatcherOnMountWithHookTypesInDEV = null;
       
 13709 var HooksDispatcherOnUpdateInDEV = null;
       
 13710 var InvalidNestedHooksDispatcherOnMountInDEV = null;
       
 13711 var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
       
 13712 
       
 13713 {
       
 13714   var warnInvalidContextAccess = function () {
       
 13715     warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
       
 13716   };
       
 13717 
       
 13718   var warnInvalidHookAccess = function () {
       
 13719     warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
       
 13720   };
       
 13721 
       
 13722   HooksDispatcherOnMountInDEV = {
       
 13723     readContext: function (context, observedBits) {
       
 13724       return readContext(context, observedBits);
       
 13725     },
       
 13726     useCallback: function (callback, deps) {
       
 13727       currentHookNameInDev = 'useCallback';
       
 13728       mountHookTypesDev();
       
 13729       return mountCallback(callback, deps);
       
 13730     },
       
 13731     useContext: function (context, observedBits) {
       
 13732       currentHookNameInDev = 'useContext';
       
 13733       mountHookTypesDev();
       
 13734       return readContext(context, observedBits);
       
 13735     },
       
 13736     useEffect: function (create, deps) {
       
 13737       currentHookNameInDev = 'useEffect';
       
 13738       mountHookTypesDev();
       
 13739       return mountEffect(create, deps);
       
 13740     },
       
 13741     useImperativeHandle: function (ref, create, deps) {
       
 13742       currentHookNameInDev = 'useImperativeHandle';
       
 13743       mountHookTypesDev();
       
 13744       return mountImperativeHandle(ref, create, deps);
       
 13745     },
       
 13746     useLayoutEffect: function (create, deps) {
       
 13747       currentHookNameInDev = 'useLayoutEffect';
       
 13748       mountHookTypesDev();
       
 13749       return mountLayoutEffect(create, deps);
       
 13750     },
       
 13751     useMemo: function (create, deps) {
       
 13752       currentHookNameInDev = 'useMemo';
       
 13753       mountHookTypesDev();
       
 13754       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13755       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13756       try {
       
 13757         return mountMemo(create, deps);
       
 13758       } finally {
       
 13759         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13760       }
       
 13761     },
       
 13762     useReducer: function (reducer, initialArg, init) {
       
 13763       currentHookNameInDev = 'useReducer';
       
 13764       mountHookTypesDev();
       
 13765       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13766       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13767       try {
       
 13768         return mountReducer(reducer, initialArg, init);
       
 13769       } finally {
       
 13770         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13771       }
       
 13772     },
       
 13773     useRef: function (initialValue) {
       
 13774       currentHookNameInDev = 'useRef';
       
 13775       mountHookTypesDev();
       
 13776       return mountRef(initialValue);
       
 13777     },
       
 13778     useState: function (initialState) {
       
 13779       currentHookNameInDev = 'useState';
       
 13780       mountHookTypesDev();
       
 13781       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13782       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13783       try {
       
 13784         return mountState(initialState);
       
 13785       } finally {
       
 13786         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13787       }
       
 13788     },
       
 13789     useDebugValue: function (value, formatterFn) {
       
 13790       currentHookNameInDev = 'useDebugValue';
       
 13791       mountHookTypesDev();
       
 13792       return mountDebugValue(value, formatterFn);
       
 13793     }
       
 13794   };
       
 13795 
       
 13796   HooksDispatcherOnMountWithHookTypesInDEV = {
       
 13797     readContext: function (context, observedBits) {
       
 13798       return readContext(context, observedBits);
       
 13799     },
       
 13800     useCallback: function (callback, deps) {
       
 13801       currentHookNameInDev = 'useCallback';
       
 13802       updateHookTypesDev();
       
 13803       return mountCallback(callback, deps);
       
 13804     },
       
 13805     useContext: function (context, observedBits) {
       
 13806       currentHookNameInDev = 'useContext';
       
 13807       updateHookTypesDev();
       
 13808       return readContext(context, observedBits);
       
 13809     },
       
 13810     useEffect: function (create, deps) {
       
 13811       currentHookNameInDev = 'useEffect';
       
 13812       updateHookTypesDev();
       
 13813       return mountEffect(create, deps);
       
 13814     },
       
 13815     useImperativeHandle: function (ref, create, deps) {
       
 13816       currentHookNameInDev = 'useImperativeHandle';
       
 13817       updateHookTypesDev();
       
 13818       return mountImperativeHandle(ref, create, deps);
       
 13819     },
       
 13820     useLayoutEffect: function (create, deps) {
       
 13821       currentHookNameInDev = 'useLayoutEffect';
       
 13822       updateHookTypesDev();
       
 13823       return mountLayoutEffect(create, deps);
       
 13824     },
       
 13825     useMemo: function (create, deps) {
       
 13826       currentHookNameInDev = 'useMemo';
       
 13827       updateHookTypesDev();
       
 13828       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13829       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13830       try {
       
 13831         return mountMemo(create, deps);
       
 13832       } finally {
       
 13833         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13834       }
       
 13835     },
       
 13836     useReducer: function (reducer, initialArg, init) {
       
 13837       currentHookNameInDev = 'useReducer';
       
 13838       updateHookTypesDev();
       
 13839       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13840       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13841       try {
       
 13842         return mountReducer(reducer, initialArg, init);
       
 13843       } finally {
       
 13844         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13845       }
       
 13846     },
       
 13847     useRef: function (initialValue) {
       
 13848       currentHookNameInDev = 'useRef';
       
 13849       updateHookTypesDev();
       
 13850       return mountRef(initialValue);
       
 13851     },
       
 13852     useState: function (initialState) {
       
 13853       currentHookNameInDev = 'useState';
       
 13854       updateHookTypesDev();
       
 13855       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13856       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13857       try {
       
 13858         return mountState(initialState);
       
 13859       } finally {
       
 13860         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13861       }
       
 13862     },
       
 13863     useDebugValue: function (value, formatterFn) {
       
 13864       currentHookNameInDev = 'useDebugValue';
       
 13865       updateHookTypesDev();
       
 13866       return mountDebugValue(value, formatterFn);
       
 13867     }
       
 13868   };
       
 13869 
       
 13870   HooksDispatcherOnUpdateInDEV = {
       
 13871     readContext: function (context, observedBits) {
       
 13872       return readContext(context, observedBits);
       
 13873     },
       
 13874     useCallback: function (callback, deps) {
       
 13875       currentHookNameInDev = 'useCallback';
       
 13876       updateHookTypesDev();
       
 13877       return updateCallback(callback, deps);
       
 13878     },
       
 13879     useContext: function (context, observedBits) {
       
 13880       currentHookNameInDev = 'useContext';
       
 13881       updateHookTypesDev();
       
 13882       return readContext(context, observedBits);
       
 13883     },
       
 13884     useEffect: function (create, deps) {
       
 13885       currentHookNameInDev = 'useEffect';
       
 13886       updateHookTypesDev();
       
 13887       return updateEffect(create, deps);
       
 13888     },
       
 13889     useImperativeHandle: function (ref, create, deps) {
       
 13890       currentHookNameInDev = 'useImperativeHandle';
       
 13891       updateHookTypesDev();
       
 13892       return updateImperativeHandle(ref, create, deps);
       
 13893     },
       
 13894     useLayoutEffect: function (create, deps) {
       
 13895       currentHookNameInDev = 'useLayoutEffect';
       
 13896       updateHookTypesDev();
       
 13897       return updateLayoutEffect(create, deps);
       
 13898     },
       
 13899     useMemo: function (create, deps) {
       
 13900       currentHookNameInDev = 'useMemo';
       
 13901       updateHookTypesDev();
       
 13902       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13903       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13904       try {
       
 13905         return updateMemo(create, deps);
       
 13906       } finally {
       
 13907         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13908       }
       
 13909     },
       
 13910     useReducer: function (reducer, initialArg, init) {
       
 13911       currentHookNameInDev = 'useReducer';
       
 13912       updateHookTypesDev();
       
 13913       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13914       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13915       try {
       
 13916         return updateReducer(reducer, initialArg, init);
       
 13917       } finally {
       
 13918         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13919       }
       
 13920     },
       
 13921     useRef: function (initialValue) {
       
 13922       currentHookNameInDev = 'useRef';
       
 13923       updateHookTypesDev();
       
 13924       return updateRef(initialValue);
       
 13925     },
       
 13926     useState: function (initialState) {
       
 13927       currentHookNameInDev = 'useState';
       
 13928       updateHookTypesDev();
       
 13929       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13930       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13931       try {
       
 13932         return updateState(initialState);
       
 13933       } finally {
       
 13934         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13935       }
       
 13936     },
       
 13937     useDebugValue: function (value, formatterFn) {
       
 13938       currentHookNameInDev = 'useDebugValue';
       
 13939       updateHookTypesDev();
       
 13940       return updateDebugValue(value, formatterFn);
       
 13941     }
       
 13942   };
       
 13943 
       
 13944   InvalidNestedHooksDispatcherOnMountInDEV = {
       
 13945     readContext: function (context, observedBits) {
       
 13946       warnInvalidContextAccess();
       
 13947       return readContext(context, observedBits);
       
 13948     },
       
 13949     useCallback: function (callback, deps) {
       
 13950       currentHookNameInDev = 'useCallback';
       
 13951       warnInvalidHookAccess();
       
 13952       mountHookTypesDev();
       
 13953       return mountCallback(callback, deps);
       
 13954     },
       
 13955     useContext: function (context, observedBits) {
       
 13956       currentHookNameInDev = 'useContext';
       
 13957       warnInvalidHookAccess();
       
 13958       mountHookTypesDev();
       
 13959       return readContext(context, observedBits);
       
 13960     },
       
 13961     useEffect: function (create, deps) {
       
 13962       currentHookNameInDev = 'useEffect';
       
 13963       warnInvalidHookAccess();
       
 13964       mountHookTypesDev();
       
 13965       return mountEffect(create, deps);
       
 13966     },
       
 13967     useImperativeHandle: function (ref, create, deps) {
       
 13968       currentHookNameInDev = 'useImperativeHandle';
       
 13969       warnInvalidHookAccess();
       
 13970       mountHookTypesDev();
       
 13971       return mountImperativeHandle(ref, create, deps);
       
 13972     },
       
 13973     useLayoutEffect: function (create, deps) {
       
 13974       currentHookNameInDev = 'useLayoutEffect';
       
 13975       warnInvalidHookAccess();
       
 13976       mountHookTypesDev();
       
 13977       return mountLayoutEffect(create, deps);
       
 13978     },
       
 13979     useMemo: function (create, deps) {
       
 13980       currentHookNameInDev = 'useMemo';
       
 13981       warnInvalidHookAccess();
       
 13982       mountHookTypesDev();
       
 13983       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13984       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13985       try {
       
 13986         return mountMemo(create, deps);
       
 13987       } finally {
       
 13988         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13989       }
       
 13990     },
       
 13991     useReducer: function (reducer, initialArg, init) {
       
 13992       currentHookNameInDev = 'useReducer';
       
 13993       warnInvalidHookAccess();
       
 13994       mountHookTypesDev();
       
 13995       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13996       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13997       try {
       
 13998         return mountReducer(reducer, initialArg, init);
       
 13999       } finally {
       
 14000         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14001       }
       
 14002     },
       
 14003     useRef: function (initialValue) {
       
 14004       currentHookNameInDev = 'useRef';
       
 14005       warnInvalidHookAccess();
       
 14006       mountHookTypesDev();
       
 14007       return mountRef(initialValue);
       
 14008     },
       
 14009     useState: function (initialState) {
       
 14010       currentHookNameInDev = 'useState';
       
 14011       warnInvalidHookAccess();
       
 14012       mountHookTypesDev();
       
 14013       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14014       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 14015       try {
       
 14016         return mountState(initialState);
       
 14017       } finally {
       
 14018         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14019       }
       
 14020     },
       
 14021     useDebugValue: function (value, formatterFn) {
       
 14022       currentHookNameInDev = 'useDebugValue';
       
 14023       warnInvalidHookAccess();
       
 14024       mountHookTypesDev();
       
 14025       return mountDebugValue(value, formatterFn);
       
 14026     }
       
 14027   };
       
 14028 
       
 14029   InvalidNestedHooksDispatcherOnUpdateInDEV = {
       
 14030     readContext: function (context, observedBits) {
       
 14031       warnInvalidContextAccess();
       
 14032       return readContext(context, observedBits);
       
 14033     },
       
 14034     useCallback: function (callback, deps) {
       
 14035       currentHookNameInDev = 'useCallback';
       
 14036       warnInvalidHookAccess();
       
 14037       updateHookTypesDev();
       
 14038       return updateCallback(callback, deps);
       
 14039     },
       
 14040     useContext: function (context, observedBits) {
       
 14041       currentHookNameInDev = 'useContext';
       
 14042       warnInvalidHookAccess();
       
 14043       updateHookTypesDev();
       
 14044       return readContext(context, observedBits);
       
 14045     },
       
 14046     useEffect: function (create, deps) {
       
 14047       currentHookNameInDev = 'useEffect';
       
 14048       warnInvalidHookAccess();
       
 14049       updateHookTypesDev();
       
 14050       return updateEffect(create, deps);
       
 14051     },
       
 14052     useImperativeHandle: function (ref, create, deps) {
       
 14053       currentHookNameInDev = 'useImperativeHandle';
       
 14054       warnInvalidHookAccess();
       
 14055       updateHookTypesDev();
       
 14056       return updateImperativeHandle(ref, create, deps);
       
 14057     },
       
 14058     useLayoutEffect: function (create, deps) {
       
 14059       currentHookNameInDev = 'useLayoutEffect';
       
 14060       warnInvalidHookAccess();
       
 14061       updateHookTypesDev();
       
 14062       return updateLayoutEffect(create, deps);
       
 14063     },
       
 14064     useMemo: function (create, deps) {
       
 14065       currentHookNameInDev = 'useMemo';
       
 14066       warnInvalidHookAccess();
       
 14067       updateHookTypesDev();
       
 14068       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14069       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 14070       try {
       
 14071         return updateMemo(create, deps);
       
 14072       } finally {
       
 14073         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14074       }
       
 14075     },
       
 14076     useReducer: function (reducer, initialArg, init) {
       
 14077       currentHookNameInDev = 'useReducer';
       
 14078       warnInvalidHookAccess();
       
 14079       updateHookTypesDev();
       
 14080       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14081       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 14082       try {
       
 14083         return updateReducer(reducer, initialArg, init);
       
 14084       } finally {
       
 14085         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14086       }
       
 14087     },
       
 14088     useRef: function (initialValue) {
       
 14089       currentHookNameInDev = 'useRef';
       
 14090       warnInvalidHookAccess();
       
 14091       updateHookTypesDev();
       
 14092       return updateRef(initialValue);
       
 14093     },
       
 14094     useState: function (initialState) {
       
 14095       currentHookNameInDev = 'useState';
       
 14096       warnInvalidHookAccess();
       
 14097       updateHookTypesDev();
       
 14098       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14099       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 14100       try {
       
 14101         return updateState(initialState);
       
 14102       } finally {
       
 14103         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14104       }
       
 14105     },
       
 14106     useDebugValue: function (value, formatterFn) {
       
 14107       currentHookNameInDev = 'useDebugValue';
       
 14108       warnInvalidHookAccess();
       
 14109       updateHookTypesDev();
       
 14110       return updateDebugValue(value, formatterFn);
       
 14111     }
       
 14112   };
       
 14113 }
       
 14114 
       
 14115 var commitTime = 0;
       
 14116 var profilerStartTime = -1;
       
 14117 
       
 14118 function getCommitTime() {
       
 14119   return commitTime;
       
 14120 }
       
 14121 
       
 14122 function recordCommitTime() {
       
 14123   if (!enableProfilerTimer) {
       
 14124     return;
       
 14125   }
       
 14126   commitTime = unstable_now();
       
 14127 }
       
 14128 
       
 14129 function startProfilerTimer(fiber) {
       
 14130   if (!enableProfilerTimer) {
       
 14131     return;
       
 14132   }
       
 14133 
       
 14134   profilerStartTime = unstable_now();
       
 14135 
       
 14136   if (fiber.actualStartTime < 0) {
       
 14137     fiber.actualStartTime = unstable_now();
       
 14138   }
       
 14139 }
       
 14140 
       
 14141 function stopProfilerTimerIfRunning(fiber) {
       
 14142   if (!enableProfilerTimer) {
       
 14143     return;
       
 14144   }
       
 14145   profilerStartTime = -1;
       
 14146 }
       
 14147 
       
 14148 function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
       
 14149   if (!enableProfilerTimer) {
       
 14150     return;
       
 14151   }
       
 14152 
       
 14153   if (profilerStartTime >= 0) {
       
 14154     var elapsedTime = unstable_now() - profilerStartTime;
       
 14155     fiber.actualDuration += elapsedTime;
       
 14156     if (overrideBaseTime) {
       
 14157       fiber.selfBaseDuration = elapsedTime;
       
 14158     }
       
 14159     profilerStartTime = -1;
       
 14160   }
       
 14161 }
       
 14162 
       
 14163 // The deepest Fiber on the stack involved in a hydration context.
       
 14164 // This may have been an insertion or a hydration.
       
 14165 var hydrationParentFiber = null;
       
 14166 var nextHydratableInstance = null;
       
 14167 var isHydrating = false;
       
 14168 
       
 14169 function enterHydrationState(fiber) {
       
 14170   if (!supportsHydration) {
       
 14171     return false;
       
 14172   }
       
 14173 
       
 14174   var parentInstance = fiber.stateNode.containerInfo;
       
 14175   nextHydratableInstance = getFirstHydratableChild(parentInstance);
       
 14176   hydrationParentFiber = fiber;
       
 14177   isHydrating = true;
       
 14178   return true;
       
 14179 }
       
 14180 
       
 14181 function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
       
 14182   if (!supportsHydration) {
       
 14183     return false;
       
 14184   }
       
 14185 
       
 14186   var suspenseInstance = fiber.stateNode;
       
 14187   nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
       
 14188   popToNextHostParent(fiber);
       
 14189   isHydrating = true;
       
 14190   return true;
       
 14191 }
       
 14192 
       
 14193 function deleteHydratableInstance(returnFiber, instance) {
       
 14194   {
       
 14195     switch (returnFiber.tag) {
       
 14196       case HostRoot:
       
 14197         didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
       
 14198         break;
       
 14199       case HostComponent:
       
 14200         didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
       
 14201         break;
       
 14202     }
       
 14203   }
       
 14204 
       
 14205   var childToDelete = createFiberFromHostInstanceForDeletion();
       
 14206   childToDelete.stateNode = instance;
       
 14207   childToDelete.return = returnFiber;
       
 14208   childToDelete.effectTag = Deletion;
       
 14209 
       
 14210   // This might seem like it belongs on progressedFirstDeletion. However,
       
 14211   // these children are not part of the reconciliation list of children.
       
 14212   // Even if we abort and rereconcile the children, that will try to hydrate
       
 14213   // again and the nodes are still in the host tree so these will be
       
 14214   // recreated.
       
 14215   if (returnFiber.lastEffect !== null) {
       
 14216     returnFiber.lastEffect.nextEffect = childToDelete;
       
 14217     returnFiber.lastEffect = childToDelete;
       
 14218   } else {
       
 14219     returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 14220   }
       
 14221 }
       
 14222 
       
 14223 function insertNonHydratedInstance(returnFiber, fiber) {
       
 14224   fiber.effectTag |= Placement;
       
 14225   {
       
 14226     switch (returnFiber.tag) {
       
 14227       case HostRoot:
       
 14228         {
       
 14229           var parentContainer = returnFiber.stateNode.containerInfo;
       
 14230           switch (fiber.tag) {
       
 14231             case HostComponent:
       
 14232               var type = fiber.type;
       
 14233               var props = fiber.pendingProps;
       
 14234               didNotFindHydratableContainerInstance(parentContainer, type, props);
       
 14235               break;
       
 14236             case HostText:
       
 14237               var text = fiber.pendingProps;
       
 14238               didNotFindHydratableContainerTextInstance(parentContainer, text);
       
 14239               break;
       
 14240             case SuspenseComponent:
       
 14241               
       
 14242               break;
       
 14243           }
       
 14244           break;
       
 14245         }
       
 14246       case HostComponent:
       
 14247         {
       
 14248           var parentType = returnFiber.type;
       
 14249           var parentProps = returnFiber.memoizedProps;
       
 14250           var parentInstance = returnFiber.stateNode;
       
 14251           switch (fiber.tag) {
       
 14252             case HostComponent:
       
 14253               var _type = fiber.type;
       
 14254               var _props = fiber.pendingProps;
       
 14255               didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
       
 14256               break;
       
 14257             case HostText:
       
 14258               var _text = fiber.pendingProps;
       
 14259               didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
       
 14260               break;
       
 14261             case SuspenseComponent:
       
 14262               didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
       
 14263               break;
       
 14264           }
       
 14265           break;
       
 14266         }
       
 14267       default:
       
 14268         return;
       
 14269     }
       
 14270   }
       
 14271 }
       
 14272 
       
 14273 function tryHydrate(fiber, nextInstance) {
       
 14274   switch (fiber.tag) {
       
 14275     case HostComponent:
       
 14276       {
       
 14277         var type = fiber.type;
       
 14278         var props = fiber.pendingProps;
       
 14279         var instance = canHydrateInstance(nextInstance, type, props);
       
 14280         if (instance !== null) {
       
 14281           fiber.stateNode = instance;
       
 14282           return true;
       
 14283         }
       
 14284         return false;
       
 14285       }
       
 14286     case HostText:
       
 14287       {
       
 14288         var text = fiber.pendingProps;
       
 14289         var textInstance = canHydrateTextInstance(nextInstance, text);
       
 14290         if (textInstance !== null) {
       
 14291           fiber.stateNode = textInstance;
       
 14292           return true;
       
 14293         }
       
 14294         return false;
       
 14295       }
       
 14296     case SuspenseComponent:
       
 14297       {
       
 14298         if (enableSuspenseServerRenderer) {
       
 14299           var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
       
 14300           if (suspenseInstance !== null) {
       
 14301             // Downgrade the tag to a dehydrated component until we've hydrated it.
       
 14302             fiber.tag = DehydratedSuspenseComponent;
       
 14303             fiber.stateNode = suspenseInstance;
       
 14304             return true;
       
 14305           }
       
 14306         }
       
 14307         return false;
       
 14308       }
       
 14309     default:
       
 14310       return false;
       
 14311   }
       
 14312 }
       
 14313 
       
 14314 function tryToClaimNextHydratableInstance(fiber) {
       
 14315   if (!isHydrating) {
       
 14316     return;
       
 14317   }
       
 14318   var nextInstance = nextHydratableInstance;
       
 14319   if (!nextInstance) {
       
 14320     // Nothing to hydrate. Make it an insertion.
       
 14321     insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 14322     isHydrating = false;
       
 14323     hydrationParentFiber = fiber;
       
 14324     return;
       
 14325   }
       
 14326   var firstAttemptedInstance = nextInstance;
       
 14327   if (!tryHydrate(fiber, nextInstance)) {
       
 14328     // If we can't hydrate this instance let's try the next one.
       
 14329     // We use this as a heuristic. It's based on intuition and not data so it
       
 14330     // might be flawed or unnecessary.
       
 14331     nextInstance = getNextHydratableSibling(firstAttemptedInstance);
       
 14332     if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
       
 14333       // Nothing to hydrate. Make it an insertion.
       
 14334       insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 14335       isHydrating = false;
       
 14336       hydrationParentFiber = fiber;
       
 14337       return;
       
 14338     }
       
 14339     // We matched the next one, we'll now assume that the first one was
       
 14340     // superfluous and we'll delete it. Since we can't eagerly delete it
       
 14341     // we'll have to schedule a deletion. To do that, this node needs a dummy
       
 14342     // fiber associated with it.
       
 14343     deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
       
 14344   }
       
 14345   hydrationParentFiber = fiber;
       
 14346   nextHydratableInstance = getFirstHydratableChild(nextInstance);
       
 14347 }
       
 14348 
       
 14349 function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
       
 14350   if (!supportsHydration) {
       
 14351     invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
       
 14352   }
       
 14353 
       
 14354   var instance = fiber.stateNode;
       
 14355   var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
       
 14356   // TODO: Type this specific to this type of component.
       
 14357   fiber.updateQueue = updatePayload;
       
 14358   // If the update payload indicates that there is a change or if there
       
 14359   // is a new ref we mark this as an update.
       
 14360   if (updatePayload !== null) {
       
 14361     return true;
       
 14362   }
       
 14363   return false;
       
 14364 }
       
 14365 
       
 14366 function prepareToHydrateHostTextInstance(fiber) {
       
 14367   if (!supportsHydration) {
       
 14368     invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
       
 14369   }
       
 14370 
       
 14371   var textInstance = fiber.stateNode;
       
 14372   var textContent = fiber.memoizedProps;
       
 14373   var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
       
 14374   {
       
 14375     if (shouldUpdate) {
       
 14376       // We assume that prepareToHydrateHostTextInstance is called in a context where the
       
 14377       // hydration parent is the parent host component of this host text.
       
 14378       var returnFiber = hydrationParentFiber;
       
 14379       if (returnFiber !== null) {
       
 14380         switch (returnFiber.tag) {
       
 14381           case HostRoot:
       
 14382             {
       
 14383               var parentContainer = returnFiber.stateNode.containerInfo;
       
 14384               didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
       
 14385               break;
       
 14386             }
       
 14387           case HostComponent:
       
 14388             {
       
 14389               var parentType = returnFiber.type;
       
 14390               var parentProps = returnFiber.memoizedProps;
       
 14391               var parentInstance = returnFiber.stateNode;
       
 14392               didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
       
 14393               break;
       
 14394             }
       
 14395         }
       
 14396       }
       
 14397     }
       
 14398   }
       
 14399   return shouldUpdate;
       
 14400 }
       
 14401 
       
 14402 function skipPastDehydratedSuspenseInstance(fiber) {
       
 14403   if (!supportsHydration) {
       
 14404     invariant(false, 'Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
       
 14405   }
       
 14406   var suspenseInstance = fiber.stateNode;
       
 14407   !suspenseInstance ? invariant(false, 'Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 14408   nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
       
 14409 }
       
 14410 
       
 14411 function popToNextHostParent(fiber) {
       
 14412   var parent = fiber.return;
       
 14413   while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
       
 14414     parent = parent.return;
       
 14415   }
       
 14416   hydrationParentFiber = parent;
       
 14417 }
       
 14418 
       
 14419 function popHydrationState(fiber) {
       
 14420   if (!supportsHydration) {
       
 14421     return false;
       
 14422   }
       
 14423   if (fiber !== hydrationParentFiber) {
       
 14424     // We're deeper than the current hydration context, inside an inserted
       
 14425     // tree.
       
 14426     return false;
       
 14427   }
       
 14428   if (!isHydrating) {
       
 14429     // If we're not currently hydrating but we're in a hydration context, then
       
 14430     // we were an insertion and now need to pop up reenter hydration of our
       
 14431     // siblings.
       
 14432     popToNextHostParent(fiber);
       
 14433     isHydrating = true;
       
 14434     return false;
       
 14435   }
       
 14436 
       
 14437   var type = fiber.type;
       
 14438 
       
 14439   // If we have any remaining hydratable nodes, we need to delete them now.
       
 14440   // We only do this deeper than head and body since they tend to have random
       
 14441   // other nodes in them. We also ignore components with pure text content in
       
 14442   // side of them.
       
 14443   // TODO: Better heuristic.
       
 14444   if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
       
 14445     var nextInstance = nextHydratableInstance;
       
 14446     while (nextInstance) {
       
 14447       deleteHydratableInstance(fiber, nextInstance);
       
 14448       nextInstance = getNextHydratableSibling(nextInstance);
       
 14449     }
       
 14450   }
       
 14451 
       
 14452   popToNextHostParent(fiber);
       
 14453   nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
       
 14454   return true;
       
 14455 }
       
 14456 
       
 14457 function resetHydrationState() {
       
 14458   if (!supportsHydration) {
       
 14459     return;
       
 14460   }
       
 14461 
       
 14462   hydrationParentFiber = null;
       
 14463   nextHydratableInstance = null;
       
 14464   isHydrating = false;
       
 14465 }
       
 14466 
       
 14467 var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
       
 14468 
       
 14469 var didReceiveUpdate = false;
       
 14470 
       
 14471 var didWarnAboutBadClass = void 0;
       
 14472 var didWarnAboutContextTypeOnFunctionComponent = void 0;
       
 14473 var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
       
 14474 var didWarnAboutFunctionRefs = void 0;
       
 14475 var didWarnAboutReassigningProps = void 0;
       
 14476 
       
 14477 {
       
 14478   didWarnAboutBadClass = {};
       
 14479   didWarnAboutContextTypeOnFunctionComponent = {};
       
 14480   didWarnAboutGetDerivedStateOnFunctionComponent = {};
       
 14481   didWarnAboutFunctionRefs = {};
       
 14482   didWarnAboutReassigningProps = false;
       
 14483 }
       
 14484 
       
 14485 function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 14486   if (current$$1 === null) {
       
 14487     // If this is a fresh new component that hasn't been rendered yet, we
       
 14488     // won't update its child set by applying minimal side-effects. Instead,
       
 14489     // we will add them all to the child before it gets rendered. That means
       
 14490     // we can optimize this reconciliation pass by not tracking side-effects.
       
 14491     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 14492   } else {
       
 14493     // If the current child is the same as the work in progress, it means that
       
 14494     // we haven't yet started any work on these children. Therefore, we use
       
 14495     // the clone algorithm to create a copy of all the current children.
       
 14496 
       
 14497     // If we had any progressed work already, that is invalid at this point so
       
 14498     // let's throw it out.
       
 14499     workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
       
 14500   }
       
 14501 }
       
 14502 
       
 14503 function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 14504   // This function is fork of reconcileChildren. It's used in cases where we
       
 14505   // want to reconcile without matching against the existing set. This has the
       
 14506   // effect of all current children being unmounted; even if the type and key
       
 14507   // are the same, the old child is unmounted and a new child is created.
       
 14508   //
       
 14509   // To do this, we're going to go through the reconcile algorithm twice. In
       
 14510   // the first pass, we schedule a deletion for all the current children by
       
 14511   // passing null.
       
 14512   workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
       
 14513   // In the second pass, we mount the new children. The trick here is that we
       
 14514   // pass null in place of where we usually pass the current child set. This has
       
 14515   // the effect of remounting all children regardless of whether their their
       
 14516   // identity matches.
       
 14517   workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 14518 }
       
 14519 
       
 14520 function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 14521   // TODO: current can be non-null here even if the component
       
 14522   // hasn't yet mounted. This happens after the first render suspends.
       
 14523   // We'll need to figure out if this is fine or can cause issues.
       
 14524 
       
 14525   {
       
 14526     if (workInProgress.type !== workInProgress.elementType) {
       
 14527       // Lazy component props can't be validated in createElement
       
 14528       // because they're only guaranteed to be resolved here.
       
 14529       var innerPropTypes = Component.propTypes;
       
 14530       if (innerPropTypes) {
       
 14531         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14532         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 14533       }
       
 14534     }
       
 14535   }
       
 14536 
       
 14537   var render = Component.render;
       
 14538   var ref = workInProgress.ref;
       
 14539 
       
 14540   // The rest is a fork of updateFunctionComponent
       
 14541   var nextChildren = void 0;
       
 14542   prepareToReadContext(workInProgress, renderExpirationTime);
       
 14543   {
       
 14544     ReactCurrentOwner$3.current = workInProgress;
       
 14545     setCurrentPhase('render');
       
 14546     nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 14547     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 14548       // Only double-render components with Hooks
       
 14549       if (workInProgress.memoizedState !== null) {
       
 14550         nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 14551       }
       
 14552     }
       
 14553     setCurrentPhase(null);
       
 14554   }
       
 14555 
       
 14556   if (current$$1 !== null && !didReceiveUpdate) {
       
 14557     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 14558     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14559   }
       
 14560 
       
 14561   // React DevTools reads this flag.
       
 14562   workInProgress.effectTag |= PerformedWork;
       
 14563   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14564   return workInProgress.child;
       
 14565 }
       
 14566 
       
 14567 function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 14568   if (current$$1 === null) {
       
 14569     var type = Component.type;
       
 14570     if (isSimpleFunctionComponent(type) && Component.compare === null &&
       
 14571     // SimpleMemoComponent codepath doesn't resolve outer props either.
       
 14572     Component.defaultProps === undefined) {
       
 14573       // If this is a plain function component without default props,
       
 14574       // and with only the default shallow comparison, we upgrade it
       
 14575       // to a SimpleMemoComponent to allow fast path updates.
       
 14576       workInProgress.tag = SimpleMemoComponent;
       
 14577       workInProgress.type = type;
       
 14578       {
       
 14579         validateFunctionComponentInDev(workInProgress, type);
       
 14580       }
       
 14581       return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
       
 14582     }
       
 14583     {
       
 14584       var innerPropTypes = type.propTypes;
       
 14585       if (innerPropTypes) {
       
 14586         // Inner memo component props aren't currently validated in createElement.
       
 14587         // We could move it there, but we'd still need this for lazy code path.
       
 14588         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14589         'prop', getComponentName(type), getCurrentFiberStackInDev);
       
 14590       }
       
 14591     }
       
 14592     var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
       
 14593     child.ref = workInProgress.ref;
       
 14594     child.return = workInProgress;
       
 14595     workInProgress.child = child;
       
 14596     return child;
       
 14597   }
       
 14598   {
       
 14599     var _type = Component.type;
       
 14600     var _innerPropTypes = _type.propTypes;
       
 14601     if (_innerPropTypes) {
       
 14602       // Inner memo component props aren't currently validated in createElement.
       
 14603       // We could move it there, but we'd still need this for lazy code path.
       
 14604       checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
       
 14605       'prop', getComponentName(_type), getCurrentFiberStackInDev);
       
 14606     }
       
 14607   }
       
 14608   var currentChild = current$$1.child; // This is always exactly one child
       
 14609   if (updateExpirationTime < renderExpirationTime) {
       
 14610     // This will be the props with resolved defaultProps,
       
 14611     // unlike current.memoizedProps which will be the unresolved ones.
       
 14612     var prevProps = currentChild.memoizedProps;
       
 14613     // Default to shallow comparison
       
 14614     var compare = Component.compare;
       
 14615     compare = compare !== null ? compare : shallowEqual;
       
 14616     if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
       
 14617       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14618     }
       
 14619   }
       
 14620   // React DevTools reads this flag.
       
 14621   workInProgress.effectTag |= PerformedWork;
       
 14622   var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
       
 14623   newChild.ref = workInProgress.ref;
       
 14624   newChild.return = workInProgress;
       
 14625   workInProgress.child = newChild;
       
 14626   return newChild;
       
 14627 }
       
 14628 
       
 14629 function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 14630   // TODO: current can be non-null here even if the component
       
 14631   // hasn't yet mounted. This happens when the inner render suspends.
       
 14632   // We'll need to figure out if this is fine or can cause issues.
       
 14633 
       
 14634   {
       
 14635     if (workInProgress.type !== workInProgress.elementType) {
       
 14636       // Lazy component props can't be validated in createElement
       
 14637       // because they're only guaranteed to be resolved here.
       
 14638       var outerMemoType = workInProgress.elementType;
       
 14639       if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
       
 14640         // We warn when you define propTypes on lazy()
       
 14641         // so let's just skip over it to find memo() outer wrapper.
       
 14642         // Inner props for memo are validated later.
       
 14643         outerMemoType = refineResolvedLazyComponent(outerMemoType);
       
 14644       }
       
 14645       var outerPropTypes = outerMemoType && outerMemoType.propTypes;
       
 14646       if (outerPropTypes) {
       
 14647         checkPropTypes_1(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
       
 14648         'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
       
 14649       }
       
 14650       // Inner propTypes will be validated in the function component path.
       
 14651     }
       
 14652   }
       
 14653   if (current$$1 !== null) {
       
 14654     var prevProps = current$$1.memoizedProps;
       
 14655     if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
       
 14656       didReceiveUpdate = false;
       
 14657       if (updateExpirationTime < renderExpirationTime) {
       
 14658         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14659       }
       
 14660     }
       
 14661   }
       
 14662   return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 14663 }
       
 14664 
       
 14665 function updateFragment(current$$1, workInProgress, renderExpirationTime) {
       
 14666   var nextChildren = workInProgress.pendingProps;
       
 14667   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14668   return workInProgress.child;
       
 14669 }
       
 14670 
       
 14671 function updateMode(current$$1, workInProgress, renderExpirationTime) {
       
 14672   var nextChildren = workInProgress.pendingProps.children;
       
 14673   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14674   return workInProgress.child;
       
 14675 }
       
 14676 
       
 14677 function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
       
 14678   if (enableProfilerTimer) {
       
 14679     workInProgress.effectTag |= Update;
       
 14680   }
       
 14681   var nextProps = workInProgress.pendingProps;
       
 14682   var nextChildren = nextProps.children;
       
 14683   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14684   return workInProgress.child;
       
 14685 }
       
 14686 
       
 14687 function markRef(current$$1, workInProgress) {
       
 14688   var ref = workInProgress.ref;
       
 14689   if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
       
 14690     // Schedule a Ref effect
       
 14691     workInProgress.effectTag |= Ref;
       
 14692   }
       
 14693 }
       
 14694 
       
 14695 function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 14696   {
       
 14697     if (workInProgress.type !== workInProgress.elementType) {
       
 14698       // Lazy component props can't be validated in createElement
       
 14699       // because they're only guaranteed to be resolved here.
       
 14700       var innerPropTypes = Component.propTypes;
       
 14701       if (innerPropTypes) {
       
 14702         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14703         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 14704       }
       
 14705     }
       
 14706   }
       
 14707 
       
 14708   var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
       
 14709   var context = getMaskedContext(workInProgress, unmaskedContext);
       
 14710 
       
 14711   var nextChildren = void 0;
       
 14712   prepareToReadContext(workInProgress, renderExpirationTime);
       
 14713   {
       
 14714     ReactCurrentOwner$3.current = workInProgress;
       
 14715     setCurrentPhase('render');
       
 14716     nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 14717     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 14718       // Only double-render components with Hooks
       
 14719       if (workInProgress.memoizedState !== null) {
       
 14720         nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 14721       }
       
 14722     }
       
 14723     setCurrentPhase(null);
       
 14724   }
       
 14725 
       
 14726   if (current$$1 !== null && !didReceiveUpdate) {
       
 14727     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 14728     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14729   }
       
 14730 
       
 14731   // React DevTools reads this flag.
       
 14732   workInProgress.effectTag |= PerformedWork;
       
 14733   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14734   return workInProgress.child;
       
 14735 }
       
 14736 
       
 14737 function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 14738   {
       
 14739     if (workInProgress.type !== workInProgress.elementType) {
       
 14740       // Lazy component props can't be validated in createElement
       
 14741       // because they're only guaranteed to be resolved here.
       
 14742       var innerPropTypes = Component.propTypes;
       
 14743       if (innerPropTypes) {
       
 14744         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14745         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 14746       }
       
 14747     }
       
 14748   }
       
 14749 
       
 14750   // Push context providers early to prevent context stack mismatches.
       
 14751   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 14752   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 14753   var hasContext = void 0;
       
 14754   if (isContextProvider(Component)) {
       
 14755     hasContext = true;
       
 14756     pushContextProvider(workInProgress);
       
 14757   } else {
       
 14758     hasContext = false;
       
 14759   }
       
 14760   prepareToReadContext(workInProgress, renderExpirationTime);
       
 14761 
       
 14762   var instance = workInProgress.stateNode;
       
 14763   var shouldUpdate = void 0;
       
 14764   if (instance === null) {
       
 14765     if (current$$1 !== null) {
       
 14766       // An class component without an instance only mounts if it suspended
       
 14767       // inside a non- concurrent tree, in an inconsistent state. We want to
       
 14768       // tree it like a new mount, even though an empty version of it already
       
 14769       // committed. Disconnect the alternate pointers.
       
 14770       current$$1.alternate = null;
       
 14771       workInProgress.alternate = null;
       
 14772       // Since this is conceptually a new fiber, schedule a Placement effect
       
 14773       workInProgress.effectTag |= Placement;
       
 14774     }
       
 14775     // In the initial pass we might need to construct the instance.
       
 14776     constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 14777     mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 14778     shouldUpdate = true;
       
 14779   } else if (current$$1 === null) {
       
 14780     // In a resume, we'll already have an instance we can reuse.
       
 14781     shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 14782   } else {
       
 14783     shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 14784   }
       
 14785   var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
       
 14786   {
       
 14787     var inst = workInProgress.stateNode;
       
 14788     if (inst.props !== nextProps) {
       
 14789       !didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
       
 14790       didWarnAboutReassigningProps = true;
       
 14791     }
       
 14792   }
       
 14793   return nextUnitOfWork;
       
 14794 }
       
 14795 
       
 14796 function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
       
 14797   // Refs should update even if shouldComponentUpdate returns false
       
 14798   markRef(current$$1, workInProgress);
       
 14799 
       
 14800   var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 14801 
       
 14802   if (!shouldUpdate && !didCaptureError) {
       
 14803     // Context providers should defer to sCU for rendering
       
 14804     if (hasContext) {
       
 14805       invalidateContextProvider(workInProgress, Component, false);
       
 14806     }
       
 14807 
       
 14808     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14809   }
       
 14810 
       
 14811   var instance = workInProgress.stateNode;
       
 14812 
       
 14813   // Rerender
       
 14814   ReactCurrentOwner$3.current = workInProgress;
       
 14815   var nextChildren = void 0;
       
 14816   if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
       
 14817     // If we captured an error, but getDerivedStateFrom catch is not defined,
       
 14818     // unmount all the children. componentDidCatch will schedule an update to
       
 14819     // re-render a fallback. This is temporary until we migrate everyone to
       
 14820     // the new API.
       
 14821     // TODO: Warn in a future release.
       
 14822     nextChildren = null;
       
 14823 
       
 14824     if (enableProfilerTimer) {
       
 14825       stopProfilerTimerIfRunning(workInProgress);
       
 14826     }
       
 14827   } else {
       
 14828     {
       
 14829       setCurrentPhase('render');
       
 14830       nextChildren = instance.render();
       
 14831       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 14832         instance.render();
       
 14833       }
       
 14834       setCurrentPhase(null);
       
 14835     }
       
 14836   }
       
 14837 
       
 14838   // React DevTools reads this flag.
       
 14839   workInProgress.effectTag |= PerformedWork;
       
 14840   if (current$$1 !== null && didCaptureError) {
       
 14841     // If we're recovering from an error, reconcile without reusing any of
       
 14842     // the existing children. Conceptually, the normal children and the children
       
 14843     // that are shown on error are two different sets, so we shouldn't reuse
       
 14844     // normal children even if their identities match.
       
 14845     forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14846   } else {
       
 14847     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14848   }
       
 14849 
       
 14850   // Memoize state using the values we just used to render.
       
 14851   // TODO: Restructure so we never read values from the instance.
       
 14852   workInProgress.memoizedState = instance.state;
       
 14853 
       
 14854   // The context might have changed so we need to recalculate it.
       
 14855   if (hasContext) {
       
 14856     invalidateContextProvider(workInProgress, Component, true);
       
 14857   }
       
 14858 
       
 14859   return workInProgress.child;
       
 14860 }
       
 14861 
       
 14862 function pushHostRootContext(workInProgress) {
       
 14863   var root = workInProgress.stateNode;
       
 14864   if (root.pendingContext) {
       
 14865     pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
       
 14866   } else if (root.context) {
       
 14867     // Should always be set
       
 14868     pushTopLevelContextObject(workInProgress, root.context, false);
       
 14869   }
       
 14870   pushHostContainer(workInProgress, root.containerInfo);
       
 14871 }
       
 14872 
       
 14873 function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
       
 14874   pushHostRootContext(workInProgress);
       
 14875   var updateQueue = workInProgress.updateQueue;
       
 14876   !(updateQueue !== null) ? invariant(false, 'If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 14877   var nextProps = workInProgress.pendingProps;
       
 14878   var prevState = workInProgress.memoizedState;
       
 14879   var prevChildren = prevState !== null ? prevState.element : null;
       
 14880   processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
       
 14881   var nextState = workInProgress.memoizedState;
       
 14882   // Caution: React DevTools currently depends on this property
       
 14883   // being called "element".
       
 14884   var nextChildren = nextState.element;
       
 14885   if (nextChildren === prevChildren) {
       
 14886     // If the state is the same as before, that's a bailout because we had
       
 14887     // no work that expires at this time.
       
 14888     resetHydrationState();
       
 14889     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14890   }
       
 14891   var root = workInProgress.stateNode;
       
 14892   if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
       
 14893     // If we don't have any current children this might be the first pass.
       
 14894     // We always try to hydrate. If this isn't a hydration pass there won't
       
 14895     // be any children to hydrate which is effectively the same thing as
       
 14896     // not hydrating.
       
 14897 
       
 14898     // This is a bit of a hack. We track the host root as a placement to
       
 14899     // know that we're currently in a mounting state. That way isMounted
       
 14900     // works as expected. We must reset this before committing.
       
 14901     // TODO: Delete this when we delete isMounted and findDOMNode.
       
 14902     workInProgress.effectTag |= Placement;
       
 14903 
       
 14904     // Ensure that children mount into this root without tracking
       
 14905     // side-effects. This ensures that we don't store Placement effects on
       
 14906     // nodes that will be hydrated.
       
 14907     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 14908   } else {
       
 14909     // Otherwise reset hydration state in case we aborted and resumed another
       
 14910     // root.
       
 14911     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14912     resetHydrationState();
       
 14913   }
       
 14914   return workInProgress.child;
       
 14915 }
       
 14916 
       
 14917 function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
       
 14918   pushHostContext(workInProgress);
       
 14919 
       
 14920   if (current$$1 === null) {
       
 14921     tryToClaimNextHydratableInstance(workInProgress);
       
 14922   }
       
 14923 
       
 14924   var type = workInProgress.type;
       
 14925   var nextProps = workInProgress.pendingProps;
       
 14926   var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
       
 14927 
       
 14928   var nextChildren = nextProps.children;
       
 14929   var isDirectTextChild = shouldSetTextContent(type, nextProps);
       
 14930 
       
 14931   if (isDirectTextChild) {
       
 14932     // We special case a direct text child of a host node. This is a common
       
 14933     // case. We won't handle it as a reified child. We will instead handle
       
 14934     // this in the host environment that also have access to this prop. That
       
 14935     // avoids allocating another HostText fiber and traversing it.
       
 14936     nextChildren = null;
       
 14937   } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
       
 14938     // If we're switching from a direct text child to a normal child, or to
       
 14939     // empty, we need to schedule the text content to be reset.
       
 14940     workInProgress.effectTag |= ContentReset;
       
 14941   }
       
 14942 
       
 14943   markRef(current$$1, workInProgress);
       
 14944 
       
 14945   // Check the host config to see if the children are offscreen/hidden.
       
 14946   if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
       
 14947     // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 14948     workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 14949     return null;
       
 14950   }
       
 14951 
       
 14952   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14953   return workInProgress.child;
       
 14954 }
       
 14955 
       
 14956 function updateHostText(current$$1, workInProgress) {
       
 14957   if (current$$1 === null) {
       
 14958     tryToClaimNextHydratableInstance(workInProgress);
       
 14959   }
       
 14960   // Nothing to do here. This is terminal. We'll do the completion step
       
 14961   // immediately after.
       
 14962   return null;
       
 14963 }
       
 14964 
       
 14965 function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
       
 14966   if (_current !== null) {
       
 14967     // An lazy component only mounts if it suspended inside a non-
       
 14968     // concurrent tree, in an inconsistent state. We want to treat it like
       
 14969     // a new mount, even though an empty version of it already committed.
       
 14970     // Disconnect the alternate pointers.
       
 14971     _current.alternate = null;
       
 14972     workInProgress.alternate = null;
       
 14973     // Since this is conceptually a new fiber, schedule a Placement effect
       
 14974     workInProgress.effectTag |= Placement;
       
 14975   }
       
 14976 
       
 14977   var props = workInProgress.pendingProps;
       
 14978   // We can't start a User Timing measurement with correct label yet.
       
 14979   // Cancel and resume right after we know the tag.
       
 14980   cancelWorkTimer(workInProgress);
       
 14981   var Component = readLazyComponentType(elementType);
       
 14982   // Store the unwrapped component in the type.
       
 14983   workInProgress.type = Component;
       
 14984   var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
       
 14985   startWorkTimer(workInProgress);
       
 14986   var resolvedProps = resolveDefaultProps(Component, props);
       
 14987   var child = void 0;
       
 14988   switch (resolvedTag) {
       
 14989     case FunctionComponent:
       
 14990       {
       
 14991         {
       
 14992           validateFunctionComponentInDev(workInProgress, Component);
       
 14993         }
       
 14994         child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 14995         break;
       
 14996       }
       
 14997     case ClassComponent:
       
 14998       {
       
 14999         child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 15000         break;
       
 15001       }
       
 15002     case ForwardRef:
       
 15003       {
       
 15004         child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 15005         break;
       
 15006       }
       
 15007     case MemoComponent:
       
 15008       {
       
 15009         {
       
 15010           if (workInProgress.type !== workInProgress.elementType) {
       
 15011             var outerPropTypes = Component.propTypes;
       
 15012             if (outerPropTypes) {
       
 15013               checkPropTypes_1(outerPropTypes, resolvedProps, // Resolved for outer only
       
 15014               'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 15015             }
       
 15016           }
       
 15017         }
       
 15018         child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
       
 15019         updateExpirationTime, renderExpirationTime);
       
 15020         break;
       
 15021       }
       
 15022     default:
       
 15023       {
       
 15024         var hint = '';
       
 15025         {
       
 15026           if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
       
 15027             hint = ' Did you wrap a component in React.lazy() more than once?';
       
 15028           }
       
 15029         }
       
 15030         // This message intentionally doesn't mention ForwardRef or MemoComponent
       
 15031         // because the fact that it's a separate type of work is an
       
 15032         // implementation detail.
       
 15033         invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Lazy element type must resolve to a class or function.%s', Component, hint);
       
 15034       }
       
 15035   }
       
 15036   return child;
       
 15037 }
       
 15038 
       
 15039 function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 15040   if (_current !== null) {
       
 15041     // An incomplete component only mounts if it suspended inside a non-
       
 15042     // concurrent tree, in an inconsistent state. We want to treat it like
       
 15043     // a new mount, even though an empty version of it already committed.
       
 15044     // Disconnect the alternate pointers.
       
 15045     _current.alternate = null;
       
 15046     workInProgress.alternate = null;
       
 15047     // Since this is conceptually a new fiber, schedule a Placement effect
       
 15048     workInProgress.effectTag |= Placement;
       
 15049   }
       
 15050 
       
 15051   // Promote the fiber to a class and try rendering again.
       
 15052   workInProgress.tag = ClassComponent;
       
 15053 
       
 15054   // The rest of this function is a fork of `updateClassComponent`
       
 15055 
       
 15056   // Push context providers early to prevent context stack mismatches.
       
 15057   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 15058   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 15059   var hasContext = void 0;
       
 15060   if (isContextProvider(Component)) {
       
 15061     hasContext = true;
       
 15062     pushContextProvider(workInProgress);
       
 15063   } else {
       
 15064     hasContext = false;
       
 15065   }
       
 15066   prepareToReadContext(workInProgress, renderExpirationTime);
       
 15067 
       
 15068   constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 15069   mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 15070 
       
 15071   return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 15072 }
       
 15073 
       
 15074 function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
       
 15075   if (_current !== null) {
       
 15076     // An indeterminate component only mounts if it suspended inside a non-
       
 15077     // concurrent tree, in an inconsistent state. We want to treat it like
       
 15078     // a new mount, even though an empty version of it already committed.
       
 15079     // Disconnect the alternate pointers.
       
 15080     _current.alternate = null;
       
 15081     workInProgress.alternate = null;
       
 15082     // Since this is conceptually a new fiber, schedule a Placement effect
       
 15083     workInProgress.effectTag |= Placement;
       
 15084   }
       
 15085 
       
 15086   var props = workInProgress.pendingProps;
       
 15087   var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
       
 15088   var context = getMaskedContext(workInProgress, unmaskedContext);
       
 15089 
       
 15090   prepareToReadContext(workInProgress, renderExpirationTime);
       
 15091 
       
 15092   var value = void 0;
       
 15093 
       
 15094   {
       
 15095     if (Component.prototype && typeof Component.prototype.render === 'function') {
       
 15096       var componentName = getComponentName(Component) || 'Unknown';
       
 15097 
       
 15098       if (!didWarnAboutBadClass[componentName]) {
       
 15099         warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
       
 15100         didWarnAboutBadClass[componentName] = true;
       
 15101       }
       
 15102     }
       
 15103 
       
 15104     if (workInProgress.mode & StrictMode) {
       
 15105       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
       
 15106     }
       
 15107 
       
 15108     ReactCurrentOwner$3.current = workInProgress;
       
 15109     value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 15110   }
       
 15111   // React DevTools reads this flag.
       
 15112   workInProgress.effectTag |= PerformedWork;
       
 15113 
       
 15114   if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
       
 15115     // Proceed under the assumption that this is a class instance
       
 15116     workInProgress.tag = ClassComponent;
       
 15117 
       
 15118     // Throw out any hooks that were used.
       
 15119     resetHooks();
       
 15120 
       
 15121     // Push context providers early to prevent context stack mismatches.
       
 15122     // During mounting we don't know the child context yet as the instance doesn't exist.
       
 15123     // We will invalidate the child context in finishClassComponent() right after rendering.
       
 15124     var hasContext = false;
       
 15125     if (isContextProvider(Component)) {
       
 15126       hasContext = true;
       
 15127       pushContextProvider(workInProgress);
       
 15128     } else {
       
 15129       hasContext = false;
       
 15130     }
       
 15131 
       
 15132     workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
       
 15133 
       
 15134     var getDerivedStateFromProps = Component.getDerivedStateFromProps;
       
 15135     if (typeof getDerivedStateFromProps === 'function') {
       
 15136       applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
       
 15137     }
       
 15138 
       
 15139     adoptClassInstance(workInProgress, value);
       
 15140     mountClassInstance(workInProgress, Component, props, renderExpirationTime);
       
 15141     return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 15142   } else {
       
 15143     // Proceed under the assumption that this is a function component
       
 15144     workInProgress.tag = FunctionComponent;
       
 15145     {
       
 15146       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 15147         // Only double-render components with Hooks
       
 15148         if (workInProgress.memoizedState !== null) {
       
 15149           value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 15150         }
       
 15151       }
       
 15152     }
       
 15153     reconcileChildren(null, workInProgress, value, renderExpirationTime);
       
 15154     {
       
 15155       validateFunctionComponentInDev(workInProgress, Component);
       
 15156     }
       
 15157     return workInProgress.child;
       
 15158   }
       
 15159 }
       
 15160 
       
 15161 function validateFunctionComponentInDev(workInProgress, Component) {
       
 15162   if (Component) {
       
 15163     !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
       
 15164   }
       
 15165   if (workInProgress.ref !== null) {
       
 15166     var info = '';
       
 15167     var ownerName = getCurrentFiberOwnerNameInDevOrNull();
       
 15168     if (ownerName) {
       
 15169       info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 15170     }
       
 15171 
       
 15172     var warningKey = ownerName || workInProgress._debugID || '';
       
 15173     var debugSource = workInProgress._debugSource;
       
 15174     if (debugSource) {
       
 15175       warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
       
 15176     }
       
 15177     if (!didWarnAboutFunctionRefs[warningKey]) {
       
 15178       didWarnAboutFunctionRefs[warningKey] = true;
       
 15179       warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
       
 15180     }
       
 15181   }
       
 15182 
       
 15183   if (typeof Component.getDerivedStateFromProps === 'function') {
       
 15184     var componentName = getComponentName(Component) || 'Unknown';
       
 15185 
       
 15186     if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) {
       
 15187       warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', componentName);
       
 15188       didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true;
       
 15189     }
       
 15190   }
       
 15191 
       
 15192   if (typeof Component.contextType === 'object' && Component.contextType !== null) {
       
 15193     var _componentName = getComponentName(Component) || 'Unknown';
       
 15194 
       
 15195     if (!didWarnAboutContextTypeOnFunctionComponent[_componentName]) {
       
 15196       warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName);
       
 15197       didWarnAboutContextTypeOnFunctionComponent[_componentName] = true;
       
 15198     }
       
 15199   }
       
 15200 }
       
 15201 
       
 15202 function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 15203   var mode = workInProgress.mode;
       
 15204   var nextProps = workInProgress.pendingProps;
       
 15205 
       
 15206   // We should attempt to render the primary children unless this boundary
       
 15207   // already suspended during this render (`alreadyCaptured` is true).
       
 15208   var nextState = workInProgress.memoizedState;
       
 15209 
       
 15210   var nextDidTimeout = void 0;
       
 15211   if ((workInProgress.effectTag & DidCapture) === NoEffect) {
       
 15212     // This is the first attempt.
       
 15213     nextState = null;
       
 15214     nextDidTimeout = false;
       
 15215   } else {
       
 15216     // Something in this boundary's subtree already suspended. Switch to
       
 15217     // rendering the fallback children.
       
 15218     nextState = {
       
 15219       timedOutAt: nextState !== null ? nextState.timedOutAt : NoWork
       
 15220     };
       
 15221     nextDidTimeout = true;
       
 15222     workInProgress.effectTag &= ~DidCapture;
       
 15223   }
       
 15224 
       
 15225   // This next part is a bit confusing. If the children timeout, we switch to
       
 15226   // showing the fallback children in place of the "primary" children.
       
 15227   // However, we don't want to delete the primary children because then their
       
 15228   // state will be lost (both the React state and the host state, e.g.
       
 15229   // uncontrolled form inputs). Instead we keep them mounted and hide them.
       
 15230   // Both the fallback children AND the primary children are rendered at the
       
 15231   // same time. Once the primary children are un-suspended, we can delete
       
 15232   // the fallback children — don't need to preserve their state.
       
 15233   //
       
 15234   // The two sets of children are siblings in the host environment, but
       
 15235   // semantically, for purposes of reconciliation, they are two separate sets.
       
 15236   // So we store them using two fragment fibers.
       
 15237   //
       
 15238   // However, we want to avoid allocating extra fibers for every placeholder.
       
 15239   // They're only necessary when the children time out, because that's the
       
 15240   // only time when both sets are mounted.
       
 15241   //
       
 15242   // So, the extra fragment fibers are only used if the children time out.
       
 15243   // Otherwise, we render the primary children directly. This requires some
       
 15244   // custom reconciliation logic to preserve the state of the primary
       
 15245   // children. It's essentially a very basic form of re-parenting.
       
 15246 
       
 15247   // `child` points to the child fiber. In the normal case, this is the first
       
 15248   // fiber of the primary children set. In the timed-out case, it's a
       
 15249   // a fragment fiber containing the primary children.
       
 15250   var child = void 0;
       
 15251   // `next` points to the next fiber React should render. In the normal case,
       
 15252   // it's the same as `child`: the first fiber of the primary children set.
       
 15253   // In the timed-out case, it's a fragment fiber containing the *fallback*
       
 15254   // children -- we skip over the primary children entirely.
       
 15255   var next = void 0;
       
 15256   if (current$$1 === null) {
       
 15257     if (enableSuspenseServerRenderer) {
       
 15258       // If we're currently hydrating, try to hydrate this boundary.
       
 15259       // But only if this has a fallback.
       
 15260       if (nextProps.fallback !== undefined) {
       
 15261         tryToClaimNextHydratableInstance(workInProgress);
       
 15262         // This could've changed the tag if this was a dehydrated suspense component.
       
 15263         if (workInProgress.tag === DehydratedSuspenseComponent) {
       
 15264           return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 15265         }
       
 15266       }
       
 15267     }
       
 15268 
       
 15269     // This is the initial mount. This branch is pretty simple because there's
       
 15270     // no previous state that needs to be preserved.
       
 15271     if (nextDidTimeout) {
       
 15272       // Mount separate fragments for primary and fallback children.
       
 15273       var nextFallbackChildren = nextProps.fallback;
       
 15274       var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
       
 15275 
       
 15276       if ((workInProgress.mode & ConcurrentMode) === NoContext) {
       
 15277         // Outside of concurrent mode, we commit the effects from the
       
 15278         var progressedState = workInProgress.memoizedState;
       
 15279         var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
       
 15280         primaryChildFragment.child = progressedPrimaryChild;
       
 15281       }
       
 15282 
       
 15283       var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
       
 15284       primaryChildFragment.sibling = fallbackChildFragment;
       
 15285       child = primaryChildFragment;
       
 15286       // Skip the primary children, and continue working on the
       
 15287       // fallback children.
       
 15288       next = fallbackChildFragment;
       
 15289       child.return = next.return = workInProgress;
       
 15290     } else {
       
 15291       // Mount the primary children without an intermediate fragment fiber.
       
 15292       var nextPrimaryChildren = nextProps.children;
       
 15293       child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
       
 15294     }
       
 15295   } else {
       
 15296     // This is an update. This branch is more complicated because we need to
       
 15297     // ensure the state of the primary children is preserved.
       
 15298     var prevState = current$$1.memoizedState;
       
 15299     var prevDidTimeout = prevState !== null;
       
 15300     if (prevDidTimeout) {
       
 15301       // The current tree already timed out. That means each child set is
       
 15302       var currentPrimaryChildFragment = current$$1.child;
       
 15303       var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
       
 15304       if (nextDidTimeout) {
       
 15305         // Still timed out. Reuse the current primary children by cloning
       
 15306         // its fragment. We're going to skip over these entirely.
       
 15307         var _nextFallbackChildren = nextProps.fallback;
       
 15308         var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
       
 15309 
       
 15310         if ((workInProgress.mode & ConcurrentMode) === NoContext) {
       
 15311           // Outside of concurrent mode, we commit the effects from the
       
 15312           var _progressedState = workInProgress.memoizedState;
       
 15313           var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
       
 15314           if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
       
 15315             _primaryChildFragment.child = _progressedPrimaryChild;
       
 15316           }
       
 15317         }
       
 15318 
       
 15319         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 15320         // parent of a new tree, we need to set its treeBaseDuration.
       
 15321         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 15322           // treeBaseDuration is the sum of all the child tree base durations.
       
 15323           var treeBaseDuration = 0;
       
 15324           var hiddenChild = _primaryChildFragment.child;
       
 15325           while (hiddenChild !== null) {
       
 15326             treeBaseDuration += hiddenChild.treeBaseDuration;
       
 15327             hiddenChild = hiddenChild.sibling;
       
 15328           }
       
 15329           _primaryChildFragment.treeBaseDuration = treeBaseDuration;
       
 15330         }
       
 15331 
       
 15332         // Clone the fallback child fragment, too. These we'll continue
       
 15333         // working on.
       
 15334         var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
       
 15335         child = _primaryChildFragment;
       
 15336         _primaryChildFragment.childExpirationTime = NoWork;
       
 15337         // Skip the primary children, and continue working on the
       
 15338         // fallback children.
       
 15339         next = _fallbackChildFragment;
       
 15340         child.return = next.return = workInProgress;
       
 15341       } else {
       
 15342         // No longer suspended. Switch back to showing the primary children,
       
 15343         // and remove the intermediate fragment fiber.
       
 15344         var _nextPrimaryChildren = nextProps.children;
       
 15345         var currentPrimaryChild = currentPrimaryChildFragment.child;
       
 15346         var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
       
 15347 
       
 15348         // If this render doesn't suspend, we need to delete the fallback
       
 15349         // children. Wait until the complete phase, after we've confirmed the
       
 15350         // fallback is no longer needed.
       
 15351         // TODO: Would it be better to store the fallback fragment on
       
 15352         // the stateNode?
       
 15353 
       
 15354         // Continue rendering the children, like we normally do.
       
 15355         child = next = primaryChild;
       
 15356       }
       
 15357     } else {
       
 15358       // The current tree has not already timed out. That means the primary
       
 15359       // children are not wrapped in a fragment fiber.
       
 15360       var _currentPrimaryChild = current$$1.child;
       
 15361       if (nextDidTimeout) {
       
 15362         // Timed out. Wrap the children in a fragment fiber to keep them
       
 15363         // separate from the fallback children.
       
 15364         var _nextFallbackChildren2 = nextProps.fallback;
       
 15365         var _primaryChildFragment2 = createFiberFromFragment(
       
 15366         // It shouldn't matter what the pending props are because we aren't
       
 15367         // going to render this fragment.
       
 15368         null, mode, NoWork, null);
       
 15369         _primaryChildFragment2.child = _currentPrimaryChild;
       
 15370 
       
 15371         // Even though we're creating a new fiber, there are no new children,
       
 15372         // because we're reusing an already mounted tree. So we don't need to
       
 15373         // schedule a placement.
       
 15374         // primaryChildFragment.effectTag |= Placement;
       
 15375 
       
 15376         if ((workInProgress.mode & ConcurrentMode) === NoContext) {
       
 15377           // Outside of concurrent mode, we commit the effects from the
       
 15378           var _progressedState2 = workInProgress.memoizedState;
       
 15379           var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
       
 15380           _primaryChildFragment2.child = _progressedPrimaryChild2;
       
 15381         }
       
 15382 
       
 15383         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 15384         // parent of a new tree, we need to set its treeBaseDuration.
       
 15385         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 15386           // treeBaseDuration is the sum of all the child tree base durations.
       
 15387           var _treeBaseDuration = 0;
       
 15388           var _hiddenChild = _primaryChildFragment2.child;
       
 15389           while (_hiddenChild !== null) {
       
 15390             _treeBaseDuration += _hiddenChild.treeBaseDuration;
       
 15391             _hiddenChild = _hiddenChild.sibling;
       
 15392           }
       
 15393           _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
       
 15394         }
       
 15395 
       
 15396         // Create a fragment from the fallback children, too.
       
 15397         var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
       
 15398         _fallbackChildFragment2.effectTag |= Placement;
       
 15399         child = _primaryChildFragment2;
       
 15400         _primaryChildFragment2.childExpirationTime = NoWork;
       
 15401         // Skip the primary children, and continue working on the
       
 15402         // fallback children.
       
 15403         next = _fallbackChildFragment2;
       
 15404         child.return = next.return = workInProgress;
       
 15405       } else {
       
 15406         // Still haven't timed out.  Continue rendering the children, like we
       
 15407         // normally do.
       
 15408         var _nextPrimaryChildren2 = nextProps.children;
       
 15409         next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
       
 15410       }
       
 15411     }
       
 15412     workInProgress.stateNode = current$$1.stateNode;
       
 15413   }
       
 15414 
       
 15415   workInProgress.memoizedState = nextState;
       
 15416   workInProgress.child = child;
       
 15417   return next;
       
 15418 }
       
 15419 
       
 15420 function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 15421   if (current$$1 === null) {
       
 15422     // During the first pass, we'll bail out and not drill into the children.
       
 15423     // Instead, we'll leave the content in place and try to hydrate it later.
       
 15424     workInProgress.expirationTime = Never;
       
 15425     return null;
       
 15426   }
       
 15427   // We use childExpirationTime to indicate that a child might depend on context, so if
       
 15428   // any context has changed, we need to treat is as if the input might have changed.
       
 15429   var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
       
 15430   if (didReceiveUpdate || hasContextChanged$$1) {
       
 15431     // This boundary has changed since the first render. This means that we are now unable to
       
 15432     // hydrate it. We might still be able to hydrate it using an earlier expiration time but
       
 15433     // during this render we can't. Instead, we're going to delete the whole subtree and
       
 15434     // instead inject a new real Suspense boundary to take its place, which may render content
       
 15435     // or fallback. The real Suspense boundary will suspend for a while so we have some time
       
 15436     // to ensure it can produce real content, but all state and pending events will be lost.
       
 15437 
       
 15438     // Detach from the current dehydrated boundary.
       
 15439     current$$1.alternate = null;
       
 15440     workInProgress.alternate = null;
       
 15441 
       
 15442     // Insert a deletion in the effect list.
       
 15443     var returnFiber = workInProgress.return;
       
 15444     !(returnFiber !== null) ? invariant(false, 'Suspense boundaries are never on the root. This is probably a bug in React.') : void 0;
       
 15445     var last = returnFiber.lastEffect;
       
 15446     if (last !== null) {
       
 15447       last.nextEffect = current$$1;
       
 15448       returnFiber.lastEffect = current$$1;
       
 15449     } else {
       
 15450       returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
       
 15451     }
       
 15452     current$$1.nextEffect = null;
       
 15453     current$$1.effectTag = Deletion;
       
 15454 
       
 15455     // Upgrade this work in progress to a real Suspense component.
       
 15456     workInProgress.tag = SuspenseComponent;
       
 15457     workInProgress.stateNode = null;
       
 15458     workInProgress.memoizedState = null;
       
 15459     // This is now an insertion.
       
 15460     workInProgress.effectTag |= Placement;
       
 15461     // Retry as a real Suspense component.
       
 15462     return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 15463   }
       
 15464   if ((workInProgress.effectTag & DidCapture) === NoEffect) {
       
 15465     // This is the first attempt.
       
 15466     reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
       
 15467     var nextProps = workInProgress.pendingProps;
       
 15468     var nextChildren = nextProps.children;
       
 15469     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 15470     return workInProgress.child;
       
 15471   } else {
       
 15472     // Something suspended. Leave the existing children in place.
       
 15473     // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
       
 15474     workInProgress.child = null;
       
 15475     return null;
       
 15476   }
       
 15477 }
       
 15478 
       
 15479 function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
       
 15480   pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 15481   var nextChildren = workInProgress.pendingProps;
       
 15482   if (current$$1 === null) {
       
 15483     // Portals are special because we don't append the children during mount
       
 15484     // but at commit. Therefore we need to track insertions which the normal
       
 15485     // flow doesn't do during mount. This doesn't happen at the root because
       
 15486     // the root always starts with a "current" with a null child.
       
 15487     // TODO: Consider unifying this with how the root works.
       
 15488     workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 15489   } else {
       
 15490     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 15491   }
       
 15492   return workInProgress.child;
       
 15493 }
       
 15494 
       
 15495 function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
       
 15496   var providerType = workInProgress.type;
       
 15497   var context = providerType._context;
       
 15498 
       
 15499   var newProps = workInProgress.pendingProps;
       
 15500   var oldProps = workInProgress.memoizedProps;
       
 15501 
       
 15502   var newValue = newProps.value;
       
 15503 
       
 15504   {
       
 15505     var providerPropTypes = workInProgress.type.propTypes;
       
 15506 
       
 15507     if (providerPropTypes) {
       
 15508       checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
       
 15509     }
       
 15510   }
       
 15511 
       
 15512   pushProvider(workInProgress, newValue);
       
 15513 
       
 15514   if (oldProps !== null) {
       
 15515     var oldValue = oldProps.value;
       
 15516     var changedBits = calculateChangedBits(context, newValue, oldValue);
       
 15517     if (changedBits === 0) {
       
 15518       // No change. Bailout early if children are the same.
       
 15519       if (oldProps.children === newProps.children && !hasContextChanged()) {
       
 15520         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 15521       }
       
 15522     } else {
       
 15523       // The context value changed. Search for matching consumers and schedule
       
 15524       // them to update.
       
 15525       propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
       
 15526     }
       
 15527   }
       
 15528 
       
 15529   var newChildren = newProps.children;
       
 15530   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 15531   return workInProgress.child;
       
 15532 }
       
 15533 
       
 15534 var hasWarnedAboutUsingContextAsConsumer = false;
       
 15535 
       
 15536 function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
       
 15537   var context = workInProgress.type;
       
 15538   // The logic below for Context differs depending on PROD or DEV mode. In
       
 15539   // DEV mode, we create a separate object for Context.Consumer that acts
       
 15540   // like a proxy to Context. This proxy object adds unnecessary code in PROD
       
 15541   // so we use the old behaviour (Context.Consumer references Context) to
       
 15542   // reduce size and overhead. The separate object references context via
       
 15543   // a property called "_context", which also gives us the ability to check
       
 15544   // in DEV mode if this property exists or not and warn if it does not.
       
 15545   {
       
 15546     if (context._context === undefined) {
       
 15547       // This may be because it's a Context (rather than a Consumer).
       
 15548       // Or it may be because it's older React where they're the same thing.
       
 15549       // We only want to warn if we're sure it's a new React.
       
 15550       if (context !== context.Consumer) {
       
 15551         if (!hasWarnedAboutUsingContextAsConsumer) {
       
 15552           hasWarnedAboutUsingContextAsConsumer = true;
       
 15553           warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
       
 15554         }
       
 15555       }
       
 15556     } else {
       
 15557       context = context._context;
       
 15558     }
       
 15559   }
       
 15560   var newProps = workInProgress.pendingProps;
       
 15561   var render = newProps.children;
       
 15562 
       
 15563   {
       
 15564     !(typeof render === 'function') ? warningWithoutStack$1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
       
 15565   }
       
 15566 
       
 15567   prepareToReadContext(workInProgress, renderExpirationTime);
       
 15568   var newValue = readContext(context, newProps.unstable_observedBits);
       
 15569   var newChildren = void 0;
       
 15570   {
       
 15571     ReactCurrentOwner$3.current = workInProgress;
       
 15572     setCurrentPhase('render');
       
 15573     newChildren = render(newValue);
       
 15574     setCurrentPhase(null);
       
 15575   }
       
 15576 
       
 15577   // React DevTools reads this flag.
       
 15578   workInProgress.effectTag |= PerformedWork;
       
 15579   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 15580   return workInProgress.child;
       
 15581 }
       
 15582 
       
 15583 function markWorkInProgressReceivedUpdate() {
       
 15584   didReceiveUpdate = true;
       
 15585 }
       
 15586 
       
 15587 function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
       
 15588   cancelWorkTimer(workInProgress);
       
 15589 
       
 15590   if (current$$1 !== null) {
       
 15591     // Reuse previous context list
       
 15592     workInProgress.contextDependencies = current$$1.contextDependencies;
       
 15593   }
       
 15594 
       
 15595   if (enableProfilerTimer) {
       
 15596     // Don't update "base" render times for bailouts.
       
 15597     stopProfilerTimerIfRunning(workInProgress);
       
 15598   }
       
 15599 
       
 15600   // Check if the children have any pending work.
       
 15601   var childExpirationTime = workInProgress.childExpirationTime;
       
 15602   if (childExpirationTime < renderExpirationTime) {
       
 15603     // The children don't have any work either. We can skip them.
       
 15604     // TODO: Once we add back resuming, we should check if the children are
       
 15605     // a work-in-progress set. If so, we need to transfer their effects.
       
 15606     return null;
       
 15607   } else {
       
 15608     // This fiber doesn't have work, but its subtree does. Clone the child
       
 15609     // fibers and continue.
       
 15610     cloneChildFibers(current$$1, workInProgress);
       
 15611     return workInProgress.child;
       
 15612   }
       
 15613 }
       
 15614 
       
 15615 function beginWork(current$$1, workInProgress, renderExpirationTime) {
       
 15616   var updateExpirationTime = workInProgress.expirationTime;
       
 15617 
       
 15618   if (current$$1 !== null) {
       
 15619     var oldProps = current$$1.memoizedProps;
       
 15620     var newProps = workInProgress.pendingProps;
       
 15621 
       
 15622     if (oldProps !== newProps || hasContextChanged()) {
       
 15623       // If props or context changed, mark the fiber as having performed work.
       
 15624       // This may be unset if the props are determined to be equal later (memo).
       
 15625       didReceiveUpdate = true;
       
 15626     } else if (updateExpirationTime < renderExpirationTime) {
       
 15627       didReceiveUpdate = false;
       
 15628       // This fiber does not have any pending work. Bailout without entering
       
 15629       // the begin phase. There's still some bookkeeping we that needs to be done
       
 15630       // in this optimized path, mostly pushing stuff onto the stack.
       
 15631       switch (workInProgress.tag) {
       
 15632         case HostRoot:
       
 15633           pushHostRootContext(workInProgress);
       
 15634           resetHydrationState();
       
 15635           break;
       
 15636         case HostComponent:
       
 15637           pushHostContext(workInProgress);
       
 15638           break;
       
 15639         case ClassComponent:
       
 15640           {
       
 15641             var Component = workInProgress.type;
       
 15642             if (isContextProvider(Component)) {
       
 15643               pushContextProvider(workInProgress);
       
 15644             }
       
 15645             break;
       
 15646           }
       
 15647         case HostPortal:
       
 15648           pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 15649           break;
       
 15650         case ContextProvider:
       
 15651           {
       
 15652             var newValue = workInProgress.memoizedProps.value;
       
 15653             pushProvider(workInProgress, newValue);
       
 15654             break;
       
 15655           }
       
 15656         case Profiler:
       
 15657           if (enableProfilerTimer) {
       
 15658             workInProgress.effectTag |= Update;
       
 15659           }
       
 15660           break;
       
 15661         case SuspenseComponent:
       
 15662           {
       
 15663             var state = workInProgress.memoizedState;
       
 15664             var didTimeout = state !== null;
       
 15665             if (didTimeout) {
       
 15666               // If this boundary is currently timed out, we need to decide
       
 15667               // whether to retry the primary children, or to skip over it and
       
 15668               // go straight to the fallback. Check the priority of the primary
       
 15669               var primaryChildFragment = workInProgress.child;
       
 15670               var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
       
 15671               if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
       
 15672                 // The primary children have pending work. Use the normal path
       
 15673                 // to attempt to render the primary children again.
       
 15674                 return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 15675               } else {
       
 15676                 // The primary children do not have pending work with sufficient
       
 15677                 // priority. Bailout.
       
 15678                 var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 15679                 if (child !== null) {
       
 15680                   // The fallback children have pending work. Skip over the
       
 15681                   // primary children and work on the fallback.
       
 15682                   return child.sibling;
       
 15683                 } else {
       
 15684                   return null;
       
 15685                 }
       
 15686               }
       
 15687             }
       
 15688             break;
       
 15689           }
       
 15690         case DehydratedSuspenseComponent:
       
 15691           {
       
 15692             if (enableSuspenseServerRenderer) {
       
 15693               // We know that this component will suspend again because if it has
       
 15694               // been unsuspended it has committed as a regular Suspense component.
       
 15695               // If it needs to be retried, it should have work scheduled on it.
       
 15696               workInProgress.effectTag |= DidCapture;
       
 15697               break;
       
 15698             }
       
 15699           }
       
 15700       }
       
 15701       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 15702     }
       
 15703   } else {
       
 15704     didReceiveUpdate = false;
       
 15705   }
       
 15706 
       
 15707   // Before entering the begin phase, clear the expiration time.
       
 15708   workInProgress.expirationTime = NoWork;
       
 15709 
       
 15710   switch (workInProgress.tag) {
       
 15711     case IndeterminateComponent:
       
 15712       {
       
 15713         var elementType = workInProgress.elementType;
       
 15714         return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
       
 15715       }
       
 15716     case LazyComponent:
       
 15717       {
       
 15718         var _elementType = workInProgress.elementType;
       
 15719         return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
       
 15720       }
       
 15721     case FunctionComponent:
       
 15722       {
       
 15723         var _Component = workInProgress.type;
       
 15724         var unresolvedProps = workInProgress.pendingProps;
       
 15725         var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
       
 15726         return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
       
 15727       }
       
 15728     case ClassComponent:
       
 15729       {
       
 15730         var _Component2 = workInProgress.type;
       
 15731         var _unresolvedProps = workInProgress.pendingProps;
       
 15732         var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
       
 15733         return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
       
 15734       }
       
 15735     case HostRoot:
       
 15736       return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
       
 15737     case HostComponent:
       
 15738       return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
       
 15739     case HostText:
       
 15740       return updateHostText(current$$1, workInProgress);
       
 15741     case SuspenseComponent:
       
 15742       return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 15743     case HostPortal:
       
 15744       return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
       
 15745     case ForwardRef:
       
 15746       {
       
 15747         var type = workInProgress.type;
       
 15748         var _unresolvedProps2 = workInProgress.pendingProps;
       
 15749         var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
       
 15750         return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
       
 15751       }
       
 15752     case Fragment:
       
 15753       return updateFragment(current$$1, workInProgress, renderExpirationTime);
       
 15754     case Mode:
       
 15755       return updateMode(current$$1, workInProgress, renderExpirationTime);
       
 15756     case Profiler:
       
 15757       return updateProfiler(current$$1, workInProgress, renderExpirationTime);
       
 15758     case ContextProvider:
       
 15759       return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
       
 15760     case ContextConsumer:
       
 15761       return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
       
 15762     case MemoComponent:
       
 15763       {
       
 15764         var _type2 = workInProgress.type;
       
 15765         var _unresolvedProps3 = workInProgress.pendingProps;
       
 15766         // Resolve outer props first, then resolve inner props.
       
 15767         var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
       
 15768         {
       
 15769           if (workInProgress.type !== workInProgress.elementType) {
       
 15770             var outerPropTypes = _type2.propTypes;
       
 15771             if (outerPropTypes) {
       
 15772               checkPropTypes_1(outerPropTypes, _resolvedProps3, // Resolved for outer only
       
 15773               'prop', getComponentName(_type2), getCurrentFiberStackInDev);
       
 15774             }
       
 15775           }
       
 15776         }
       
 15777         _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
       
 15778         return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
       
 15779       }
       
 15780     case SimpleMemoComponent:
       
 15781       {
       
 15782         return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
       
 15783       }
       
 15784     case IncompleteClassComponent:
       
 15785       {
       
 15786         var _Component3 = workInProgress.type;
       
 15787         var _unresolvedProps4 = workInProgress.pendingProps;
       
 15788         var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
       
 15789         return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
       
 15790       }
       
 15791     case DehydratedSuspenseComponent:
       
 15792       {
       
 15793         if (enableSuspenseServerRenderer) {
       
 15794           return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 15795         }
       
 15796         break;
       
 15797       }
       
 15798   }
       
 15799   invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
       
 15800 }
       
 15801 
       
 15802 var valueCursor = createCursor(null);
 12318 var valueCursor = createCursor(null);
 15803 
 12319 
 15804 var rendererSigil = void 0;
 12320 var rendererSigil = void 0;
 15805 {
 12321 {
 15806   // Use this to detect multiple renderers using the same context
 12322   // Use this to detect multiple renderers using the same context
 15811 var lastContextDependency = null;
 12327 var lastContextDependency = null;
 15812 var lastContextWithAllBitsObserved = null;
 12328 var lastContextWithAllBitsObserved = null;
 15813 
 12329 
 15814 var isDisallowedContextReadInDEV = false;
 12330 var isDisallowedContextReadInDEV = false;
 15815 
 12331 
 15816 function resetContextDependences() {
 12332 function resetContextDependencies() {
 15817   // This is called right before React yields execution, to ensure `readContext`
 12333   // This is called right before React yields execution, to ensure `readContext`
 15818   // cannot be called outside the render phase.
 12334   // cannot be called outside the render phase.
 15819   currentlyRenderingFiber = null;
 12335   currentlyRenderingFiber = null;
 15820   lastContextDependency = null;
 12336   lastContextDependency = null;
 15821   lastContextWithAllBitsObserved = null;
 12337   lastContextWithAllBitsObserved = null;
 15874 function calculateChangedBits(context, newValue, oldValue) {
 12390 function calculateChangedBits(context, newValue, oldValue) {
 15875   if (is(oldValue, newValue)) {
 12391   if (is(oldValue, newValue)) {
 15876     // No change
 12392     // No change
 15877     return 0;
 12393     return 0;
 15878   } else {
 12394   } else {
 15879     var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : maxSigned31BitInt;
 12395     var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
 15880 
 12396 
 15881     {
 12397     {
 15882       !((changedBits & maxSigned31BitInt) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
 12398       !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
 15883     }
 12399     }
 15884     return changedBits | 0;
 12400     return changedBits | 0;
 15885   }
 12401   }
 15886 }
 12402 }
 15887 
 12403 
 15915   }
 12431   }
 15916   while (fiber !== null) {
 12432   while (fiber !== null) {
 15917     var nextFiber = void 0;
 12433     var nextFiber = void 0;
 15918 
 12434 
 15919     // Visit this fiber.
 12435     // Visit this fiber.
 15920     var list = fiber.contextDependencies;
 12436     var list = fiber.dependencies;
 15921     if (list !== null) {
 12437     if (list !== null) {
 15922       nextFiber = fiber.child;
 12438       nextFiber = fiber.child;
 15923 
 12439 
 15924       var dependency = list.first;
 12440       var dependency = list.firstContext;
 15925       while (dependency !== null) {
 12441       while (dependency !== null) {
 15926         // Check if the context matches.
 12442         // Check if the context matches.
 15927         if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
 12443         if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
 15928           // Match! Schedule an update on this fiber.
 12444           // Match! Schedule an update on this fiber.
 15929 
 12445 
 15930           if (fiber.tag === ClassComponent) {
 12446           if (fiber.tag === ClassComponent) {
 15931             // Schedule a force update on the work-in-progress.
 12447             // Schedule a force update on the work-in-progress.
 15932             var update = createUpdate(renderExpirationTime);
 12448             var update = createUpdate(renderExpirationTime, null);
 15933             update.tag = ForceUpdate;
 12449             update.tag = ForceUpdate;
 15934             // TODO: Because we don't have a work-in-progress, this will add the
 12450             // TODO: Because we don't have a work-in-progress, this will add the
 15935             // update to the current fiber, too, which means it will persist even if
 12451             // update to the current fiber, too, which means it will persist even if
 15936             // this render is thrown away. Since it's a race condition, not sure it's
 12452             // this render is thrown away. Since it's a race condition, not sure it's
 15937             // worth fixing.
 12453             // worth fixing.
 16014 function prepareToReadContext(workInProgress, renderExpirationTime) {
 12530 function prepareToReadContext(workInProgress, renderExpirationTime) {
 16015   currentlyRenderingFiber = workInProgress;
 12531   currentlyRenderingFiber = workInProgress;
 16016   lastContextDependency = null;
 12532   lastContextDependency = null;
 16017   lastContextWithAllBitsObserved = null;
 12533   lastContextWithAllBitsObserved = null;
 16018 
 12534 
 16019   var currentDependencies = workInProgress.contextDependencies;
 12535   var dependencies = workInProgress.dependencies;
 16020   if (currentDependencies !== null && currentDependencies.expirationTime >= renderExpirationTime) {
 12536   if (dependencies !== null) {
 16021     // Context list has a pending update. Mark that this fiber performed work.
 12537     var firstContext = dependencies.firstContext;
 16022     markWorkInProgressReceivedUpdate();
 12538     if (firstContext !== null) {
 16023   }
 12539       if (dependencies.expirationTime >= renderExpirationTime) {
 16024 
 12540         // Context list has a pending update. Mark that this fiber performed work.
 16025   // Reset the work-in-progress list
 12541         markWorkInProgressReceivedUpdate();
 16026   workInProgress.contextDependencies = null;
 12542       }
       
 12543       // Reset the work-in-progress list
       
 12544       dependencies.firstContext = null;
       
 12545     }
       
 12546   }
 16027 }
 12547 }
 16028 
 12548 
 16029 function readContext(context, observedBits) {
 12549 function readContext(context, observedBits) {
 16030   {
 12550   {
 16031     // This warning would fire if you read context inside a Hook like useMemo.
 12551     // This warning would fire if you read context inside a Hook like useMemo.
 16037     // Nothing to do. We already observe everything in this context.
 12557     // Nothing to do. We already observe everything in this context.
 16038   } else if (observedBits === false || observedBits === 0) {
 12558   } else if (observedBits === false || observedBits === 0) {
 16039     // Do not observe any updates.
 12559     // Do not observe any updates.
 16040   } else {
 12560   } else {
 16041     var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types.
 12561     var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types.
 16042     if (typeof observedBits !== 'number' || observedBits === maxSigned31BitInt) {
 12562     if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) {
 16043       // Observe all updates.
 12563       // Observe all updates.
 16044       lastContextWithAllBitsObserved = context;
 12564       lastContextWithAllBitsObserved = context;
 16045       resolvedObservedBits = maxSigned31BitInt;
 12565       resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
 16046     } else {
 12566     } else {
 16047       resolvedObservedBits = observedBits;
 12567       resolvedObservedBits = observedBits;
 16048     }
 12568     }
 16049 
 12569 
 16050     var contextItem = {
 12570     var contextItem = {
 16052       observedBits: resolvedObservedBits,
 12572       observedBits: resolvedObservedBits,
 16053       next: null
 12573       next: null
 16054     };
 12574     };
 16055 
 12575 
 16056     if (lastContextDependency === null) {
 12576     if (lastContextDependency === null) {
 16057       !(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().') : void 0;
 12577       (function () {
       
 12578         if (!(currentlyRenderingFiber !== null)) {
       
 12579           {
       
 12580             throw ReactError(Error('Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().'));
       
 12581           }
       
 12582         }
       
 12583       })();
 16058 
 12584 
 16059       // This is the first dependency for this component. Create a new list.
 12585       // This is the first dependency for this component. Create a new list.
 16060       lastContextDependency = contextItem;
 12586       lastContextDependency = contextItem;
 16061       currentlyRenderingFiber.contextDependencies = {
 12587       currentlyRenderingFiber.dependencies = {
 16062         first: contextItem,
 12588         expirationTime: NoWork,
 16063         expirationTime: NoWork
 12589         firstContext: contextItem,
       
 12590         responders: null
 16064       };
 12591       };
 16065     } else {
 12592     } else {
 16066       // Append a new context item.
 12593       // Append a new context item.
 16067       lastContextDependency = lastContextDependency.next = contextItem;
 12594       lastContextDependency = lastContextDependency.next = contextItem;
 16068     }
 12595     }
 16157 // `checkHasForceUpdateAfterProcessing`.
 12684 // `checkHasForceUpdateAfterProcessing`.
 16158 var hasForceUpdate = false;
 12685 var hasForceUpdate = false;
 16159 
 12686 
 16160 var didWarnUpdateInsideUpdate = void 0;
 12687 var didWarnUpdateInsideUpdate = void 0;
 16161 var currentlyProcessingQueue = void 0;
 12688 var currentlyProcessingQueue = void 0;
 16162 var resetCurrentlyProcessingQueue = void 0;
 12689 
 16163 {
 12690 {
 16164   didWarnUpdateInsideUpdate = false;
 12691   didWarnUpdateInsideUpdate = false;
 16165   currentlyProcessingQueue = null;
 12692   currentlyProcessingQueue = null;
 16166   resetCurrentlyProcessingQueue = function () {
 12693   
 16167     currentlyProcessingQueue = null;
       
 16168   };
       
 16169 }
 12694 }
 16170 
 12695 
 16171 function createUpdateQueue(baseState) {
 12696 function createUpdateQueue(baseState) {
 16172   var queue = {
 12697   var queue = {
 16173     baseState: baseState,
 12698     baseState: baseState,
 16201     lastCapturedEffect: null
 12726     lastCapturedEffect: null
 16202   };
 12727   };
 16203   return queue;
 12728   return queue;
 16204 }
 12729 }
 16205 
 12730 
 16206 function createUpdate(expirationTime) {
 12731 function createUpdate(expirationTime, suspenseConfig) {
 16207   return {
 12732   var update = {
 16208     expirationTime: expirationTime,
 12733     expirationTime: expirationTime,
       
 12734     suspenseConfig: suspenseConfig,
 16209 
 12735 
 16210     tag: UpdateState,
 12736     tag: UpdateState,
 16211     payload: null,
 12737     payload: null,
 16212     callback: null,
 12738     callback: null,
 16213 
 12739 
 16214     next: null,
 12740     next: null,
 16215     nextEffect: null
 12741     nextEffect: null
 16216   };
 12742   };
       
 12743   {
       
 12744     update.priority = getCurrentPriorityLevel();
       
 12745   }
       
 12746   return update;
 16217 }
 12747 }
 16218 
 12748 
 16219 function appendUpdateToQueue(queue, update) {
 12749 function appendUpdateToQueue(queue, update) {
 16220   // Append the update to the end of the list.
 12750   // Append the update to the end of the list.
 16221   if (queue.lastUpdate === null) {
 12751   if (queue.lastUpdate === null) {
 16420       // expiration time.
 12950       // expiration time.
 16421       if (newExpirationTime < updateExpirationTime) {
 12951       if (newExpirationTime < updateExpirationTime) {
 16422         newExpirationTime = updateExpirationTime;
 12952         newExpirationTime = updateExpirationTime;
 16423       }
 12953       }
 16424     } else {
 12954     } else {
 16425       // This update does have sufficient priority. Process it and compute
 12955       // This update does have sufficient priority.
 16426       // a new result.
 12956 
       
 12957       // Mark the event time of this update as relevant to this render pass.
       
 12958       // TODO: This should ideally use the true event time of this update rather than
       
 12959       // its priority which is a derived and not reverseable value.
       
 12960       // TODO: We should skip this update if it was already committed but currently
       
 12961       // we have no way of detecting the difference between a committed and suspended
       
 12962       // update here.
       
 12963       markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig);
       
 12964 
       
 12965       // Process it and compute a new result.
 16427       resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
 12966       resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
 16428       var _callback = update.callback;
 12967       var _callback = update.callback;
 16429       if (_callback !== null) {
 12968       if (_callback !== null) {
 16430         workInProgress.effectTag |= Callback;
 12969         workInProgress.effectTag |= Callback;
 16431         // Set this to null, in case it was mutated during an aborted render.
 12970         // Set this to null, in case it was mutated during an aborted render.
 16516     currentlyProcessingQueue = null;
 13055     currentlyProcessingQueue = null;
 16517   }
 13056   }
 16518 }
 13057 }
 16519 
 13058 
 16520 function callCallback(callback, context) {
 13059 function callCallback(callback, context) {
 16521   !(typeof callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', callback) : void 0;
 13060   (function () {
       
 13061     if (!(typeof callback === 'function')) {
       
 13062       {
       
 13063         throw ReactError(Error('Invalid argument passed as callback. Expected a function. Instead received: ' + callback));
       
 13064       }
       
 13065     }
       
 13066   })();
 16522   callback.call(context);
 13067   callback.call(context);
 16523 }
 13068 }
 16524 
 13069 
 16525 function resetHasForceUpdateBeforeProcessing() {
 13070 function resetHasForceUpdateBeforeProcessing() {
 16526   hasForceUpdate = false;
 13071   hasForceUpdate = false;
 16562     }
 13107     }
 16563     effect = effect.nextEffect;
 13108     effect = effect.nextEffect;
 16564   }
 13109   }
 16565 }
 13110 }
 16566 
 13111 
 16567 function createCapturedValue(value, source) {
 13112 var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
 16568   // If the value is an error, call this function immediately after it is thrown
 13113 
 16569   // so the stack is accurate.
 13114 
       
 13115 function requestCurrentSuspenseConfig() {
       
 13116   return ReactCurrentBatchConfig.suspense;
       
 13117 }
       
 13118 
       
 13119 var fakeInternalInstance = {};
       
 13120 var isArray$1 = Array.isArray;
       
 13121 
       
 13122 // React.Component uses a shared frozen object by default.
       
 13123 // We'll use it to determine whether we need to initialize legacy refs.
       
 13124 var emptyRefsObject = new React.Component().refs;
       
 13125 
       
 13126 var didWarnAboutStateAssignmentForComponent = void 0;
       
 13127 var didWarnAboutUninitializedState = void 0;
       
 13128 var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
       
 13129 var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
       
 13130 var didWarnAboutUndefinedDerivedState = void 0;
       
 13131 var warnOnUndefinedDerivedState = void 0;
       
 13132 var warnOnInvalidCallback$1 = void 0;
       
 13133 var didWarnAboutDirectlyAssigningPropsToState = void 0;
       
 13134 var didWarnAboutContextTypeAndContextTypes = void 0;
       
 13135 var didWarnAboutInvalidateContextType = void 0;
       
 13136 
       
 13137 {
       
 13138   didWarnAboutStateAssignmentForComponent = new Set();
       
 13139   didWarnAboutUninitializedState = new Set();
       
 13140   didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
       
 13141   didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
       
 13142   didWarnAboutDirectlyAssigningPropsToState = new Set();
       
 13143   didWarnAboutUndefinedDerivedState = new Set();
       
 13144   didWarnAboutContextTypeAndContextTypes = new Set();
       
 13145   didWarnAboutInvalidateContextType = new Set();
       
 13146 
       
 13147   var didWarnOnInvalidCallback = new Set();
       
 13148 
       
 13149   warnOnInvalidCallback$1 = function (callback, callerName) {
       
 13150     if (callback === null || typeof callback === 'function') {
       
 13151       return;
       
 13152     }
       
 13153     var key = callerName + '_' + callback;
       
 13154     if (!didWarnOnInvalidCallback.has(key)) {
       
 13155       didWarnOnInvalidCallback.add(key);
       
 13156       warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
       
 13157     }
       
 13158   };
       
 13159 
       
 13160   warnOnUndefinedDerivedState = function (type, partialState) {
       
 13161     if (partialState === undefined) {
       
 13162       var componentName = getComponentName(type) || 'Component';
       
 13163       if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
       
 13164         didWarnAboutUndefinedDerivedState.add(componentName);
       
 13165         warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
       
 13166       }
       
 13167     }
       
 13168   };
       
 13169 
       
 13170   // This is so gross but it's at least non-critical and can be removed if
       
 13171   // it causes problems. This is meant to give a nicer error message for
       
 13172   // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
       
 13173   // ...)) which otherwise throws a "_processChildContext is not a function"
       
 13174   // exception.
       
 13175   Object.defineProperty(fakeInternalInstance, '_processChildContext', {
       
 13176     enumerable: false,
       
 13177     value: function () {
       
 13178       (function () {
       
 13179         {
       
 13180           {
       
 13181             throw ReactError(Error('_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).'));
       
 13182           }
       
 13183         }
       
 13184       })();
       
 13185     }
       
 13186   });
       
 13187   Object.freeze(fakeInternalInstance);
       
 13188 }
       
 13189 
       
 13190 function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
       
 13191   var prevState = workInProgress.memoizedState;
       
 13192 
       
 13193   {
       
 13194     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 13195       // Invoke the function an extra time to help detect side-effects.
       
 13196       getDerivedStateFromProps(nextProps, prevState);
       
 13197     }
       
 13198   }
       
 13199 
       
 13200   var partialState = getDerivedStateFromProps(nextProps, prevState);
       
 13201 
       
 13202   {
       
 13203     warnOnUndefinedDerivedState(ctor, partialState);
       
 13204   }
       
 13205   // Merge the partial state and the previous state.
       
 13206   var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
       
 13207   workInProgress.memoizedState = memoizedState;
       
 13208 
       
 13209   // Once the update queue is empty, persist the derived state onto the
       
 13210   // base state.
       
 13211   var updateQueue = workInProgress.updateQueue;
       
 13212   if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
       
 13213     updateQueue.baseState = memoizedState;
       
 13214   }
       
 13215 }
       
 13216 
       
 13217 var classComponentUpdater = {
       
 13218   isMounted: isMounted,
       
 13219   enqueueSetState: function (inst, payload, callback) {
       
 13220     var fiber = get(inst);
       
 13221     var currentTime = requestCurrentTime();
       
 13222     var suspenseConfig = requestCurrentSuspenseConfig();
       
 13223     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 13224 
       
 13225     var update = createUpdate(expirationTime, suspenseConfig);
       
 13226     update.payload = payload;
       
 13227     if (callback !== undefined && callback !== null) {
       
 13228       {
       
 13229         warnOnInvalidCallback$1(callback, 'setState');
       
 13230       }
       
 13231       update.callback = callback;
       
 13232     }
       
 13233 
       
 13234     if (revertPassiveEffectsChange) {
       
 13235       flushPassiveEffects();
       
 13236     }
       
 13237     enqueueUpdate(fiber, update);
       
 13238     scheduleWork(fiber, expirationTime);
       
 13239   },
       
 13240   enqueueReplaceState: function (inst, payload, callback) {
       
 13241     var fiber = get(inst);
       
 13242     var currentTime = requestCurrentTime();
       
 13243     var suspenseConfig = requestCurrentSuspenseConfig();
       
 13244     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 13245 
       
 13246     var update = createUpdate(expirationTime, suspenseConfig);
       
 13247     update.tag = ReplaceState;
       
 13248     update.payload = payload;
       
 13249 
       
 13250     if (callback !== undefined && callback !== null) {
       
 13251       {
       
 13252         warnOnInvalidCallback$1(callback, 'replaceState');
       
 13253       }
       
 13254       update.callback = callback;
       
 13255     }
       
 13256 
       
 13257     if (revertPassiveEffectsChange) {
       
 13258       flushPassiveEffects();
       
 13259     }
       
 13260     enqueueUpdate(fiber, update);
       
 13261     scheduleWork(fiber, expirationTime);
       
 13262   },
       
 13263   enqueueForceUpdate: function (inst, callback) {
       
 13264     var fiber = get(inst);
       
 13265     var currentTime = requestCurrentTime();
       
 13266     var suspenseConfig = requestCurrentSuspenseConfig();
       
 13267     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 13268 
       
 13269     var update = createUpdate(expirationTime, suspenseConfig);
       
 13270     update.tag = ForceUpdate;
       
 13271 
       
 13272     if (callback !== undefined && callback !== null) {
       
 13273       {
       
 13274         warnOnInvalidCallback$1(callback, 'forceUpdate');
       
 13275       }
       
 13276       update.callback = callback;
       
 13277     }
       
 13278 
       
 13279     if (revertPassiveEffectsChange) {
       
 13280       flushPassiveEffects();
       
 13281     }
       
 13282     enqueueUpdate(fiber, update);
       
 13283     scheduleWork(fiber, expirationTime);
       
 13284   }
       
 13285 };
       
 13286 
       
 13287 function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
       
 13288   var instance = workInProgress.stateNode;
       
 13289   if (typeof instance.shouldComponentUpdate === 'function') {
       
 13290     startPhaseTimer(workInProgress, 'shouldComponentUpdate');
       
 13291     var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
       
 13292     stopPhaseTimer();
       
 13293 
       
 13294     {
       
 13295       !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
       
 13296     }
       
 13297 
       
 13298     return shouldUpdate;
       
 13299   }
       
 13300 
       
 13301   if (ctor.prototype && ctor.prototype.isPureReactComponent) {
       
 13302     return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
       
 13303   }
       
 13304 
       
 13305   return true;
       
 13306 }
       
 13307 
       
 13308 function checkClassInstance(workInProgress, ctor, newProps) {
       
 13309   var instance = workInProgress.stateNode;
       
 13310   {
       
 13311     var name = getComponentName(ctor) || 'Component';
       
 13312     var renderPresent = instance.render;
       
 13313 
       
 13314     if (!renderPresent) {
       
 13315       if (ctor.prototype && typeof ctor.prototype.render === 'function') {
       
 13316         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
       
 13317       } else {
       
 13318         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
       
 13319       }
       
 13320     }
       
 13321 
       
 13322     var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
       
 13323     !noGetInitialStateOnES6 ? warningWithoutStack$1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
       
 13324     var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
       
 13325     !noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
       
 13326     var noInstancePropTypes = !instance.propTypes;
       
 13327     !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
       
 13328     var noInstanceContextType = !instance.contextType;
       
 13329     !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
       
 13330 
       
 13331     if (disableLegacyContext) {
       
 13332       if (ctor.childContextTypes) {
       
 13333         warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', name);
       
 13334       }
       
 13335       if (ctor.contextTypes) {
       
 13336         warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', name);
       
 13337       }
       
 13338     } else {
       
 13339       var noInstanceContextTypes = !instance.contextTypes;
       
 13340       !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
       
 13341 
       
 13342       if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
       
 13343         didWarnAboutContextTypeAndContextTypes.add(ctor);
       
 13344         warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
       
 13345       }
       
 13346     }
       
 13347 
       
 13348     var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
       
 13349     !noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
       
 13350     if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
       
 13351       warningWithoutStack$1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
       
 13352     }
       
 13353     var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
       
 13354     !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
       
 13355     var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
       
 13356     !noComponentDidReceiveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
       
 13357     var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
       
 13358     !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
       
 13359     var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
       
 13360     !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
       
 13361     var hasMutatedProps = instance.props !== newProps;
       
 13362     !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
       
 13363     var noInstanceDefaultProps = !instance.defaultProps;
       
 13364     !noInstanceDefaultProps ? warningWithoutStack$1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
       
 13365 
       
 13366     if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
       
 13367       didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
       
 13368       warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
       
 13369     }
       
 13370 
       
 13371     var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
       
 13372     !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
       
 13373     var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
       
 13374     !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
       
 13375     var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
       
 13376     !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
       
 13377     var _state = instance.state;
       
 13378     if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
       
 13379       warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
       
 13380     }
       
 13381     if (typeof instance.getChildContext === 'function') {
       
 13382       !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
       
 13383     }
       
 13384   }
       
 13385 }
       
 13386 
       
 13387 function adoptClassInstance(workInProgress, instance) {
       
 13388   instance.updater = classComponentUpdater;
       
 13389   workInProgress.stateNode = instance;
       
 13390   // The instance needs access to the fiber so that it can schedule updates
       
 13391   set(instance, workInProgress);
       
 13392   {
       
 13393     instance._reactInternalInstance = fakeInternalInstance;
       
 13394   }
       
 13395 }
       
 13396 
       
 13397 function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
       
 13398   var isLegacyContextConsumer = false;
       
 13399   var unmaskedContext = emptyContextObject;
       
 13400   var context = emptyContextObject;
       
 13401   var contextType = ctor.contextType;
       
 13402 
       
 13403   {
       
 13404     if ('contextType' in ctor) {
       
 13405       var isValid =
       
 13406       // Allow null for conditional declaration
       
 13407       contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
       
 13408 
       
 13409       if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
       
 13410         didWarnAboutInvalidateContextType.add(ctor);
       
 13411 
       
 13412         var addendum = '';
       
 13413         if (contextType === undefined) {
       
 13414           addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
       
 13415         } else if (typeof contextType !== 'object') {
       
 13416           addendum = ' However, it is set to a ' + typeof contextType + '.';
       
 13417         } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
       
 13418           addendum = ' Did you accidentally pass the Context.Provider instead?';
       
 13419         } else if (contextType._context !== undefined) {
       
 13420           // <Context.Consumer>
       
 13421           addendum = ' Did you accidentally pass the Context.Consumer instead?';
       
 13422         } else {
       
 13423           addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
       
 13424         }
       
 13425         warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
       
 13426       }
       
 13427     }
       
 13428   }
       
 13429 
       
 13430   if (typeof contextType === 'object' && contextType !== null) {
       
 13431     context = readContext(contextType);
       
 13432   } else if (!disableLegacyContext) {
       
 13433     unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13434     var contextTypes = ctor.contextTypes;
       
 13435     isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
       
 13436     context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
       
 13437   }
       
 13438 
       
 13439   // Instantiate twice to help detect side-effects.
       
 13440   {
       
 13441     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 13442       new ctor(props, context); // eslint-disable-line no-new
       
 13443     }
       
 13444   }
       
 13445 
       
 13446   var instance = new ctor(props, context);
       
 13447   var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
       
 13448   adoptClassInstance(workInProgress, instance);
       
 13449 
       
 13450   {
       
 13451     if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
       
 13452       var componentName = getComponentName(ctor) || 'Component';
       
 13453       if (!didWarnAboutUninitializedState.has(componentName)) {
       
 13454         didWarnAboutUninitializedState.add(componentName);
       
 13455         warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
       
 13456       }
       
 13457     }
       
 13458 
       
 13459     // If new component APIs are defined, "unsafe" lifecycles won't be called.
       
 13460     // Warn about these lifecycles if they are present.
       
 13461     // Don't warn about react-lifecycles-compat polyfilled methods though.
       
 13462     if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13463       var foundWillMountName = null;
       
 13464       var foundWillReceivePropsName = null;
       
 13465       var foundWillUpdateName = null;
       
 13466       if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 13467         foundWillMountName = 'componentWillMount';
       
 13468       } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13469         foundWillMountName = 'UNSAFE_componentWillMount';
       
 13470       }
       
 13471       if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 13472         foundWillReceivePropsName = 'componentWillReceiveProps';
       
 13473       } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 13474         foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
       
 13475       }
       
 13476       if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 13477         foundWillUpdateName = 'componentWillUpdate';
       
 13478       } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 13479         foundWillUpdateName = 'UNSAFE_componentWillUpdate';
       
 13480       }
       
 13481       if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
       
 13482         var _componentName = getComponentName(ctor) || 'Component';
       
 13483         var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
       
 13484         if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
       
 13485           didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
       
 13486           warningWithoutStack$1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n  ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n  ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n  ' + foundWillUpdateName : '');
       
 13487         }
       
 13488       }
       
 13489     }
       
 13490   }
       
 13491 
       
 13492   // Cache unmasked context so we can avoid recreating masked context unless necessary.
       
 13493   // ReactFiberContext usually updates this cache but can't for newly-created instances.
       
 13494   if (isLegacyContextConsumer) {
       
 13495     cacheContext(workInProgress, unmaskedContext, context);
       
 13496   }
       
 13497 
       
 13498   return instance;
       
 13499 }
       
 13500 
       
 13501 function callComponentWillMount(workInProgress, instance) {
       
 13502   startPhaseTimer(workInProgress, 'componentWillMount');
       
 13503   var oldState = instance.state;
       
 13504 
       
 13505   if (typeof instance.componentWillMount === 'function') {
       
 13506     instance.componentWillMount();
       
 13507   }
       
 13508   if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13509     instance.UNSAFE_componentWillMount();
       
 13510   }
       
 13511 
       
 13512   stopPhaseTimer();
       
 13513 
       
 13514   if (oldState !== instance.state) {
       
 13515     {
       
 13516       warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
       
 13517     }
       
 13518     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 13519   }
       
 13520 }
       
 13521 
       
 13522 function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
       
 13523   var oldState = instance.state;
       
 13524   startPhaseTimer(workInProgress, 'componentWillReceiveProps');
       
 13525   if (typeof instance.componentWillReceiveProps === 'function') {
       
 13526     instance.componentWillReceiveProps(newProps, nextContext);
       
 13527   }
       
 13528   if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 13529     instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
       
 13530   }
       
 13531   stopPhaseTimer();
       
 13532 
       
 13533   if (instance.state !== oldState) {
       
 13534     {
       
 13535       var componentName = getComponentName(workInProgress.type) || 'Component';
       
 13536       if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
       
 13537         didWarnAboutStateAssignmentForComponent.add(componentName);
       
 13538         warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
       
 13539       }
       
 13540     }
       
 13541     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 13542   }
       
 13543 }
       
 13544 
       
 13545 // Invokes the mount life-cycles on a previously never rendered instance.
       
 13546 function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 13547   {
       
 13548     checkClassInstance(workInProgress, ctor, newProps);
       
 13549   }
       
 13550 
       
 13551   var instance = workInProgress.stateNode;
       
 13552   instance.props = newProps;
       
 13553   instance.state = workInProgress.memoizedState;
       
 13554   instance.refs = emptyRefsObject;
       
 13555 
       
 13556   var contextType = ctor.contextType;
       
 13557   if (typeof contextType === 'object' && contextType !== null) {
       
 13558     instance.context = readContext(contextType);
       
 13559   } else if (disableLegacyContext) {
       
 13560     instance.context = emptyContextObject;
       
 13561   } else {
       
 13562     var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13563     instance.context = getMaskedContext(workInProgress, unmaskedContext);
       
 13564   }
       
 13565 
       
 13566   {
       
 13567     if (instance.state === newProps) {
       
 13568       var componentName = getComponentName(ctor) || 'Component';
       
 13569       if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
       
 13570         didWarnAboutDirectlyAssigningPropsToState.add(componentName);
       
 13571         warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
       
 13572       }
       
 13573     }
       
 13574 
       
 13575     if (workInProgress.mode & StrictMode) {
       
 13576       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
       
 13577     }
       
 13578 
       
 13579     if (warnAboutDeprecatedLifecycles) {
       
 13580       ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
       
 13581     }
       
 13582   }
       
 13583 
       
 13584   var updateQueue = workInProgress.updateQueue;
       
 13585   if (updateQueue !== null) {
       
 13586     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13587     instance.state = workInProgress.memoizedState;
       
 13588   }
       
 13589 
       
 13590   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13591   if (typeof getDerivedStateFromProps === 'function') {
       
 13592     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13593     instance.state = workInProgress.memoizedState;
       
 13594   }
       
 13595 
       
 13596   // In order to support react-lifecycles-compat polyfilled components,
       
 13597   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13598   if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 13599     callComponentWillMount(workInProgress, instance);
       
 13600     // If we had additional state updates during this life-cycle, let's
       
 13601     // process them now.
       
 13602     updateQueue = workInProgress.updateQueue;
       
 13603     if (updateQueue !== null) {
       
 13604       processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13605       instance.state = workInProgress.memoizedState;
       
 13606     }
       
 13607   }
       
 13608 
       
 13609   if (typeof instance.componentDidMount === 'function') {
       
 13610     workInProgress.effectTag |= Update;
       
 13611   }
       
 13612 }
       
 13613 
       
 13614 function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 13615   var instance = workInProgress.stateNode;
       
 13616 
       
 13617   var oldProps = workInProgress.memoizedProps;
       
 13618   instance.props = oldProps;
       
 13619 
       
 13620   var oldContext = instance.context;
       
 13621   var contextType = ctor.contextType;
       
 13622   var nextContext = emptyContextObject;
       
 13623   if (typeof contextType === 'object' && contextType !== null) {
       
 13624     nextContext = readContext(contextType);
       
 13625   } else if (!disableLegacyContext) {
       
 13626     var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13627     nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
       
 13628   }
       
 13629 
       
 13630   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13631   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 13632 
       
 13633   // Note: During these life-cycles, instance.props/instance.state are what
       
 13634   // ever the previously attempted to render - not the "current". However,
       
 13635   // during componentDidUpdate we pass the "current" props.
       
 13636 
       
 13637   // In order to support react-lifecycles-compat polyfilled components,
       
 13638   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13639   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 13640     if (oldProps !== newProps || oldContext !== nextContext) {
       
 13641       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 13642     }
       
 13643   }
       
 13644 
       
 13645   resetHasForceUpdateBeforeProcessing();
       
 13646 
       
 13647   var oldState = workInProgress.memoizedState;
       
 13648   var newState = instance.state = oldState;
       
 13649   var updateQueue = workInProgress.updateQueue;
       
 13650   if (updateQueue !== null) {
       
 13651     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13652     newState = workInProgress.memoizedState;
       
 13653   }
       
 13654   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 13655     // If an update was already in progress, we should schedule an Update
       
 13656     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13657     if (typeof instance.componentDidMount === 'function') {
       
 13658       workInProgress.effectTag |= Update;
       
 13659     }
       
 13660     return false;
       
 13661   }
       
 13662 
       
 13663   if (typeof getDerivedStateFromProps === 'function') {
       
 13664     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13665     newState = workInProgress.memoizedState;
       
 13666   }
       
 13667 
       
 13668   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 13669 
       
 13670   if (shouldUpdate) {
       
 13671     // In order to support react-lifecycles-compat polyfilled components,
       
 13672     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13673     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 13674       startPhaseTimer(workInProgress, 'componentWillMount');
       
 13675       if (typeof instance.componentWillMount === 'function') {
       
 13676         instance.componentWillMount();
       
 13677       }
       
 13678       if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13679         instance.UNSAFE_componentWillMount();
       
 13680       }
       
 13681       stopPhaseTimer();
       
 13682     }
       
 13683     if (typeof instance.componentDidMount === 'function') {
       
 13684       workInProgress.effectTag |= Update;
       
 13685     }
       
 13686   } else {
       
 13687     // If an update was already in progress, we should schedule an Update
       
 13688     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13689     if (typeof instance.componentDidMount === 'function') {
       
 13690       workInProgress.effectTag |= Update;
       
 13691     }
       
 13692 
       
 13693     // If shouldComponentUpdate returned false, we should still update the
       
 13694     // memoized state to indicate that this work can be reused.
       
 13695     workInProgress.memoizedProps = newProps;
       
 13696     workInProgress.memoizedState = newState;
       
 13697   }
       
 13698 
       
 13699   // Update the existing instance's state, props, and context pointers even
       
 13700   // if shouldComponentUpdate returns false.
       
 13701   instance.props = newProps;
       
 13702   instance.state = newState;
       
 13703   instance.context = nextContext;
       
 13704 
       
 13705   return shouldUpdate;
       
 13706 }
       
 13707 
       
 13708 // Invokes the update life-cycles and returns false if it shouldn't rerender.
       
 13709 function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
       
 13710   var instance = workInProgress.stateNode;
       
 13711 
       
 13712   var oldProps = workInProgress.memoizedProps;
       
 13713   instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
       
 13714 
       
 13715   var oldContext = instance.context;
       
 13716   var contextType = ctor.contextType;
       
 13717   var nextContext = emptyContextObject;
       
 13718   if (typeof contextType === 'object' && contextType !== null) {
       
 13719     nextContext = readContext(contextType);
       
 13720   } else if (!disableLegacyContext) {
       
 13721     var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13722     nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
       
 13723   }
       
 13724 
       
 13725   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13726   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 13727 
       
 13728   // Note: During these life-cycles, instance.props/instance.state are what
       
 13729   // ever the previously attempted to render - not the "current". However,
       
 13730   // during componentDidUpdate we pass the "current" props.
       
 13731 
       
 13732   // In order to support react-lifecycles-compat polyfilled components,
       
 13733   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13734   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 13735     if (oldProps !== newProps || oldContext !== nextContext) {
       
 13736       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 13737     }
       
 13738   }
       
 13739 
       
 13740   resetHasForceUpdateBeforeProcessing();
       
 13741 
       
 13742   var oldState = workInProgress.memoizedState;
       
 13743   var newState = instance.state = oldState;
       
 13744   var updateQueue = workInProgress.updateQueue;
       
 13745   if (updateQueue !== null) {
       
 13746     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13747     newState = workInProgress.memoizedState;
       
 13748   }
       
 13749 
       
 13750   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 13751     // If an update was already in progress, we should schedule an Update
       
 13752     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13753     if (typeof instance.componentDidUpdate === 'function') {
       
 13754       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13755         workInProgress.effectTag |= Update;
       
 13756       }
       
 13757     }
       
 13758     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13759       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13760         workInProgress.effectTag |= Snapshot;
       
 13761       }
       
 13762     }
       
 13763     return false;
       
 13764   }
       
 13765 
       
 13766   if (typeof getDerivedStateFromProps === 'function') {
       
 13767     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13768     newState = workInProgress.memoizedState;
       
 13769   }
       
 13770 
       
 13771   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 13772 
       
 13773   if (shouldUpdate) {
       
 13774     // In order to support react-lifecycles-compat polyfilled components,
       
 13775     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13776     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
       
 13777       startPhaseTimer(workInProgress, 'componentWillUpdate');
       
 13778       if (typeof instance.componentWillUpdate === 'function') {
       
 13779         instance.componentWillUpdate(newProps, newState, nextContext);
       
 13780       }
       
 13781       if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 13782         instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
       
 13783       }
       
 13784       stopPhaseTimer();
       
 13785     }
       
 13786     if (typeof instance.componentDidUpdate === 'function') {
       
 13787       workInProgress.effectTag |= Update;
       
 13788     }
       
 13789     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13790       workInProgress.effectTag |= Snapshot;
       
 13791     }
       
 13792   } else {
       
 13793     // If an update was already in progress, we should schedule an Update
       
 13794     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13795     if (typeof instance.componentDidUpdate === 'function') {
       
 13796       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13797         workInProgress.effectTag |= Update;
       
 13798       }
       
 13799     }
       
 13800     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13801       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13802         workInProgress.effectTag |= Snapshot;
       
 13803       }
       
 13804     }
       
 13805 
       
 13806     // If shouldComponentUpdate returned false, we should still update the
       
 13807     // memoized props/state to indicate that this work can be reused.
       
 13808     workInProgress.memoizedProps = newProps;
       
 13809     workInProgress.memoizedState = newState;
       
 13810   }
       
 13811 
       
 13812   // Update the existing instance's state, props, and context pointers even
       
 13813   // if shouldComponentUpdate returns false.
       
 13814   instance.props = newProps;
       
 13815   instance.state = newState;
       
 13816   instance.context = nextContext;
       
 13817 
       
 13818   return shouldUpdate;
       
 13819 }
       
 13820 
       
 13821 var didWarnAboutMaps = void 0;
       
 13822 var didWarnAboutGenerators = void 0;
       
 13823 var didWarnAboutStringRefInStrictMode = void 0;
       
 13824 var ownerHasKeyUseWarning = void 0;
       
 13825 var ownerHasFunctionTypeWarning = void 0;
       
 13826 var warnForMissingKey = function (child) {};
       
 13827 
       
 13828 {
       
 13829   didWarnAboutMaps = false;
       
 13830   didWarnAboutGenerators = false;
       
 13831   didWarnAboutStringRefInStrictMode = {};
       
 13832 
       
 13833   /**
       
 13834    * Warn if there's no key explicitly set on dynamic arrays of children or
       
 13835    * object keys are not valid. This allows us to keep track of children between
       
 13836    * updates.
       
 13837    */
       
 13838   ownerHasKeyUseWarning = {};
       
 13839   ownerHasFunctionTypeWarning = {};
       
 13840 
       
 13841   warnForMissingKey = function (child) {
       
 13842     if (child === null || typeof child !== 'object') {
       
 13843       return;
       
 13844     }
       
 13845     if (!child._store || child._store.validated || child.key != null) {
       
 13846       return;
       
 13847     }
       
 13848     (function () {
       
 13849       if (!(typeof child._store === 'object')) {
       
 13850         {
       
 13851           throw ReactError(Error('React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.'));
       
 13852         }
       
 13853       }
       
 13854     })();
       
 13855     child._store.validated = true;
       
 13856 
       
 13857     var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
       
 13858     if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
       
 13859       return;
       
 13860     }
       
 13861     ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
       
 13862 
       
 13863     warning$1(false, 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
       
 13864   };
       
 13865 }
       
 13866 
       
 13867 var isArray = Array.isArray;
       
 13868 
       
 13869 function coerceRef(returnFiber, current$$1, element) {
       
 13870   var mixedRef = element.ref;
       
 13871   if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
       
 13872     {
       
 13873       if (returnFiber.mode & StrictMode) {
       
 13874         var componentName = getComponentName(returnFiber.type) || 'Component';
       
 13875         if (!didWarnAboutStringRefInStrictMode[componentName]) {
       
 13876           warningWithoutStack$1(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackByFiberInDevAndProd(returnFiber));
       
 13877           didWarnAboutStringRefInStrictMode[componentName] = true;
       
 13878         }
       
 13879       }
       
 13880     }
       
 13881 
       
 13882     if (element._owner) {
       
 13883       var owner = element._owner;
       
 13884       var inst = void 0;
       
 13885       if (owner) {
       
 13886         var ownerFiber = owner;
       
 13887         (function () {
       
 13888           if (!(ownerFiber.tag === ClassComponent)) {
       
 13889             {
       
 13890               throw ReactError(Error('Function components cannot have refs. Did you mean to use React.forwardRef()?'));
       
 13891             }
       
 13892           }
       
 13893         })();
       
 13894         inst = ownerFiber.stateNode;
       
 13895       }
       
 13896       (function () {
       
 13897         if (!inst) {
       
 13898           {
       
 13899             throw ReactError(Error('Missing owner for string ref ' + mixedRef + '. This error is likely caused by a bug in React. Please file an issue.'));
       
 13900           }
       
 13901         }
       
 13902       })();
       
 13903       var stringRef = '' + mixedRef;
       
 13904       // Check if previous string ref matches new string ref
       
 13905       if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
       
 13906         return current$$1.ref;
       
 13907       }
       
 13908       var ref = function (value) {
       
 13909         var refs = inst.refs;
       
 13910         if (refs === emptyRefsObject) {
       
 13911           // This is a lazy pooled frozen object, so we need to initialize.
       
 13912           refs = inst.refs = {};
       
 13913         }
       
 13914         if (value === null) {
       
 13915           delete refs[stringRef];
       
 13916         } else {
       
 13917           refs[stringRef] = value;
       
 13918         }
       
 13919       };
       
 13920       ref._stringRef = stringRef;
       
 13921       return ref;
       
 13922     } else {
       
 13923       (function () {
       
 13924         if (!(typeof mixedRef === 'string')) {
       
 13925           {
       
 13926             throw ReactError(Error('Expected ref to be a function, a string, an object returned by React.createRef(), or null.'));
       
 13927           }
       
 13928         }
       
 13929       })();
       
 13930       (function () {
       
 13931         if (!element._owner) {
       
 13932           {
       
 13933             throw ReactError(Error('Element ref was specified as a string (' + mixedRef + ') but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.'));
       
 13934           }
       
 13935         }
       
 13936       })();
       
 13937     }
       
 13938   }
       
 13939   return mixedRef;
       
 13940 }
       
 13941 
       
 13942 function throwOnInvalidObjectType(returnFiber, newChild) {
       
 13943   if (returnFiber.type !== 'textarea') {
       
 13944     var addendum = '';
       
 13945     {
       
 13946       addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
       
 13947     }
       
 13948     (function () {
       
 13949       {
       
 13950         {
       
 13951           throw ReactError(Error('Objects are not valid as a React child (found: ' + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ').' + addendum));
       
 13952         }
       
 13953       }
       
 13954     })();
       
 13955   }
       
 13956 }
       
 13957 
       
 13958 function warnOnFunctionType() {
       
 13959   var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
       
 13960 
       
 13961   if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
       
 13962     return;
       
 13963   }
       
 13964   ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
       
 13965 
       
 13966   warning$1(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
       
 13967 }
       
 13968 
       
 13969 // This wrapper function exists because I expect to clone the code in each path
       
 13970 // to be able to optimize each path individually by branching early. This needs
       
 13971 // a compiler or we can do it manually. Helpers that don't need this branching
       
 13972 // live outside of this function.
       
 13973 function ChildReconciler(shouldTrackSideEffects) {
       
 13974   function deleteChild(returnFiber, childToDelete) {
       
 13975     if (!shouldTrackSideEffects) {
       
 13976       // Noop.
       
 13977       return;
       
 13978     }
       
 13979     // Deletions are added in reversed order so we add it to the front.
       
 13980     // At this point, the return fiber's effect list is empty except for
       
 13981     // deletions, so we can just append the deletion to the list. The remaining
       
 13982     // effects aren't added until the complete phase. Once we implement
       
 13983     // resuming, this may not be true.
       
 13984     var last = returnFiber.lastEffect;
       
 13985     if (last !== null) {
       
 13986       last.nextEffect = childToDelete;
       
 13987       returnFiber.lastEffect = childToDelete;
       
 13988     } else {
       
 13989       returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 13990     }
       
 13991     childToDelete.nextEffect = null;
       
 13992     childToDelete.effectTag = Deletion;
       
 13993   }
       
 13994 
       
 13995   function deleteRemainingChildren(returnFiber, currentFirstChild) {
       
 13996     if (!shouldTrackSideEffects) {
       
 13997       // Noop.
       
 13998       return null;
       
 13999     }
       
 14000 
       
 14001     // TODO: For the shouldClone case, this could be micro-optimized a bit by
       
 14002     // assuming that after the first child we've already added everything.
       
 14003     var childToDelete = currentFirstChild;
       
 14004     while (childToDelete !== null) {
       
 14005       deleteChild(returnFiber, childToDelete);
       
 14006       childToDelete = childToDelete.sibling;
       
 14007     }
       
 14008     return null;
       
 14009   }
       
 14010 
       
 14011   function mapRemainingChildren(returnFiber, currentFirstChild) {
       
 14012     // Add the remaining children to a temporary map so that we can find them by
       
 14013     // keys quickly. Implicit (null) keys get added to this set with their index
       
 14014     var existingChildren = new Map();
       
 14015 
       
 14016     var existingChild = currentFirstChild;
       
 14017     while (existingChild !== null) {
       
 14018       if (existingChild.key !== null) {
       
 14019         existingChildren.set(existingChild.key, existingChild);
       
 14020       } else {
       
 14021         existingChildren.set(existingChild.index, existingChild);
       
 14022       }
       
 14023       existingChild = existingChild.sibling;
       
 14024     }
       
 14025     return existingChildren;
       
 14026   }
       
 14027 
       
 14028   function useFiber(fiber, pendingProps, expirationTime) {
       
 14029     // We currently set sibling to null and index to 0 here because it is easy
       
 14030     // to forget to do before returning it. E.g. for the single child case.
       
 14031     var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
       
 14032     clone.index = 0;
       
 14033     clone.sibling = null;
       
 14034     return clone;
       
 14035   }
       
 14036 
       
 14037   function placeChild(newFiber, lastPlacedIndex, newIndex) {
       
 14038     newFiber.index = newIndex;
       
 14039     if (!shouldTrackSideEffects) {
       
 14040       // Noop.
       
 14041       return lastPlacedIndex;
       
 14042     }
       
 14043     var current$$1 = newFiber.alternate;
       
 14044     if (current$$1 !== null) {
       
 14045       var oldIndex = current$$1.index;
       
 14046       if (oldIndex < lastPlacedIndex) {
       
 14047         // This is a move.
       
 14048         newFiber.effectTag = Placement;
       
 14049         return lastPlacedIndex;
       
 14050       } else {
       
 14051         // This item can stay in place.
       
 14052         return oldIndex;
       
 14053       }
       
 14054     } else {
       
 14055       // This is an insertion.
       
 14056       newFiber.effectTag = Placement;
       
 14057       return lastPlacedIndex;
       
 14058     }
       
 14059   }
       
 14060 
       
 14061   function placeSingleChild(newFiber) {
       
 14062     // This is simpler for the single child case. We only need to do a
       
 14063     // placement for inserting new children.
       
 14064     if (shouldTrackSideEffects && newFiber.alternate === null) {
       
 14065       newFiber.effectTag = Placement;
       
 14066     }
       
 14067     return newFiber;
       
 14068   }
       
 14069 
       
 14070   function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
       
 14071     if (current$$1 === null || current$$1.tag !== HostText) {
       
 14072       // Insert
       
 14073       var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 14074       created.return = returnFiber;
       
 14075       return created;
       
 14076     } else {
       
 14077       // Update
       
 14078       var existing = useFiber(current$$1, textContent, expirationTime);
       
 14079       existing.return = returnFiber;
       
 14080       return existing;
       
 14081     }
       
 14082   }
       
 14083 
       
 14084   function updateElement(returnFiber, current$$1, element, expirationTime) {
       
 14085     if (current$$1 !== null && (current$$1.elementType === element.type || (
       
 14086     // Keep this check inline so it only runs on the false path:
       
 14087     isCompatibleFamilyForHotReloading(current$$1, element)))) {
       
 14088       // Move based on index
       
 14089       var existing = useFiber(current$$1, element.props, expirationTime);
       
 14090       existing.ref = coerceRef(returnFiber, current$$1, element);
       
 14091       existing.return = returnFiber;
       
 14092       {
       
 14093         existing._debugSource = element._source;
       
 14094         existing._debugOwner = element._owner;
       
 14095       }
       
 14096       return existing;
       
 14097     } else {
       
 14098       // Insert
       
 14099       var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 14100       created.ref = coerceRef(returnFiber, current$$1, element);
       
 14101       created.return = returnFiber;
       
 14102       return created;
       
 14103     }
       
 14104   }
       
 14105 
       
 14106   function updatePortal(returnFiber, current$$1, portal, expirationTime) {
       
 14107     if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
       
 14108       // Insert
       
 14109       var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 14110       created.return = returnFiber;
       
 14111       return created;
       
 14112     } else {
       
 14113       // Update
       
 14114       var existing = useFiber(current$$1, portal.children || [], expirationTime);
       
 14115       existing.return = returnFiber;
       
 14116       return existing;
       
 14117     }
       
 14118   }
       
 14119 
       
 14120   function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
       
 14121     if (current$$1 === null || current$$1.tag !== Fragment) {
       
 14122       // Insert
       
 14123       var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
       
 14124       created.return = returnFiber;
       
 14125       return created;
       
 14126     } else {
       
 14127       // Update
       
 14128       var existing = useFiber(current$$1, fragment, expirationTime);
       
 14129       existing.return = returnFiber;
       
 14130       return existing;
       
 14131     }
       
 14132   }
       
 14133 
       
 14134   function createChild(returnFiber, newChild, expirationTime) {
       
 14135     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14136       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 14137       // we can continue to replace it without aborting even if it is not a text
       
 14138       // node.
       
 14139       var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
       
 14140       created.return = returnFiber;
       
 14141       return created;
       
 14142     }
       
 14143 
       
 14144     if (typeof newChild === 'object' && newChild !== null) {
       
 14145       switch (newChild.$$typeof) {
       
 14146         case REACT_ELEMENT_TYPE:
       
 14147           {
       
 14148             var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
       
 14149             _created.ref = coerceRef(returnFiber, null, newChild);
       
 14150             _created.return = returnFiber;
       
 14151             return _created;
       
 14152           }
       
 14153         case REACT_PORTAL_TYPE:
       
 14154           {
       
 14155             var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
       
 14156             _created2.return = returnFiber;
       
 14157             return _created2;
       
 14158           }
       
 14159       }
       
 14160 
       
 14161       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 14162         var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
       
 14163         _created3.return = returnFiber;
       
 14164         return _created3;
       
 14165       }
       
 14166 
       
 14167       throwOnInvalidObjectType(returnFiber, newChild);
       
 14168     }
       
 14169 
       
 14170     {
       
 14171       if (typeof newChild === 'function') {
       
 14172         warnOnFunctionType();
       
 14173       }
       
 14174     }
       
 14175 
       
 14176     return null;
       
 14177   }
       
 14178 
       
 14179   function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
       
 14180     // Update the fiber if the keys match, otherwise return null.
       
 14181 
       
 14182     var key = oldFiber !== null ? oldFiber.key : null;
       
 14183 
       
 14184     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14185       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 14186       // we can continue to replace it without aborting even if it is not a text
       
 14187       // node.
       
 14188       if (key !== null) {
       
 14189         return null;
       
 14190       }
       
 14191       return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
       
 14192     }
       
 14193 
       
 14194     if (typeof newChild === 'object' && newChild !== null) {
       
 14195       switch (newChild.$$typeof) {
       
 14196         case REACT_ELEMENT_TYPE:
       
 14197           {
       
 14198             if (newChild.key === key) {
       
 14199               if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 14200                 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
       
 14201               }
       
 14202               return updateElement(returnFiber, oldFiber, newChild, expirationTime);
       
 14203             } else {
       
 14204               return null;
       
 14205             }
       
 14206           }
       
 14207         case REACT_PORTAL_TYPE:
       
 14208           {
       
 14209             if (newChild.key === key) {
       
 14210               return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
       
 14211             } else {
       
 14212               return null;
       
 14213             }
       
 14214           }
       
 14215       }
       
 14216 
       
 14217       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 14218         if (key !== null) {
       
 14219           return null;
       
 14220         }
       
 14221 
       
 14222         return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
       
 14223       }
       
 14224 
       
 14225       throwOnInvalidObjectType(returnFiber, newChild);
       
 14226     }
       
 14227 
       
 14228     {
       
 14229       if (typeof newChild === 'function') {
       
 14230         warnOnFunctionType();
       
 14231       }
       
 14232     }
       
 14233 
       
 14234     return null;
       
 14235   }
       
 14236 
       
 14237   function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
       
 14238     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14239       // Text nodes don't have keys, so we neither have to check the old nor
       
 14240       // new node for the key. If both are text nodes, they match.
       
 14241       var matchedFiber = existingChildren.get(newIdx) || null;
       
 14242       return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
       
 14243     }
       
 14244 
       
 14245     if (typeof newChild === 'object' && newChild !== null) {
       
 14246       switch (newChild.$$typeof) {
       
 14247         case REACT_ELEMENT_TYPE:
       
 14248           {
       
 14249             var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 14250             if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 14251               return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
       
 14252             }
       
 14253             return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
       
 14254           }
       
 14255         case REACT_PORTAL_TYPE:
       
 14256           {
       
 14257             var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 14258             return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
       
 14259           }
       
 14260       }
       
 14261 
       
 14262       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 14263         var _matchedFiber3 = existingChildren.get(newIdx) || null;
       
 14264         return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
       
 14265       }
       
 14266 
       
 14267       throwOnInvalidObjectType(returnFiber, newChild);
       
 14268     }
       
 14269 
       
 14270     {
       
 14271       if (typeof newChild === 'function') {
       
 14272         warnOnFunctionType();
       
 14273       }
       
 14274     }
       
 14275 
       
 14276     return null;
       
 14277   }
       
 14278 
       
 14279   /**
       
 14280    * Warns if there is a duplicate or missing key
       
 14281    */
       
 14282   function warnOnInvalidKey(child, knownKeys) {
       
 14283     {
       
 14284       if (typeof child !== 'object' || child === null) {
       
 14285         return knownKeys;
       
 14286       }
       
 14287       switch (child.$$typeof) {
       
 14288         case REACT_ELEMENT_TYPE:
       
 14289         case REACT_PORTAL_TYPE:
       
 14290           warnForMissingKey(child);
       
 14291           var key = child.key;
       
 14292           if (typeof key !== 'string') {
       
 14293             break;
       
 14294           }
       
 14295           if (knownKeys === null) {
       
 14296             knownKeys = new Set();
       
 14297             knownKeys.add(key);
       
 14298             break;
       
 14299           }
       
 14300           if (!knownKeys.has(key)) {
       
 14301             knownKeys.add(key);
       
 14302             break;
       
 14303           }
       
 14304           warning$1(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
       
 14305           break;
       
 14306         default:
       
 14307           break;
       
 14308       }
       
 14309     }
       
 14310     return knownKeys;
       
 14311   }
       
 14312 
       
 14313   function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
       
 14314     // This algorithm can't optimize by searching from both ends since we
       
 14315     // don't have backpointers on fibers. I'm trying to see how far we can get
       
 14316     // with that model. If it ends up not being worth the tradeoffs, we can
       
 14317     // add it later.
       
 14318 
       
 14319     // Even with a two ended optimization, we'd want to optimize for the case
       
 14320     // where there are few changes and brute force the comparison instead of
       
 14321     // going for the Map. It'd like to explore hitting that path first in
       
 14322     // forward-only mode and only go for the Map once we notice that we need
       
 14323     // lots of look ahead. This doesn't handle reversal as well as two ended
       
 14324     // search but that's unusual. Besides, for the two ended optimization to
       
 14325     // work on Iterables, we'd need to copy the whole set.
       
 14326 
       
 14327     // In this first iteration, we'll just live with hitting the bad case
       
 14328     // (adding everything to a Map) in for every insert/move.
       
 14329 
       
 14330     // If you change this code, also update reconcileChildrenIterator() which
       
 14331     // uses the same algorithm.
       
 14332 
       
 14333     {
       
 14334       // First, validate keys.
       
 14335       var knownKeys = null;
       
 14336       for (var i = 0; i < newChildren.length; i++) {
       
 14337         var child = newChildren[i];
       
 14338         knownKeys = warnOnInvalidKey(child, knownKeys);
       
 14339       }
       
 14340     }
       
 14341 
       
 14342     var resultingFirstChild = null;
       
 14343     var previousNewFiber = null;
       
 14344 
       
 14345     var oldFiber = currentFirstChild;
       
 14346     var lastPlacedIndex = 0;
       
 14347     var newIdx = 0;
       
 14348     var nextOldFiber = null;
       
 14349     for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
       
 14350       if (oldFiber.index > newIdx) {
       
 14351         nextOldFiber = oldFiber;
       
 14352         oldFiber = null;
       
 14353       } else {
       
 14354         nextOldFiber = oldFiber.sibling;
       
 14355       }
       
 14356       var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
       
 14357       if (newFiber === null) {
       
 14358         // TODO: This breaks on empty slots like null children. That's
       
 14359         // unfortunate because it triggers the slow path all the time. We need
       
 14360         // a better way to communicate whether this was a miss or null,
       
 14361         // boolean, undefined, etc.
       
 14362         if (oldFiber === null) {
       
 14363           oldFiber = nextOldFiber;
       
 14364         }
       
 14365         break;
       
 14366       }
       
 14367       if (shouldTrackSideEffects) {
       
 14368         if (oldFiber && newFiber.alternate === null) {
       
 14369           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 14370           // need to delete the existing child.
       
 14371           deleteChild(returnFiber, oldFiber);
       
 14372         }
       
 14373       }
       
 14374       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 14375       if (previousNewFiber === null) {
       
 14376         // TODO: Move out of the loop. This only happens for the first run.
       
 14377         resultingFirstChild = newFiber;
       
 14378       } else {
       
 14379         // TODO: Defer siblings if we're not at the right index for this slot.
       
 14380         // I.e. if we had null values before, then we want to defer this
       
 14381         // for each null value. However, we also don't want to call updateSlot
       
 14382         // with the previous one.
       
 14383         previousNewFiber.sibling = newFiber;
       
 14384       }
       
 14385       previousNewFiber = newFiber;
       
 14386       oldFiber = nextOldFiber;
       
 14387     }
       
 14388 
       
 14389     if (newIdx === newChildren.length) {
       
 14390       // We've reached the end of the new children. We can delete the rest.
       
 14391       deleteRemainingChildren(returnFiber, oldFiber);
       
 14392       return resultingFirstChild;
       
 14393     }
       
 14394 
       
 14395     if (oldFiber === null) {
       
 14396       // If we don't have any more existing children we can choose a fast path
       
 14397       // since the rest will all be insertions.
       
 14398       for (; newIdx < newChildren.length; newIdx++) {
       
 14399         var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
       
 14400         if (_newFiber === null) {
       
 14401           continue;
       
 14402         }
       
 14403         lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
       
 14404         if (previousNewFiber === null) {
       
 14405           // TODO: Move out of the loop. This only happens for the first run.
       
 14406           resultingFirstChild = _newFiber;
       
 14407         } else {
       
 14408           previousNewFiber.sibling = _newFiber;
       
 14409         }
       
 14410         previousNewFiber = _newFiber;
       
 14411       }
       
 14412       return resultingFirstChild;
       
 14413     }
       
 14414 
       
 14415     // Add all children to a key map for quick lookups.
       
 14416     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 14417 
       
 14418     // Keep scanning and use the map to restore deleted items as moves.
       
 14419     for (; newIdx < newChildren.length; newIdx++) {
       
 14420       var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
       
 14421       if (_newFiber2 !== null) {
       
 14422         if (shouldTrackSideEffects) {
       
 14423           if (_newFiber2.alternate !== null) {
       
 14424             // The new fiber is a work in progress, but if there exists a
       
 14425             // current, that means that we reused the fiber. We need to delete
       
 14426             // it from the child list so that we don't add it to the deletion
       
 14427             // list.
       
 14428             existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
       
 14429           }
       
 14430         }
       
 14431         lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
       
 14432         if (previousNewFiber === null) {
       
 14433           resultingFirstChild = _newFiber2;
       
 14434         } else {
       
 14435           previousNewFiber.sibling = _newFiber2;
       
 14436         }
       
 14437         previousNewFiber = _newFiber2;
       
 14438       }
       
 14439     }
       
 14440 
       
 14441     if (shouldTrackSideEffects) {
       
 14442       // Any existing children that weren't consumed above were deleted. We need
       
 14443       // to add them to the deletion list.
       
 14444       existingChildren.forEach(function (child) {
       
 14445         return deleteChild(returnFiber, child);
       
 14446       });
       
 14447     }
       
 14448 
       
 14449     return resultingFirstChild;
       
 14450   }
       
 14451 
       
 14452   function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
       
 14453     // This is the same implementation as reconcileChildrenArray(),
       
 14454     // but using the iterator instead.
       
 14455 
       
 14456     var iteratorFn = getIteratorFn(newChildrenIterable);
       
 14457     (function () {
       
 14458       if (!(typeof iteratorFn === 'function')) {
       
 14459         {
       
 14460           throw ReactError(Error('An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.'));
       
 14461         }
       
 14462       }
       
 14463     })();
       
 14464 
       
 14465     {
       
 14466       // We don't support rendering Generators because it's a mutation.
       
 14467       // See https://github.com/facebook/react/issues/12995
       
 14468       if (typeof Symbol === 'function' &&
       
 14469       // $FlowFixMe Flow doesn't know about toStringTag
       
 14470       newChildrenIterable[Symbol.toStringTag] === 'Generator') {
       
 14471         !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
       
 14472         didWarnAboutGenerators = true;
       
 14473       }
       
 14474 
       
 14475       // Warn about using Maps as children
       
 14476       if (newChildrenIterable.entries === iteratorFn) {
       
 14477         !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;
       
 14478         didWarnAboutMaps = true;
       
 14479       }
       
 14480 
       
 14481       // First, validate keys.
       
 14482       // We'll get a different iterator later for the main pass.
       
 14483       var _newChildren = iteratorFn.call(newChildrenIterable);
       
 14484       if (_newChildren) {
       
 14485         var knownKeys = null;
       
 14486         var _step = _newChildren.next();
       
 14487         for (; !_step.done; _step = _newChildren.next()) {
       
 14488           var child = _step.value;
       
 14489           knownKeys = warnOnInvalidKey(child, knownKeys);
       
 14490         }
       
 14491       }
       
 14492     }
       
 14493 
       
 14494     var newChildren = iteratorFn.call(newChildrenIterable);
       
 14495     (function () {
       
 14496       if (!(newChildren != null)) {
       
 14497         {
       
 14498           throw ReactError(Error('An iterable object provided no iterator.'));
       
 14499         }
       
 14500       }
       
 14501     })();
       
 14502 
       
 14503     var resultingFirstChild = null;
       
 14504     var previousNewFiber = null;
       
 14505 
       
 14506     var oldFiber = currentFirstChild;
       
 14507     var lastPlacedIndex = 0;
       
 14508     var newIdx = 0;
       
 14509     var nextOldFiber = null;
       
 14510 
       
 14511     var step = newChildren.next();
       
 14512     for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
       
 14513       if (oldFiber.index > newIdx) {
       
 14514         nextOldFiber = oldFiber;
       
 14515         oldFiber = null;
       
 14516       } else {
       
 14517         nextOldFiber = oldFiber.sibling;
       
 14518       }
       
 14519       var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
       
 14520       if (newFiber === null) {
       
 14521         // TODO: This breaks on empty slots like null children. That's
       
 14522         // unfortunate because it triggers the slow path all the time. We need
       
 14523         // a better way to communicate whether this was a miss or null,
       
 14524         // boolean, undefined, etc.
       
 14525         if (oldFiber === null) {
       
 14526           oldFiber = nextOldFiber;
       
 14527         }
       
 14528         break;
       
 14529       }
       
 14530       if (shouldTrackSideEffects) {
       
 14531         if (oldFiber && newFiber.alternate === null) {
       
 14532           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 14533           // need to delete the existing child.
       
 14534           deleteChild(returnFiber, oldFiber);
       
 14535         }
       
 14536       }
       
 14537       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 14538       if (previousNewFiber === null) {
       
 14539         // TODO: Move out of the loop. This only happens for the first run.
       
 14540         resultingFirstChild = newFiber;
       
 14541       } else {
       
 14542         // TODO: Defer siblings if we're not at the right index for this slot.
       
 14543         // I.e. if we had null values before, then we want to defer this
       
 14544         // for each null value. However, we also don't want to call updateSlot
       
 14545         // with the previous one.
       
 14546         previousNewFiber.sibling = newFiber;
       
 14547       }
       
 14548       previousNewFiber = newFiber;
       
 14549       oldFiber = nextOldFiber;
       
 14550     }
       
 14551 
       
 14552     if (step.done) {
       
 14553       // We've reached the end of the new children. We can delete the rest.
       
 14554       deleteRemainingChildren(returnFiber, oldFiber);
       
 14555       return resultingFirstChild;
       
 14556     }
       
 14557 
       
 14558     if (oldFiber === null) {
       
 14559       // If we don't have any more existing children we can choose a fast path
       
 14560       // since the rest will all be insertions.
       
 14561       for (; !step.done; newIdx++, step = newChildren.next()) {
       
 14562         var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
       
 14563         if (_newFiber3 === null) {
       
 14564           continue;
       
 14565         }
       
 14566         lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
       
 14567         if (previousNewFiber === null) {
       
 14568           // TODO: Move out of the loop. This only happens for the first run.
       
 14569           resultingFirstChild = _newFiber3;
       
 14570         } else {
       
 14571           previousNewFiber.sibling = _newFiber3;
       
 14572         }
       
 14573         previousNewFiber = _newFiber3;
       
 14574       }
       
 14575       return resultingFirstChild;
       
 14576     }
       
 14577 
       
 14578     // Add all children to a key map for quick lookups.
       
 14579     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 14580 
       
 14581     // Keep scanning and use the map to restore deleted items as moves.
       
 14582     for (; !step.done; newIdx++, step = newChildren.next()) {
       
 14583       var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
       
 14584       if (_newFiber4 !== null) {
       
 14585         if (shouldTrackSideEffects) {
       
 14586           if (_newFiber4.alternate !== null) {
       
 14587             // The new fiber is a work in progress, but if there exists a
       
 14588             // current, that means that we reused the fiber. We need to delete
       
 14589             // it from the child list so that we don't add it to the deletion
       
 14590             // list.
       
 14591             existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
       
 14592           }
       
 14593         }
       
 14594         lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
       
 14595         if (previousNewFiber === null) {
       
 14596           resultingFirstChild = _newFiber4;
       
 14597         } else {
       
 14598           previousNewFiber.sibling = _newFiber4;
       
 14599         }
       
 14600         previousNewFiber = _newFiber4;
       
 14601       }
       
 14602     }
       
 14603 
       
 14604     if (shouldTrackSideEffects) {
       
 14605       // Any existing children that weren't consumed above were deleted. We need
       
 14606       // to add them to the deletion list.
       
 14607       existingChildren.forEach(function (child) {
       
 14608         return deleteChild(returnFiber, child);
       
 14609       });
       
 14610     }
       
 14611 
       
 14612     return resultingFirstChild;
       
 14613   }
       
 14614 
       
 14615   function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
       
 14616     // There's no need to check for keys on text nodes since we don't have a
       
 14617     // way to define them.
       
 14618     if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
       
 14619       // We already have an existing node so let's just update it and delete
       
 14620       // the rest.
       
 14621       deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
       
 14622       var existing = useFiber(currentFirstChild, textContent, expirationTime);
       
 14623       existing.return = returnFiber;
       
 14624       return existing;
       
 14625     }
       
 14626     // The existing first child is not a text node so we need to create one
       
 14627     // and delete the existing ones.
       
 14628     deleteRemainingChildren(returnFiber, currentFirstChild);
       
 14629     var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 14630     created.return = returnFiber;
       
 14631     return created;
       
 14632   }
       
 14633 
       
 14634   function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
       
 14635     var key = element.key;
       
 14636     var child = currentFirstChild;
       
 14637     while (child !== null) {
       
 14638       // TODO: If key === null and child.key === null, then this only applies to
       
 14639       // the first item in the list.
       
 14640       if (child.key === key) {
       
 14641         if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type || (
       
 14642         // Keep this check inline so it only runs on the false path:
       
 14643         isCompatibleFamilyForHotReloading(child, element))) {
       
 14644           deleteRemainingChildren(returnFiber, child.sibling);
       
 14645           var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
       
 14646           existing.ref = coerceRef(returnFiber, child, element);
       
 14647           existing.return = returnFiber;
       
 14648           {
       
 14649             existing._debugSource = element._source;
       
 14650             existing._debugOwner = element._owner;
       
 14651           }
       
 14652           return existing;
       
 14653         } else {
       
 14654           deleteRemainingChildren(returnFiber, child);
       
 14655           break;
       
 14656         }
       
 14657       } else {
       
 14658         deleteChild(returnFiber, child);
       
 14659       }
       
 14660       child = child.sibling;
       
 14661     }
       
 14662 
       
 14663     if (element.type === REACT_FRAGMENT_TYPE) {
       
 14664       var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
       
 14665       created.return = returnFiber;
       
 14666       return created;
       
 14667     } else {
       
 14668       var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 14669       _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
       
 14670       _created4.return = returnFiber;
       
 14671       return _created4;
       
 14672     }
       
 14673   }
       
 14674 
       
 14675   function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
       
 14676     var key = portal.key;
       
 14677     var child = currentFirstChild;
       
 14678     while (child !== null) {
       
 14679       // TODO: If key === null and child.key === null, then this only applies to
       
 14680       // the first item in the list.
       
 14681       if (child.key === key) {
       
 14682         if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
       
 14683           deleteRemainingChildren(returnFiber, child.sibling);
       
 14684           var existing = useFiber(child, portal.children || [], expirationTime);
       
 14685           existing.return = returnFiber;
       
 14686           return existing;
       
 14687         } else {
       
 14688           deleteRemainingChildren(returnFiber, child);
       
 14689           break;
       
 14690         }
       
 14691       } else {
       
 14692         deleteChild(returnFiber, child);
       
 14693       }
       
 14694       child = child.sibling;
       
 14695     }
       
 14696 
       
 14697     var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 14698     created.return = returnFiber;
       
 14699     return created;
       
 14700   }
       
 14701 
       
 14702   // This API will tag the children with the side-effect of the reconciliation
       
 14703   // itself. They will be added to the side-effect list as we pass through the
       
 14704   // children and the parent.
       
 14705   function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
       
 14706     // This function is not recursive.
       
 14707     // If the top level item is an array, we treat it as a set of children,
       
 14708     // not as a fragment. Nested arrays on the other hand will be treated as
       
 14709     // fragment nodes. Recursion happens at the normal flow.
       
 14710 
       
 14711     // Handle top level unkeyed fragments as if they were arrays.
       
 14712     // This leads to an ambiguity between <>{[...]}</> and <>...</>.
       
 14713     // We treat the ambiguous cases above the same.
       
 14714     var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
       
 14715     if (isUnkeyedTopLevelFragment) {
       
 14716       newChild = newChild.props.children;
       
 14717     }
       
 14718 
       
 14719     // Handle object types
       
 14720     var isObject = typeof newChild === 'object' && newChild !== null;
       
 14721 
       
 14722     if (isObject) {
       
 14723       switch (newChild.$$typeof) {
       
 14724         case REACT_ELEMENT_TYPE:
       
 14725           return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
       
 14726         case REACT_PORTAL_TYPE:
       
 14727           return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
       
 14728       }
       
 14729     }
       
 14730 
       
 14731     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14732       return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
       
 14733     }
       
 14734 
       
 14735     if (isArray(newChild)) {
       
 14736       return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
       
 14737     }
       
 14738 
       
 14739     if (getIteratorFn(newChild)) {
       
 14740       return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
       
 14741     }
       
 14742 
       
 14743     if (isObject) {
       
 14744       throwOnInvalidObjectType(returnFiber, newChild);
       
 14745     }
       
 14746 
       
 14747     {
       
 14748       if (typeof newChild === 'function') {
       
 14749         warnOnFunctionType();
       
 14750       }
       
 14751     }
       
 14752     if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
       
 14753       // If the new child is undefined, and the return fiber is a composite
       
 14754       // component, throw an error. If Fiber return types are disabled,
       
 14755       // we already threw above.
       
 14756       switch (returnFiber.tag) {
       
 14757         case ClassComponent:
       
 14758           {
       
 14759             {
       
 14760               var instance = returnFiber.stateNode;
       
 14761               if (instance.render._isMockFunction) {
       
 14762                 // We allow auto-mocks to proceed as if they're returning null.
       
 14763                 break;
       
 14764               }
       
 14765             }
       
 14766           }
       
 14767         // Intentionally fall through to the next case, which handles both
       
 14768         // functions and classes
       
 14769         // eslint-disable-next-lined no-fallthrough
       
 14770         case FunctionComponent:
       
 14771           {
       
 14772             var Component = returnFiber.type;
       
 14773             (function () {
       
 14774               {
       
 14775                 {
       
 14776                   throw ReactError(Error((Component.displayName || Component.name || 'Component') + '(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.'));
       
 14777                 }
       
 14778               }
       
 14779             })();
       
 14780           }
       
 14781       }
       
 14782     }
       
 14783 
       
 14784     // Remaining cases are all treated as empty.
       
 14785     return deleteRemainingChildren(returnFiber, currentFirstChild);
       
 14786   }
       
 14787 
       
 14788   return reconcileChildFibers;
       
 14789 }
       
 14790 
       
 14791 var reconcileChildFibers = ChildReconciler(true);
       
 14792 var mountChildFibers = ChildReconciler(false);
       
 14793 
       
 14794 function cloneChildFibers(current$$1, workInProgress) {
       
 14795   (function () {
       
 14796     if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
       
 14797       {
       
 14798         throw ReactError(Error('Resuming work not yet implemented.'));
       
 14799       }
       
 14800     }
       
 14801   })();
       
 14802 
       
 14803   if (workInProgress.child === null) {
       
 14804     return;
       
 14805   }
       
 14806 
       
 14807   var currentChild = workInProgress.child;
       
 14808   var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 14809   workInProgress.child = newChild;
       
 14810 
       
 14811   newChild.return = workInProgress;
       
 14812   while (currentChild.sibling !== null) {
       
 14813     currentChild = currentChild.sibling;
       
 14814     newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 14815     newChild.return = workInProgress;
       
 14816   }
       
 14817   newChild.sibling = null;
       
 14818 }
       
 14819 
       
 14820 // Reset a workInProgress child set to prepare it for a second pass.
       
 14821 function resetChildFibers(workInProgress, renderExpirationTime) {
       
 14822   var child = workInProgress.child;
       
 14823   while (child !== null) {
       
 14824     resetWorkInProgress(child, renderExpirationTime);
       
 14825     child = child.sibling;
       
 14826   }
       
 14827 }
       
 14828 
       
 14829 var NO_CONTEXT = {};
       
 14830 
       
 14831 var contextStackCursor$1 = createCursor(NO_CONTEXT);
       
 14832 var contextFiberStackCursor = createCursor(NO_CONTEXT);
       
 14833 var rootInstanceStackCursor = createCursor(NO_CONTEXT);
       
 14834 
       
 14835 function requiredContext(c) {
       
 14836   (function () {
       
 14837     if (!(c !== NO_CONTEXT)) {
       
 14838       {
       
 14839         throw ReactError(Error('Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.'));
       
 14840       }
       
 14841     }
       
 14842   })();
       
 14843   return c;
       
 14844 }
       
 14845 
       
 14846 function getRootHostContainer() {
       
 14847   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 14848   return rootInstance;
       
 14849 }
       
 14850 
       
 14851 function pushHostContainer(fiber, nextRootInstance) {
       
 14852   // Push current root instance onto the stack;
       
 14853   // This allows us to reset root when portals are popped.
       
 14854   push(rootInstanceStackCursor, nextRootInstance, fiber);
       
 14855   // Track the context and the Fiber that provided it.
       
 14856   // This enables us to pop only Fibers that provide unique contexts.
       
 14857   push(contextFiberStackCursor, fiber, fiber);
       
 14858 
       
 14859   // Finally, we need to push the host context to the stack.
       
 14860   // However, we can't just call getRootHostContext() and push it because
       
 14861   // we'd have a different number of entries on the stack depending on
       
 14862   // whether getRootHostContext() throws somewhere in renderer code or not.
       
 14863   // So we push an empty value first. This lets us safely unwind on errors.
       
 14864   push(contextStackCursor$1, NO_CONTEXT, fiber);
       
 14865   var nextRootContext = getRootHostContext(nextRootInstance);
       
 14866   // Now that we know this function doesn't throw, replace it.
       
 14867   pop(contextStackCursor$1, fiber);
       
 14868   push(contextStackCursor$1, nextRootContext, fiber);
       
 14869 }
       
 14870 
       
 14871 function popHostContainer(fiber) {
       
 14872   pop(contextStackCursor$1, fiber);
       
 14873   pop(contextFiberStackCursor, fiber);
       
 14874   pop(rootInstanceStackCursor, fiber);
       
 14875 }
       
 14876 
       
 14877 function getHostContext() {
       
 14878   var context = requiredContext(contextStackCursor$1.current);
       
 14879   return context;
       
 14880 }
       
 14881 
       
 14882 function pushHostContext(fiber) {
       
 14883   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 14884   var context = requiredContext(contextStackCursor$1.current);
       
 14885   var nextContext = getChildHostContext(context, fiber.type, rootInstance);
       
 14886 
       
 14887   // Don't push this Fiber's context unless it's unique.
       
 14888   if (context === nextContext) {
       
 14889     return;
       
 14890   }
       
 14891 
       
 14892   // Track the context and the Fiber that provided it.
       
 14893   // This enables us to pop only Fibers that provide unique contexts.
       
 14894   push(contextFiberStackCursor, fiber, fiber);
       
 14895   push(contextStackCursor$1, nextContext, fiber);
       
 14896 }
       
 14897 
       
 14898 function popHostContext(fiber) {
       
 14899   // Do not pop unless this Fiber provided the current context.
       
 14900   // pushHostContext() only pushes Fibers that provide unique contexts.
       
 14901   if (contextFiberStackCursor.current !== fiber) {
       
 14902     return;
       
 14903   }
       
 14904 
       
 14905   pop(contextStackCursor$1, fiber);
       
 14906   pop(contextFiberStackCursor, fiber);
       
 14907 }
       
 14908 
       
 14909 var DefaultSuspenseContext = 0;
       
 14910 
       
 14911 // The Suspense Context is split into two parts. The lower bits is
       
 14912 // inherited deeply down the subtree. The upper bits only affect
       
 14913 // this immediate suspense boundary and gets reset each new
       
 14914 // boundary or suspense list.
       
 14915 var SubtreeSuspenseContextMask = 1;
       
 14916 
       
 14917 // Subtree Flags:
       
 14918 
       
 14919 // InvisibleParentSuspenseContext indicates that one of our parent Suspense
       
 14920 // boundaries is not currently showing visible main content.
       
 14921 // Either because it is already showing a fallback or is not mounted at all.
       
 14922 // We can use this to determine if it is desirable to trigger a fallback at
       
 14923 // the parent. If not, then we might need to trigger undesirable boundaries
       
 14924 // and/or suspend the commit to avoid hiding the parent content.
       
 14925 var InvisibleParentSuspenseContext = 1;
       
 14926 
       
 14927 // Shallow Flags:
       
 14928 
       
 14929 // ForceSuspenseFallback can be used by SuspenseList to force newly added
       
 14930 // items into their fallback state during one of the render passes.
       
 14931 var ForceSuspenseFallback = 2;
       
 14932 
       
 14933 var suspenseStackCursor = createCursor(DefaultSuspenseContext);
       
 14934 
       
 14935 function hasSuspenseContext(parentContext, flag) {
       
 14936   return (parentContext & flag) !== 0;
       
 14937 }
       
 14938 
       
 14939 function setDefaultShallowSuspenseContext(parentContext) {
       
 14940   return parentContext & SubtreeSuspenseContextMask;
       
 14941 }
       
 14942 
       
 14943 function setShallowSuspenseContext(parentContext, shallowContext) {
       
 14944   return parentContext & SubtreeSuspenseContextMask | shallowContext;
       
 14945 }
       
 14946 
       
 14947 function addSubtreeSuspenseContext(parentContext, subtreeContext) {
       
 14948   return parentContext | subtreeContext;
       
 14949 }
       
 14950 
       
 14951 function pushSuspenseContext(fiber, newContext) {
       
 14952   push(suspenseStackCursor, newContext, fiber);
       
 14953 }
       
 14954 
       
 14955 function popSuspenseContext(fiber) {
       
 14956   pop(suspenseStackCursor, fiber);
       
 14957 }
       
 14958 
       
 14959 // TODO: This is now an empty object. Should we switch this to a boolean?
       
 14960 // Alternatively we can make this use an effect tag similar to SuspenseList.
       
 14961 
       
 14962 
       
 14963 function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
       
 14964   // If it was the primary children that just suspended, capture and render the
       
 14965   var nextState = workInProgress.memoizedState;
       
 14966   if (nextState !== null) {
       
 14967     return false;
       
 14968   }
       
 14969   var props = workInProgress.memoizedProps;
       
 14970   // In order to capture, the Suspense component must have a fallback prop.
       
 14971   if (props.fallback === undefined) {
       
 14972     return false;
       
 14973   }
       
 14974   // Regular boundaries always capture.
       
 14975   if (props.unstable_avoidThisFallback !== true) {
       
 14976     return true;
       
 14977   }
       
 14978   // If it's a boundary we should avoid, then we prefer to bubble up to the
       
 14979   // parent boundary if it is currently invisible.
       
 14980   if (hasInvisibleParent) {
       
 14981     return false;
       
 14982   }
       
 14983   // If the parent is not able to handle it, we must handle it.
       
 14984   return true;
       
 14985 }
       
 14986 
       
 14987 function findFirstSuspended(row) {
       
 14988   var node = row;
       
 14989   while (node !== null) {
       
 14990     if (node.tag === SuspenseComponent) {
       
 14991       var state = node.memoizedState;
       
 14992       if (state !== null) {
       
 14993         return node;
       
 14994       }
       
 14995     } else if (node.tag === SuspenseListComponent &&
       
 14996     // revealOrder undefined can't be trusted because it don't
       
 14997     // keep track of whether it suspended or not.
       
 14998     node.memoizedProps.revealOrder !== undefined) {
       
 14999       var didSuspend = (node.effectTag & DidCapture) !== NoEffect;
       
 15000       if (didSuspend) {
       
 15001         return node;
       
 15002       }
       
 15003     } else if (node.child !== null) {
       
 15004       node.child.return = node;
       
 15005       node = node.child;
       
 15006       continue;
       
 15007     }
       
 15008     if (node === row) {
       
 15009       return null;
       
 15010     }
       
 15011     while (node.sibling === null) {
       
 15012       if (node.return === null || node.return === row) {
       
 15013         return null;
       
 15014       }
       
 15015       node = node.return;
       
 15016     }
       
 15017     node.sibling.return = node.return;
       
 15018     node = node.sibling;
       
 15019   }
       
 15020   return null;
       
 15021 }
       
 15022 
       
 15023 var NoEffect$1 = /*             */0;
       
 15024 var UnmountSnapshot = /*      */2;
       
 15025 var UnmountMutation = /*      */4;
       
 15026 var MountMutation = /*        */8;
       
 15027 var UnmountLayout = /*        */16;
       
 15028 var MountLayout = /*          */32;
       
 15029 var MountPassive = /*         */64;
       
 15030 var UnmountPassive = /*       */128;
       
 15031 
       
 15032 var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
       
 15033 
       
 15034 
       
 15035 var didWarnAboutMismatchedHooksForComponent = void 0;
       
 15036 {
       
 15037   didWarnAboutMismatchedHooksForComponent = new Set();
       
 15038 }
       
 15039 
       
 15040 // These are set right before calling the component.
       
 15041 var renderExpirationTime$1 = NoWork;
       
 15042 // The work-in-progress fiber. I've named it differently to distinguish it from
       
 15043 // the work-in-progress hook.
       
 15044 var currentlyRenderingFiber$1 = null;
       
 15045 
       
 15046 // Hooks are stored as a linked list on the fiber's memoizedState field. The
       
 15047 // current hook list is the list that belongs to the current fiber. The
       
 15048 // work-in-progress hook list is a new list that will be added to the
       
 15049 // work-in-progress fiber.
       
 15050 var currentHook = null;
       
 15051 var nextCurrentHook = null;
       
 15052 var firstWorkInProgressHook = null;
       
 15053 var workInProgressHook = null;
       
 15054 var nextWorkInProgressHook = null;
       
 15055 
       
 15056 var remainingExpirationTime = NoWork;
       
 15057 var componentUpdateQueue = null;
       
 15058 var sideEffectTag = 0;
       
 15059 
       
 15060 // Updates scheduled during render will trigger an immediate re-render at the
       
 15061 // end of the current pass. We can't store these updates on the normal queue,
       
 15062 // because if the work is aborted, they should be discarded. Because this is
       
 15063 // a relatively rare case, we also don't want to add an additional field to
       
 15064 // either the hook or queue object types. So we store them in a lazily create
       
 15065 // map of queue -> render-phase updates, which are discarded once the component
       
 15066 // completes without re-rendering.
       
 15067 
       
 15068 // Whether an update was scheduled during the currently executing render pass.
       
 15069 var didScheduleRenderPhaseUpdate = false;
       
 15070 // Lazily created map of render-phase updates
       
 15071 var renderPhaseUpdates = null;
       
 15072 // Counter to prevent infinite loops.
       
 15073 var numberOfReRenders = 0;
       
 15074 var RE_RENDER_LIMIT = 25;
       
 15075 
       
 15076 // In DEV, this is the name of the currently executing primitive hook
       
 15077 var currentHookNameInDev = null;
       
 15078 
       
 15079 // In DEV, this list ensures that hooks are called in the same order between renders.
       
 15080 // The list stores the order of hooks used during the initial render (mount).
       
 15081 // Subsequent renders (updates) reference this list.
       
 15082 var hookTypesDev = null;
       
 15083 var hookTypesUpdateIndexDev = -1;
       
 15084 
       
 15085 // In DEV, this tracks whether currently rendering component needs to ignore
       
 15086 // the dependencies for Hooks that need them (e.g. useEffect or useMemo).
       
 15087 // When true, such Hooks will always be "remounted". Only used during hot reload.
       
 15088 var ignorePreviousDependencies = false;
       
 15089 
       
 15090 function mountHookTypesDev() {
       
 15091   {
       
 15092     var hookName = currentHookNameInDev;
       
 15093 
       
 15094     if (hookTypesDev === null) {
       
 15095       hookTypesDev = [hookName];
       
 15096     } else {
       
 15097       hookTypesDev.push(hookName);
       
 15098     }
       
 15099   }
       
 15100 }
       
 15101 
       
 15102 function updateHookTypesDev() {
       
 15103   {
       
 15104     var hookName = currentHookNameInDev;
       
 15105 
       
 15106     if (hookTypesDev !== null) {
       
 15107       hookTypesUpdateIndexDev++;
       
 15108       if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
       
 15109         warnOnHookMismatchInDev(hookName);
       
 15110       }
       
 15111     }
       
 15112   }
       
 15113 }
       
 15114 
       
 15115 function checkDepsAreArrayDev(deps) {
       
 15116   {
       
 15117     if (deps !== undefined && deps !== null && !Array.isArray(deps)) {
       
 15118       // Verify deps, but only on mount to avoid extra checks.
       
 15119       // It's unlikely their type would change as usually you define them inline.
       
 15120       warning$1(false, '%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps);
       
 15121     }
       
 15122   }
       
 15123 }
       
 15124 
       
 15125 function warnOnHookMismatchInDev(currentHookName) {
       
 15126   {
       
 15127     var componentName = getComponentName(currentlyRenderingFiber$1.type);
       
 15128     if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
       
 15129       didWarnAboutMismatchedHooksForComponent.add(componentName);
       
 15130 
       
 15131       if (hookTypesDev !== null) {
       
 15132         var table = '';
       
 15133 
       
 15134         var secondColumnStart = 30;
       
 15135 
       
 15136         for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
       
 15137           var oldHookName = hookTypesDev[i];
       
 15138           var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
       
 15139 
       
 15140           var row = i + 1 + '. ' + oldHookName;
       
 15141 
       
 15142           // Extra space so second column lines up
       
 15143           // lol @ IE not supporting String#repeat
       
 15144           while (row.length < secondColumnStart) {
       
 15145             row += ' ';
       
 15146           }
       
 15147 
       
 15148           row += newHookName + '\n';
       
 15149 
       
 15150           table += row;
       
 15151         }
       
 15152 
       
 15153         warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + '   Previous render            Next render\n' + '   ------------------------------------------------------\n' + '%s' + '   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
       
 15154       }
       
 15155     }
       
 15156   }
       
 15157 }
       
 15158 
       
 15159 function throwInvalidHookError() {
       
 15160   (function () {
       
 15161     {
       
 15162       {
       
 15163         throw ReactError(Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.'));
       
 15164       }
       
 15165     }
       
 15166   })();
       
 15167 }
       
 15168 
       
 15169 function areHookInputsEqual(nextDeps, prevDeps) {
       
 15170   {
       
 15171     if (ignorePreviousDependencies) {
       
 15172       // Only true when this component is being hot reloaded.
       
 15173       return false;
       
 15174     }
       
 15175   }
       
 15176 
       
 15177   if (prevDeps === null) {
       
 15178     {
       
 15179       warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
       
 15180     }
       
 15181     return false;
       
 15182   }
       
 15183 
       
 15184   {
       
 15185     // Don't bother comparing lengths in prod because these arrays should be
       
 15186     // passed inline.
       
 15187     if (nextDeps.length !== prevDeps.length) {
       
 15188       warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + prevDeps.join(', ') + ']', '[' + nextDeps.join(', ') + ']');
       
 15189     }
       
 15190   }
       
 15191   for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
       
 15192     if (is(nextDeps[i], prevDeps[i])) {
       
 15193       continue;
       
 15194     }
       
 15195     return false;
       
 15196   }
       
 15197   return true;
       
 15198 }
       
 15199 
       
 15200 function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
       
 15201   renderExpirationTime$1 = nextRenderExpirationTime;
       
 15202   currentlyRenderingFiber$1 = workInProgress;
       
 15203   nextCurrentHook = current !== null ? current.memoizedState : null;
       
 15204 
       
 15205   {
       
 15206     hookTypesDev = current !== null ? current._debugHookTypes : null;
       
 15207     hookTypesUpdateIndexDev = -1;
       
 15208     // Used for hot reloading:
       
 15209     ignorePreviousDependencies = current !== null && current.type !== workInProgress.type;
       
 15210   }
       
 15211 
       
 15212   // The following should have already been reset
       
 15213   // currentHook = null;
       
 15214   // workInProgressHook = null;
       
 15215 
       
 15216   // remainingExpirationTime = NoWork;
       
 15217   // componentUpdateQueue = null;
       
 15218 
       
 15219   // didScheduleRenderPhaseUpdate = false;
       
 15220   // renderPhaseUpdates = null;
       
 15221   // numberOfReRenders = 0;
       
 15222   // sideEffectTag = 0;
       
 15223 
       
 15224   // TODO Warn if no hooks are used at all during mount, then some are used during update.
       
 15225   // Currently we will identify the update render as a mount because nextCurrentHook === null.
       
 15226   // This is tricky because it's valid for certain types of components (e.g. React.lazy)
       
 15227 
       
 15228   // Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
       
 15229   // Non-stateful hooks (e.g. context) don't get added to memoizedState,
       
 15230   // so nextCurrentHook would be null during updates and mounts.
       
 15231   {
       
 15232     if (nextCurrentHook !== null) {
       
 15233       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 15234     } else if (hookTypesDev !== null) {
       
 15235       // This dispatcher handles an edge case where a component is updating,
       
 15236       // but no stateful hooks have been used.
       
 15237       // We want to match the production code behavior (which will use HooksDispatcherOnMount),
       
 15238       // but with the extra DEV validation to ensure hooks ordering hasn't changed.
       
 15239       // This dispatcher does that.
       
 15240       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
       
 15241     } else {
       
 15242       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
       
 15243     }
       
 15244   }
       
 15245 
       
 15246   var children = Component(props, refOrContext);
       
 15247 
       
 15248   if (didScheduleRenderPhaseUpdate) {
       
 15249     do {
       
 15250       didScheduleRenderPhaseUpdate = false;
       
 15251       numberOfReRenders += 1;
       
 15252 
       
 15253       // Start over from the beginning of the list
       
 15254       nextCurrentHook = current !== null ? current.memoizedState : null;
       
 15255       nextWorkInProgressHook = firstWorkInProgressHook;
       
 15256 
       
 15257       currentHook = null;
       
 15258       workInProgressHook = null;
       
 15259       componentUpdateQueue = null;
       
 15260 
       
 15261       {
       
 15262         // Also validate hook order for cascading updates.
       
 15263         hookTypesUpdateIndexDev = -1;
       
 15264       }
       
 15265 
       
 15266       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 15267 
       
 15268       children = Component(props, refOrContext);
       
 15269     } while (didScheduleRenderPhaseUpdate);
       
 15270 
       
 15271     renderPhaseUpdates = null;
       
 15272     numberOfReRenders = 0;
       
 15273   }
       
 15274 
       
 15275   // We can assume the previous dispatcher is always this one, since we set it
       
 15276   // at the beginning of the render phase and there's no re-entrancy.
       
 15277   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 15278 
       
 15279   var renderedWork = currentlyRenderingFiber$1;
       
 15280 
       
 15281   renderedWork.memoizedState = firstWorkInProgressHook;
       
 15282   renderedWork.expirationTime = remainingExpirationTime;
       
 15283   renderedWork.updateQueue = componentUpdateQueue;
       
 15284   renderedWork.effectTag |= sideEffectTag;
       
 15285 
       
 15286   {
       
 15287     renderedWork._debugHookTypes = hookTypesDev;
       
 15288   }
       
 15289 
       
 15290   // This check uses currentHook so that it works the same in DEV and prod bundles.
       
 15291   // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
       
 15292   var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
       
 15293 
       
 15294   renderExpirationTime$1 = NoWork;
       
 15295   currentlyRenderingFiber$1 = null;
       
 15296 
       
 15297   currentHook = null;
       
 15298   nextCurrentHook = null;
       
 15299   firstWorkInProgressHook = null;
       
 15300   workInProgressHook = null;
       
 15301   nextWorkInProgressHook = null;
       
 15302 
       
 15303   {
       
 15304     currentHookNameInDev = null;
       
 15305     hookTypesDev = null;
       
 15306     hookTypesUpdateIndexDev = -1;
       
 15307   }
       
 15308 
       
 15309   remainingExpirationTime = NoWork;
       
 15310   componentUpdateQueue = null;
       
 15311   sideEffectTag = 0;
       
 15312 
       
 15313   // These were reset above
       
 15314   // didScheduleRenderPhaseUpdate = false;
       
 15315   // renderPhaseUpdates = null;
       
 15316   // numberOfReRenders = 0;
       
 15317 
       
 15318   (function () {
       
 15319     if (!!didRenderTooFewHooks) {
       
 15320       {
       
 15321         throw ReactError(Error('Rendered fewer hooks than expected. This may be caused by an accidental early return statement.'));
       
 15322       }
       
 15323     }
       
 15324   })();
       
 15325 
       
 15326   return children;
       
 15327 }
       
 15328 
       
 15329 function bailoutHooks(current, workInProgress, expirationTime) {
       
 15330   workInProgress.updateQueue = current.updateQueue;
       
 15331   workInProgress.effectTag &= ~(Passive | Update);
       
 15332   if (current.expirationTime <= expirationTime) {
       
 15333     current.expirationTime = NoWork;
       
 15334   }
       
 15335 }
       
 15336 
       
 15337 function resetHooks() {
       
 15338   // We can assume the previous dispatcher is always this one, since we set it
       
 15339   // at the beginning of the render phase and there's no re-entrancy.
       
 15340   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 15341 
       
 15342   // This is used to reset the state of this module when a component throws.
       
 15343   // It's also called inside mountIndeterminateComponent if we determine the
       
 15344   // component is a module-style component.
       
 15345   renderExpirationTime$1 = NoWork;
       
 15346   currentlyRenderingFiber$1 = null;
       
 15347 
       
 15348   currentHook = null;
       
 15349   nextCurrentHook = null;
       
 15350   firstWorkInProgressHook = null;
       
 15351   workInProgressHook = null;
       
 15352   nextWorkInProgressHook = null;
       
 15353 
       
 15354   {
       
 15355     hookTypesDev = null;
       
 15356     hookTypesUpdateIndexDev = -1;
       
 15357 
       
 15358     currentHookNameInDev = null;
       
 15359   }
       
 15360 
       
 15361   remainingExpirationTime = NoWork;
       
 15362   componentUpdateQueue = null;
       
 15363   sideEffectTag = 0;
       
 15364 
       
 15365   didScheduleRenderPhaseUpdate = false;
       
 15366   renderPhaseUpdates = null;
       
 15367   numberOfReRenders = 0;
       
 15368 }
       
 15369 
       
 15370 function mountWorkInProgressHook() {
       
 15371   var hook = {
       
 15372     memoizedState: null,
       
 15373 
       
 15374     baseState: null,
       
 15375     queue: null,
       
 15376     baseUpdate: null,
       
 15377 
       
 15378     next: null
       
 15379   };
       
 15380 
       
 15381   if (workInProgressHook === null) {
       
 15382     // This is the first hook in the list
       
 15383     firstWorkInProgressHook = workInProgressHook = hook;
       
 15384   } else {
       
 15385     // Append to the end of the list
       
 15386     workInProgressHook = workInProgressHook.next = hook;
       
 15387   }
       
 15388   return workInProgressHook;
       
 15389 }
       
 15390 
       
 15391 function updateWorkInProgressHook() {
       
 15392   // This function is used both for updates and for re-renders triggered by a
       
 15393   // render phase update. It assumes there is either a current hook we can
       
 15394   // clone, or a work-in-progress hook from a previous render pass that we can
       
 15395   // use as a base. When we reach the end of the base list, we must switch to
       
 15396   // the dispatcher used for mounts.
       
 15397   if (nextWorkInProgressHook !== null) {
       
 15398     // There's already a work-in-progress. Reuse it.
       
 15399     workInProgressHook = nextWorkInProgressHook;
       
 15400     nextWorkInProgressHook = workInProgressHook.next;
       
 15401 
       
 15402     currentHook = nextCurrentHook;
       
 15403     nextCurrentHook = currentHook !== null ? currentHook.next : null;
       
 15404   } else {
       
 15405     // Clone from the current hook.
       
 15406     (function () {
       
 15407       if (!(nextCurrentHook !== null)) {
       
 15408         {
       
 15409           throw ReactError(Error('Rendered more hooks than during the previous render.'));
       
 15410         }
       
 15411       }
       
 15412     })();
       
 15413     currentHook = nextCurrentHook;
       
 15414 
       
 15415     var newHook = {
       
 15416       memoizedState: currentHook.memoizedState,
       
 15417 
       
 15418       baseState: currentHook.baseState,
       
 15419       queue: currentHook.queue,
       
 15420       baseUpdate: currentHook.baseUpdate,
       
 15421 
       
 15422       next: null
       
 15423     };
       
 15424 
       
 15425     if (workInProgressHook === null) {
       
 15426       // This is the first hook in the list.
       
 15427       workInProgressHook = firstWorkInProgressHook = newHook;
       
 15428     } else {
       
 15429       // Append to the end of the list.
       
 15430       workInProgressHook = workInProgressHook.next = newHook;
       
 15431     }
       
 15432     nextCurrentHook = currentHook.next;
       
 15433   }
       
 15434   return workInProgressHook;
       
 15435 }
       
 15436 
       
 15437 function createFunctionComponentUpdateQueue() {
 16570   return {
 15438   return {
 16571     value: value,
 15439     lastEffect: null
 16572     source: source,
       
 16573     stack: getStackByFiberInDevAndProd(source)
       
 16574   };
 15440   };
 16575 }
 15441 }
       
 15442 
       
 15443 function basicStateReducer(state, action) {
       
 15444   return typeof action === 'function' ? action(state) : action;
       
 15445 }
       
 15446 
       
 15447 function mountReducer(reducer, initialArg, init) {
       
 15448   var hook = mountWorkInProgressHook();
       
 15449   var initialState = void 0;
       
 15450   if (init !== undefined) {
       
 15451     initialState = init(initialArg);
       
 15452   } else {
       
 15453     initialState = initialArg;
       
 15454   }
       
 15455   hook.memoizedState = hook.baseState = initialState;
       
 15456   var queue = hook.queue = {
       
 15457     last: null,
       
 15458     dispatch: null,
       
 15459     lastRenderedReducer: reducer,
       
 15460     lastRenderedState: initialState
       
 15461   };
       
 15462   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 15463   // Flow doesn't know this is non-null, but we do.
       
 15464   currentlyRenderingFiber$1, queue);
       
 15465   return [hook.memoizedState, dispatch];
       
 15466 }
       
 15467 
       
 15468 function updateReducer(reducer, initialArg, init) {
       
 15469   var hook = updateWorkInProgressHook();
       
 15470   var queue = hook.queue;
       
 15471   (function () {
       
 15472     if (!(queue !== null)) {
       
 15473       {
       
 15474         throw ReactError(Error('Should have a queue. This is likely a bug in React. Please file an issue.'));
       
 15475       }
       
 15476     }
       
 15477   })();
       
 15478 
       
 15479   queue.lastRenderedReducer = reducer;
       
 15480 
       
 15481   if (numberOfReRenders > 0) {
       
 15482     // This is a re-render. Apply the new render phase updates to the previous
       
 15483     var _dispatch = queue.dispatch;
       
 15484     if (renderPhaseUpdates !== null) {
       
 15485       // Render phase updates are stored in a map of queue -> linked list
       
 15486       var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 15487       if (firstRenderPhaseUpdate !== undefined) {
       
 15488         renderPhaseUpdates.delete(queue);
       
 15489         var newState = hook.memoizedState;
       
 15490         var update = firstRenderPhaseUpdate;
       
 15491         do {
       
 15492           // Process this render phase update. We don't have to check the
       
 15493           // priority because it will always be the same as the current
       
 15494           // render's.
       
 15495           var _action = update.action;
       
 15496           newState = reducer(newState, _action);
       
 15497           update = update.next;
       
 15498         } while (update !== null);
       
 15499 
       
 15500         // Mark that the fiber performed work, but only if the new state is
       
 15501         // different from the current state.
       
 15502         if (!is(newState, hook.memoizedState)) {
       
 15503           markWorkInProgressReceivedUpdate();
       
 15504         }
       
 15505 
       
 15506         hook.memoizedState = newState;
       
 15507         // Don't persist the state accumulated from the render phase updates to
       
 15508         // the base state unless the queue is empty.
       
 15509         // TODO: Not sure if this is the desired semantics, but it's what we
       
 15510         // do for gDSFP. I can't remember why.
       
 15511         if (hook.baseUpdate === queue.last) {
       
 15512           hook.baseState = newState;
       
 15513         }
       
 15514 
       
 15515         queue.lastRenderedState = newState;
       
 15516 
       
 15517         return [newState, _dispatch];
       
 15518       }
       
 15519     }
       
 15520     return [hook.memoizedState, _dispatch];
       
 15521   }
       
 15522 
       
 15523   // The last update in the entire queue
       
 15524   var last = queue.last;
       
 15525   // The last update that is part of the base state.
       
 15526   var baseUpdate = hook.baseUpdate;
       
 15527   var baseState = hook.baseState;
       
 15528 
       
 15529   // Find the first unprocessed update.
       
 15530   var first = void 0;
       
 15531   if (baseUpdate !== null) {
       
 15532     if (last !== null) {
       
 15533       // For the first update, the queue is a circular linked list where
       
 15534       // `queue.last.next = queue.first`. Once the first update commits, and
       
 15535       // the `baseUpdate` is no longer empty, we can unravel the list.
       
 15536       last.next = null;
       
 15537     }
       
 15538     first = baseUpdate.next;
       
 15539   } else {
       
 15540     first = last !== null ? last.next : null;
       
 15541   }
       
 15542   if (first !== null) {
       
 15543     var _newState = baseState;
       
 15544     var newBaseState = null;
       
 15545     var newBaseUpdate = null;
       
 15546     var prevUpdate = baseUpdate;
       
 15547     var _update = first;
       
 15548     var didSkip = false;
       
 15549     do {
       
 15550       var updateExpirationTime = _update.expirationTime;
       
 15551       if (updateExpirationTime < renderExpirationTime$1) {
       
 15552         // Priority is insufficient. Skip this update. If this is the first
       
 15553         // skipped update, the previous update/state is the new base
       
 15554         // update/state.
       
 15555         if (!didSkip) {
       
 15556           didSkip = true;
       
 15557           newBaseUpdate = prevUpdate;
       
 15558           newBaseState = _newState;
       
 15559         }
       
 15560         // Update the remaining priority in the queue.
       
 15561         if (updateExpirationTime > remainingExpirationTime) {
       
 15562           remainingExpirationTime = updateExpirationTime;
       
 15563         }
       
 15564       } else {
       
 15565         // This update does have sufficient priority.
       
 15566 
       
 15567         // Mark the event time of this update as relevant to this render pass.
       
 15568         // TODO: This should ideally use the true event time of this update rather than
       
 15569         // its priority which is a derived and not reverseable value.
       
 15570         // TODO: We should skip this update if it was already committed but currently
       
 15571         // we have no way of detecting the difference between a committed and suspended
       
 15572         // update here.
       
 15573         markRenderEventTimeAndConfig(updateExpirationTime, _update.suspenseConfig);
       
 15574 
       
 15575         // Process this update.
       
 15576         if (_update.eagerReducer === reducer) {
       
 15577           // If this update was processed eagerly, and its reducer matches the
       
 15578           // current reducer, we can use the eagerly computed state.
       
 15579           _newState = _update.eagerState;
       
 15580         } else {
       
 15581           var _action2 = _update.action;
       
 15582           _newState = reducer(_newState, _action2);
       
 15583         }
       
 15584       }
       
 15585       prevUpdate = _update;
       
 15586       _update = _update.next;
       
 15587     } while (_update !== null && _update !== first);
       
 15588 
       
 15589     if (!didSkip) {
       
 15590       newBaseUpdate = prevUpdate;
       
 15591       newBaseState = _newState;
       
 15592     }
       
 15593 
       
 15594     // Mark that the fiber performed work, but only if the new state is
       
 15595     // different from the current state.
       
 15596     if (!is(_newState, hook.memoizedState)) {
       
 15597       markWorkInProgressReceivedUpdate();
       
 15598     }
       
 15599 
       
 15600     hook.memoizedState = _newState;
       
 15601     hook.baseUpdate = newBaseUpdate;
       
 15602     hook.baseState = newBaseState;
       
 15603 
       
 15604     queue.lastRenderedState = _newState;
       
 15605   }
       
 15606 
       
 15607   var dispatch = queue.dispatch;
       
 15608   return [hook.memoizedState, dispatch];
       
 15609 }
       
 15610 
       
 15611 function mountState(initialState) {
       
 15612   var hook = mountWorkInProgressHook();
       
 15613   if (typeof initialState === 'function') {
       
 15614     initialState = initialState();
       
 15615   }
       
 15616   hook.memoizedState = hook.baseState = initialState;
       
 15617   var queue = hook.queue = {
       
 15618     last: null,
       
 15619     dispatch: null,
       
 15620     lastRenderedReducer: basicStateReducer,
       
 15621     lastRenderedState: initialState
       
 15622   };
       
 15623   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 15624   // Flow doesn't know this is non-null, but we do.
       
 15625   currentlyRenderingFiber$1, queue);
       
 15626   return [hook.memoizedState, dispatch];
       
 15627 }
       
 15628 
       
 15629 function updateState(initialState) {
       
 15630   return updateReducer(basicStateReducer, initialState);
       
 15631 }
       
 15632 
       
 15633 function pushEffect(tag, create, destroy, deps) {
       
 15634   var effect = {
       
 15635     tag: tag,
       
 15636     create: create,
       
 15637     destroy: destroy,
       
 15638     deps: deps,
       
 15639     // Circular
       
 15640     next: null
       
 15641   };
       
 15642   if (componentUpdateQueue === null) {
       
 15643     componentUpdateQueue = createFunctionComponentUpdateQueue();
       
 15644     componentUpdateQueue.lastEffect = effect.next = effect;
       
 15645   } else {
       
 15646     var _lastEffect = componentUpdateQueue.lastEffect;
       
 15647     if (_lastEffect === null) {
       
 15648       componentUpdateQueue.lastEffect = effect.next = effect;
       
 15649     } else {
       
 15650       var firstEffect = _lastEffect.next;
       
 15651       _lastEffect.next = effect;
       
 15652       effect.next = firstEffect;
       
 15653       componentUpdateQueue.lastEffect = effect;
       
 15654     }
       
 15655   }
       
 15656   return effect;
       
 15657 }
       
 15658 
       
 15659 function mountRef(initialValue) {
       
 15660   var hook = mountWorkInProgressHook();
       
 15661   var ref = { current: initialValue };
       
 15662   {
       
 15663     Object.seal(ref);
       
 15664   }
       
 15665   hook.memoizedState = ref;
       
 15666   return ref;
       
 15667 }
       
 15668 
       
 15669 function updateRef(initialValue) {
       
 15670   var hook = updateWorkInProgressHook();
       
 15671   return hook.memoizedState;
       
 15672 }
       
 15673 
       
 15674 function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 15675   var hook = mountWorkInProgressHook();
       
 15676   var nextDeps = deps === undefined ? null : deps;
       
 15677   sideEffectTag |= fiberEffectTag;
       
 15678   hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);
       
 15679 }
       
 15680 
       
 15681 function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 15682   var hook = updateWorkInProgressHook();
       
 15683   var nextDeps = deps === undefined ? null : deps;
       
 15684   var destroy = undefined;
       
 15685 
       
 15686   if (currentHook !== null) {
       
 15687     var prevEffect = currentHook.memoizedState;
       
 15688     destroy = prevEffect.destroy;
       
 15689     if (nextDeps !== null) {
       
 15690       var prevDeps = prevEffect.deps;
       
 15691       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 15692         pushEffect(NoEffect$1, create, destroy, nextDeps);
       
 15693         return;
       
 15694       }
       
 15695     }
       
 15696   }
       
 15697 
       
 15698   sideEffectTag |= fiberEffectTag;
       
 15699   hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);
       
 15700 }
       
 15701 
       
 15702 function mountEffect(create, deps) {
       
 15703   {
       
 15704     // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 15705     if ('undefined' !== typeof jest) {
       
 15706       warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
       
 15707     }
       
 15708   }
       
 15709   return mountEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 15710 }
       
 15711 
       
 15712 function updateEffect(create, deps) {
       
 15713   {
       
 15714     // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 15715     if ('undefined' !== typeof jest) {
       
 15716       warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
       
 15717     }
       
 15718   }
       
 15719   return updateEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 15720 }
       
 15721 
       
 15722 function mountLayoutEffect(create, deps) {
       
 15723   return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 15724 }
       
 15725 
       
 15726 function updateLayoutEffect(create, deps) {
       
 15727   return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 15728 }
       
 15729 
       
 15730 function imperativeHandleEffect(create, ref) {
       
 15731   if (typeof ref === 'function') {
       
 15732     var refCallback = ref;
       
 15733     var _inst = create();
       
 15734     refCallback(_inst);
       
 15735     return function () {
       
 15736       refCallback(null);
       
 15737     };
       
 15738   } else if (ref !== null && ref !== undefined) {
       
 15739     var refObject = ref;
       
 15740     {
       
 15741       !refObject.hasOwnProperty('current') ? warning$1(false, 'Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}') : void 0;
       
 15742     }
       
 15743     var _inst2 = create();
       
 15744     refObject.current = _inst2;
       
 15745     return function () {
       
 15746       refObject.current = null;
       
 15747     };
       
 15748   }
       
 15749 }
       
 15750 
       
 15751 function mountImperativeHandle(ref, create, deps) {
       
 15752   {
       
 15753     !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
       
 15754   }
       
 15755 
       
 15756   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 15757   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 15758 
       
 15759   return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 15760 }
       
 15761 
       
 15762 function updateImperativeHandle(ref, create, deps) {
       
 15763   {
       
 15764     !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
       
 15765   }
       
 15766 
       
 15767   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 15768   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 15769 
       
 15770   return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 15771 }
       
 15772 
       
 15773 function mountDebugValue(value, formatterFn) {
       
 15774   // This hook is normally a no-op.
       
 15775   // The react-debug-hooks package injects its own implementation
       
 15776   // so that e.g. DevTools can display custom hook values.
       
 15777 }
       
 15778 
       
 15779 var updateDebugValue = mountDebugValue;
       
 15780 
       
 15781 function mountCallback(callback, deps) {
       
 15782   var hook = mountWorkInProgressHook();
       
 15783   var nextDeps = deps === undefined ? null : deps;
       
 15784   hook.memoizedState = [callback, nextDeps];
       
 15785   return callback;
       
 15786 }
       
 15787 
       
 15788 function updateCallback(callback, deps) {
       
 15789   var hook = updateWorkInProgressHook();
       
 15790   var nextDeps = deps === undefined ? null : deps;
       
 15791   var prevState = hook.memoizedState;
       
 15792   if (prevState !== null) {
       
 15793     if (nextDeps !== null) {
       
 15794       var prevDeps = prevState[1];
       
 15795       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 15796         return prevState[0];
       
 15797       }
       
 15798     }
       
 15799   }
       
 15800   hook.memoizedState = [callback, nextDeps];
       
 15801   return callback;
       
 15802 }
       
 15803 
       
 15804 function mountMemo(nextCreate, deps) {
       
 15805   var hook = mountWorkInProgressHook();
       
 15806   var nextDeps = deps === undefined ? null : deps;
       
 15807   var nextValue = nextCreate();
       
 15808   hook.memoizedState = [nextValue, nextDeps];
       
 15809   return nextValue;
       
 15810 }
       
 15811 
       
 15812 function updateMemo(nextCreate, deps) {
       
 15813   var hook = updateWorkInProgressHook();
       
 15814   var nextDeps = deps === undefined ? null : deps;
       
 15815   var prevState = hook.memoizedState;
       
 15816   if (prevState !== null) {
       
 15817     // Assume these are defined. If they're not, areHookInputsEqual will warn.
       
 15818     if (nextDeps !== null) {
       
 15819       var prevDeps = prevState[1];
       
 15820       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 15821         return prevState[0];
       
 15822       }
       
 15823     }
       
 15824   }
       
 15825   var nextValue = nextCreate();
       
 15826   hook.memoizedState = [nextValue, nextDeps];
       
 15827   return nextValue;
       
 15828 }
       
 15829 
       
 15830 function dispatchAction(fiber, queue, action) {
       
 15831   (function () {
       
 15832     if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
       
 15833       {
       
 15834         throw ReactError(Error('Too many re-renders. React limits the number of renders to prevent an infinite loop.'));
       
 15835       }
       
 15836     }
       
 15837   })();
       
 15838 
       
 15839   {
       
 15840     !(arguments.length <= 3) ? warning$1(false, "State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().') : void 0;
       
 15841   }
       
 15842 
       
 15843   var alternate = fiber.alternate;
       
 15844   if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
       
 15845     // This is a render phase update. Stash it in a lazily-created map of
       
 15846     // queue -> linked list of updates. After this render pass, we'll restart
       
 15847     // and apply the stashed updates on top of the work-in-progress hook.
       
 15848     didScheduleRenderPhaseUpdate = true;
       
 15849     var update = {
       
 15850       expirationTime: renderExpirationTime$1,
       
 15851       suspenseConfig: null,
       
 15852       action: action,
       
 15853       eagerReducer: null,
       
 15854       eagerState: null,
       
 15855       next: null
       
 15856     };
       
 15857     {
       
 15858       update.priority = getCurrentPriorityLevel();
       
 15859     }
       
 15860     if (renderPhaseUpdates === null) {
       
 15861       renderPhaseUpdates = new Map();
       
 15862     }
       
 15863     var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 15864     if (firstRenderPhaseUpdate === undefined) {
       
 15865       renderPhaseUpdates.set(queue, update);
       
 15866     } else {
       
 15867       // Append the update to the end of the list.
       
 15868       var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
       
 15869       while (lastRenderPhaseUpdate.next !== null) {
       
 15870         lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
       
 15871       }
       
 15872       lastRenderPhaseUpdate.next = update;
       
 15873     }
       
 15874   } else {
       
 15875     if (revertPassiveEffectsChange) {
       
 15876       flushPassiveEffects();
       
 15877     }
       
 15878 
       
 15879     var currentTime = requestCurrentTime();
       
 15880     var _suspenseConfig = requestCurrentSuspenseConfig();
       
 15881     var _expirationTime = computeExpirationForFiber(currentTime, fiber, _suspenseConfig);
       
 15882 
       
 15883     var _update2 = {
       
 15884       expirationTime: _expirationTime,
       
 15885       suspenseConfig: _suspenseConfig,
       
 15886       action: action,
       
 15887       eagerReducer: null,
       
 15888       eagerState: null,
       
 15889       next: null
       
 15890     };
       
 15891 
       
 15892     {
       
 15893       _update2.priority = getCurrentPriorityLevel();
       
 15894     }
       
 15895 
       
 15896     // Append the update to the end of the list.
       
 15897     var _last = queue.last;
       
 15898     if (_last === null) {
       
 15899       // This is the first update. Create a circular list.
       
 15900       _update2.next = _update2;
       
 15901     } else {
       
 15902       var first = _last.next;
       
 15903       if (first !== null) {
       
 15904         // Still circular.
       
 15905         _update2.next = first;
       
 15906       }
       
 15907       _last.next = _update2;
       
 15908     }
       
 15909     queue.last = _update2;
       
 15910 
       
 15911     if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
       
 15912       // The queue is currently empty, which means we can eagerly compute the
       
 15913       // next state before entering the render phase. If the new state is the
       
 15914       // same as the current state, we may be able to bail out entirely.
       
 15915       var _lastRenderedReducer = queue.lastRenderedReducer;
       
 15916       if (_lastRenderedReducer !== null) {
       
 15917         var prevDispatcher = void 0;
       
 15918         {
       
 15919           prevDispatcher = ReactCurrentDispatcher$1.current;
       
 15920           ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 15921         }
       
 15922         try {
       
 15923           var currentState = queue.lastRenderedState;
       
 15924           var _eagerState = _lastRenderedReducer(currentState, action);
       
 15925           // Stash the eagerly computed state, and the reducer used to compute
       
 15926           // it, on the update object. If the reducer hasn't changed by the
       
 15927           // time we enter the render phase, then the eager state can be used
       
 15928           // without calling the reducer again.
       
 15929           _update2.eagerReducer = _lastRenderedReducer;
       
 15930           _update2.eagerState = _eagerState;
       
 15931           if (is(_eagerState, currentState)) {
       
 15932             // Fast path. We can bail out without scheduling React to re-render.
       
 15933             // It's still possible that we'll need to rebase this update later,
       
 15934             // if the component re-renders for a different reason and by that
       
 15935             // time the reducer has changed.
       
 15936             return;
       
 15937           }
       
 15938         } catch (error) {
       
 15939           // Suppress the error. It will throw again in the render phase.
       
 15940         } finally {
       
 15941           {
       
 15942             ReactCurrentDispatcher$1.current = prevDispatcher;
       
 15943           }
       
 15944         }
       
 15945       }
       
 15946     }
       
 15947     {
       
 15948       // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 15949       if ('undefined' !== typeof jest) {
       
 15950         warnIfNotScopedWithMatchingAct(fiber);
       
 15951         warnIfNotCurrentlyActingUpdatesInDev(fiber);
       
 15952       }
       
 15953     }
       
 15954     scheduleWork(fiber, _expirationTime);
       
 15955   }
       
 15956 }
       
 15957 
       
 15958 var ContextOnlyDispatcher = {
       
 15959   readContext: readContext,
       
 15960 
       
 15961   useCallback: throwInvalidHookError,
       
 15962   useContext: throwInvalidHookError,
       
 15963   useEffect: throwInvalidHookError,
       
 15964   useImperativeHandle: throwInvalidHookError,
       
 15965   useLayoutEffect: throwInvalidHookError,
       
 15966   useMemo: throwInvalidHookError,
       
 15967   useReducer: throwInvalidHookError,
       
 15968   useRef: throwInvalidHookError,
       
 15969   useState: throwInvalidHookError,
       
 15970   useDebugValue: throwInvalidHookError,
       
 15971   useResponder: throwInvalidHookError
       
 15972 };
       
 15973 
       
 15974 var HooksDispatcherOnMountInDEV = null;
       
 15975 var HooksDispatcherOnMountWithHookTypesInDEV = null;
       
 15976 var HooksDispatcherOnUpdateInDEV = null;
       
 15977 var InvalidNestedHooksDispatcherOnMountInDEV = null;
       
 15978 var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
       
 15979 
       
 15980 {
       
 15981   var warnInvalidContextAccess = function () {
       
 15982     warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
       
 15983   };
       
 15984 
       
 15985   var warnInvalidHookAccess = function () {
       
 15986     warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
       
 15987   };
       
 15988 
       
 15989   HooksDispatcherOnMountInDEV = {
       
 15990     readContext: function (context, observedBits) {
       
 15991       return readContext(context, observedBits);
       
 15992     },
       
 15993     useCallback: function (callback, deps) {
       
 15994       currentHookNameInDev = 'useCallback';
       
 15995       mountHookTypesDev();
       
 15996       checkDepsAreArrayDev(deps);
       
 15997       return mountCallback(callback, deps);
       
 15998     },
       
 15999     useContext: function (context, observedBits) {
       
 16000       currentHookNameInDev = 'useContext';
       
 16001       mountHookTypesDev();
       
 16002       return readContext(context, observedBits);
       
 16003     },
       
 16004     useEffect: function (create, deps) {
       
 16005       currentHookNameInDev = 'useEffect';
       
 16006       mountHookTypesDev();
       
 16007       checkDepsAreArrayDev(deps);
       
 16008       return mountEffect(create, deps);
       
 16009     },
       
 16010     useImperativeHandle: function (ref, create, deps) {
       
 16011       currentHookNameInDev = 'useImperativeHandle';
       
 16012       mountHookTypesDev();
       
 16013       checkDepsAreArrayDev(deps);
       
 16014       return mountImperativeHandle(ref, create, deps);
       
 16015     },
       
 16016     useLayoutEffect: function (create, deps) {
       
 16017       currentHookNameInDev = 'useLayoutEffect';
       
 16018       mountHookTypesDev();
       
 16019       checkDepsAreArrayDev(deps);
       
 16020       return mountLayoutEffect(create, deps);
       
 16021     },
       
 16022     useMemo: function (create, deps) {
       
 16023       currentHookNameInDev = 'useMemo';
       
 16024       mountHookTypesDev();
       
 16025       checkDepsAreArrayDev(deps);
       
 16026       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16027       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16028       try {
       
 16029         return mountMemo(create, deps);
       
 16030       } finally {
       
 16031         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16032       }
       
 16033     },
       
 16034     useReducer: function (reducer, initialArg, init) {
       
 16035       currentHookNameInDev = 'useReducer';
       
 16036       mountHookTypesDev();
       
 16037       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16038       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16039       try {
       
 16040         return mountReducer(reducer, initialArg, init);
       
 16041       } finally {
       
 16042         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16043       }
       
 16044     },
       
 16045     useRef: function (initialValue) {
       
 16046       currentHookNameInDev = 'useRef';
       
 16047       mountHookTypesDev();
       
 16048       return mountRef(initialValue);
       
 16049     },
       
 16050     useState: function (initialState) {
       
 16051       currentHookNameInDev = 'useState';
       
 16052       mountHookTypesDev();
       
 16053       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16054       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16055       try {
       
 16056         return mountState(initialState);
       
 16057       } finally {
       
 16058         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16059       }
       
 16060     },
       
 16061     useDebugValue: function (value, formatterFn) {
       
 16062       currentHookNameInDev = 'useDebugValue';
       
 16063       mountHookTypesDev();
       
 16064       return mountDebugValue(value, formatterFn);
       
 16065     },
       
 16066     useResponder: function (responder, props) {
       
 16067       currentHookNameInDev = 'useResponder';
       
 16068       mountHookTypesDev();
       
 16069       return createResponderListener(responder, props);
       
 16070     }
       
 16071   };
       
 16072 
       
 16073   HooksDispatcherOnMountWithHookTypesInDEV = {
       
 16074     readContext: function (context, observedBits) {
       
 16075       return readContext(context, observedBits);
       
 16076     },
       
 16077     useCallback: function (callback, deps) {
       
 16078       currentHookNameInDev = 'useCallback';
       
 16079       updateHookTypesDev();
       
 16080       return mountCallback(callback, deps);
       
 16081     },
       
 16082     useContext: function (context, observedBits) {
       
 16083       currentHookNameInDev = 'useContext';
       
 16084       updateHookTypesDev();
       
 16085       return readContext(context, observedBits);
       
 16086     },
       
 16087     useEffect: function (create, deps) {
       
 16088       currentHookNameInDev = 'useEffect';
       
 16089       updateHookTypesDev();
       
 16090       return mountEffect(create, deps);
       
 16091     },
       
 16092     useImperativeHandle: function (ref, create, deps) {
       
 16093       currentHookNameInDev = 'useImperativeHandle';
       
 16094       updateHookTypesDev();
       
 16095       return mountImperativeHandle(ref, create, deps);
       
 16096     },
       
 16097     useLayoutEffect: function (create, deps) {
       
 16098       currentHookNameInDev = 'useLayoutEffect';
       
 16099       updateHookTypesDev();
       
 16100       return mountLayoutEffect(create, deps);
       
 16101     },
       
 16102     useMemo: function (create, deps) {
       
 16103       currentHookNameInDev = 'useMemo';
       
 16104       updateHookTypesDev();
       
 16105       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16106       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16107       try {
       
 16108         return mountMemo(create, deps);
       
 16109       } finally {
       
 16110         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16111       }
       
 16112     },
       
 16113     useReducer: function (reducer, initialArg, init) {
       
 16114       currentHookNameInDev = 'useReducer';
       
 16115       updateHookTypesDev();
       
 16116       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16117       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16118       try {
       
 16119         return mountReducer(reducer, initialArg, init);
       
 16120       } finally {
       
 16121         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16122       }
       
 16123     },
       
 16124     useRef: function (initialValue) {
       
 16125       currentHookNameInDev = 'useRef';
       
 16126       updateHookTypesDev();
       
 16127       return mountRef(initialValue);
       
 16128     },
       
 16129     useState: function (initialState) {
       
 16130       currentHookNameInDev = 'useState';
       
 16131       updateHookTypesDev();
       
 16132       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16133       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16134       try {
       
 16135         return mountState(initialState);
       
 16136       } finally {
       
 16137         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16138       }
       
 16139     },
       
 16140     useDebugValue: function (value, formatterFn) {
       
 16141       currentHookNameInDev = 'useDebugValue';
       
 16142       updateHookTypesDev();
       
 16143       return mountDebugValue(value, formatterFn);
       
 16144     },
       
 16145     useResponder: function (responder, props) {
       
 16146       currentHookNameInDev = 'useResponder';
       
 16147       updateHookTypesDev();
       
 16148       return createResponderListener(responder, props);
       
 16149     }
       
 16150   };
       
 16151 
       
 16152   HooksDispatcherOnUpdateInDEV = {
       
 16153     readContext: function (context, observedBits) {
       
 16154       return readContext(context, observedBits);
       
 16155     },
       
 16156     useCallback: function (callback, deps) {
       
 16157       currentHookNameInDev = 'useCallback';
       
 16158       updateHookTypesDev();
       
 16159       return updateCallback(callback, deps);
       
 16160     },
       
 16161     useContext: function (context, observedBits) {
       
 16162       currentHookNameInDev = 'useContext';
       
 16163       updateHookTypesDev();
       
 16164       return readContext(context, observedBits);
       
 16165     },
       
 16166     useEffect: function (create, deps) {
       
 16167       currentHookNameInDev = 'useEffect';
       
 16168       updateHookTypesDev();
       
 16169       return updateEffect(create, deps);
       
 16170     },
       
 16171     useImperativeHandle: function (ref, create, deps) {
       
 16172       currentHookNameInDev = 'useImperativeHandle';
       
 16173       updateHookTypesDev();
       
 16174       return updateImperativeHandle(ref, create, deps);
       
 16175     },
       
 16176     useLayoutEffect: function (create, deps) {
       
 16177       currentHookNameInDev = 'useLayoutEffect';
       
 16178       updateHookTypesDev();
       
 16179       return updateLayoutEffect(create, deps);
       
 16180     },
       
 16181     useMemo: function (create, deps) {
       
 16182       currentHookNameInDev = 'useMemo';
       
 16183       updateHookTypesDev();
       
 16184       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16185       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16186       try {
       
 16187         return updateMemo(create, deps);
       
 16188       } finally {
       
 16189         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16190       }
       
 16191     },
       
 16192     useReducer: function (reducer, initialArg, init) {
       
 16193       currentHookNameInDev = 'useReducer';
       
 16194       updateHookTypesDev();
       
 16195       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16196       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16197       try {
       
 16198         return updateReducer(reducer, initialArg, init);
       
 16199       } finally {
       
 16200         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16201       }
       
 16202     },
       
 16203     useRef: function (initialValue) {
       
 16204       currentHookNameInDev = 'useRef';
       
 16205       updateHookTypesDev();
       
 16206       return updateRef(initialValue);
       
 16207     },
       
 16208     useState: function (initialState) {
       
 16209       currentHookNameInDev = 'useState';
       
 16210       updateHookTypesDev();
       
 16211       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16212       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16213       try {
       
 16214         return updateState(initialState);
       
 16215       } finally {
       
 16216         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16217       }
       
 16218     },
       
 16219     useDebugValue: function (value, formatterFn) {
       
 16220       currentHookNameInDev = 'useDebugValue';
       
 16221       updateHookTypesDev();
       
 16222       return updateDebugValue(value, formatterFn);
       
 16223     },
       
 16224     useResponder: function (responder, props) {
       
 16225       currentHookNameInDev = 'useResponder';
       
 16226       updateHookTypesDev();
       
 16227       return createResponderListener(responder, props);
       
 16228     }
       
 16229   };
       
 16230 
       
 16231   InvalidNestedHooksDispatcherOnMountInDEV = {
       
 16232     readContext: function (context, observedBits) {
       
 16233       warnInvalidContextAccess();
       
 16234       return readContext(context, observedBits);
       
 16235     },
       
 16236     useCallback: function (callback, deps) {
       
 16237       currentHookNameInDev = 'useCallback';
       
 16238       warnInvalidHookAccess();
       
 16239       mountHookTypesDev();
       
 16240       return mountCallback(callback, deps);
       
 16241     },
       
 16242     useContext: function (context, observedBits) {
       
 16243       currentHookNameInDev = 'useContext';
       
 16244       warnInvalidHookAccess();
       
 16245       mountHookTypesDev();
       
 16246       return readContext(context, observedBits);
       
 16247     },
       
 16248     useEffect: function (create, deps) {
       
 16249       currentHookNameInDev = 'useEffect';
       
 16250       warnInvalidHookAccess();
       
 16251       mountHookTypesDev();
       
 16252       return mountEffect(create, deps);
       
 16253     },
       
 16254     useImperativeHandle: function (ref, create, deps) {
       
 16255       currentHookNameInDev = 'useImperativeHandle';
       
 16256       warnInvalidHookAccess();
       
 16257       mountHookTypesDev();
       
 16258       return mountImperativeHandle(ref, create, deps);
       
 16259     },
       
 16260     useLayoutEffect: function (create, deps) {
       
 16261       currentHookNameInDev = 'useLayoutEffect';
       
 16262       warnInvalidHookAccess();
       
 16263       mountHookTypesDev();
       
 16264       return mountLayoutEffect(create, deps);
       
 16265     },
       
 16266     useMemo: function (create, deps) {
       
 16267       currentHookNameInDev = 'useMemo';
       
 16268       warnInvalidHookAccess();
       
 16269       mountHookTypesDev();
       
 16270       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16271       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16272       try {
       
 16273         return mountMemo(create, deps);
       
 16274       } finally {
       
 16275         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16276       }
       
 16277     },
       
 16278     useReducer: function (reducer, initialArg, init) {
       
 16279       currentHookNameInDev = 'useReducer';
       
 16280       warnInvalidHookAccess();
       
 16281       mountHookTypesDev();
       
 16282       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16283       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16284       try {
       
 16285         return mountReducer(reducer, initialArg, init);
       
 16286       } finally {
       
 16287         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16288       }
       
 16289     },
       
 16290     useRef: function (initialValue) {
       
 16291       currentHookNameInDev = 'useRef';
       
 16292       warnInvalidHookAccess();
       
 16293       mountHookTypesDev();
       
 16294       return mountRef(initialValue);
       
 16295     },
       
 16296     useState: function (initialState) {
       
 16297       currentHookNameInDev = 'useState';
       
 16298       warnInvalidHookAccess();
       
 16299       mountHookTypesDev();
       
 16300       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16301       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16302       try {
       
 16303         return mountState(initialState);
       
 16304       } finally {
       
 16305         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16306       }
       
 16307     },
       
 16308     useDebugValue: function (value, formatterFn) {
       
 16309       currentHookNameInDev = 'useDebugValue';
       
 16310       warnInvalidHookAccess();
       
 16311       mountHookTypesDev();
       
 16312       return mountDebugValue(value, formatterFn);
       
 16313     },
       
 16314     useResponder: function (responder, props) {
       
 16315       currentHookNameInDev = 'useResponder';
       
 16316       warnInvalidHookAccess();
       
 16317       mountHookTypesDev();
       
 16318       return createResponderListener(responder, props);
       
 16319     }
       
 16320   };
       
 16321 
       
 16322   InvalidNestedHooksDispatcherOnUpdateInDEV = {
       
 16323     readContext: function (context, observedBits) {
       
 16324       warnInvalidContextAccess();
       
 16325       return readContext(context, observedBits);
       
 16326     },
       
 16327     useCallback: function (callback, deps) {
       
 16328       currentHookNameInDev = 'useCallback';
       
 16329       warnInvalidHookAccess();
       
 16330       updateHookTypesDev();
       
 16331       return updateCallback(callback, deps);
       
 16332     },
       
 16333     useContext: function (context, observedBits) {
       
 16334       currentHookNameInDev = 'useContext';
       
 16335       warnInvalidHookAccess();
       
 16336       updateHookTypesDev();
       
 16337       return readContext(context, observedBits);
       
 16338     },
       
 16339     useEffect: function (create, deps) {
       
 16340       currentHookNameInDev = 'useEffect';
       
 16341       warnInvalidHookAccess();
       
 16342       updateHookTypesDev();
       
 16343       return updateEffect(create, deps);
       
 16344     },
       
 16345     useImperativeHandle: function (ref, create, deps) {
       
 16346       currentHookNameInDev = 'useImperativeHandle';
       
 16347       warnInvalidHookAccess();
       
 16348       updateHookTypesDev();
       
 16349       return updateImperativeHandle(ref, create, deps);
       
 16350     },
       
 16351     useLayoutEffect: function (create, deps) {
       
 16352       currentHookNameInDev = 'useLayoutEffect';
       
 16353       warnInvalidHookAccess();
       
 16354       updateHookTypesDev();
       
 16355       return updateLayoutEffect(create, deps);
       
 16356     },
       
 16357     useMemo: function (create, deps) {
       
 16358       currentHookNameInDev = 'useMemo';
       
 16359       warnInvalidHookAccess();
       
 16360       updateHookTypesDev();
       
 16361       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16362       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16363       try {
       
 16364         return updateMemo(create, deps);
       
 16365       } finally {
       
 16366         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16367       }
       
 16368     },
       
 16369     useReducer: function (reducer, initialArg, init) {
       
 16370       currentHookNameInDev = 'useReducer';
       
 16371       warnInvalidHookAccess();
       
 16372       updateHookTypesDev();
       
 16373       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16374       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16375       try {
       
 16376         return updateReducer(reducer, initialArg, init);
       
 16377       } finally {
       
 16378         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16379       }
       
 16380     },
       
 16381     useRef: function (initialValue) {
       
 16382       currentHookNameInDev = 'useRef';
       
 16383       warnInvalidHookAccess();
       
 16384       updateHookTypesDev();
       
 16385       return updateRef(initialValue);
       
 16386     },
       
 16387     useState: function (initialState) {
       
 16388       currentHookNameInDev = 'useState';
       
 16389       warnInvalidHookAccess();
       
 16390       updateHookTypesDev();
       
 16391       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16392       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16393       try {
       
 16394         return updateState(initialState);
       
 16395       } finally {
       
 16396         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16397       }
       
 16398     },
       
 16399     useDebugValue: function (value, formatterFn) {
       
 16400       currentHookNameInDev = 'useDebugValue';
       
 16401       warnInvalidHookAccess();
       
 16402       updateHookTypesDev();
       
 16403       return updateDebugValue(value, formatterFn);
       
 16404     },
       
 16405     useResponder: function (responder, props) {
       
 16406       currentHookNameInDev = 'useResponder';
       
 16407       warnInvalidHookAccess();
       
 16408       updateHookTypesDev();
       
 16409       return createResponderListener(responder, props);
       
 16410     }
       
 16411   };
       
 16412 }
       
 16413 
       
 16414 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
 16415 // CommonJS interop named imports.
       
 16416 var now$1 = unstable_now;
       
 16417 
       
 16418 
       
 16419 var commitTime = 0;
       
 16420 var profilerStartTime = -1;
       
 16421 
       
 16422 function getCommitTime() {
       
 16423   return commitTime;
       
 16424 }
       
 16425 
       
 16426 function recordCommitTime() {
       
 16427   if (!enableProfilerTimer) {
       
 16428     return;
       
 16429   }
       
 16430   commitTime = now$1();
       
 16431 }
       
 16432 
       
 16433 function startProfilerTimer(fiber) {
       
 16434   if (!enableProfilerTimer) {
       
 16435     return;
       
 16436   }
       
 16437 
       
 16438   profilerStartTime = now$1();
       
 16439 
       
 16440   if (fiber.actualStartTime < 0) {
       
 16441     fiber.actualStartTime = now$1();
       
 16442   }
       
 16443 }
       
 16444 
       
 16445 function stopProfilerTimerIfRunning(fiber) {
       
 16446   if (!enableProfilerTimer) {
       
 16447     return;
       
 16448   }
       
 16449   profilerStartTime = -1;
       
 16450 }
       
 16451 
       
 16452 function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
       
 16453   if (!enableProfilerTimer) {
       
 16454     return;
       
 16455   }
       
 16456 
       
 16457   if (profilerStartTime >= 0) {
       
 16458     var elapsedTime = now$1() - profilerStartTime;
       
 16459     fiber.actualDuration += elapsedTime;
       
 16460     if (overrideBaseTime) {
       
 16461       fiber.selfBaseDuration = elapsedTime;
       
 16462     }
       
 16463     profilerStartTime = -1;
       
 16464   }
       
 16465 }
       
 16466 
       
 16467 // The deepest Fiber on the stack involved in a hydration context.
       
 16468 // This may have been an insertion or a hydration.
       
 16469 var hydrationParentFiber = null;
       
 16470 var nextHydratableInstance = null;
       
 16471 var isHydrating = false;
       
 16472 
       
 16473 function enterHydrationState(fiber) {
       
 16474   if (!supportsHydration) {
       
 16475     return false;
       
 16476   }
       
 16477 
       
 16478   var parentInstance = fiber.stateNode.containerInfo;
       
 16479   nextHydratableInstance = getFirstHydratableChild(parentInstance);
       
 16480   hydrationParentFiber = fiber;
       
 16481   isHydrating = true;
       
 16482   return true;
       
 16483 }
       
 16484 
       
 16485 function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
       
 16486   if (!supportsHydration) {
       
 16487     return false;
       
 16488   }
       
 16489 
       
 16490   var suspenseInstance = fiber.stateNode;
       
 16491   nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
       
 16492   popToNextHostParent(fiber);
       
 16493   isHydrating = true;
       
 16494   return true;
       
 16495 }
       
 16496 
       
 16497 function deleteHydratableInstance(returnFiber, instance) {
       
 16498   {
       
 16499     switch (returnFiber.tag) {
       
 16500       case HostRoot:
       
 16501         didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
       
 16502         break;
       
 16503       case HostComponent:
       
 16504         didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
       
 16505         break;
       
 16506     }
       
 16507   }
       
 16508 
       
 16509   var childToDelete = createFiberFromHostInstanceForDeletion();
       
 16510   childToDelete.stateNode = instance;
       
 16511   childToDelete.return = returnFiber;
       
 16512   childToDelete.effectTag = Deletion;
       
 16513 
       
 16514   // This might seem like it belongs on progressedFirstDeletion. However,
       
 16515   // these children are not part of the reconciliation list of children.
       
 16516   // Even if we abort and rereconcile the children, that will try to hydrate
       
 16517   // again and the nodes are still in the host tree so these will be
       
 16518   // recreated.
       
 16519   if (returnFiber.lastEffect !== null) {
       
 16520     returnFiber.lastEffect.nextEffect = childToDelete;
       
 16521     returnFiber.lastEffect = childToDelete;
       
 16522   } else {
       
 16523     returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 16524   }
       
 16525 }
       
 16526 
       
 16527 function insertNonHydratedInstance(returnFiber, fiber) {
       
 16528   fiber.effectTag |= Placement;
       
 16529   {
       
 16530     switch (returnFiber.tag) {
       
 16531       case HostRoot:
       
 16532         {
       
 16533           var parentContainer = returnFiber.stateNode.containerInfo;
       
 16534           switch (fiber.tag) {
       
 16535             case HostComponent:
       
 16536               var type = fiber.type;
       
 16537               var props = fiber.pendingProps;
       
 16538               didNotFindHydratableContainerInstance(parentContainer, type, props);
       
 16539               break;
       
 16540             case HostText:
       
 16541               var text = fiber.pendingProps;
       
 16542               didNotFindHydratableContainerTextInstance(parentContainer, text);
       
 16543               break;
       
 16544             case SuspenseComponent:
       
 16545               
       
 16546               break;
       
 16547           }
       
 16548           break;
       
 16549         }
       
 16550       case HostComponent:
       
 16551         {
       
 16552           var parentType = returnFiber.type;
       
 16553           var parentProps = returnFiber.memoizedProps;
       
 16554           var parentInstance = returnFiber.stateNode;
       
 16555           switch (fiber.tag) {
       
 16556             case HostComponent:
       
 16557               var _type = fiber.type;
       
 16558               var _props = fiber.pendingProps;
       
 16559               didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
       
 16560               break;
       
 16561             case HostText:
       
 16562               var _text = fiber.pendingProps;
       
 16563               didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
       
 16564               break;
       
 16565             case SuspenseComponent:
       
 16566               didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
       
 16567               break;
       
 16568           }
       
 16569           break;
       
 16570         }
       
 16571       default:
       
 16572         return;
       
 16573     }
       
 16574   }
       
 16575 }
       
 16576 
       
 16577 function tryHydrate(fiber, nextInstance) {
       
 16578   switch (fiber.tag) {
       
 16579     case HostComponent:
       
 16580       {
       
 16581         var type = fiber.type;
       
 16582         var props = fiber.pendingProps;
       
 16583         var instance = canHydrateInstance(nextInstance, type, props);
       
 16584         if (instance !== null) {
       
 16585           fiber.stateNode = instance;
       
 16586           return true;
       
 16587         }
       
 16588         return false;
       
 16589       }
       
 16590     case HostText:
       
 16591       {
       
 16592         var text = fiber.pendingProps;
       
 16593         var textInstance = canHydrateTextInstance(nextInstance, text);
       
 16594         if (textInstance !== null) {
       
 16595           fiber.stateNode = textInstance;
       
 16596           return true;
       
 16597         }
       
 16598         return false;
       
 16599       }
       
 16600     case SuspenseComponent:
       
 16601       {
       
 16602         if (enableSuspenseServerRenderer) {
       
 16603           var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
       
 16604           if (suspenseInstance !== null) {
       
 16605             // Downgrade the tag to a dehydrated component until we've hydrated it.
       
 16606             fiber.tag = DehydratedSuspenseComponent;
       
 16607             fiber.stateNode = suspenseInstance;
       
 16608             return true;
       
 16609           }
       
 16610         }
       
 16611         return false;
       
 16612       }
       
 16613     default:
       
 16614       return false;
       
 16615   }
       
 16616 }
       
 16617 
       
 16618 function tryToClaimNextHydratableInstance(fiber) {
       
 16619   if (!isHydrating) {
       
 16620     return;
       
 16621   }
       
 16622   var nextInstance = nextHydratableInstance;
       
 16623   if (!nextInstance) {
       
 16624     // Nothing to hydrate. Make it an insertion.
       
 16625     insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 16626     isHydrating = false;
       
 16627     hydrationParentFiber = fiber;
       
 16628     return;
       
 16629   }
       
 16630   var firstAttemptedInstance = nextInstance;
       
 16631   if (!tryHydrate(fiber, nextInstance)) {
       
 16632     // If we can't hydrate this instance let's try the next one.
       
 16633     // We use this as a heuristic. It's based on intuition and not data so it
       
 16634     // might be flawed or unnecessary.
       
 16635     nextInstance = getNextHydratableSibling(firstAttemptedInstance);
       
 16636     if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
       
 16637       // Nothing to hydrate. Make it an insertion.
       
 16638       insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 16639       isHydrating = false;
       
 16640       hydrationParentFiber = fiber;
       
 16641       return;
       
 16642     }
       
 16643     // We matched the next one, we'll now assume that the first one was
       
 16644     // superfluous and we'll delete it. Since we can't eagerly delete it
       
 16645     // we'll have to schedule a deletion. To do that, this node needs a dummy
       
 16646     // fiber associated with it.
       
 16647     deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
       
 16648   }
       
 16649   hydrationParentFiber = fiber;
       
 16650   nextHydratableInstance = getFirstHydratableChild(nextInstance);
       
 16651 }
       
 16652 
       
 16653 function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
       
 16654   if (!supportsHydration) {
       
 16655     (function () {
       
 16656       {
       
 16657         {
       
 16658           throw ReactError(Error('Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
       
 16659         }
       
 16660       }
       
 16661     })();
       
 16662   }
       
 16663 
       
 16664   var instance = fiber.stateNode;
       
 16665   var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
       
 16666   // TODO: Type this specific to this type of component.
       
 16667   fiber.updateQueue = updatePayload;
       
 16668   // If the update payload indicates that there is a change or if there
       
 16669   // is a new ref we mark this as an update.
       
 16670   if (updatePayload !== null) {
       
 16671     return true;
       
 16672   }
       
 16673   return false;
       
 16674 }
       
 16675 
       
 16676 function prepareToHydrateHostTextInstance(fiber) {
       
 16677   if (!supportsHydration) {
       
 16678     (function () {
       
 16679       {
       
 16680         {
       
 16681           throw ReactError(Error('Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
       
 16682         }
       
 16683       }
       
 16684     })();
       
 16685   }
       
 16686 
       
 16687   var textInstance = fiber.stateNode;
       
 16688   var textContent = fiber.memoizedProps;
       
 16689   var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
       
 16690   {
       
 16691     if (shouldUpdate) {
       
 16692       // We assume that prepareToHydrateHostTextInstance is called in a context where the
       
 16693       // hydration parent is the parent host component of this host text.
       
 16694       var returnFiber = hydrationParentFiber;
       
 16695       if (returnFiber !== null) {
       
 16696         switch (returnFiber.tag) {
       
 16697           case HostRoot:
       
 16698             {
       
 16699               var parentContainer = returnFiber.stateNode.containerInfo;
       
 16700               didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
       
 16701               break;
       
 16702             }
       
 16703           case HostComponent:
       
 16704             {
       
 16705               var parentType = returnFiber.type;
       
 16706               var parentProps = returnFiber.memoizedProps;
       
 16707               var parentInstance = returnFiber.stateNode;
       
 16708               didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
       
 16709               break;
       
 16710             }
       
 16711         }
       
 16712       }
       
 16713     }
       
 16714   }
       
 16715   return shouldUpdate;
       
 16716 }
       
 16717 
       
 16718 function skipPastDehydratedSuspenseInstance(fiber) {
       
 16719   if (!supportsHydration) {
       
 16720     (function () {
       
 16721       {
       
 16722         {
       
 16723           throw ReactError(Error('Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
       
 16724         }
       
 16725       }
       
 16726     })();
       
 16727   }
       
 16728   var suspenseInstance = fiber.stateNode;
       
 16729   (function () {
       
 16730     if (!suspenseInstance) {
       
 16731       {
       
 16732         throw ReactError(Error('Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.'));
       
 16733       }
       
 16734     }
       
 16735   })();
       
 16736   nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
       
 16737 }
       
 16738 
       
 16739 function popToNextHostParent(fiber) {
       
 16740   var parent = fiber.return;
       
 16741   while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
       
 16742     parent = parent.return;
       
 16743   }
       
 16744   hydrationParentFiber = parent;
       
 16745 }
       
 16746 
       
 16747 function popHydrationState(fiber) {
       
 16748   if (!supportsHydration) {
       
 16749     return false;
       
 16750   }
       
 16751   if (fiber !== hydrationParentFiber) {
       
 16752     // We're deeper than the current hydration context, inside an inserted
       
 16753     // tree.
       
 16754     return false;
       
 16755   }
       
 16756   if (!isHydrating) {
       
 16757     // If we're not currently hydrating but we're in a hydration context, then
       
 16758     // we were an insertion and now need to pop up reenter hydration of our
       
 16759     // siblings.
       
 16760     popToNextHostParent(fiber);
       
 16761     isHydrating = true;
       
 16762     return false;
       
 16763   }
       
 16764 
       
 16765   var type = fiber.type;
       
 16766 
       
 16767   // If we have any remaining hydratable nodes, we need to delete them now.
       
 16768   // We only do this deeper than head and body since they tend to have random
       
 16769   // other nodes in them. We also ignore components with pure text content in
       
 16770   // side of them.
       
 16771   // TODO: Better heuristic.
       
 16772   if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
       
 16773     var nextInstance = nextHydratableInstance;
       
 16774     while (nextInstance) {
       
 16775       deleteHydratableInstance(fiber, nextInstance);
       
 16776       nextInstance = getNextHydratableSibling(nextInstance);
       
 16777     }
       
 16778   }
       
 16779 
       
 16780   popToNextHostParent(fiber);
       
 16781   nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
       
 16782   return true;
       
 16783 }
       
 16784 
       
 16785 function resetHydrationState() {
       
 16786   if (!supportsHydration) {
       
 16787     return;
       
 16788   }
       
 16789 
       
 16790   hydrationParentFiber = null;
       
 16791   nextHydratableInstance = null;
       
 16792   isHydrating = false;
       
 16793 }
       
 16794 
       
 16795 var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
       
 16796 
       
 16797 var didReceiveUpdate = false;
       
 16798 
       
 16799 var didWarnAboutBadClass = void 0;
       
 16800 var didWarnAboutModulePatternComponent = void 0;
       
 16801 var didWarnAboutContextTypeOnFunctionComponent = void 0;
       
 16802 var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
       
 16803 var didWarnAboutFunctionRefs = void 0;
       
 16804 var didWarnAboutReassigningProps = void 0;
       
 16805 var didWarnAboutMaxDuration = void 0;
       
 16806 var didWarnAboutRevealOrder = void 0;
       
 16807 var didWarnAboutTailOptions = void 0;
       
 16808 var didWarnAboutDefaultPropsOnFunctionComponent = void 0;
       
 16809 
       
 16810 {
       
 16811   didWarnAboutBadClass = {};
       
 16812   didWarnAboutModulePatternComponent = {};
       
 16813   didWarnAboutContextTypeOnFunctionComponent = {};
       
 16814   didWarnAboutGetDerivedStateOnFunctionComponent = {};
       
 16815   didWarnAboutFunctionRefs = {};
       
 16816   didWarnAboutReassigningProps = false;
       
 16817   didWarnAboutMaxDuration = false;
       
 16818   didWarnAboutRevealOrder = {};
       
 16819   didWarnAboutTailOptions = {};
       
 16820   didWarnAboutDefaultPropsOnFunctionComponent = {};
       
 16821 }
       
 16822 
       
 16823 function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 16824   if (current$$1 === null) {
       
 16825     // If this is a fresh new component that hasn't been rendered yet, we
       
 16826     // won't update its child set by applying minimal side-effects. Instead,
       
 16827     // we will add them all to the child before it gets rendered. That means
       
 16828     // we can optimize this reconciliation pass by not tracking side-effects.
       
 16829     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 16830   } else {
       
 16831     // If the current child is the same as the work in progress, it means that
       
 16832     // we haven't yet started any work on these children. Therefore, we use
       
 16833     // the clone algorithm to create a copy of all the current children.
       
 16834 
       
 16835     // If we had any progressed work already, that is invalid at this point so
       
 16836     // let's throw it out.
       
 16837     workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
       
 16838   }
       
 16839 }
       
 16840 
       
 16841 function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 16842   // This function is fork of reconcileChildren. It's used in cases where we
       
 16843   // want to reconcile without matching against the existing set. This has the
       
 16844   // effect of all current children being unmounted; even if the type and key
       
 16845   // are the same, the old child is unmounted and a new child is created.
       
 16846   //
       
 16847   // To do this, we're going to go through the reconcile algorithm twice. In
       
 16848   // the first pass, we schedule a deletion for all the current children by
       
 16849   // passing null.
       
 16850   workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
       
 16851   // In the second pass, we mount the new children. The trick here is that we
       
 16852   // pass null in place of where we usually pass the current child set. This has
       
 16853   // the effect of remounting all children regardless of whether their their
       
 16854   // identity matches.
       
 16855   workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 16856 }
       
 16857 
       
 16858 function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 16859   // TODO: current can be non-null here even if the component
       
 16860   // hasn't yet mounted. This happens after the first render suspends.
       
 16861   // We'll need to figure out if this is fine or can cause issues.
       
 16862 
       
 16863   {
       
 16864     if (workInProgress.type !== workInProgress.elementType) {
       
 16865       // Lazy component props can't be validated in createElement
       
 16866       // because they're only guaranteed to be resolved here.
       
 16867       var innerPropTypes = Component.propTypes;
       
 16868       if (innerPropTypes) {
       
 16869         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 16870         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 16871       }
       
 16872     }
       
 16873   }
       
 16874 
       
 16875   var render = Component.render;
       
 16876   var ref = workInProgress.ref;
       
 16877 
       
 16878   // The rest is a fork of updateFunctionComponent
       
 16879   var nextChildren = void 0;
       
 16880   prepareToReadContext(workInProgress, renderExpirationTime);
       
 16881   {
       
 16882     ReactCurrentOwner$3.current = workInProgress;
       
 16883     setCurrentPhase('render');
       
 16884     nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 16885     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 16886       // Only double-render components with Hooks
       
 16887       if (workInProgress.memoizedState !== null) {
       
 16888         nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 16889       }
       
 16890     }
       
 16891     setCurrentPhase(null);
       
 16892   }
       
 16893 
       
 16894   if (current$$1 !== null && !didReceiveUpdate) {
       
 16895     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 16896     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 16897   }
       
 16898 
       
 16899   // React DevTools reads this flag.
       
 16900   workInProgress.effectTag |= PerformedWork;
       
 16901   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 16902   return workInProgress.child;
       
 16903 }
       
 16904 
       
 16905 function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 16906   if (current$$1 === null) {
       
 16907     var type = Component.type;
       
 16908     if (isSimpleFunctionComponent(type) && Component.compare === null &&
       
 16909     // SimpleMemoComponent codepath doesn't resolve outer props either.
       
 16910     Component.defaultProps === undefined) {
       
 16911       var resolvedType = type;
       
 16912       {
       
 16913         resolvedType = resolveFunctionForHotReloading(type);
       
 16914       }
       
 16915       // If this is a plain function component without default props,
       
 16916       // and with only the default shallow comparison, we upgrade it
       
 16917       // to a SimpleMemoComponent to allow fast path updates.
       
 16918       workInProgress.tag = SimpleMemoComponent;
       
 16919       workInProgress.type = resolvedType;
       
 16920       {
       
 16921         validateFunctionComponentInDev(workInProgress, type);
       
 16922       }
       
 16923       return updateSimpleMemoComponent(current$$1, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
       
 16924     }
       
 16925     {
       
 16926       var innerPropTypes = type.propTypes;
       
 16927       if (innerPropTypes) {
       
 16928         // Inner memo component props aren't currently validated in createElement.
       
 16929         // We could move it there, but we'd still need this for lazy code path.
       
 16930         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 16931         'prop', getComponentName(type), getCurrentFiberStackInDev);
       
 16932       }
       
 16933     }
       
 16934     var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
       
 16935     child.ref = workInProgress.ref;
       
 16936     child.return = workInProgress;
       
 16937     workInProgress.child = child;
       
 16938     return child;
       
 16939   }
       
 16940   {
       
 16941     var _type = Component.type;
       
 16942     var _innerPropTypes = _type.propTypes;
       
 16943     if (_innerPropTypes) {
       
 16944       // Inner memo component props aren't currently validated in createElement.
       
 16945       // We could move it there, but we'd still need this for lazy code path.
       
 16946       checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
       
 16947       'prop', getComponentName(_type), getCurrentFiberStackInDev);
       
 16948     }
       
 16949   }
       
 16950   var currentChild = current$$1.child; // This is always exactly one child
       
 16951   if (updateExpirationTime < renderExpirationTime) {
       
 16952     // This will be the props with resolved defaultProps,
       
 16953     // unlike current.memoizedProps which will be the unresolved ones.
       
 16954     var prevProps = currentChild.memoizedProps;
       
 16955     // Default to shallow comparison
       
 16956     var compare = Component.compare;
       
 16957     compare = compare !== null ? compare : shallowEqual;
       
 16958     if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
       
 16959       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 16960     }
       
 16961   }
       
 16962   // React DevTools reads this flag.
       
 16963   workInProgress.effectTag |= PerformedWork;
       
 16964   var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
       
 16965   newChild.ref = workInProgress.ref;
       
 16966   newChild.return = workInProgress;
       
 16967   workInProgress.child = newChild;
       
 16968   return newChild;
       
 16969 }
       
 16970 
       
 16971 function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 16972   // TODO: current can be non-null here even if the component
       
 16973   // hasn't yet mounted. This happens when the inner render suspends.
       
 16974   // We'll need to figure out if this is fine or can cause issues.
       
 16975 
       
 16976   {
       
 16977     if (workInProgress.type !== workInProgress.elementType) {
       
 16978       // Lazy component props can't be validated in createElement
       
 16979       // because they're only guaranteed to be resolved here.
       
 16980       var outerMemoType = workInProgress.elementType;
       
 16981       if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
       
 16982         // We warn when you define propTypes on lazy()
       
 16983         // so let's just skip over it to find memo() outer wrapper.
       
 16984         // Inner props for memo are validated later.
       
 16985         outerMemoType = refineResolvedLazyComponent(outerMemoType);
       
 16986       }
       
 16987       var outerPropTypes = outerMemoType && outerMemoType.propTypes;
       
 16988       if (outerPropTypes) {
       
 16989         checkPropTypes_1(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
       
 16990         'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
       
 16991       }
       
 16992       // Inner propTypes will be validated in the function component path.
       
 16993     }
       
 16994   }
       
 16995   if (current$$1 !== null) {
       
 16996     var prevProps = current$$1.memoizedProps;
       
 16997     if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref && (
       
 16998     // Prevent bailout if the implementation changed due to hot reload:
       
 16999     workInProgress.type === current$$1.type)) {
       
 17000       didReceiveUpdate = false;
       
 17001       if (updateExpirationTime < renderExpirationTime) {
       
 17002         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17003       }
       
 17004     }
       
 17005   }
       
 17006   return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 17007 }
       
 17008 
       
 17009 function updateFragment(current$$1, workInProgress, renderExpirationTime) {
       
 17010   var nextChildren = workInProgress.pendingProps;
       
 17011   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17012   return workInProgress.child;
       
 17013 }
       
 17014 
       
 17015 function updateMode(current$$1, workInProgress, renderExpirationTime) {
       
 17016   var nextChildren = workInProgress.pendingProps.children;
       
 17017   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17018   return workInProgress.child;
       
 17019 }
       
 17020 
       
 17021 function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
       
 17022   if (enableProfilerTimer) {
       
 17023     workInProgress.effectTag |= Update;
       
 17024   }
       
 17025   var nextProps = workInProgress.pendingProps;
       
 17026   var nextChildren = nextProps.children;
       
 17027   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17028   return workInProgress.child;
       
 17029 }
       
 17030 
       
 17031 function markRef(current$$1, workInProgress) {
       
 17032   var ref = workInProgress.ref;
       
 17033   if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
       
 17034     // Schedule a Ref effect
       
 17035     workInProgress.effectTag |= Ref;
       
 17036   }
       
 17037 }
       
 17038 
       
 17039 function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17040   {
       
 17041     if (workInProgress.type !== workInProgress.elementType) {
       
 17042       // Lazy component props can't be validated in createElement
       
 17043       // because they're only guaranteed to be resolved here.
       
 17044       var innerPropTypes = Component.propTypes;
       
 17045       if (innerPropTypes) {
       
 17046         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 17047         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17048       }
       
 17049     }
       
 17050   }
       
 17051 
       
 17052   var context = void 0;
       
 17053   if (!disableLegacyContext) {
       
 17054     var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
       
 17055     context = getMaskedContext(workInProgress, unmaskedContext);
       
 17056   }
       
 17057 
       
 17058   var nextChildren = void 0;
       
 17059   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17060   {
       
 17061     ReactCurrentOwner$3.current = workInProgress;
       
 17062     setCurrentPhase('render');
       
 17063     nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 17064     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 17065       // Only double-render components with Hooks
       
 17066       if (workInProgress.memoizedState !== null) {
       
 17067         nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 17068       }
       
 17069     }
       
 17070     setCurrentPhase(null);
       
 17071   }
       
 17072 
       
 17073   if (current$$1 !== null && !didReceiveUpdate) {
       
 17074     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 17075     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17076   }
       
 17077 
       
 17078   // React DevTools reads this flag.
       
 17079   workInProgress.effectTag |= PerformedWork;
       
 17080   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17081   return workInProgress.child;
       
 17082 }
       
 17083 
       
 17084 function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17085   {
       
 17086     if (workInProgress.type !== workInProgress.elementType) {
       
 17087       // Lazy component props can't be validated in createElement
       
 17088       // because they're only guaranteed to be resolved here.
       
 17089       var innerPropTypes = Component.propTypes;
       
 17090       if (innerPropTypes) {
       
 17091         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 17092         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17093       }
       
 17094     }
       
 17095   }
       
 17096 
       
 17097   // Push context providers early to prevent context stack mismatches.
       
 17098   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 17099   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 17100   var hasContext = void 0;
       
 17101   if (isContextProvider(Component)) {
       
 17102     hasContext = true;
       
 17103     pushContextProvider(workInProgress);
       
 17104   } else {
       
 17105     hasContext = false;
       
 17106   }
       
 17107   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17108 
       
 17109   var instance = workInProgress.stateNode;
       
 17110   var shouldUpdate = void 0;
       
 17111   if (instance === null) {
       
 17112     if (current$$1 !== null) {
       
 17113       // An class component without an instance only mounts if it suspended
       
 17114       // inside a non- concurrent tree, in an inconsistent state. We want to
       
 17115       // tree it like a new mount, even though an empty version of it already
       
 17116       // committed. Disconnect the alternate pointers.
       
 17117       current$$1.alternate = null;
       
 17118       workInProgress.alternate = null;
       
 17119       // Since this is conceptually a new fiber, schedule a Placement effect
       
 17120       workInProgress.effectTag |= Placement;
       
 17121     }
       
 17122     // In the initial pass we might need to construct the instance.
       
 17123     constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17124     mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17125     shouldUpdate = true;
       
 17126   } else if (current$$1 === null) {
       
 17127     // In a resume, we'll already have an instance we can reuse.
       
 17128     shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17129   } else {
       
 17130     shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 17131   }
       
 17132   var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
       
 17133   {
       
 17134     var inst = workInProgress.stateNode;
       
 17135     if (inst.props !== nextProps) {
       
 17136       !didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
       
 17137       didWarnAboutReassigningProps = true;
       
 17138     }
       
 17139   }
       
 17140   return nextUnitOfWork;
       
 17141 }
       
 17142 
       
 17143 function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
       
 17144   // Refs should update even if shouldComponentUpdate returns false
       
 17145   markRef(current$$1, workInProgress);
       
 17146 
       
 17147   var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 17148 
       
 17149   if (!shouldUpdate && !didCaptureError) {
       
 17150     // Context providers should defer to sCU for rendering
       
 17151     if (hasContext) {
       
 17152       invalidateContextProvider(workInProgress, Component, false);
       
 17153     }
       
 17154 
       
 17155     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17156   }
       
 17157 
       
 17158   var instance = workInProgress.stateNode;
       
 17159 
       
 17160   // Rerender
       
 17161   ReactCurrentOwner$3.current = workInProgress;
       
 17162   var nextChildren = void 0;
       
 17163   if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
       
 17164     // If we captured an error, but getDerivedStateFrom catch is not defined,
       
 17165     // unmount all the children. componentDidCatch will schedule an update to
       
 17166     // re-render a fallback. This is temporary until we migrate everyone to
       
 17167     // the new API.
       
 17168     // TODO: Warn in a future release.
       
 17169     nextChildren = null;
       
 17170 
       
 17171     if (enableProfilerTimer) {
       
 17172       stopProfilerTimerIfRunning(workInProgress);
       
 17173     }
       
 17174   } else {
       
 17175     {
       
 17176       setCurrentPhase('render');
       
 17177       nextChildren = instance.render();
       
 17178       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 17179         instance.render();
       
 17180       }
       
 17181       setCurrentPhase(null);
       
 17182     }
       
 17183   }
       
 17184 
       
 17185   // React DevTools reads this flag.
       
 17186   workInProgress.effectTag |= PerformedWork;
       
 17187   if (current$$1 !== null && didCaptureError) {
       
 17188     // If we're recovering from an error, reconcile without reusing any of
       
 17189     // the existing children. Conceptually, the normal children and the children
       
 17190     // that are shown on error are two different sets, so we shouldn't reuse
       
 17191     // normal children even if their identities match.
       
 17192     forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17193   } else {
       
 17194     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17195   }
       
 17196 
       
 17197   // Memoize state using the values we just used to render.
       
 17198   // TODO: Restructure so we never read values from the instance.
       
 17199   workInProgress.memoizedState = instance.state;
       
 17200 
       
 17201   // The context might have changed so we need to recalculate it.
       
 17202   if (hasContext) {
       
 17203     invalidateContextProvider(workInProgress, Component, true);
       
 17204   }
       
 17205 
       
 17206   return workInProgress.child;
       
 17207 }
       
 17208 
       
 17209 function pushHostRootContext(workInProgress) {
       
 17210   var root = workInProgress.stateNode;
       
 17211   if (root.pendingContext) {
       
 17212     pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
       
 17213   } else if (root.context) {
       
 17214     // Should always be set
       
 17215     pushTopLevelContextObject(workInProgress, root.context, false);
       
 17216   }
       
 17217   pushHostContainer(workInProgress, root.containerInfo);
       
 17218 }
       
 17219 
       
 17220 function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
       
 17221   pushHostRootContext(workInProgress);
       
 17222   var updateQueue = workInProgress.updateQueue;
       
 17223   (function () {
       
 17224     if (!(updateQueue !== null)) {
       
 17225       {
       
 17226         throw ReactError(Error('If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.'));
       
 17227       }
       
 17228     }
       
 17229   })();
       
 17230   var nextProps = workInProgress.pendingProps;
       
 17231   var prevState = workInProgress.memoizedState;
       
 17232   var prevChildren = prevState !== null ? prevState.element : null;
       
 17233   processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
       
 17234   var nextState = workInProgress.memoizedState;
       
 17235   // Caution: React DevTools currently depends on this property
       
 17236   // being called "element".
       
 17237   var nextChildren = nextState.element;
       
 17238   if (nextChildren === prevChildren) {
       
 17239     // If the state is the same as before, that's a bailout because we had
       
 17240     // no work that expires at this time.
       
 17241     resetHydrationState();
       
 17242     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17243   }
       
 17244   var root = workInProgress.stateNode;
       
 17245   if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
       
 17246     // If we don't have any current children this might be the first pass.
       
 17247     // We always try to hydrate. If this isn't a hydration pass there won't
       
 17248     // be any children to hydrate which is effectively the same thing as
       
 17249     // not hydrating.
       
 17250 
       
 17251     // This is a bit of a hack. We track the host root as a placement to
       
 17252     // know that we're currently in a mounting state. That way isMounted
       
 17253     // works as expected. We must reset this before committing.
       
 17254     // TODO: Delete this when we delete isMounted and findDOMNode.
       
 17255     workInProgress.effectTag |= Placement;
       
 17256 
       
 17257     // Ensure that children mount into this root without tracking
       
 17258     // side-effects. This ensures that we don't store Placement effects on
       
 17259     // nodes that will be hydrated.
       
 17260     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 17261   } else {
       
 17262     // Otherwise reset hydration state in case we aborted and resumed another
       
 17263     // root.
       
 17264     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17265     resetHydrationState();
       
 17266   }
       
 17267   return workInProgress.child;
       
 17268 }
       
 17269 
       
 17270 function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
       
 17271   pushHostContext(workInProgress);
       
 17272 
       
 17273   if (current$$1 === null) {
       
 17274     tryToClaimNextHydratableInstance(workInProgress);
       
 17275   }
       
 17276 
       
 17277   var type = workInProgress.type;
       
 17278   var nextProps = workInProgress.pendingProps;
       
 17279   var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
       
 17280 
       
 17281   var nextChildren = nextProps.children;
       
 17282   var isDirectTextChild = shouldSetTextContent(type, nextProps);
       
 17283 
       
 17284   if (isDirectTextChild) {
       
 17285     // We special case a direct text child of a host node. This is a common
       
 17286     // case. We won't handle it as a reified child. We will instead handle
       
 17287     // this in the host environment that also have access to this prop. That
       
 17288     // avoids allocating another HostText fiber and traversing it.
       
 17289     nextChildren = null;
       
 17290   } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
       
 17291     // If we're switching from a direct text child to a normal child, or to
       
 17292     // empty, we need to schedule the text content to be reset.
       
 17293     workInProgress.effectTag |= ContentReset;
       
 17294   }
       
 17295 
       
 17296   markRef(current$$1, workInProgress);
       
 17297 
       
 17298   // Check the host config to see if the children are offscreen/hidden.
       
 17299   if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
       
 17300     if (enableSchedulerTracing) {
       
 17301       markSpawnedWork(Never);
       
 17302     }
       
 17303     // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 17304     workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 17305     return null;
       
 17306   }
       
 17307 
       
 17308   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17309   return workInProgress.child;
       
 17310 }
       
 17311 
       
 17312 function updateHostText(current$$1, workInProgress) {
       
 17313   if (current$$1 === null) {
       
 17314     tryToClaimNextHydratableInstance(workInProgress);
       
 17315   }
       
 17316   // Nothing to do here. This is terminal. We'll do the completion step
       
 17317   // immediately after.
       
 17318   return null;
       
 17319 }
       
 17320 
       
 17321 function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
       
 17322   if (_current !== null) {
       
 17323     // An lazy component only mounts if it suspended inside a non-
       
 17324     // concurrent tree, in an inconsistent state. We want to treat it like
       
 17325     // a new mount, even though an empty version of it already committed.
       
 17326     // Disconnect the alternate pointers.
       
 17327     _current.alternate = null;
       
 17328     workInProgress.alternate = null;
       
 17329     // Since this is conceptually a new fiber, schedule a Placement effect
       
 17330     workInProgress.effectTag |= Placement;
       
 17331   }
       
 17332 
       
 17333   var props = workInProgress.pendingProps;
       
 17334   // We can't start a User Timing measurement with correct label yet.
       
 17335   // Cancel and resume right after we know the tag.
       
 17336   cancelWorkTimer(workInProgress);
       
 17337   var Component = readLazyComponentType(elementType);
       
 17338   // Store the unwrapped component in the type.
       
 17339   workInProgress.type = Component;
       
 17340   var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
       
 17341   startWorkTimer(workInProgress);
       
 17342   var resolvedProps = resolveDefaultProps(Component, props);
       
 17343   var child = void 0;
       
 17344   switch (resolvedTag) {
       
 17345     case FunctionComponent:
       
 17346       {
       
 17347         {
       
 17348           validateFunctionComponentInDev(workInProgress, Component);
       
 17349           workInProgress.type = Component = resolveFunctionForHotReloading(Component);
       
 17350         }
       
 17351         child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17352         break;
       
 17353       }
       
 17354     case ClassComponent:
       
 17355       {
       
 17356         {
       
 17357           workInProgress.type = Component = resolveClassForHotReloading(Component);
       
 17358         }
       
 17359         child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17360         break;
       
 17361       }
       
 17362     case ForwardRef:
       
 17363       {
       
 17364         {
       
 17365           workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
       
 17366         }
       
 17367         child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17368         break;
       
 17369       }
       
 17370     case MemoComponent:
       
 17371       {
       
 17372         {
       
 17373           if (workInProgress.type !== workInProgress.elementType) {
       
 17374             var outerPropTypes = Component.propTypes;
       
 17375             if (outerPropTypes) {
       
 17376               checkPropTypes_1(outerPropTypes, resolvedProps, // Resolved for outer only
       
 17377               'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17378             }
       
 17379           }
       
 17380         }
       
 17381         child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
       
 17382         updateExpirationTime, renderExpirationTime);
       
 17383         break;
       
 17384       }
       
 17385     default:
       
 17386       {
       
 17387         var hint = '';
       
 17388         {
       
 17389           if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
       
 17390             hint = ' Did you wrap a component in React.lazy() more than once?';
       
 17391           }
       
 17392         }
       
 17393         // This message intentionally doesn't mention ForwardRef or MemoComponent
       
 17394         // because the fact that it's a separate type of work is an
       
 17395         // implementation detail.
       
 17396         (function () {
       
 17397           {
       
 17398             {
       
 17399               throw ReactError(Error('Element type is invalid. Received a promise that resolves to: ' + Component + '. Lazy element type must resolve to a class or function.' + hint));
       
 17400             }
       
 17401           }
       
 17402         })();
       
 17403       }
       
 17404   }
       
 17405   return child;
       
 17406 }
       
 17407 
       
 17408 function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17409   if (_current !== null) {
       
 17410     // An incomplete component only mounts if it suspended inside a non-
       
 17411     // concurrent tree, in an inconsistent state. We want to treat it like
       
 17412     // a new mount, even though an empty version of it already committed.
       
 17413     // Disconnect the alternate pointers.
       
 17414     _current.alternate = null;
       
 17415     workInProgress.alternate = null;
       
 17416     // Since this is conceptually a new fiber, schedule a Placement effect
       
 17417     workInProgress.effectTag |= Placement;
       
 17418   }
       
 17419 
       
 17420   // Promote the fiber to a class and try rendering again.
       
 17421   workInProgress.tag = ClassComponent;
       
 17422 
       
 17423   // The rest of this function is a fork of `updateClassComponent`
       
 17424 
       
 17425   // Push context providers early to prevent context stack mismatches.
       
 17426   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 17427   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 17428   var hasContext = void 0;
       
 17429   if (isContextProvider(Component)) {
       
 17430     hasContext = true;
       
 17431     pushContextProvider(workInProgress);
       
 17432   } else {
       
 17433     hasContext = false;
       
 17434   }
       
 17435   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17436 
       
 17437   constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17438   mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17439 
       
 17440   return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 17441 }
       
 17442 
       
 17443 function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
       
 17444   if (_current !== null) {
       
 17445     // An indeterminate component only mounts if it suspended inside a non-
       
 17446     // concurrent tree, in an inconsistent state. We want to treat it like
       
 17447     // a new mount, even though an empty version of it already committed.
       
 17448     // Disconnect the alternate pointers.
       
 17449     _current.alternate = null;
       
 17450     workInProgress.alternate = null;
       
 17451     // Since this is conceptually a new fiber, schedule a Placement effect
       
 17452     workInProgress.effectTag |= Placement;
       
 17453   }
       
 17454 
       
 17455   var props = workInProgress.pendingProps;
       
 17456   var context = void 0;
       
 17457   if (!disableLegacyContext) {
       
 17458     var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
       
 17459     context = getMaskedContext(workInProgress, unmaskedContext);
       
 17460   }
       
 17461 
       
 17462   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17463   var value = void 0;
       
 17464 
       
 17465   {
       
 17466     if (Component.prototype && typeof Component.prototype.render === 'function') {
       
 17467       var componentName = getComponentName(Component) || 'Unknown';
       
 17468 
       
 17469       if (!didWarnAboutBadClass[componentName]) {
       
 17470         warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
       
 17471         didWarnAboutBadClass[componentName] = true;
       
 17472       }
       
 17473     }
       
 17474 
       
 17475     if (workInProgress.mode & StrictMode) {
       
 17476       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
       
 17477     }
       
 17478 
       
 17479     ReactCurrentOwner$3.current = workInProgress;
       
 17480     value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 17481   }
       
 17482   // React DevTools reads this flag.
       
 17483   workInProgress.effectTag |= PerformedWork;
       
 17484 
       
 17485   if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
       
 17486     {
       
 17487       var _componentName = getComponentName(Component) || 'Unknown';
       
 17488       if (!didWarnAboutModulePatternComponent[_componentName]) {
       
 17489         warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
       
 17490         didWarnAboutModulePatternComponent[_componentName] = true;
       
 17491       }
       
 17492     }
       
 17493 
       
 17494     // Proceed under the assumption that this is a class instance
       
 17495     workInProgress.tag = ClassComponent;
       
 17496 
       
 17497     // Throw out any hooks that were used.
       
 17498     resetHooks();
       
 17499 
       
 17500     // Push context providers early to prevent context stack mismatches.
       
 17501     // During mounting we don't know the child context yet as the instance doesn't exist.
       
 17502     // We will invalidate the child context in finishClassComponent() right after rendering.
       
 17503     var hasContext = false;
       
 17504     if (isContextProvider(Component)) {
       
 17505       hasContext = true;
       
 17506       pushContextProvider(workInProgress);
       
 17507     } else {
       
 17508       hasContext = false;
       
 17509     }
       
 17510 
       
 17511     workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
       
 17512 
       
 17513     var getDerivedStateFromProps = Component.getDerivedStateFromProps;
       
 17514     if (typeof getDerivedStateFromProps === 'function') {
       
 17515       applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
       
 17516     }
       
 17517 
       
 17518     adoptClassInstance(workInProgress, value);
       
 17519     mountClassInstance(workInProgress, Component, props, renderExpirationTime);
       
 17520     return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 17521   } else {
       
 17522     // Proceed under the assumption that this is a function component
       
 17523     workInProgress.tag = FunctionComponent;
       
 17524     {
       
 17525       if (disableLegacyContext && Component.contextTypes) {
       
 17526         warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
       
 17527       }
       
 17528 
       
 17529       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 17530         // Only double-render components with Hooks
       
 17531         if (workInProgress.memoizedState !== null) {
       
 17532           value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 17533         }
       
 17534       }
       
 17535     }
       
 17536     reconcileChildren(null, workInProgress, value, renderExpirationTime);
       
 17537     {
       
 17538       validateFunctionComponentInDev(workInProgress, Component);
       
 17539     }
       
 17540     return workInProgress.child;
       
 17541   }
       
 17542 }
       
 17543 
       
 17544 function validateFunctionComponentInDev(workInProgress, Component) {
       
 17545   if (Component) {
       
 17546     !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
       
 17547   }
       
 17548   if (workInProgress.ref !== null) {
       
 17549     var info = '';
       
 17550     var ownerName = getCurrentFiberOwnerNameInDevOrNull();
       
 17551     if (ownerName) {
       
 17552       info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 17553     }
       
 17554 
       
 17555     var warningKey = ownerName || workInProgress._debugID || '';
       
 17556     var debugSource = workInProgress._debugSource;
       
 17557     if (debugSource) {
       
 17558       warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
       
 17559     }
       
 17560     if (!didWarnAboutFunctionRefs[warningKey]) {
       
 17561       didWarnAboutFunctionRefs[warningKey] = true;
       
 17562       warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
       
 17563     }
       
 17564   }
       
 17565 
       
 17566   if (warnAboutDefaultPropsOnFunctionComponents && Component.defaultProps !== undefined) {
       
 17567     var componentName = getComponentName(Component) || 'Unknown';
       
 17568 
       
 17569     if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
       
 17570       warningWithoutStack$1(false, '%s: Support for defaultProps will be removed from function components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName);
       
 17571       didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
       
 17572     }
       
 17573   }
       
 17574 
       
 17575   if (typeof Component.getDerivedStateFromProps === 'function') {
       
 17576     var _componentName2 = getComponentName(Component) || 'Unknown';
       
 17577 
       
 17578     if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) {
       
 17579       warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName2);
       
 17580       didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true;
       
 17581     }
       
 17582   }
       
 17583 
       
 17584   if (typeof Component.contextType === 'object' && Component.contextType !== null) {
       
 17585     var _componentName3 = getComponentName(Component) || 'Unknown';
       
 17586 
       
 17587     if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) {
       
 17588       warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName3);
       
 17589       didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true;
       
 17590     }
       
 17591   }
       
 17592 }
       
 17593 
       
 17594 // TODO: This is now an empty object. Should we just make it a boolean?
       
 17595 var SUSPENDED_MARKER = {};
       
 17596 
       
 17597 function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
       
 17598   // If the context is telling us that we should show a fallback, and we're not
       
 17599   // already showing content, then we should show the fallback instead.
       
 17600   return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current$$1 === null || current$$1.memoizedState !== null);
       
 17601 }
       
 17602 
       
 17603 function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 17604   var mode = workInProgress.mode;
       
 17605   var nextProps = workInProgress.pendingProps;
       
 17606 
       
 17607   // This is used by DevTools to force a boundary to suspend.
       
 17608   {
       
 17609     if (shouldSuspend(workInProgress)) {
       
 17610       workInProgress.effectTag |= DidCapture;
       
 17611     }
       
 17612   }
       
 17613 
       
 17614   var suspenseContext = suspenseStackCursor.current;
       
 17615 
       
 17616   var nextState = null;
       
 17617   var nextDidTimeout = false;
       
 17618 
       
 17619   if ((workInProgress.effectTag & DidCapture) !== NoEffect || shouldRemainOnFallback(suspenseContext, current$$1, workInProgress)) {
       
 17620     // Something in this boundary's subtree already suspended. Switch to
       
 17621     // rendering the fallback children.
       
 17622     nextState = SUSPENDED_MARKER;
       
 17623     nextDidTimeout = true;
       
 17624     workInProgress.effectTag &= ~DidCapture;
       
 17625   } else {
       
 17626     // Attempting the main content
       
 17627     if (current$$1 === null || current$$1.memoizedState !== null) {
       
 17628       // This is a new mount or this boundary is already showing a fallback state.
       
 17629       // Mark this subtree context as having at least one invisible parent that could
       
 17630       // handle the fallback state.
       
 17631       // Boundaries without fallbacks or should be avoided are not considered since
       
 17632       // they cannot handle preferred fallback states.
       
 17633       if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
       
 17634         suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
       
 17635       }
       
 17636     }
       
 17637   }
       
 17638 
       
 17639   suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 17640 
       
 17641   pushSuspenseContext(workInProgress, suspenseContext);
       
 17642 
       
 17643   {
       
 17644     if ('maxDuration' in nextProps) {
       
 17645       if (!didWarnAboutMaxDuration) {
       
 17646         didWarnAboutMaxDuration = true;
       
 17647         warning$1(false, 'maxDuration has been removed from React. ' + 'Remove the maxDuration prop.');
       
 17648       }
       
 17649     }
       
 17650   }
       
 17651 
       
 17652   // This next part is a bit confusing. If the children timeout, we switch to
       
 17653   // showing the fallback children in place of the "primary" children.
       
 17654   // However, we don't want to delete the primary children because then their
       
 17655   // state will be lost (both the React state and the host state, e.g.
       
 17656   // uncontrolled form inputs). Instead we keep them mounted and hide them.
       
 17657   // Both the fallback children AND the primary children are rendered at the
       
 17658   // same time. Once the primary children are un-suspended, we can delete
       
 17659   // the fallback children — don't need to preserve their state.
       
 17660   //
       
 17661   // The two sets of children are siblings in the host environment, but
       
 17662   // semantically, for purposes of reconciliation, they are two separate sets.
       
 17663   // So we store them using two fragment fibers.
       
 17664   //
       
 17665   // However, we want to avoid allocating extra fibers for every placeholder.
       
 17666   // They're only necessary when the children time out, because that's the
       
 17667   // only time when both sets are mounted.
       
 17668   //
       
 17669   // So, the extra fragment fibers are only used if the children time out.
       
 17670   // Otherwise, we render the primary children directly. This requires some
       
 17671   // custom reconciliation logic to preserve the state of the primary
       
 17672   // children. It's essentially a very basic form of re-parenting.
       
 17673 
       
 17674   // `child` points to the child fiber. In the normal case, this is the first
       
 17675   // fiber of the primary children set. In the timed-out case, it's a
       
 17676   // a fragment fiber containing the primary children.
       
 17677   var child = void 0;
       
 17678   // `next` points to the next fiber React should render. In the normal case,
       
 17679   // it's the same as `child`: the first fiber of the primary children set.
       
 17680   // In the timed-out case, it's a fragment fiber containing the *fallback*
       
 17681   // children -- we skip over the primary children entirely.
       
 17682   var next = void 0;
       
 17683   if (current$$1 === null) {
       
 17684     if (enableSuspenseServerRenderer) {
       
 17685       // If we're currently hydrating, try to hydrate this boundary.
       
 17686       // But only if this has a fallback.
       
 17687       if (nextProps.fallback !== undefined) {
       
 17688         tryToClaimNextHydratableInstance(workInProgress);
       
 17689         // This could've changed the tag if this was a dehydrated suspense component.
       
 17690         if (workInProgress.tag === DehydratedSuspenseComponent) {
       
 17691           popSuspenseContext(workInProgress);
       
 17692           return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 17693         }
       
 17694       }
       
 17695     }
       
 17696 
       
 17697     // This is the initial mount. This branch is pretty simple because there's
       
 17698     // no previous state that needs to be preserved.
       
 17699     if (nextDidTimeout) {
       
 17700       // Mount separate fragments for primary and fallback children.
       
 17701       var nextFallbackChildren = nextProps.fallback;
       
 17702       var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
       
 17703       primaryChildFragment.return = workInProgress;
       
 17704 
       
 17705       if ((workInProgress.mode & BatchedMode) === NoMode) {
       
 17706         // Outside of batched mode, we commit the effects from the
       
 17707         var progressedState = workInProgress.memoizedState;
       
 17708         var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
       
 17709         primaryChildFragment.child = progressedPrimaryChild;
       
 17710         var progressedChild = progressedPrimaryChild;
       
 17711         while (progressedChild !== null) {
       
 17712           progressedChild.return = primaryChildFragment;
       
 17713           progressedChild = progressedChild.sibling;
       
 17714         }
       
 17715       }
       
 17716 
       
 17717       var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
       
 17718       fallbackChildFragment.return = workInProgress;
       
 17719       primaryChildFragment.sibling = fallbackChildFragment;
       
 17720       child = primaryChildFragment;
       
 17721       // Skip the primary children, and continue working on the
       
 17722       // fallback children.
       
 17723       next = fallbackChildFragment;
       
 17724     } else {
       
 17725       // Mount the primary children without an intermediate fragment fiber.
       
 17726       var nextPrimaryChildren = nextProps.children;
       
 17727       child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
       
 17728     }
       
 17729   } else {
       
 17730     // This is an update. This branch is more complicated because we need to
       
 17731     // ensure the state of the primary children is preserved.
       
 17732     var prevState = current$$1.memoizedState;
       
 17733     var prevDidTimeout = prevState !== null;
       
 17734     if (prevDidTimeout) {
       
 17735       // The current tree already timed out. That means each child set is
       
 17736       var currentPrimaryChildFragment = current$$1.child;
       
 17737       var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
       
 17738       if (nextDidTimeout) {
       
 17739         // Still timed out. Reuse the current primary children by cloning
       
 17740         // its fragment. We're going to skip over these entirely.
       
 17741         var _nextFallbackChildren = nextProps.fallback;
       
 17742         var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
       
 17743         _primaryChildFragment.return = workInProgress;
       
 17744 
       
 17745         if ((workInProgress.mode & BatchedMode) === NoMode) {
       
 17746           // Outside of batched mode, we commit the effects from the
       
 17747           var _progressedState = workInProgress.memoizedState;
       
 17748           var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
       
 17749           if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
       
 17750             _primaryChildFragment.child = _progressedPrimaryChild;
       
 17751             var _progressedChild = _progressedPrimaryChild;
       
 17752             while (_progressedChild !== null) {
       
 17753               _progressedChild.return = _primaryChildFragment;
       
 17754               _progressedChild = _progressedChild.sibling;
       
 17755             }
       
 17756           }
       
 17757         }
       
 17758 
       
 17759         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 17760         // parent of a new tree, we need to set its treeBaseDuration.
       
 17761         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 17762           // treeBaseDuration is the sum of all the child tree base durations.
       
 17763           var treeBaseDuration = 0;
       
 17764           var hiddenChild = _primaryChildFragment.child;
       
 17765           while (hiddenChild !== null) {
       
 17766             treeBaseDuration += hiddenChild.treeBaseDuration;
       
 17767             hiddenChild = hiddenChild.sibling;
       
 17768           }
       
 17769           _primaryChildFragment.treeBaseDuration = treeBaseDuration;
       
 17770         }
       
 17771 
       
 17772         // Clone the fallback child fragment, too. These we'll continue
       
 17773         // working on.
       
 17774         var _fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
       
 17775         _fallbackChildFragment.return = workInProgress;
       
 17776         _primaryChildFragment.sibling = _fallbackChildFragment;
       
 17777         child = _primaryChildFragment;
       
 17778         _primaryChildFragment.childExpirationTime = NoWork;
       
 17779         // Skip the primary children, and continue working on the
       
 17780         // fallback children.
       
 17781         next = _fallbackChildFragment;
       
 17782       } else {
       
 17783         // No longer suspended. Switch back to showing the primary children,
       
 17784         // and remove the intermediate fragment fiber.
       
 17785         var _nextPrimaryChildren = nextProps.children;
       
 17786         var currentPrimaryChild = currentPrimaryChildFragment.child;
       
 17787         var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
       
 17788 
       
 17789         // If this render doesn't suspend, we need to delete the fallback
       
 17790         // children. Wait until the complete phase, after we've confirmed the
       
 17791         // fallback is no longer needed.
       
 17792         // TODO: Would it be better to store the fallback fragment on
       
 17793         // the stateNode?
       
 17794 
       
 17795         // Continue rendering the children, like we normally do.
       
 17796         child = next = primaryChild;
       
 17797       }
       
 17798     } else {
       
 17799       // The current tree has not already timed out. That means the primary
       
 17800       // children are not wrapped in a fragment fiber.
       
 17801       var _currentPrimaryChild = current$$1.child;
       
 17802       if (nextDidTimeout) {
       
 17803         // Timed out. Wrap the children in a fragment fiber to keep them
       
 17804         // separate from the fallback children.
       
 17805         var _nextFallbackChildren2 = nextProps.fallback;
       
 17806         var _primaryChildFragment2 = createFiberFromFragment(
       
 17807         // It shouldn't matter what the pending props are because we aren't
       
 17808         // going to render this fragment.
       
 17809         null, mode, NoWork, null);
       
 17810         _primaryChildFragment2.return = workInProgress;
       
 17811         _primaryChildFragment2.child = _currentPrimaryChild;
       
 17812         if (_currentPrimaryChild !== null) {
       
 17813           _currentPrimaryChild.return = _primaryChildFragment2;
       
 17814         }
       
 17815 
       
 17816         // Even though we're creating a new fiber, there are no new children,
       
 17817         // because we're reusing an already mounted tree. So we don't need to
       
 17818         // schedule a placement.
       
 17819         // primaryChildFragment.effectTag |= Placement;
       
 17820 
       
 17821         if ((workInProgress.mode & BatchedMode) === NoMode) {
       
 17822           // Outside of batched mode, we commit the effects from the
       
 17823           var _progressedState2 = workInProgress.memoizedState;
       
 17824           var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
       
 17825           _primaryChildFragment2.child = _progressedPrimaryChild2;
       
 17826           var _progressedChild2 = _progressedPrimaryChild2;
       
 17827           while (_progressedChild2 !== null) {
       
 17828             _progressedChild2.return = _primaryChildFragment2;
       
 17829             _progressedChild2 = _progressedChild2.sibling;
       
 17830           }
       
 17831         }
       
 17832 
       
 17833         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 17834         // parent of a new tree, we need to set its treeBaseDuration.
       
 17835         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 17836           // treeBaseDuration is the sum of all the child tree base durations.
       
 17837           var _treeBaseDuration = 0;
       
 17838           var _hiddenChild = _primaryChildFragment2.child;
       
 17839           while (_hiddenChild !== null) {
       
 17840             _treeBaseDuration += _hiddenChild.treeBaseDuration;
       
 17841             _hiddenChild = _hiddenChild.sibling;
       
 17842           }
       
 17843           _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
       
 17844         }
       
 17845 
       
 17846         // Create a fragment from the fallback children, too.
       
 17847         var _fallbackChildFragment2 = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
       
 17848         _fallbackChildFragment2.return = workInProgress;
       
 17849         _primaryChildFragment2.sibling = _fallbackChildFragment2;
       
 17850         _fallbackChildFragment2.effectTag |= Placement;
       
 17851         child = _primaryChildFragment2;
       
 17852         _primaryChildFragment2.childExpirationTime = NoWork;
       
 17853         // Skip the primary children, and continue working on the
       
 17854         // fallback children.
       
 17855         next = _fallbackChildFragment2;
       
 17856       } else {
       
 17857         // Still haven't timed out.  Continue rendering the children, like we
       
 17858         // normally do.
       
 17859         var _nextPrimaryChildren2 = nextProps.children;
       
 17860         next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
       
 17861       }
       
 17862     }
       
 17863     workInProgress.stateNode = current$$1.stateNode;
       
 17864   }
       
 17865 
       
 17866   workInProgress.memoizedState = nextState;
       
 17867   workInProgress.child = child;
       
 17868   return next;
       
 17869 }
       
 17870 
       
 17871 function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime) {
       
 17872   // Detach from the current dehydrated boundary.
       
 17873   current$$1.alternate = null;
       
 17874   workInProgress.alternate = null;
       
 17875 
       
 17876   // Insert a deletion in the effect list.
       
 17877   var returnFiber = workInProgress.return;
       
 17878   (function () {
       
 17879     if (!(returnFiber !== null)) {
       
 17880       {
       
 17881         throw ReactError(Error('Suspense boundaries are never on the root. This is probably a bug in React.'));
       
 17882       }
       
 17883     }
       
 17884   })();
       
 17885   var last = returnFiber.lastEffect;
       
 17886   if (last !== null) {
       
 17887     last.nextEffect = current$$1;
       
 17888     returnFiber.lastEffect = current$$1;
       
 17889   } else {
       
 17890     returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
       
 17891   }
       
 17892   current$$1.nextEffect = null;
       
 17893   current$$1.effectTag = Deletion;
       
 17894 
       
 17895   popSuspenseContext(workInProgress);
       
 17896 
       
 17897   // Upgrade this work in progress to a real Suspense component.
       
 17898   workInProgress.tag = SuspenseComponent;
       
 17899   workInProgress.stateNode = null;
       
 17900   workInProgress.memoizedState = null;
       
 17901   // This is now an insertion.
       
 17902   workInProgress.effectTag |= Placement;
       
 17903   // Retry as a real Suspense component.
       
 17904   return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 17905 }
       
 17906 
       
 17907 function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 17908   pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 17909   var suspenseInstance = workInProgress.stateNode;
       
 17910   if (current$$1 === null) {
       
 17911     // During the first pass, we'll bail out and not drill into the children.
       
 17912     // Instead, we'll leave the content in place and try to hydrate it later.
       
 17913     if (isSuspenseInstanceFallback(suspenseInstance)) {
       
 17914       // This is a client-only boundary. Since we won't get any content from the server
       
 17915       // for this, we need to schedule that at a higher priority based on when it would
       
 17916       // have timed out. In theory we could render it in this pass but it would have the
       
 17917       // wrong priority associated with it and will prevent hydration of parent path.
       
 17918       // Instead, we'll leave work left on it to render it in a separate commit.
       
 17919 
       
 17920       // TODO This time should be the time at which the server rendered response that is
       
 17921       // a parent to this boundary was displayed. However, since we currently don't have
       
 17922       // a protocol to transfer that time, we'll just estimate it by using the current
       
 17923       // time. This will mean that Suspense timeouts are slightly shifted to later than
       
 17924       // they should be.
       
 17925       var serverDisplayTime = requestCurrentTime();
       
 17926       // Schedule a normal pri update to render this content.
       
 17927       workInProgress.expirationTime = computeAsyncExpiration(serverDisplayTime);
       
 17928     } else {
       
 17929       // We'll continue hydrating the rest at offscreen priority since we'll already
       
 17930       // be showing the right content coming from the server, it is no rush.
       
 17931       workInProgress.expirationTime = Never;
       
 17932     }
       
 17933     return null;
       
 17934   }
       
 17935   if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
       
 17936     // Something suspended. Leave the existing children in place.
       
 17937     // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
       
 17938     workInProgress.child = null;
       
 17939     return null;
       
 17940   }
       
 17941   if (isSuspenseInstanceFallback(suspenseInstance)) {
       
 17942     // This boundary is in a permanent fallback state. In this case, we'll never
       
 17943     // get an update and we'll never be able to hydrate the final content. Let's just try the
       
 17944     // client side render instead.
       
 17945     return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
       
 17946   }
       
 17947   // We use childExpirationTime to indicate that a child might depend on context, so if
       
 17948   // any context has changed, we need to treat is as if the input might have changed.
       
 17949   var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
       
 17950   if (didReceiveUpdate || hasContextChanged$$1) {
       
 17951     // This boundary has changed since the first render. This means that we are now unable to
       
 17952     // hydrate it. We might still be able to hydrate it using an earlier expiration time but
       
 17953     // during this render we can't. Instead, we're going to delete the whole subtree and
       
 17954     // instead inject a new real Suspense boundary to take its place, which may render content
       
 17955     // or fallback. The real Suspense boundary will suspend for a while so we have some time
       
 17956     // to ensure it can produce real content, but all state and pending events will be lost.
       
 17957     return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
       
 17958   } else if (isSuspenseInstancePending(suspenseInstance)) {
       
 17959     // This component is still pending more data from the server, so we can't hydrate its
       
 17960     // content. We treat it as if this component suspended itself. It might seem as if
       
 17961     // we could just try to render it client-side instead. However, this will perform a
       
 17962     // lot of unnecessary work and is unlikely to complete since it often will suspend
       
 17963     // on missing data anyway. Additionally, the server might be able to render more
       
 17964     // than we can on the client yet. In that case we'd end up with more fallback states
       
 17965     // on the client than if we just leave it alone. If the server times out or errors
       
 17966     // these should update this boundary to the permanent Fallback state instead.
       
 17967     // Mark it as having captured (i.e. suspended).
       
 17968     workInProgress.effectTag |= DidCapture;
       
 17969     // Leave the children in place. I.e. empty.
       
 17970     workInProgress.child = null;
       
 17971     // Register a callback to retry this boundary once the server has sent the result.
       
 17972     registerSuspenseInstanceRetry(suspenseInstance, retryTimedOutBoundary.bind(null, current$$1));
       
 17973     return null;
       
 17974   } else {
       
 17975     // This is the first attempt.
       
 17976     reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
       
 17977     var nextProps = workInProgress.pendingProps;
       
 17978     var nextChildren = nextProps.children;
       
 17979     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 17980     return workInProgress.child;
       
 17981   }
       
 17982 }
       
 17983 
       
 17984 function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
       
 17985   // Mark any Suspense boundaries with fallbacks as having work to do.
       
 17986   // If they were previously forced into fallbacks, they may now be able
       
 17987   // to unblock.
       
 17988   var node = firstChild;
       
 17989   while (node !== null) {
       
 17990     if (node.tag === SuspenseComponent) {
       
 17991       var state = node.memoizedState;
       
 17992       if (state !== null) {
       
 17993         if (node.expirationTime < renderExpirationTime) {
       
 17994           node.expirationTime = renderExpirationTime;
       
 17995         }
       
 17996         var alternate = node.alternate;
       
 17997         if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
       
 17998           alternate.expirationTime = renderExpirationTime;
       
 17999         }
       
 18000         scheduleWorkOnParentPath(node.return, renderExpirationTime);
       
 18001       }
       
 18002     } else if (node.child !== null) {
       
 18003       node.child.return = node;
       
 18004       node = node.child;
       
 18005       continue;
       
 18006     }
       
 18007     if (node === workInProgress) {
       
 18008       return;
       
 18009     }
       
 18010     while (node.sibling === null) {
       
 18011       if (node.return === null || node.return === workInProgress) {
       
 18012         return;
       
 18013       }
       
 18014       node = node.return;
       
 18015     }
       
 18016     node.sibling.return = node.return;
       
 18017     node = node.sibling;
       
 18018   }
       
 18019 }
       
 18020 
       
 18021 function findLastContentRow(firstChild) {
       
 18022   // This is going to find the last row among these children that is already
       
 18023   // showing content on the screen, as opposed to being in fallback state or
       
 18024   // new. If a row has multiple Suspense boundaries, any of them being in the
       
 18025   // fallback state, counts as the whole row being in a fallback state.
       
 18026   // Note that the "rows" will be workInProgress, but any nested children
       
 18027   // will still be current since we haven't rendered them yet. The mounted
       
 18028   // order may not be the same as the new order. We use the new order.
       
 18029   var row = firstChild;
       
 18030   var lastContentRow = null;
       
 18031   while (row !== null) {
       
 18032     var currentRow = row.alternate;
       
 18033     // New rows can't be content rows.
       
 18034     if (currentRow !== null && findFirstSuspended(currentRow) === null) {
       
 18035       lastContentRow = row;
       
 18036     }
       
 18037     row = row.sibling;
       
 18038   }
       
 18039   return lastContentRow;
       
 18040 }
       
 18041 
       
 18042 function validateRevealOrder(revealOrder) {
       
 18043   {
       
 18044     if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
       
 18045       didWarnAboutRevealOrder[revealOrder] = true;
       
 18046       if (typeof revealOrder === 'string') {
       
 18047         switch (revealOrder.toLowerCase()) {
       
 18048           case 'together':
       
 18049           case 'forwards':
       
 18050           case 'backwards':
       
 18051             {
       
 18052               warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
       
 18053               break;
       
 18054             }
       
 18055           case 'forward':
       
 18056           case 'backward':
       
 18057             {
       
 18058               warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
       
 18059               break;
       
 18060             }
       
 18061           default:
       
 18062             warning$1(false, '"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
       
 18063             break;
       
 18064         }
       
 18065       } else {
       
 18066         warning$1(false, '%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
       
 18067       }
       
 18068     }
       
 18069   }
       
 18070 }
       
 18071 
       
 18072 function validateTailOptions(tailMode, revealOrder) {
       
 18073   {
       
 18074     if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
       
 18075       if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
       
 18076         didWarnAboutTailOptions[tailMode] = true;
       
 18077         warning$1(false, '"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
       
 18078       } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
       
 18079         didWarnAboutTailOptions[tailMode] = true;
       
 18080         warning$1(false, '<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
       
 18081       }
       
 18082     }
       
 18083   }
       
 18084 }
       
 18085 
       
 18086 function validateSuspenseListNestedChild(childSlot, index) {
       
 18087   {
       
 18088     var isArray = Array.isArray(childSlot);
       
 18089     var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
       
 18090     if (isArray || isIterable) {
       
 18091       var type = isArray ? 'array' : 'iterable';
       
 18092       warning$1(false, 'A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
       
 18093       return false;
       
 18094     }
       
 18095   }
       
 18096   return true;
       
 18097 }
       
 18098 
       
 18099 function validateSuspenseListChildren(children, revealOrder) {
       
 18100   {
       
 18101     if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
       
 18102       if (Array.isArray(children)) {
       
 18103         for (var i = 0; i < children.length; i++) {
       
 18104           if (!validateSuspenseListNestedChild(children[i], i)) {
       
 18105             return;
       
 18106           }
       
 18107         }
       
 18108       } else {
       
 18109         var iteratorFn = getIteratorFn(children);
       
 18110         if (typeof iteratorFn === 'function') {
       
 18111           var childrenIterator = iteratorFn.call(children);
       
 18112           if (childrenIterator) {
       
 18113             var step = childrenIterator.next();
       
 18114             var _i = 0;
       
 18115             for (; !step.done; step = childrenIterator.next()) {
       
 18116               if (!validateSuspenseListNestedChild(step.value, _i)) {
       
 18117                 return;
       
 18118               }
       
 18119               _i++;
       
 18120             }
       
 18121           }
       
 18122         } else {
       
 18123           warning$1(false, 'A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
       
 18124         }
       
 18125       }
       
 18126     }
       
 18127   }
       
 18128 }
       
 18129 
       
 18130 function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
       
 18131   var renderState = workInProgress.memoizedState;
       
 18132   if (renderState === null) {
       
 18133     workInProgress.memoizedState = {
       
 18134       isBackwards: isBackwards,
       
 18135       rendering: null,
       
 18136       last: lastContentRow,
       
 18137       tail: tail,
       
 18138       tailExpiration: 0,
       
 18139       tailMode: tailMode
       
 18140     };
       
 18141   } else {
       
 18142     // We can reuse the existing object from previous renders.
       
 18143     renderState.isBackwards = isBackwards;
       
 18144     renderState.rendering = null;
       
 18145     renderState.last = lastContentRow;
       
 18146     renderState.tail = tail;
       
 18147     renderState.tailExpiration = 0;
       
 18148     renderState.tailMode = tailMode;
       
 18149   }
       
 18150 }
       
 18151 
       
 18152 // This can end up rendering this component multiple passes.
       
 18153 // The first pass splits the children fibers into two sets. A head and tail.
       
 18154 // We first render the head. If anything is in fallback state, we do another
       
 18155 // pass through beginWork to rerender all children (including the tail) with
       
 18156 // the force suspend context. If the first render didn't have anything in
       
 18157 // in fallback state. Then we render each row in the tail one-by-one.
       
 18158 // That happens in the completeWork phase without going back to beginWork.
       
 18159 function updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime) {
       
 18160   var nextProps = workInProgress.pendingProps;
       
 18161   var revealOrder = nextProps.revealOrder;
       
 18162   var tailMode = nextProps.tail;
       
 18163   var newChildren = nextProps.children;
       
 18164 
       
 18165   validateRevealOrder(revealOrder);
       
 18166   validateTailOptions(tailMode, revealOrder);
       
 18167   validateSuspenseListChildren(newChildren, revealOrder);
       
 18168 
       
 18169   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 18170 
       
 18171   var suspenseContext = suspenseStackCursor.current;
       
 18172 
       
 18173   var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 18174   if (shouldForceFallback) {
       
 18175     suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 18176     workInProgress.effectTag |= DidCapture;
       
 18177   } else {
       
 18178     var didSuspendBefore = current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect;
       
 18179     if (didSuspendBefore) {
       
 18180       // If we previously forced a fallback, we need to schedule work
       
 18181       // on any nested boundaries to let them know to try to render
       
 18182       // again. This is the same as context updating.
       
 18183       propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime);
       
 18184     }
       
 18185     suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 18186   }
       
 18187   pushSuspenseContext(workInProgress, suspenseContext);
       
 18188 
       
 18189   if ((workInProgress.mode & BatchedMode) === NoMode) {
       
 18190     // Outside of batched mode, SuspenseList doesn't work so we just
       
 18191     // use make it a noop by treating it as the default revealOrder.
       
 18192     workInProgress.memoizedState = null;
       
 18193   } else {
       
 18194     switch (revealOrder) {
       
 18195       case 'forwards':
       
 18196         {
       
 18197           var lastContentRow = findLastContentRow(workInProgress.child);
       
 18198           var tail = void 0;
       
 18199           if (lastContentRow === null) {
       
 18200             // The whole list is part of the tail.
       
 18201             // TODO: We could fast path by just rendering the tail now.
       
 18202             tail = workInProgress.child;
       
 18203             workInProgress.child = null;
       
 18204           } else {
       
 18205             // Disconnect the tail rows after the content row.
       
 18206             // We're going to render them separately later.
       
 18207             tail = lastContentRow.sibling;
       
 18208             lastContentRow.sibling = null;
       
 18209           }
       
 18210           initSuspenseListRenderState(workInProgress, false, // isBackwards
       
 18211           tail, lastContentRow, tailMode);
       
 18212           break;
       
 18213         }
       
 18214       case 'backwards':
       
 18215         {
       
 18216           // We're going to find the first row that has existing content.
       
 18217           // At the same time we're going to reverse the list of everything
       
 18218           // we pass in the meantime. That's going to be our tail in reverse
       
 18219           // order.
       
 18220           var _tail = null;
       
 18221           var row = workInProgress.child;
       
 18222           workInProgress.child = null;
       
 18223           while (row !== null) {
       
 18224             var currentRow = row.alternate;
       
 18225             // New rows can't be content rows.
       
 18226             if (currentRow !== null && findFirstSuspended(currentRow) === null) {
       
 18227               // This is the beginning of the main content.
       
 18228               workInProgress.child = row;
       
 18229               break;
       
 18230             }
       
 18231             var nextRow = row.sibling;
       
 18232             row.sibling = _tail;
       
 18233             _tail = row;
       
 18234             row = nextRow;
       
 18235           }
       
 18236           // TODO: If workInProgress.child is null, we can continue on the tail immediately.
       
 18237           initSuspenseListRenderState(workInProgress, true, // isBackwards
       
 18238           _tail, null, // last
       
 18239           tailMode);
       
 18240           break;
       
 18241         }
       
 18242       case 'together':
       
 18243         {
       
 18244           initSuspenseListRenderState(workInProgress, false, // isBackwards
       
 18245           null, // tail
       
 18246           null, // last
       
 18247           undefined);
       
 18248           break;
       
 18249         }
       
 18250       default:
       
 18251         {
       
 18252           // The default reveal order is the same as not having
       
 18253           // a boundary.
       
 18254           workInProgress.memoizedState = null;
       
 18255         }
       
 18256     }
       
 18257   }
       
 18258   return workInProgress.child;
       
 18259 }
       
 18260 
       
 18261 function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
       
 18262   pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 18263   var nextChildren = workInProgress.pendingProps;
       
 18264   if (current$$1 === null) {
       
 18265     // Portals are special because we don't append the children during mount
       
 18266     // but at commit. Therefore we need to track insertions which the normal
       
 18267     // flow doesn't do during mount. This doesn't happen at the root because
       
 18268     // the root always starts with a "current" with a null child.
       
 18269     // TODO: Consider unifying this with how the root works.
       
 18270     workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 18271   } else {
       
 18272     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 18273   }
       
 18274   return workInProgress.child;
       
 18275 }
       
 18276 
       
 18277 function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
       
 18278   var providerType = workInProgress.type;
       
 18279   var context = providerType._context;
       
 18280 
       
 18281   var newProps = workInProgress.pendingProps;
       
 18282   var oldProps = workInProgress.memoizedProps;
       
 18283 
       
 18284   var newValue = newProps.value;
       
 18285 
       
 18286   {
       
 18287     var providerPropTypes = workInProgress.type.propTypes;
       
 18288 
       
 18289     if (providerPropTypes) {
       
 18290       checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
       
 18291     }
       
 18292   }
       
 18293 
       
 18294   pushProvider(workInProgress, newValue);
       
 18295 
       
 18296   if (oldProps !== null) {
       
 18297     var oldValue = oldProps.value;
       
 18298     var changedBits = calculateChangedBits(context, newValue, oldValue);
       
 18299     if (changedBits === 0) {
       
 18300       // No change. Bailout early if children are the same.
       
 18301       if (oldProps.children === newProps.children && !hasContextChanged()) {
       
 18302         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 18303       }
       
 18304     } else {
       
 18305       // The context value changed. Search for matching consumers and schedule
       
 18306       // them to update.
       
 18307       propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
       
 18308     }
       
 18309   }
       
 18310 
       
 18311   var newChildren = newProps.children;
       
 18312   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 18313   return workInProgress.child;
       
 18314 }
       
 18315 
       
 18316 var hasWarnedAboutUsingContextAsConsumer = false;
       
 18317 
       
 18318 function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
       
 18319   var context = workInProgress.type;
       
 18320   // The logic below for Context differs depending on PROD or DEV mode. In
       
 18321   // DEV mode, we create a separate object for Context.Consumer that acts
       
 18322   // like a proxy to Context. This proxy object adds unnecessary code in PROD
       
 18323   // so we use the old behaviour (Context.Consumer references Context) to
       
 18324   // reduce size and overhead. The separate object references context via
       
 18325   // a property called "_context", which also gives us the ability to check
       
 18326   // in DEV mode if this property exists or not and warn if it does not.
       
 18327   {
       
 18328     if (context._context === undefined) {
       
 18329       // This may be because it's a Context (rather than a Consumer).
       
 18330       // Or it may be because it's older React where they're the same thing.
       
 18331       // We only want to warn if we're sure it's a new React.
       
 18332       if (context !== context.Consumer) {
       
 18333         if (!hasWarnedAboutUsingContextAsConsumer) {
       
 18334           hasWarnedAboutUsingContextAsConsumer = true;
       
 18335           warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
       
 18336         }
       
 18337       }
       
 18338     } else {
       
 18339       context = context._context;
       
 18340     }
       
 18341   }
       
 18342   var newProps = workInProgress.pendingProps;
       
 18343   var render = newProps.children;
       
 18344 
       
 18345   {
       
 18346     !(typeof render === 'function') ? warningWithoutStack$1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
       
 18347   }
       
 18348 
       
 18349   prepareToReadContext(workInProgress, renderExpirationTime);
       
 18350   var newValue = readContext(context, newProps.unstable_observedBits);
       
 18351   var newChildren = void 0;
       
 18352   {
       
 18353     ReactCurrentOwner$3.current = workInProgress;
       
 18354     setCurrentPhase('render');
       
 18355     newChildren = render(newValue);
       
 18356     setCurrentPhase(null);
       
 18357   }
       
 18358 
       
 18359   // React DevTools reads this flag.
       
 18360   workInProgress.effectTag |= PerformedWork;
       
 18361   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 18362   return workInProgress.child;
       
 18363 }
       
 18364 
       
 18365 function updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime) {
       
 18366   var fundamentalImpl = workInProgress.type.impl;
       
 18367   if (fundamentalImpl.reconcileChildren === false) {
       
 18368     return null;
       
 18369   }
       
 18370   var nextProps = workInProgress.pendingProps;
       
 18371   var nextChildren = nextProps.children;
       
 18372 
       
 18373   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 18374   return workInProgress.child;
       
 18375 }
       
 18376 
       
 18377 function markWorkInProgressReceivedUpdate() {
       
 18378   didReceiveUpdate = true;
       
 18379 }
       
 18380 
       
 18381 function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
       
 18382   cancelWorkTimer(workInProgress);
       
 18383 
       
 18384   if (current$$1 !== null) {
       
 18385     // Reuse previous dependencies
       
 18386     workInProgress.dependencies = current$$1.dependencies;
       
 18387   }
       
 18388 
       
 18389   if (enableProfilerTimer) {
       
 18390     // Don't update "base" render times for bailouts.
       
 18391     stopProfilerTimerIfRunning(workInProgress);
       
 18392   }
       
 18393 
       
 18394   // Check if the children have any pending work.
       
 18395   var childExpirationTime = workInProgress.childExpirationTime;
       
 18396   if (childExpirationTime < renderExpirationTime) {
       
 18397     // The children don't have any work either. We can skip them.
       
 18398     // TODO: Once we add back resuming, we should check if the children are
       
 18399     // a work-in-progress set. If so, we need to transfer their effects.
       
 18400     return null;
       
 18401   } else {
       
 18402     // This fiber doesn't have work, but its subtree does. Clone the child
       
 18403     // fibers and continue.
       
 18404     cloneChildFibers(current$$1, workInProgress);
       
 18405     return workInProgress.child;
       
 18406   }
       
 18407 }
       
 18408 
       
 18409 function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) {
       
 18410   {
       
 18411     var returnFiber = oldWorkInProgress.return;
       
 18412     if (returnFiber === null) {
       
 18413       throw new Error('Cannot swap the root fiber.');
       
 18414     }
       
 18415 
       
 18416     // Disconnect from the old current.
       
 18417     // It will get deleted.
       
 18418     current$$1.alternate = null;
       
 18419     oldWorkInProgress.alternate = null;
       
 18420 
       
 18421     // Connect to the new tree.
       
 18422     newWorkInProgress.index = oldWorkInProgress.index;
       
 18423     newWorkInProgress.sibling = oldWorkInProgress.sibling;
       
 18424     newWorkInProgress.return = oldWorkInProgress.return;
       
 18425     newWorkInProgress.ref = oldWorkInProgress.ref;
       
 18426 
       
 18427     // Replace the child/sibling pointers above it.
       
 18428     if (oldWorkInProgress === returnFiber.child) {
       
 18429       returnFiber.child = newWorkInProgress;
       
 18430     } else {
       
 18431       var prevSibling = returnFiber.child;
       
 18432       if (prevSibling === null) {
       
 18433         throw new Error('Expected parent to have a child.');
       
 18434       }
       
 18435       while (prevSibling.sibling !== oldWorkInProgress) {
       
 18436         prevSibling = prevSibling.sibling;
       
 18437         if (prevSibling === null) {
       
 18438           throw new Error('Expected to find the previous sibling.');
       
 18439         }
       
 18440       }
       
 18441       prevSibling.sibling = newWorkInProgress;
       
 18442     }
       
 18443 
       
 18444     // Delete the old fiber and place the new one.
       
 18445     // Since the old fiber is disconnected, we have to schedule it manually.
       
 18446     var last = returnFiber.lastEffect;
       
 18447     if (last !== null) {
       
 18448       last.nextEffect = current$$1;
       
 18449       returnFiber.lastEffect = current$$1;
       
 18450     } else {
       
 18451       returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
       
 18452     }
       
 18453     current$$1.nextEffect = null;
       
 18454     current$$1.effectTag = Deletion;
       
 18455 
       
 18456     newWorkInProgress.effectTag |= Placement;
       
 18457 
       
 18458     // Restart work from the new fiber.
       
 18459     return newWorkInProgress;
       
 18460   }
       
 18461 }
       
 18462 
       
 18463 function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
       
 18464   var updateExpirationTime = workInProgress.expirationTime;
       
 18465 
       
 18466   {
       
 18467     if (workInProgress._debugNeedsRemount && current$$1 !== null) {
       
 18468       // This will restart the begin phase with a new fiber.
       
 18469       return remountFiber(current$$1, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
       
 18470     }
       
 18471   }
       
 18472 
       
 18473   if (current$$1 !== null) {
       
 18474     var oldProps = current$$1.memoizedProps;
       
 18475     var newProps = workInProgress.pendingProps;
       
 18476 
       
 18477     if (oldProps !== newProps || hasContextChanged() || (
       
 18478     // Force a re-render if the implementation changed due to hot reload:
       
 18479     workInProgress.type !== current$$1.type)) {
       
 18480       // If props or context changed, mark the fiber as having performed work.
       
 18481       // This may be unset if the props are determined to be equal later (memo).
       
 18482       didReceiveUpdate = true;
       
 18483     } else if (updateExpirationTime < renderExpirationTime) {
       
 18484       didReceiveUpdate = false;
       
 18485       // This fiber does not have any pending work. Bailout without entering
       
 18486       // the begin phase. There's still some bookkeeping we that needs to be done
       
 18487       // in this optimized path, mostly pushing stuff onto the stack.
       
 18488       switch (workInProgress.tag) {
       
 18489         case HostRoot:
       
 18490           pushHostRootContext(workInProgress);
       
 18491           resetHydrationState();
       
 18492           break;
       
 18493         case HostComponent:
       
 18494           pushHostContext(workInProgress);
       
 18495           if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
       
 18496             if (enableSchedulerTracing) {
       
 18497               markSpawnedWork(Never);
       
 18498             }
       
 18499             // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 18500             workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 18501             return null;
       
 18502           }
       
 18503           break;
       
 18504         case ClassComponent:
       
 18505           {
       
 18506             var Component = workInProgress.type;
       
 18507             if (isContextProvider(Component)) {
       
 18508               pushContextProvider(workInProgress);
       
 18509             }
       
 18510             break;
       
 18511           }
       
 18512         case HostPortal:
       
 18513           pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 18514           break;
       
 18515         case ContextProvider:
       
 18516           {
       
 18517             var newValue = workInProgress.memoizedProps.value;
       
 18518             pushProvider(workInProgress, newValue);
       
 18519             break;
       
 18520           }
       
 18521         case Profiler:
       
 18522           if (enableProfilerTimer) {
       
 18523             workInProgress.effectTag |= Update;
       
 18524           }
       
 18525           break;
       
 18526         case SuspenseComponent:
       
 18527           {
       
 18528             var state = workInProgress.memoizedState;
       
 18529             var didTimeout = state !== null;
       
 18530             if (didTimeout) {
       
 18531               // If this boundary is currently timed out, we need to decide
       
 18532               // whether to retry the primary children, or to skip over it and
       
 18533               // go straight to the fallback. Check the priority of the primary
       
 18534               var primaryChildFragment = workInProgress.child;
       
 18535               var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
       
 18536               if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
       
 18537                 // The primary children have pending work. Use the normal path
       
 18538                 // to attempt to render the primary children again.
       
 18539                 return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 18540               } else {
       
 18541                 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18542                 // The primary children do not have pending work with sufficient
       
 18543                 // priority. Bailout.
       
 18544                 var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 18545                 if (child !== null) {
       
 18546                   // The fallback children have pending work. Skip over the
       
 18547                   // primary children and work on the fallback.
       
 18548                   return child.sibling;
       
 18549                 } else {
       
 18550                   return null;
       
 18551                 }
       
 18552               }
       
 18553             } else {
       
 18554               pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18555             }
       
 18556             break;
       
 18557           }
       
 18558         case DehydratedSuspenseComponent:
       
 18559           {
       
 18560             if (enableSuspenseServerRenderer) {
       
 18561               pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18562               // We know that this component will suspend again because if it has
       
 18563               // been unsuspended it has committed as a regular Suspense component.
       
 18564               // If it needs to be retried, it should have work scheduled on it.
       
 18565               workInProgress.effectTag |= DidCapture;
       
 18566             }
       
 18567             break;
       
 18568           }
       
 18569         case SuspenseListComponent:
       
 18570           {
       
 18571             var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
       
 18572 
       
 18573             var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
       
 18574 
       
 18575             if (didSuspendBefore) {
       
 18576               if (hasChildWork) {
       
 18577                 // If something was in fallback state last time, and we have all the
       
 18578                 // same children then we're still in progressive loading state.
       
 18579                 // Something might get unblocked by state updates or retries in the
       
 18580                 // tree which will affect the tail. So we need to use the normal
       
 18581                 // path to compute the correct tail.
       
 18582                 return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
       
 18583               }
       
 18584               // If none of the children had any work, that means that none of
       
 18585               // them got retried so they'll still be blocked in the same way
       
 18586               // as before. We can fast bail out.
       
 18587               workInProgress.effectTag |= DidCapture;
       
 18588             }
       
 18589 
       
 18590             // If nothing suspended before and we're rendering the same children,
       
 18591             // then the tail doesn't matter. Anything new that suspends will work
       
 18592             // in the "together" mode, so we can continue from the state we had.
       
 18593             var renderState = workInProgress.memoizedState;
       
 18594             if (renderState !== null) {
       
 18595               // Reset to the "together" mode in case we've started a different
       
 18596               // update in the past but didn't complete it.
       
 18597               renderState.rendering = null;
       
 18598               renderState.tail = null;
       
 18599             }
       
 18600             pushSuspenseContext(workInProgress, suspenseStackCursor.current);
       
 18601 
       
 18602             if (hasChildWork) {
       
 18603               break;
       
 18604             } else {
       
 18605               // If none of the children had any work, that means that none of
       
 18606               // them got retried so they'll still be blocked in the same way
       
 18607               // as before. We can fast bail out.
       
 18608               return null;
       
 18609             }
       
 18610           }
       
 18611       }
       
 18612       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 18613     }
       
 18614   } else {
       
 18615     didReceiveUpdate = false;
       
 18616   }
       
 18617 
       
 18618   // Before entering the begin phase, clear the expiration time.
       
 18619   workInProgress.expirationTime = NoWork;
       
 18620 
       
 18621   switch (workInProgress.tag) {
       
 18622     case IndeterminateComponent:
       
 18623       {
       
 18624         return mountIndeterminateComponent(current$$1, workInProgress, workInProgress.type, renderExpirationTime);
       
 18625       }
       
 18626     case LazyComponent:
       
 18627       {
       
 18628         var elementType = workInProgress.elementType;
       
 18629         return mountLazyComponent(current$$1, workInProgress, elementType, updateExpirationTime, renderExpirationTime);
       
 18630       }
       
 18631     case FunctionComponent:
       
 18632       {
       
 18633         var _Component = workInProgress.type;
       
 18634         var unresolvedProps = workInProgress.pendingProps;
       
 18635         var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
       
 18636         return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
       
 18637       }
       
 18638     case ClassComponent:
       
 18639       {
       
 18640         var _Component2 = workInProgress.type;
       
 18641         var _unresolvedProps = workInProgress.pendingProps;
       
 18642         var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
       
 18643         return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
       
 18644       }
       
 18645     case HostRoot:
       
 18646       return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
       
 18647     case HostComponent:
       
 18648       return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
       
 18649     case HostText:
       
 18650       return updateHostText(current$$1, workInProgress);
       
 18651     case SuspenseComponent:
       
 18652       return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 18653     case HostPortal:
       
 18654       return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
       
 18655     case ForwardRef:
       
 18656       {
       
 18657         var type = workInProgress.type;
       
 18658         var _unresolvedProps2 = workInProgress.pendingProps;
       
 18659         var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
       
 18660         return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
       
 18661       }
       
 18662     case Fragment:
       
 18663       return updateFragment(current$$1, workInProgress, renderExpirationTime);
       
 18664     case Mode:
       
 18665       return updateMode(current$$1, workInProgress, renderExpirationTime);
       
 18666     case Profiler:
       
 18667       return updateProfiler(current$$1, workInProgress, renderExpirationTime);
       
 18668     case ContextProvider:
       
 18669       return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
       
 18670     case ContextConsumer:
       
 18671       return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
       
 18672     case MemoComponent:
       
 18673       {
       
 18674         var _type2 = workInProgress.type;
       
 18675         var _unresolvedProps3 = workInProgress.pendingProps;
       
 18676         // Resolve outer props first, then resolve inner props.
       
 18677         var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
       
 18678         {
       
 18679           if (workInProgress.type !== workInProgress.elementType) {
       
 18680             var outerPropTypes = _type2.propTypes;
       
 18681             if (outerPropTypes) {
       
 18682               checkPropTypes_1(outerPropTypes, _resolvedProps3, // Resolved for outer only
       
 18683               'prop', getComponentName(_type2), getCurrentFiberStackInDev);
       
 18684             }
       
 18685           }
       
 18686         }
       
 18687         _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
       
 18688         return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
       
 18689       }
       
 18690     case SimpleMemoComponent:
       
 18691       {
       
 18692         return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
       
 18693       }
       
 18694     case IncompleteClassComponent:
       
 18695       {
       
 18696         var _Component3 = workInProgress.type;
       
 18697         var _unresolvedProps4 = workInProgress.pendingProps;
       
 18698         var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
       
 18699         return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
       
 18700       }
       
 18701     case DehydratedSuspenseComponent:
       
 18702       {
       
 18703         if (enableSuspenseServerRenderer) {
       
 18704           return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 18705         }
       
 18706         break;
       
 18707       }
       
 18708     case SuspenseListComponent:
       
 18709       {
       
 18710         return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
       
 18711       }
       
 18712     case FundamentalComponent:
       
 18713       {
       
 18714         if (enableFundamentalAPI) {
       
 18715           return updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime);
       
 18716         }
       
 18717         break;
       
 18718       }
       
 18719   }
       
 18720   (function () {
       
 18721     {
       
 18722       {
       
 18723         throw ReactError(Error('Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'));
       
 18724       }
       
 18725     }
       
 18726   })();
       
 18727 }
       
 18728 
       
 18729 function createFundamentalStateInstance(currentFiber, props, impl, state) {
       
 18730   return {
       
 18731     currentFiber: currentFiber,
       
 18732     impl: impl,
       
 18733     instance: null,
       
 18734     prevProps: null,
       
 18735     props: props,
       
 18736     state: state
       
 18737   };
       
 18738 }
       
 18739 
       
 18740 var emptyObject = {};
       
 18741 var isArray$2 = Array.isArray;
 16576 
 18742 
 16577 function markUpdate(workInProgress) {
 18743 function markUpdate(workInProgress) {
 16578   // Tag the fiber with an update effect. This turns a Placement into
 18744   // Tag the fiber with an update effect. This turns a Placement into
 16579   // a PlacementAndUpdate.
 18745   // a PlacementAndUpdate.
 16580   workInProgress.effectTag |= Update;
 18746   workInProgress.effectTag |= Update;
 16596     // children to find all the terminal nodes.
 18762     // children to find all the terminal nodes.
 16597     var node = workInProgress.child;
 18763     var node = workInProgress.child;
 16598     while (node !== null) {
 18764     while (node !== null) {
 16599       if (node.tag === HostComponent || node.tag === HostText) {
 18765       if (node.tag === HostComponent || node.tag === HostText) {
 16600         appendInitialChild(parent, node.stateNode);
 18766         appendInitialChild(parent, node.stateNode);
       
 18767       } else if (node.tag === FundamentalComponent) {
       
 18768         appendInitialChild(parent, node.stateNode.instance);
 16601       } else if (node.tag === HostPortal) {
 18769       } else if (node.tag === HostPortal) {
 16602         // If we have a portal child, then we don't want to traverse
 18770         // If we have a portal child, then we don't want to traverse
 16603         // down its children. Instead, we'll get insertions from each child in
 18771         // down its children. Instead, we'll get insertions from each child in
 16604         // the portal directly.
 18772         // the portal directly.
 16605       } else if (node.child !== null) {
 18773       } else if (node.child !== null) {
 16667     var node = workInProgress.child;
 18835     var node = workInProgress.child;
 16668     while (node !== null) {
 18836     while (node !== null) {
 16669       // eslint-disable-next-line no-labels
 18837       // eslint-disable-next-line no-labels
 16670       branches: if (node.tag === HostComponent) {
 18838       branches: if (node.tag === HostComponent) {
 16671         var instance = node.stateNode;
 18839         var instance = node.stateNode;
 16672         if (needsVisibilityToggle) {
 18840         if (needsVisibilityToggle && isHidden) {
       
 18841           // This child is inside a timed out tree. Hide it.
 16673           var props = node.memoizedProps;
 18842           var props = node.memoizedProps;
 16674           var type = node.type;
 18843           var type = node.type;
 16675           if (isHidden) {
 18844           instance = cloneHiddenInstance(instance, type, props, node);
 16676             // This child is inside a timed out tree. Hide it.
       
 16677             instance = cloneHiddenInstance(instance, type, props, node);
       
 16678           } else {
       
 16679             // This child was previously inside a timed out tree. If it was not
       
 16680             // updated during this render, it may need to be unhidden. Clone
       
 16681             // again to be sure.
       
 16682             instance = cloneUnhiddenInstance(instance, type, props, node);
       
 16683           }
       
 16684           node.stateNode = instance;
       
 16685         }
 18845         }
 16686         appendInitialChild(parent, instance);
 18846         appendInitialChild(parent, instance);
 16687       } else if (node.tag === HostText) {
 18847       } else if (node.tag === HostText) {
 16688         var _instance = node.stateNode;
 18848         var _instance = node.stateNode;
 16689         if (needsVisibilityToggle) {
 18849         if (needsVisibilityToggle && isHidden) {
       
 18850           // This child is inside a timed out tree. Hide it.
 16690           var text = node.memoizedProps;
 18851           var text = node.memoizedProps;
 16691           var rootContainerInstance = getRootHostContainer();
 18852           _instance = cloneHiddenTextInstance(_instance, text, node);
 16692           var currentHostContext = getHostContext();
       
 16693           if (isHidden) {
       
 16694             _instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
       
 16695           } else {
       
 16696             _instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
       
 16697           }
       
 16698           node.stateNode = _instance;
       
 16699         }
 18853         }
 16700         appendInitialChild(parent, _instance);
 18854         appendInitialChild(parent, _instance);
       
 18855       } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
       
 18856         var _instance2 = node.stateNode.instance;
       
 18857         if (needsVisibilityToggle && isHidden) {
       
 18858           // This child is inside a timed out tree. Hide it.
       
 18859           var _props = node.memoizedProps;
       
 18860           var _type = node.type;
       
 18861           _instance2 = cloneHiddenInstance(_instance2, _type, _props, node);
       
 18862         }
       
 18863         appendInitialChild(parent, _instance2);
 16701       } else if (node.tag === HostPortal) {
 18864       } else if (node.tag === HostPortal) {
 16702         // If we have a portal child, then we don't want to traverse
 18865         // If we have a portal child, then we don't want to traverse
 16703         // down its children. Instead, we'll get insertions from each child in
 18866         // down its children. Instead, we'll get insertions from each child in
 16704         // the portal directly.
 18867         // the portal directly.
 16705       } else if (node.tag === SuspenseComponent) {
 18868       } else if (node.tag === SuspenseComponent) {
 16706         var current = node.alternate;
 18869         if ((node.effectTag & Update) !== NoEffect) {
 16707         if (current !== null) {
 18870           // Need to toggle the visibility of the primary children.
 16708           var oldState = current.memoizedState;
 18871           var newIsHidden = node.memoizedState !== null;
 16709           var newState = node.memoizedState;
 18872           if (newIsHidden) {
 16710           var oldIsHidden = oldState !== null;
 18873             var primaryChildParent = node.child;
 16711           var newIsHidden = newState !== null;
       
 16712           if (oldIsHidden !== newIsHidden) {
       
 16713             // The placeholder either just timed out or switched back to the normal
       
 16714             // children after having previously timed out. Toggle the visibility of
       
 16715             // the direct host children.
       
 16716             var primaryChildParent = newIsHidden ? node.child : node;
       
 16717             if (primaryChildParent !== null) {
 18874             if (primaryChildParent !== null) {
 16718               appendAllChildren(parent, primaryChildParent, true, newIsHidden);
 18875               if (primaryChildParent.child !== null) {
       
 18876                 primaryChildParent.child.return = primaryChildParent;
       
 18877                 appendAllChildren(parent, primaryChildParent, true, newIsHidden);
       
 18878               }
       
 18879               var fallbackChildParent = primaryChildParent.sibling;
       
 18880               if (fallbackChildParent !== null) {
       
 18881                 fallbackChildParent.return = node;
       
 18882                 node = fallbackChildParent;
       
 18883                 continue;
       
 18884               }
 16719             }
 18885             }
 16720             // eslint-disable-next-line no-labels
       
 16721             break branches;
       
 16722           }
 18886           }
 16723         }
 18887         }
 16724         if (node.child !== null) {
 18888         if (node.child !== null) {
 16725           // Continue traversing like normal
 18889           // Continue traversing like normal
 16726           node.child.return = node;
 18890           node.child.return = node;
 16755     var node = workInProgress.child;
 18919     var node = workInProgress.child;
 16756     while (node !== null) {
 18920     while (node !== null) {
 16757       // eslint-disable-next-line no-labels
 18921       // eslint-disable-next-line no-labels
 16758       branches: if (node.tag === HostComponent) {
 18922       branches: if (node.tag === HostComponent) {
 16759         var instance = node.stateNode;
 18923         var instance = node.stateNode;
 16760         if (needsVisibilityToggle) {
 18924         if (needsVisibilityToggle && isHidden) {
       
 18925           // This child is inside a timed out tree. Hide it.
 16761           var props = node.memoizedProps;
 18926           var props = node.memoizedProps;
 16762           var type = node.type;
 18927           var type = node.type;
 16763           if (isHidden) {
 18928           instance = cloneHiddenInstance(instance, type, props, node);
 16764             // This child is inside a timed out tree. Hide it.
       
 16765             instance = cloneHiddenInstance(instance, type, props, node);
       
 16766           } else {
       
 16767             // This child was previously inside a timed out tree. If it was not
       
 16768             // updated during this render, it may need to be unhidden. Clone
       
 16769             // again to be sure.
       
 16770             instance = cloneUnhiddenInstance(instance, type, props, node);
       
 16771           }
       
 16772           node.stateNode = instance;
       
 16773         }
 18929         }
 16774         appendChildToContainerChildSet(containerChildSet, instance);
 18930         appendChildToContainerChildSet(containerChildSet, instance);
 16775       } else if (node.tag === HostText) {
 18931       } else if (node.tag === HostText) {
 16776         var _instance2 = node.stateNode;
 18932         var _instance3 = node.stateNode;
 16777         if (needsVisibilityToggle) {
 18933         if (needsVisibilityToggle && isHidden) {
       
 18934           // This child is inside a timed out tree. Hide it.
 16778           var text = node.memoizedProps;
 18935           var text = node.memoizedProps;
 16779           var rootContainerInstance = getRootHostContainer();
 18936           _instance3 = cloneHiddenTextInstance(_instance3, text, node);
 16780           var currentHostContext = getHostContext();
 18937         }
 16781           if (isHidden) {
 18938         appendChildToContainerChildSet(containerChildSet, _instance3);
 16782             _instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
 18939       } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
 16783           } else {
 18940         var _instance4 = node.stateNode.instance;
 16784             _instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
 18941         if (needsVisibilityToggle && isHidden) {
 16785           }
 18942           // This child is inside a timed out tree. Hide it.
 16786           node.stateNode = _instance2;
 18943           var _props2 = node.memoizedProps;
 16787         }
 18944           var _type2 = node.type;
 16788         appendChildToContainerChildSet(containerChildSet, _instance2);
 18945           _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node);
       
 18946         }
       
 18947         appendChildToContainerChildSet(containerChildSet, _instance4);
 16789       } else if (node.tag === HostPortal) {
 18948       } else if (node.tag === HostPortal) {
 16790         // If we have a portal child, then we don't want to traverse
 18949         // If we have a portal child, then we don't want to traverse
 16791         // down its children. Instead, we'll get insertions from each child in
 18950         // down its children. Instead, we'll get insertions from each child in
 16792         // the portal directly.
 18951         // the portal directly.
 16793       } else if (node.tag === SuspenseComponent) {
 18952       } else if (node.tag === SuspenseComponent) {
 16794         var current = node.alternate;
 18953         if ((node.effectTag & Update) !== NoEffect) {
 16795         if (current !== null) {
 18954           // Need to toggle the visibility of the primary children.
 16796           var oldState = current.memoizedState;
 18955           var newIsHidden = node.memoizedState !== null;
 16797           var newState = node.memoizedState;
 18956           if (newIsHidden) {
 16798           var oldIsHidden = oldState !== null;
 18957             var primaryChildParent = node.child;
 16799           var newIsHidden = newState !== null;
       
 16800           if (oldIsHidden !== newIsHidden) {
       
 16801             // The placeholder either just timed out or switched back to the normal
       
 16802             // children after having previously timed out. Toggle the visibility of
       
 16803             // the direct host children.
       
 16804             var primaryChildParent = newIsHidden ? node.child : node;
       
 16805             if (primaryChildParent !== null) {
 18958             if (primaryChildParent !== null) {
 16806               appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
 18959               if (primaryChildParent.child !== null) {
       
 18960                 primaryChildParent.child.return = primaryChildParent;
       
 18961                 appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
       
 18962               }
       
 18963               var fallbackChildParent = primaryChildParent.sibling;
       
 18964               if (fallbackChildParent !== null) {
       
 18965                 fallbackChildParent.return = node;
       
 18966                 node = fallbackChildParent;
       
 18967                 continue;
       
 18968               }
 16807             }
 18969             }
 16808             // eslint-disable-next-line no-labels
       
 16809             break branches;
       
 16810           }
 18970           }
 16811         }
 18971         }
 16812         if (node.child !== null) {
 18972         if (node.child !== null) {
 16813           // Continue traversing like normal
 18973           // Continue traversing like normal
 16814           node.child.return = node;
 18974           node.child.return = node;
 16912   updateHostText$1 = function (current, workInProgress, oldText, newText) {
 19072   updateHostText$1 = function (current, workInProgress, oldText, newText) {
 16913     // Noop
 19073     // Noop
 16914   };
 19074   };
 16915 }
 19075 }
 16916 
 19076 
       
 19077 function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
       
 19078   switch (renderState.tailMode) {
       
 19079     case 'hidden':
       
 19080       {
       
 19081         // Any insertions at the end of the tail list after this point
       
 19082         // should be invisible. If there are already mounted boundaries
       
 19083         // anything before them are not considered for collapsing.
       
 19084         // Therefore we need to go through the whole tail to find if
       
 19085         // there are any.
       
 19086         var tailNode = renderState.tail;
       
 19087         var lastTailNode = null;
       
 19088         while (tailNode !== null) {
       
 19089           if (tailNode.alternate !== null) {
       
 19090             lastTailNode = tailNode;
       
 19091           }
       
 19092           tailNode = tailNode.sibling;
       
 19093         }
       
 19094         // Next we're simply going to delete all insertions after the
       
 19095         // last rendered item.
       
 19096         if (lastTailNode === null) {
       
 19097           // All remaining items in the tail are insertions.
       
 19098           renderState.tail = null;
       
 19099         } else {
       
 19100           // Detach the insertion after the last node that was already
       
 19101           // inserted.
       
 19102           lastTailNode.sibling = null;
       
 19103         }
       
 19104         break;
       
 19105       }
       
 19106     case 'collapsed':
       
 19107       {
       
 19108         // Any insertions at the end of the tail list after this point
       
 19109         // should be invisible. If there are already mounted boundaries
       
 19110         // anything before them are not considered for collapsing.
       
 19111         // Therefore we need to go through the whole tail to find if
       
 19112         // there are any.
       
 19113         var _tailNode = renderState.tail;
       
 19114         var _lastTailNode = null;
       
 19115         while (_tailNode !== null) {
       
 19116           if (_tailNode.alternate !== null) {
       
 19117             _lastTailNode = _tailNode;
       
 19118           }
       
 19119           _tailNode = _tailNode.sibling;
       
 19120         }
       
 19121         // Next we're simply going to delete all insertions after the
       
 19122         // last rendered item.
       
 19123         if (_lastTailNode === null) {
       
 19124           // All remaining items in the tail are insertions.
       
 19125           if (!hasRenderedATailFallback && renderState.tail !== null) {
       
 19126             // We suspended during the head. We want to show at least one
       
 19127             // row at the tail. So we'll keep on and cut off the rest.
       
 19128             renderState.tail.sibling = null;
       
 19129           } else {
       
 19130             renderState.tail = null;
       
 19131           }
       
 19132         } else {
       
 19133           // Detach the insertion after the last node that was already
       
 19134           // inserted.
       
 19135           _lastTailNode.sibling = null;
       
 19136         }
       
 19137         break;
       
 19138       }
       
 19139   }
       
 19140 }
       
 19141 
 16917 function completeWork(current, workInProgress, renderExpirationTime) {
 19142 function completeWork(current, workInProgress, renderExpirationTime) {
 16918   var newProps = workInProgress.pendingProps;
 19143   var newProps = workInProgress.pendingProps;
 16919 
 19144 
 16920   switch (workInProgress.tag) {
 19145   switch (workInProgress.tag) {
 16921     case IndeterminateComponent:
 19146     case IndeterminateComponent:
 16959         var rootContainerInstance = getRootHostContainer();
 19184         var rootContainerInstance = getRootHostContainer();
 16960         var type = workInProgress.type;
 19185         var type = workInProgress.type;
 16961         if (current !== null && workInProgress.stateNode != null) {
 19186         if (current !== null && workInProgress.stateNode != null) {
 16962           updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
 19187           updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
 16963 
 19188 
       
 19189           if (enableFlareAPI) {
       
 19190             var prevListeners = current.memoizedProps.listeners;
       
 19191             var nextListeners = newProps.listeners;
       
 19192             var instance = workInProgress.stateNode;
       
 19193             if (prevListeners !== nextListeners) {
       
 19194               updateEventListeners(nextListeners, instance, rootContainerInstance, workInProgress);
       
 19195             }
       
 19196           }
       
 19197 
 16964           if (current.ref !== workInProgress.ref) {
 19198           if (current.ref !== workInProgress.ref) {
 16965             markRef$1(workInProgress);
 19199             markRef$1(workInProgress);
 16966           }
 19200           }
 16967         } else {
 19201         } else {
 16968           if (!newProps) {
 19202           if (!newProps) {
 16969             !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 19203             (function () {
       
 19204               if (!(workInProgress.stateNode !== null)) {
       
 19205                 {
       
 19206                   throw ReactError(Error('We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.'));
       
 19207                 }
       
 19208               }
       
 19209             })();
 16970             // This can happen when we abort work.
 19210             // This can happen when we abort work.
 16971             break;
 19211             break;
 16972           }
 19212           }
 16973 
 19213 
 16974           var currentHostContext = getHostContext();
 19214           var currentHostContext = getHostContext();
 16984               // If changes to the hydrated node needs to be applied at the
 19224               // If changes to the hydrated node needs to be applied at the
 16985               // commit-phase we mark this as such.
 19225               // commit-phase we mark this as such.
 16986               markUpdate(workInProgress);
 19226               markUpdate(workInProgress);
 16987             }
 19227             }
 16988           } else {
 19228           } else {
 16989             var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
 19229             var _instance5 = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
 16990 
 19230 
 16991             appendAllChildren(instance, workInProgress, false, false);
 19231             appendAllChildren(_instance5, workInProgress, false, false);
       
 19232 
       
 19233             if (enableFlareAPI) {
       
 19234               var listeners = newProps.listeners;
       
 19235               if (listeners != null) {
       
 19236                 updateEventListeners(listeners, _instance5, rootContainerInstance, workInProgress);
       
 19237               }
       
 19238             }
 16992 
 19239 
 16993             // Certain renderers require commit-time effects for initial mount.
 19240             // Certain renderers require commit-time effects for initial mount.
 16994             // (eg DOM renderer supports auto-focus for certain elements).
 19241             // (eg DOM renderer supports auto-focus for certain elements).
 16995             // Make sure such renderers get scheduled for later work.
 19242             // Make sure such renderers get scheduled for later work.
 16996             if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance, currentHostContext)) {
 19243             if (finalizeInitialChildren(_instance5, type, newProps, rootContainerInstance, currentHostContext)) {
 16997               markUpdate(workInProgress);
 19244               markUpdate(workInProgress);
 16998             }
 19245             }
 16999             workInProgress.stateNode = instance;
 19246             workInProgress.stateNode = _instance5;
 17000           }
 19247           }
 17001 
 19248 
 17002           if (workInProgress.ref !== null) {
 19249           if (workInProgress.ref !== null) {
 17003             // If there is a ref on a host node we need to schedule a callback
 19250             // If there is a ref on a host node we need to schedule a callback
 17004             markRef$1(workInProgress);
 19251             markRef$1(workInProgress);
 17014           // If we have an alternate, that means this is an update and we need
 19261           // If we have an alternate, that means this is an update and we need
 17015           // to schedule a side-effect to do the updates.
 19262           // to schedule a side-effect to do the updates.
 17016           updateHostText$1(current, workInProgress, oldText, newText);
 19263           updateHostText$1(current, workInProgress, oldText, newText);
 17017         } else {
 19264         } else {
 17018           if (typeof newText !== 'string') {
 19265           if (typeof newText !== 'string') {
 17019             !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 19266             (function () {
       
 19267               if (!(workInProgress.stateNode !== null)) {
       
 19268                 {
       
 19269                   throw ReactError(Error('We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.'));
       
 19270                 }
       
 19271               }
       
 19272             })();
 17020             // This can happen when we abort work.
 19273             // This can happen when we abort work.
 17021           }
 19274           }
 17022           var _rootContainerInstance = getRootHostContainer();
 19275           var _rootContainerInstance = getRootHostContainer();
 17023           var _currentHostContext = getHostContext();
 19276           var _currentHostContext = getHostContext();
 17024           var _wasHydrated = popHydrationState(workInProgress);
 19277           var _wasHydrated = popHydrationState(workInProgress);
 17034       }
 19287       }
 17035     case ForwardRef:
 19288     case ForwardRef:
 17036       break;
 19289       break;
 17037     case SuspenseComponent:
 19290     case SuspenseComponent:
 17038       {
 19291       {
       
 19292         popSuspenseContext(workInProgress);
 17039         var nextState = workInProgress.memoizedState;
 19293         var nextState = workInProgress.memoizedState;
 17040         if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
 19294         if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
 17041           // Something suspended. Re-render with the fallback children.
 19295           // Something suspended. Re-render with the fallback children.
 17042           workInProgress.expirationTime = renderExpirationTime;
 19296           workInProgress.expirationTime = renderExpirationTime;
 17043           // Do not reset the effect list.
 19297           // Do not reset the effect list.
 17044           return workInProgress;
 19298           return workInProgress;
 17045         }
 19299         }
 17046 
 19300 
 17047         var nextDidTimeout = nextState !== null;
 19301         var nextDidTimeout = nextState !== null;
 17048         var prevDidTimeout = current !== null && current.memoizedState !== null;
 19302         var prevDidTimeout = false;
 17049 
 19303         if (current === null) {
 17050         if (current !== null && !nextDidTimeout && prevDidTimeout) {
 19304           // In cases where we didn't find a suitable hydration boundary we never
 17051           // We just switched from the fallback to the normal children. Delete
 19305           // downgraded this to a DehydratedSuspenseComponent, but we still need to
 17052           // the fallback.
 19306           // pop the hydration state since we might be inside the insertion tree.
 17053           // TODO: Would it be better to store the fallback fragment on
 19307           popHydrationState(workInProgress);
 17054           var currentFallbackChild = current.child.sibling;
 19308         } else {
 17055           if (currentFallbackChild !== null) {
 19309           var prevState = current.memoizedState;
 17056             // Deletions go at the beginning of the return fiber's effect list
 19310           prevDidTimeout = prevState !== null;
 17057             var first = workInProgress.firstEffect;
 19311           if (!nextDidTimeout && prevState !== null) {
 17058             if (first !== null) {
 19312             // We just switched from the fallback to the normal children.
 17059               workInProgress.firstEffect = currentFallbackChild;
 19313             // Delete the fallback.
 17060               currentFallbackChild.nextEffect = first;
 19314             // TODO: Would it be better to store the fallback fragment on
       
 19315             var currentFallbackChild = current.child.sibling;
       
 19316             if (currentFallbackChild !== null) {
       
 19317               // Deletions go at the beginning of the return fiber's effect list
       
 19318               var first = workInProgress.firstEffect;
       
 19319               if (first !== null) {
       
 19320                 workInProgress.firstEffect = currentFallbackChild;
       
 19321                 currentFallbackChild.nextEffect = first;
       
 19322               } else {
       
 19323                 workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
       
 19324                 currentFallbackChild.nextEffect = null;
       
 19325               }
       
 19326               currentFallbackChild.effectTag = Deletion;
       
 19327             }
       
 19328           }
       
 19329         }
       
 19330 
       
 19331         if (nextDidTimeout && !prevDidTimeout) {
       
 19332           // If this subtreee is running in batched mode we can suspend,
       
 19333           // otherwise we won't suspend.
       
 19334           // TODO: This will still suspend a synchronous tree if anything
       
 19335           // in the concurrent tree already suspended during this render.
       
 19336           // This is a known bug.
       
 19337           if ((workInProgress.mode & BatchedMode) !== NoMode) {
       
 19338             // TODO: Move this back to throwException because this is too late
       
 19339             // if this is a large tree which is common for initial loads. We
       
 19340             // don't know if we should restart a render or not until we get
       
 19341             // this marker, and this is too late.
       
 19342             // If this render already had a ping or lower pri updates,
       
 19343             // and this is the first time we know we're going to suspend we
       
 19344             // should be able to immediately restart from within throwException.
       
 19345             var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
       
 19346             if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
       
 19347               // If this was in an invisible tree or a new render, then showing
       
 19348               // this boundary is ok.
       
 19349               renderDidSuspend();
 17061             } else {
 19350             } else {
 17062               workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
 19351               // Otherwise, we're going to have to hide content so we should
 17063               currentFallbackChild.nextEffect = null;
 19352               // suspend for longer if possible.
       
 19353               renderDidSuspendDelayIfPossible();
 17064             }
 19354             }
 17065             currentFallbackChild.effectTag = Deletion;
       
 17066           }
 19355           }
 17067         }
 19356         }
 17068 
 19357 
 17069         if (nextDidTimeout || prevDidTimeout) {
 19358         if (supportsPersistence) {
 17070           // If the children are hidden, or if they were previous hidden, schedule
 19359           // TODO: Only schedule updates if not prevDidTimeout.
 17071           // an effect to toggle their visibility. This is also used to attach a
 19360           if (nextDidTimeout) {
 17072           // retry listener to the promise.
 19361             // If this boundary just timed out, schedule an effect to attach a
       
 19362             // retry listener to the proimse. This flag is also used to hide the
       
 19363             // primary children.
       
 19364             workInProgress.effectTag |= Update;
       
 19365           }
       
 19366         }
       
 19367         if (supportsMutation) {
       
 19368           // TODO: Only schedule updates if these values are non equal, i.e. it changed.
       
 19369           if (nextDidTimeout || prevDidTimeout) {
       
 19370             // If this boundary just timed out, schedule an effect to attach a
       
 19371             // retry listener to the proimse. This flag is also used to hide the
       
 19372             // primary children. In mutation mode, we also need the flag to
       
 19373             // *unhide* children that were previously hidden, so check if the
       
 19374             // is currently timed out, too.
       
 19375             workInProgress.effectTag |= Update;
       
 19376           }
       
 19377         }
       
 19378         if (enableSuspenseCallback && workInProgress.updateQueue !== null && workInProgress.memoizedProps.suspenseCallback != null) {
       
 19379           // Always notify the callback
 17073           workInProgress.effectTag |= Update;
 19380           workInProgress.effectTag |= Update;
 17074         }
 19381         }
 17075         break;
 19382         break;
 17076       }
 19383       }
 17077     case Fragment:
 19384     case Fragment:
 17103         break;
 19410         break;
 17104       }
 19411       }
 17105     case DehydratedSuspenseComponent:
 19412     case DehydratedSuspenseComponent:
 17106       {
 19413       {
 17107         if (enableSuspenseServerRenderer) {
 19414         if (enableSuspenseServerRenderer) {
       
 19415           popSuspenseContext(workInProgress);
 17108           if (current === null) {
 19416           if (current === null) {
 17109             var _wasHydrated2 = popHydrationState(workInProgress);
 19417             var _wasHydrated2 = popHydrationState(workInProgress);
 17110             !_wasHydrated2 ? invariant(false, 'A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.') : void 0;
 19418             (function () {
       
 19419               if (!_wasHydrated2) {
       
 19420                 {
       
 19421                   throw ReactError(Error('A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.'));
       
 19422                 }
       
 19423               }
       
 19424             })();
       
 19425             if (enableSchedulerTracing) {
       
 19426               markSpawnedWork(Never);
       
 19427             }
 17111             skipPastDehydratedSuspenseInstance(workInProgress);
 19428             skipPastDehydratedSuspenseInstance(workInProgress);
 17112           } else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
 19429           } else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
 17113             // This boundary did not suspend so it's now hydrated.
 19430             // This boundary did not suspend so it's now hydrated.
 17114             // To handle any future suspense cases, we're going to now upgrade it
 19431             // To handle any future suspense cases, we're going to now upgrade it
 17115             // to a Suspense component. We detach it from the existing current fiber.
 19432             // to a Suspense component. We detach it from the existing current fiber.
 17120             workInProgress.stateNode = null;
 19437             workInProgress.stateNode = null;
 17121           }
 19438           }
 17122         }
 19439         }
 17123         break;
 19440         break;
 17124       }
 19441       }
       
 19442     case SuspenseListComponent:
       
 19443       {
       
 19444         popSuspenseContext(workInProgress);
       
 19445 
       
 19446         var renderState = workInProgress.memoizedState;
       
 19447 
       
 19448         if (renderState === null) {
       
 19449           // We're running in the default, "independent" mode. We don't do anything
       
 19450           // in this mode.
       
 19451           break;
       
 19452         }
       
 19453 
       
 19454         var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 19455 
       
 19456         var renderedTail = renderState.rendering;
       
 19457         if (renderedTail === null) {
       
 19458           // We just rendered the head.
       
 19459           if (!didSuspendAlready) {
       
 19460             // This is the first pass. We need to figure out if anything is still
       
 19461             // suspended in the rendered set.
       
 19462 
       
 19463             // If new content unsuspended, but there's still some content that
       
 19464             // didn't. Then we need to do a second pass that forces everything
       
 19465             // to keep showing their fallbacks.
       
 19466 
       
 19467             // We might be suspended if something in this render pass suspended, or
       
 19468             // something in the previous committed pass suspended. Otherwise,
       
 19469             // there's no chance so we can skip the expensive call to
       
 19470             // findFirstSuspended.
       
 19471             var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect);
       
 19472             if (!cannotBeSuspended) {
       
 19473               var row = workInProgress.child;
       
 19474               while (row !== null) {
       
 19475                 var suspended = findFirstSuspended(row);
       
 19476                 if (suspended !== null) {
       
 19477                   didSuspendAlready = true;
       
 19478                   workInProgress.effectTag |= DidCapture;
       
 19479                   cutOffTailIfNeeded(renderState, false);
       
 19480 
       
 19481                   // If this is a newly suspended tree, it might not get committed as
       
 19482                   // part of the second pass. In that case nothing will subscribe to
       
 19483                   // its thennables. Instead, we'll transfer its thennables to the
       
 19484                   // SuspenseList so that it can retry if they resolve.
       
 19485                   // There might be multiple of these in the list but since we're
       
 19486                   // going to wait for all of them anyway, it doesn't really matter
       
 19487                   // which ones gets to ping. In theory we could get clever and keep
       
 19488                   // track of how many dependencies remain but it gets tricky because
       
 19489                   // in the meantime, we can add/remove/change items and dependencies.
       
 19490                   // We might bail out of the loop before finding any but that
       
 19491                   // doesn't matter since that means that the other boundaries that
       
 19492                   // we did find already has their listeners attached.
       
 19493                   var newThennables = suspended.updateQueue;
       
 19494                   if (newThennables !== null) {
       
 19495                     workInProgress.updateQueue = newThennables;
       
 19496                     workInProgress.effectTag |= Update;
       
 19497                   }
       
 19498 
       
 19499                   // Rerender the whole list, but this time, we'll force fallbacks
       
 19500                   // to stay in place.
       
 19501                   // Reset the effect list before doing the second pass since that's now invalid.
       
 19502                   workInProgress.firstEffect = workInProgress.lastEffect = null;
       
 19503                   // Reset the child fibers to their original state.
       
 19504                   resetChildFibers(workInProgress, renderExpirationTime);
       
 19505 
       
 19506                   // Set up the Suspense Context to force suspense and immediately
       
 19507                   // rerender the children.
       
 19508                   pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
       
 19509                   return workInProgress.child;
       
 19510                 }
       
 19511                 row = row.sibling;
       
 19512               }
       
 19513             }
       
 19514           } else {
       
 19515             cutOffTailIfNeeded(renderState, false);
       
 19516           }
       
 19517           // Next we're going to render the tail.
       
 19518         } else {
       
 19519           // Append the rendered row to the child list.
       
 19520           if (!didSuspendAlready) {
       
 19521             var _suspended = findFirstSuspended(renderedTail);
       
 19522             if (_suspended !== null) {
       
 19523               workInProgress.effectTag |= DidCapture;
       
 19524               didSuspendAlready = true;
       
 19525               cutOffTailIfNeeded(renderState, true);
       
 19526               // This might have been modified.
       
 19527               if (renderState.tail === null && renderState.tailMode === 'hidden') {
       
 19528                 // We need to delete the row we just rendered.
       
 19529                 // Ensure we transfer the update queue to the parent.
       
 19530                 var _newThennables = _suspended.updateQueue;
       
 19531                 if (_newThennables !== null) {
       
 19532                   workInProgress.updateQueue = _newThennables;
       
 19533                   workInProgress.effectTag |= Update;
       
 19534                 }
       
 19535                 // Reset the effect list to what it w as before we rendered this
       
 19536                 // child. The nested children have already appended themselves.
       
 19537                 var lastEffect = workInProgress.lastEffect = renderState.lastEffect;
       
 19538                 // Remove any effects that were appended after this point.
       
 19539                 if (lastEffect !== null) {
       
 19540                   lastEffect.nextEffect = null;
       
 19541                 }
       
 19542                 // We're done.
       
 19543                 return null;
       
 19544               }
       
 19545             } else if (now() > renderState.tailExpiration && renderExpirationTime > Never) {
       
 19546               // We have now passed our CPU deadline and we'll just give up further
       
 19547               // attempts to render the main content and only render fallbacks.
       
 19548               // The assumption is that this is usually faster.
       
 19549               workInProgress.effectTag |= DidCapture;
       
 19550               didSuspendAlready = true;
       
 19551 
       
 19552               cutOffTailIfNeeded(renderState, false);
       
 19553 
       
 19554               // Since nothing actually suspended, there will nothing to ping this
       
 19555               // to get it started back up to attempt the next item. If we can show
       
 19556               // them, then they really have the same priority as this render.
       
 19557               // So we'll pick it back up the very next render pass once we've had
       
 19558               // an opportunity to yield for paint.
       
 19559 
       
 19560               var nextPriority = renderExpirationTime - 1;
       
 19561               workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority;
       
 19562               if (enableSchedulerTracing) {
       
 19563                 markSpawnedWork(nextPriority);
       
 19564               }
       
 19565             }
       
 19566           }
       
 19567           if (renderState.isBackwards) {
       
 19568             // The effect list of the backwards tail will have been added
       
 19569             // to the end. This breaks the guarantee that life-cycles fire in
       
 19570             // sibling order but that isn't a strong guarantee promised by React.
       
 19571             // Especially since these might also just pop in during future commits.
       
 19572             // Append to the beginning of the list.
       
 19573             renderedTail.sibling = workInProgress.child;
       
 19574             workInProgress.child = renderedTail;
       
 19575           } else {
       
 19576             var previousSibling = renderState.last;
       
 19577             if (previousSibling !== null) {
       
 19578               previousSibling.sibling = renderedTail;
       
 19579             } else {
       
 19580               workInProgress.child = renderedTail;
       
 19581             }
       
 19582             renderState.last = renderedTail;
       
 19583           }
       
 19584         }
       
 19585 
       
 19586         if (renderState.tail !== null) {
       
 19587           // We still have tail rows to render.
       
 19588           if (renderState.tailExpiration === 0) {
       
 19589             // Heuristic for how long we're willing to spend rendering rows
       
 19590             // until we just give up and show what we have so far.
       
 19591             var TAIL_EXPIRATION_TIMEOUT_MS = 500;
       
 19592             renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS;
       
 19593           }
       
 19594           // Pop a row.
       
 19595           var next = renderState.tail;
       
 19596           renderState.rendering = next;
       
 19597           renderState.tail = next.sibling;
       
 19598           renderState.lastEffect = workInProgress.lastEffect;
       
 19599           next.sibling = null;
       
 19600 
       
 19601           // Restore the context.
       
 19602           // TODO: We can probably just avoid popping it instead and only
       
 19603           // setting it the first time we go from not suspended to suspended.
       
 19604           var suspenseContext = suspenseStackCursor.current;
       
 19605           if (didSuspendAlready) {
       
 19606             suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 19607           } else {
       
 19608             suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 19609           }
       
 19610           pushSuspenseContext(workInProgress, suspenseContext);
       
 19611           // Do a pass over the next row.
       
 19612           return next;
       
 19613         }
       
 19614         break;
       
 19615       }
       
 19616     case FundamentalComponent:
       
 19617       {
       
 19618         if (enableFundamentalAPI) {
       
 19619           var fundamentalImpl = workInProgress.type.impl;
       
 19620           var fundamentalInstance = workInProgress.stateNode;
       
 19621 
       
 19622           if (fundamentalInstance === null) {
       
 19623             var getInitialState = fundamentalImpl.getInitialState;
       
 19624             var fundamentalState = void 0;
       
 19625             if (getInitialState !== undefined) {
       
 19626               fundamentalState = getInitialState(newProps);
       
 19627             }
       
 19628             fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance(workInProgress, newProps, fundamentalImpl, fundamentalState || {});
       
 19629             var _instance6 = getFundamentalComponentInstance(fundamentalInstance);
       
 19630             fundamentalInstance.instance = _instance6;
       
 19631             if (fundamentalImpl.reconcileChildren === false) {
       
 19632               return null;
       
 19633             }
       
 19634             appendAllChildren(_instance6, workInProgress, false, false);
       
 19635             mountFundamentalComponent(fundamentalInstance);
       
 19636           } else {
       
 19637             // We fire update in commit phase
       
 19638             var prevProps = fundamentalInstance.props;
       
 19639             fundamentalInstance.prevProps = prevProps;
       
 19640             fundamentalInstance.props = newProps;
       
 19641             fundamentalInstance.currentFiber = workInProgress;
       
 19642             if (supportsPersistence) {
       
 19643               var _instance7 = cloneFundamentalInstance(fundamentalInstance);
       
 19644               fundamentalInstance.instance = _instance7;
       
 19645               appendAllChildren(_instance7, workInProgress, false, false);
       
 19646             }
       
 19647             var shouldUpdate = shouldUpdateFundamentalComponent(fundamentalInstance);
       
 19648             if (shouldUpdate) {
       
 19649               markUpdate(workInProgress);
       
 19650             }
       
 19651           }
       
 19652         }
       
 19653         break;
       
 19654       }
 17125     default:
 19655     default:
 17126       invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
 19656       (function () {
       
 19657         {
       
 19658           {
       
 19659             throw ReactError(Error('Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'));
       
 19660           }
       
 19661         }
       
 19662       })();
 17127   }
 19663   }
 17128 
 19664 
 17129   return null;
 19665   return null;
 17130 }
 19666 }
 17131 
 19667 
 17132 function shouldCaptureSuspense(workInProgress) {
 19668 function mountEventResponder$1(responder, responderProps, instance, rootContainerInstance, fiber, respondersMap) {
 17133   // In order to capture, the Suspense component must have a fallback prop.
 19669   var responderState = emptyObject;
 17134   if (workInProgress.memoizedProps.fallback === undefined) {
 19670   var getInitialState = responder.getInitialState;
 17135     return false;
 19671   if (getInitialState !== null) {
 17136   }
 19672     responderState = getInitialState(responderProps);
 17137   // If it was the primary children that just suspended, capture and render the
 19673   }
 17138   // fallback. Otherwise, don't capture and bubble to the next boundary.
 19674   var responderInstance = createResponderInstance(responder, responderProps, responderState, instance, fiber);
 17139   var nextState = workInProgress.memoizedState;
 19675   mountResponderInstance(responder, responderInstance, responderProps, responderState, instance, rootContainerInstance);
 17140   return nextState === null;
 19676   respondersMap.set(responder, responderInstance);
       
 19677 }
       
 19678 
       
 19679 function updateEventListener(listener, fiber, visistedResponders, respondersMap, instance, rootContainerInstance) {
       
 19680   var responder = void 0;
       
 19681   var props = void 0;
       
 19682 
       
 19683   if (listener) {
       
 19684     responder = listener.responder;
       
 19685     props = listener.props;
       
 19686   }
       
 19687   (function () {
       
 19688     if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
       
 19689       {
       
 19690         throw ReactError(Error('An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer().'));
       
 19691       }
       
 19692     }
       
 19693   })();
       
 19694   var listenerProps = props;
       
 19695   if (visistedResponders.has(responder)) {
       
 19696     // show warning
       
 19697     {
       
 19698       warning$1(false, 'Duplicate event responder "%s" found in event listeners. ' + 'Event listeners passed to elements cannot use the same event responder more than once.', responder.displayName);
       
 19699     }
       
 19700     return;
       
 19701   }
       
 19702   visistedResponders.add(responder);
       
 19703   var responderInstance = respondersMap.get(responder);
       
 19704 
       
 19705   if (responderInstance === undefined) {
       
 19706     // Mount
       
 19707     mountEventResponder$1(responder, listenerProps, instance, rootContainerInstance, fiber, respondersMap);
       
 19708   } else {
       
 19709     // Update
       
 19710     responderInstance.props = listenerProps;
       
 19711     responderInstance.fiber = fiber;
       
 19712   }
       
 19713 }
       
 19714 
       
 19715 function updateEventListeners(listeners, instance, rootContainerInstance, fiber) {
       
 19716   var visistedResponders = new Set();
       
 19717   var dependencies = fiber.dependencies;
       
 19718   if (listeners != null) {
       
 19719     if (dependencies === null) {
       
 19720       dependencies = fiber.dependencies = {
       
 19721         expirationTime: NoWork,
       
 19722         firstContext: null,
       
 19723         responders: new Map()
       
 19724       };
       
 19725     }
       
 19726     var respondersMap = dependencies.responders;
       
 19727     if (respondersMap === null) {
       
 19728       respondersMap = new Map();
       
 19729     }
       
 19730     if (isArray$2(listeners)) {
       
 19731       for (var i = 0, length = listeners.length; i < length; i++) {
       
 19732         var listener = listeners[i];
       
 19733         updateEventListener(listener, fiber, visistedResponders, respondersMap, instance, rootContainerInstance);
       
 19734       }
       
 19735     } else {
       
 19736       updateEventListener(listeners, fiber, visistedResponders, respondersMap, instance, rootContainerInstance);
       
 19737     }
       
 19738   }
       
 19739   if (dependencies !== null) {
       
 19740     var _respondersMap = dependencies.responders;
       
 19741     if (_respondersMap !== null) {
       
 19742       // Unmount
       
 19743       var mountedResponders = Array.from(_respondersMap.keys());
       
 19744       for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) {
       
 19745         var mountedResponder = mountedResponders[_i];
       
 19746         if (!visistedResponders.has(mountedResponder)) {
       
 19747           var responderInstance = _respondersMap.get(mountedResponder);
       
 19748           unmountResponderInstance(responderInstance);
       
 19749           _respondersMap.delete(mountedResponder);
       
 19750         }
       
 19751       }
       
 19752     }
       
 19753   }
       
 19754 }
       
 19755 
       
 19756 function unwindWork(workInProgress, renderExpirationTime) {
       
 19757   switch (workInProgress.tag) {
       
 19758     case ClassComponent:
       
 19759       {
       
 19760         var Component = workInProgress.type;
       
 19761         if (isContextProvider(Component)) {
       
 19762           popContext(workInProgress);
       
 19763         }
       
 19764         var effectTag = workInProgress.effectTag;
       
 19765         if (effectTag & ShouldCapture) {
       
 19766           workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
       
 19767           return workInProgress;
       
 19768         }
       
 19769         return null;
       
 19770       }
       
 19771     case HostRoot:
       
 19772       {
       
 19773         popHostContainer(workInProgress);
       
 19774         popTopLevelContextObject(workInProgress);
       
 19775         var _effectTag = workInProgress.effectTag;
       
 19776         (function () {
       
 19777           if (!((_effectTag & DidCapture) === NoEffect)) {
       
 19778             {
       
 19779               throw ReactError(Error('The root failed to unmount after an error. This is likely a bug in React. Please file an issue.'));
       
 19780             }
       
 19781           }
       
 19782         })();
       
 19783         workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
       
 19784         return workInProgress;
       
 19785       }
       
 19786     case HostComponent:
       
 19787       {
       
 19788         // TODO: popHydrationState
       
 19789         popHostContext(workInProgress);
       
 19790         return null;
       
 19791       }
       
 19792     case SuspenseComponent:
       
 19793       {
       
 19794         popSuspenseContext(workInProgress);
       
 19795         var _effectTag2 = workInProgress.effectTag;
       
 19796         if (_effectTag2 & ShouldCapture) {
       
 19797           workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
       
 19798           // Captured a suspense effect. Re-render the boundary.
       
 19799           return workInProgress;
       
 19800         }
       
 19801         return null;
       
 19802       }
       
 19803     case DehydratedSuspenseComponent:
       
 19804       {
       
 19805         if (enableSuspenseServerRenderer) {
       
 19806           // TODO: popHydrationState
       
 19807           popSuspenseContext(workInProgress);
       
 19808           var _effectTag3 = workInProgress.effectTag;
       
 19809           if (_effectTag3 & ShouldCapture) {
       
 19810             workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
       
 19811             // Captured a suspense effect. Re-render the boundary.
       
 19812             return workInProgress;
       
 19813           }
       
 19814         }
       
 19815         return null;
       
 19816       }
       
 19817     case SuspenseListComponent:
       
 19818       {
       
 19819         popSuspenseContext(workInProgress);
       
 19820         // SuspenseList doesn't actually catch anything. It should've been
       
 19821         // caught by a nested boundary. If not, it should bubble through.
       
 19822         return null;
       
 19823       }
       
 19824     case HostPortal:
       
 19825       popHostContainer(workInProgress);
       
 19826       return null;
       
 19827     case ContextProvider:
       
 19828       popProvider(workInProgress);
       
 19829       return null;
       
 19830     default:
       
 19831       return null;
       
 19832   }
       
 19833 }
       
 19834 
       
 19835 function unwindInterruptedWork(interruptedWork) {
       
 19836   switch (interruptedWork.tag) {
       
 19837     case ClassComponent:
       
 19838       {
       
 19839         var childContextTypes = interruptedWork.type.childContextTypes;
       
 19840         if (childContextTypes !== null && childContextTypes !== undefined) {
       
 19841           popContext(interruptedWork);
       
 19842         }
       
 19843         break;
       
 19844       }
       
 19845     case HostRoot:
       
 19846       {
       
 19847         popHostContainer(interruptedWork);
       
 19848         popTopLevelContextObject(interruptedWork);
       
 19849         break;
       
 19850       }
       
 19851     case HostComponent:
       
 19852       {
       
 19853         popHostContext(interruptedWork);
       
 19854         break;
       
 19855       }
       
 19856     case HostPortal:
       
 19857       popHostContainer(interruptedWork);
       
 19858       break;
       
 19859     case SuspenseComponent:
       
 19860       popSuspenseContext(interruptedWork);
       
 19861       break;
       
 19862     case DehydratedSuspenseComponent:
       
 19863       if (enableSuspenseServerRenderer) {
       
 19864         // TODO: popHydrationState
       
 19865         popSuspenseContext(interruptedWork);
       
 19866       }
       
 19867       break;
       
 19868     case SuspenseListComponent:
       
 19869       popSuspenseContext(interruptedWork);
       
 19870       break;
       
 19871     case ContextProvider:
       
 19872       popProvider(interruptedWork);
       
 19873       break;
       
 19874     default:
       
 19875       break;
       
 19876   }
       
 19877 }
       
 19878 
       
 19879 function createCapturedValue(value, source) {
       
 19880   // If the value is an error, call this function immediately after it is thrown
       
 19881   // so the stack is accurate.
       
 19882   return {
       
 19883     value: value,
       
 19884     source: source,
       
 19885     stack: getStackByFiberInDevAndProd(source)
       
 19886   };
 17141 }
 19887 }
 17142 
 19888 
 17143 // This module is forked in different environments.
 19889 // This module is forked in different environments.
 17144 // By default, return `true` to log errors to the console.
 19890 // By default, return `true` to log errors to the console.
 17145 // Forks can return `false` if this isn't desirable.
 19891 // Forks can return `false` if this isn't desirable.
 17344     case IncompleteClassComponent:
 20090     case IncompleteClassComponent:
 17345       // Nothing to do for these component types
 20091       // Nothing to do for these component types
 17346       return;
 20092       return;
 17347     default:
 20093     default:
 17348       {
 20094       {
 17349         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
 20095         (function () {
       
 20096           {
       
 20097             {
       
 20098               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
       
 20099             }
       
 20100           }
       
 20101         })();
 17350       }
 20102       }
 17351   }
 20103   }
 17352 }
 20104 }
 17353 
 20105 
 17354 function commitHookEffectList(unmountTag, mountTag, finishedWork) {
 20106 function commitHookEffectList(unmountTag, mountTag, finishedWork) {
 17376           if (_destroy !== undefined && typeof _destroy !== 'function') {
 20128           if (_destroy !== undefined && typeof _destroy !== 'function') {
 17377             var addendum = void 0;
 20129             var addendum = void 0;
 17378             if (_destroy === null) {
 20130             if (_destroy === null) {
 17379               addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
 20131               addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
 17380             } else if (typeof _destroy.then === 'function') {
 20132             } else if (typeof _destroy.then === 'function') {
 17381               addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, you may write an async function separately ' + 'and then call it from inside the effect:\n\n' + 'async function fetchComment(commentId) {\n' + '  // You can await here\n' + '}\n\n' + 'useEffect(() => {\n' + '  fetchComment(commentId);\n' + '}, [commentId]);\n\n' + 'In the future, React will provide a more idiomatic solution for data fetching ' + "that doesn't involve writing effects manually.";
 20133               addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + '  async function fetchData() {\n' + '    // You can await here\n' + '    const response = await MyAPI.getData(someId);\n' + '    // ...\n' + '  }\n' + '  fetchData();\n' + '}, [someId]); // Or [] if effect doesn\'t need props or state\n\n' + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
 17382             } else {
 20134             } else {
 17383               addendum = ' You returned: ' + _destroy;
 20135               addendum = ' You returned: ' + _destroy;
 17384             }
 20136             }
 17385             warningWithoutStack$1(false, 'An Effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
 20137             warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
 17386           }
 20138           }
 17387         }
 20139         }
 17388       }
 20140       }
 17389       effect = effect.next;
 20141       effect = effect.next;
 17390     } while (effect !== firstEffect);
 20142     } while (effect !== firstEffect);
 17391   }
 20143   }
 17392 }
 20144 }
 17393 
 20145 
 17394 function commitPassiveHookEffects(finishedWork) {
 20146 function commitPassiveHookEffects(finishedWork) {
 17395   commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
 20147   if ((finishedWork.effectTag & Passive) !== NoEffect) {
 17396   commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
 20148     switch (finishedWork.tag) {
       
 20149       case FunctionComponent:
       
 20150       case ForwardRef:
       
 20151       case SimpleMemoComponent:
       
 20152         {
       
 20153           commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
       
 20154           commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
       
 20155           break;
       
 20156         }
       
 20157       default:
       
 20158         break;
       
 20159     }
       
 20160   }
 17397 }
 20161 }
 17398 
 20162 
 17399 function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
 20163 function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
 17400   switch (finishedWork.tag) {
 20164   switch (finishedWork.tag) {
 17401     case FunctionComponent:
 20165     case FunctionComponent:
 17502     case Profiler:
 20266     case Profiler:
 17503       {
 20267       {
 17504         if (enableProfilerTimer) {
 20268         if (enableProfilerTimer) {
 17505           var onRender = finishedWork.memoizedProps.onRender;
 20269           var onRender = finishedWork.memoizedProps.onRender;
 17506 
 20270 
 17507           if (enableSchedulerTracing) {
 20271           if (typeof onRender === 'function') {
 17508             onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
 20272             if (enableSchedulerTracing) {
 17509           } else {
 20273               onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
 17510             onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
 20274             } else {
       
 20275               onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
       
 20276             }
 17511           }
 20277           }
 17512         }
 20278         }
 17513         return;
 20279         return;
 17514       }
 20280       }
 17515     case SuspenseComponent:
 20281     case SuspenseComponent:
 17516       break;
 20282     case SuspenseListComponent:
 17517     case IncompleteClassComponent:
 20283     case IncompleteClassComponent:
 17518       break;
 20284     case FundamentalComponent:
       
 20285       return;
 17519     default:
 20286     default:
 17520       {
 20287       {
 17521         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
 20288         (function () {
       
 20289           {
       
 20290             {
       
 20291               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
       
 20292             }
       
 20293           }
       
 20294         })();
 17522       }
 20295       }
 17523   }
 20296   }
 17524 }
 20297 }
 17525 
 20298 
 17526 function hideOrUnhideAllChildren(finishedWork, isHidden) {
 20299 function hideOrUnhideAllChildren(finishedWork, isHidden) {
 17606 }
 20379 }
 17607 
 20380 
 17608 // User-originating errors (lifecycles and refs) should not interrupt
 20381 // User-originating errors (lifecycles and refs) should not interrupt
 17609 // deletion, so don't let them throw. Host-originating errors should
 20382 // deletion, so don't let them throw. Host-originating errors should
 17610 // interrupt deletion, so it's okay
 20383 // interrupt deletion, so it's okay
 17611 function commitUnmount(current$$1) {
 20384 function commitUnmount(current$$1, renderPriorityLevel) {
 17612   onCommitUnmount(current$$1);
 20385   onCommitUnmount(current$$1);
 17613 
 20386 
 17614   switch (current$$1.tag) {
 20387   switch (current$$1.tag) {
 17615     case FunctionComponent:
 20388     case FunctionComponent:
 17616     case ForwardRef:
 20389     case ForwardRef:
 17620         var updateQueue = current$$1.updateQueue;
 20393         var updateQueue = current$$1.updateQueue;
 17621         if (updateQueue !== null) {
 20394         if (updateQueue !== null) {
 17622           var lastEffect = updateQueue.lastEffect;
 20395           var lastEffect = updateQueue.lastEffect;
 17623           if (lastEffect !== null) {
 20396           if (lastEffect !== null) {
 17624             var firstEffect = lastEffect.next;
 20397             var firstEffect = lastEffect.next;
 17625             var effect = firstEffect;
 20398 
 17626             do {
 20399             // When the owner fiber is deleted, the destroy function of a passive
 17627               var destroy = effect.destroy;
 20400             // effect hook is called during the synchronous commit phase. This is
 17628               if (destroy !== undefined) {
 20401             // a concession to implementation complexity. Calling it in the
 17629                 safelyCallDestroy(current$$1, destroy);
 20402             // passive effect phase (like they usually are, when dependencies
 17630               }
 20403             // change during an update) would require either traversing the
 17631               effect = effect.next;
 20404             // children of the deleted fiber again, or including unmount effects
 17632             } while (effect !== firstEffect);
 20405             // as part of the fiber effect list.
       
 20406             //
       
 20407             // Because this is during the sync commit phase, we need to change
       
 20408             // the priority.
       
 20409             //
       
 20410             // TODO: Reconsider this implementation trade off.
       
 20411             var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
       
 20412             runWithPriority$2(priorityLevel, function () {
       
 20413               var effect = firstEffect;
       
 20414               do {
       
 20415                 var destroy = effect.destroy;
       
 20416                 if (destroy !== undefined) {
       
 20417                   safelyCallDestroy(current$$1, destroy);
       
 20418                 }
       
 20419                 effect = effect.next;
       
 20420               } while (effect !== firstEffect);
       
 20421             });
 17633           }
 20422           }
 17634         }
 20423         }
 17635         break;
 20424         break;
 17636       }
 20425       }
 17637     case ClassComponent:
 20426     case ClassComponent:
 17643         }
 20432         }
 17644         return;
 20433         return;
 17645       }
 20434       }
 17646     case HostComponent:
 20435     case HostComponent:
 17647       {
 20436       {
       
 20437         if (enableFlareAPI) {
       
 20438           var dependencies = current$$1.dependencies;
       
 20439 
       
 20440           if (dependencies !== null) {
       
 20441             var respondersMap = dependencies.responders;
       
 20442             if (respondersMap !== null) {
       
 20443               var responderInstances = Array.from(respondersMap.values());
       
 20444               for (var i = 0, length = responderInstances.length; i < length; i++) {
       
 20445                 var responderInstance = responderInstances[i];
       
 20446                 unmountResponderInstance(responderInstance);
       
 20447               }
       
 20448               dependencies.responders = null;
       
 20449             }
       
 20450           }
       
 20451         }
 17648         safelyDetachRef(current$$1);
 20452         safelyDetachRef(current$$1);
 17649         return;
 20453         return;
 17650       }
 20454       }
 17651     case HostPortal:
 20455     case HostPortal:
 17652       {
 20456       {
 17653         // TODO: this is recursive.
 20457         // TODO: this is recursive.
 17654         // We are also not using this parent because
 20458         // We are also not using this parent because
 17655         // the portal will get pushed immediately.
 20459         // the portal will get pushed immediately.
 17656         if (supportsMutation) {
 20460         if (supportsMutation) {
 17657           unmountHostComponents(current$$1);
 20461           unmountHostComponents(current$$1, renderPriorityLevel);
 17658         } else if (supportsPersistence) {
 20462         } else if (supportsPersistence) {
 17659           emptyPortalContainer(current$$1);
 20463           emptyPortalContainer(current$$1);
 17660         }
 20464         }
 17661         return;
 20465         return;
 17662       }
 20466       }
 17663   }
 20467     case FundamentalComponent:
 17664 }
 20468       {
 17665 
 20469         if (enableFundamentalAPI) {
 17666 function commitNestedUnmounts(root) {
 20470           var fundamentalInstance = current$$1.stateNode;
       
 20471           if (fundamentalInstance !== null) {
       
 20472             unmountFundamentalComponent(fundamentalInstance);
       
 20473             current$$1.stateNode = null;
       
 20474           }
       
 20475         }
       
 20476       }
       
 20477   }
       
 20478 }
       
 20479 
       
 20480 function commitNestedUnmounts(root, renderPriorityLevel) {
 17667   // While we're inside a removed host node we don't want to call
 20481   // While we're inside a removed host node we don't want to call
 17668   // removeChild on the inner nodes because they're removed by the top
 20482   // removeChild on the inner nodes because they're removed by the top
 17669   // call anyway. We also want to call componentWillUnmount on all
 20483   // call anyway. We also want to call componentWillUnmount on all
 17670   // composites before this host node is removed from the tree. Therefore
 20484   // composites before this host node is removed from the tree. Therefore
 17671   var node = root;
 20485   var node = root;
 17672   while (true) {
 20486   while (true) {
 17673     commitUnmount(node);
 20487     commitUnmount(node, renderPriorityLevel);
 17674     // Visit children because they may contain more composite or host nodes.
 20488     // Visit children because they may contain more composite or host nodes.
 17675     // Skip portals because commitUnmount() currently visits them recursively.
 20489     // Skip portals because commitUnmount() currently visits them recursively.
 17676     if (node.child !== null && (
 20490     if (node.child !== null && (
 17677     // If we use mutation we drill down into portals using commitUnmount above.
 20491     // If we use mutation we drill down into portals using commitUnmount above.
 17678     // If we don't use mutation we drill down into portals here instead.
 20492     // If we don't use mutation we drill down into portals here instead.
 17703   // itself will be GC:ed when the parent updates the next time.
 20517   // itself will be GC:ed when the parent updates the next time.
 17704   current$$1.return = null;
 20518   current$$1.return = null;
 17705   current$$1.child = null;
 20519   current$$1.child = null;
 17706   current$$1.memoizedState = null;
 20520   current$$1.memoizedState = null;
 17707   current$$1.updateQueue = null;
 20521   current$$1.updateQueue = null;
       
 20522   current$$1.dependencies = null;
 17708   var alternate = current$$1.alternate;
 20523   var alternate = current$$1.alternate;
 17709   if (alternate !== null) {
 20524   if (alternate !== null) {
 17710     alternate.return = null;
 20525     alternate.return = null;
 17711     alternate.child = null;
 20526     alternate.child = null;
 17712     alternate.memoizedState = null;
 20527     alternate.memoizedState = null;
 17713     alternate.updateQueue = null;
 20528     alternate.updateQueue = null;
       
 20529     alternate.dependencies = null;
 17714   }
 20530   }
 17715 }
 20531 }
 17716 
 20532 
 17717 function emptyPortalContainer(current$$1) {
 20533 function emptyPortalContainer(current$$1) {
 17718   if (!supportsPersistence) {
 20534   if (!supportsPersistence) {
 17731     return;
 20547     return;
 17732   }
 20548   }
 17733 
 20549 
 17734   switch (finishedWork.tag) {
 20550   switch (finishedWork.tag) {
 17735     case ClassComponent:
 20551     case ClassComponent:
 17736       {
       
 17737         return;
       
 17738       }
       
 17739     case HostComponent:
 20552     case HostComponent:
 17740       {
       
 17741         return;
       
 17742       }
       
 17743     case HostText:
 20553     case HostText:
       
 20554     case FundamentalComponent:
 17744       {
 20555       {
 17745         return;
 20556         return;
 17746       }
 20557       }
 17747     case HostRoot:
 20558     case HostRoot:
 17748     case HostPortal:
 20559     case HostPortal:
 17754         replaceContainerChildren(containerInfo, _pendingChildren);
 20565         replaceContainerChildren(containerInfo, _pendingChildren);
 17755         return;
 20566         return;
 17756       }
 20567       }
 17757     default:
 20568     default:
 17758       {
 20569       {
 17759         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
 20570         (function () {
       
 20571           {
       
 20572             {
       
 20573               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
       
 20574             }
       
 20575           }
       
 20576         })();
 17760       }
 20577       }
 17761   }
 20578   }
 17762 }
 20579 }
 17763 
 20580 
 17764 function getHostParentFiber(fiber) {
 20581 function getHostParentFiber(fiber) {
 17767     if (isHostParent(parent)) {
 20584     if (isHostParent(parent)) {
 17768       return parent;
 20585       return parent;
 17769     }
 20586     }
 17770     parent = parent.return;
 20587     parent = parent.return;
 17771   }
 20588   }
 17772   invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.');
 20589   (function () {
       
 20590     {
       
 20591       {
       
 20592         throw ReactError(Error('Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'));
       
 20593       }
       
 20594     }
       
 20595   })();
 17773 }
 20596 }
 17774 
 20597 
 17775 function isHostParent(fiber) {
 20598 function isHostParent(fiber) {
 17776   return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
 20599   return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
 17777 }
 20600 }
 17826   var parentFiber = getHostParentFiber(finishedWork);
 20649   var parentFiber = getHostParentFiber(finishedWork);
 17827 
 20650 
 17828   // Note: these two variables *must* always be updated together.
 20651   // Note: these two variables *must* always be updated together.
 17829   var parent = void 0;
 20652   var parent = void 0;
 17830   var isContainer = void 0;
 20653   var isContainer = void 0;
 17831 
 20654   var parentStateNode = parentFiber.stateNode;
 17832   switch (parentFiber.tag) {
 20655   switch (parentFiber.tag) {
 17833     case HostComponent:
 20656     case HostComponent:
 17834       parent = parentFiber.stateNode;
 20657       parent = parentStateNode;
 17835       isContainer = false;
 20658       isContainer = false;
 17836       break;
 20659       break;
 17837     case HostRoot:
 20660     case HostRoot:
 17838       parent = parentFiber.stateNode.containerInfo;
 20661       parent = parentStateNode.containerInfo;
 17839       isContainer = true;
 20662       isContainer = true;
 17840       break;
 20663       break;
 17841     case HostPortal:
 20664     case HostPortal:
 17842       parent = parentFiber.stateNode.containerInfo;
 20665       parent = parentStateNode.containerInfo;
 17843       isContainer = true;
 20666       isContainer = true;
 17844       break;
 20667       break;
       
 20668     case FundamentalComponent:
       
 20669       if (enableFundamentalAPI) {
       
 20670         parent = parentStateNode.instance;
       
 20671         isContainer = false;
       
 20672       }
       
 20673     // eslint-disable-next-line-no-fallthrough
 17845     default:
 20674     default:
 17846       invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');
 20675       (function () {
       
 20676         {
       
 20677           {
       
 20678             throw ReactError(Error('Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'));
       
 20679           }
       
 20680         }
       
 20681       })();
 17847   }
 20682   }
 17848   if (parentFiber.effectTag & ContentReset) {
 20683   if (parentFiber.effectTag & ContentReset) {
 17849     // Reset the text content of the parent before doing any insertions
 20684     // Reset the text content of the parent before doing any insertions
 17850     resetTextContent(parent);
 20685     resetTextContent(parent);
 17851     // Clear ContentReset from the effect tag
 20686     // Clear ContentReset from the effect tag
 17855   var before = getHostSibling(finishedWork);
 20690   var before = getHostSibling(finishedWork);
 17856   // We only have the top Fiber that was inserted but we need to recurse down its
 20691   // We only have the top Fiber that was inserted but we need to recurse down its
 17857   // children to find all the terminal nodes.
 20692   // children to find all the terminal nodes.
 17858   var node = finishedWork;
 20693   var node = finishedWork;
 17859   while (true) {
 20694   while (true) {
 17860     if (node.tag === HostComponent || node.tag === HostText) {
 20695     var isHost = node.tag === HostComponent || node.tag === HostText;
       
 20696     if (isHost || node.tag === FundamentalComponent) {
       
 20697       var stateNode = isHost ? node.stateNode : node.stateNode.instance;
 17861       if (before) {
 20698       if (before) {
 17862         if (isContainer) {
 20699         if (isContainer) {
 17863           insertInContainerBefore(parent, node.stateNode, before);
 20700           insertInContainerBefore(parent, stateNode, before);
 17864         } else {
 20701         } else {
 17865           insertBefore(parent, node.stateNode, before);
 20702           insertBefore(parent, stateNode, before);
 17866         }
 20703         }
 17867       } else {
 20704       } else {
 17868         if (isContainer) {
 20705         if (isContainer) {
 17869           appendChildToContainer(parent, node.stateNode);
 20706           appendChildToContainer(parent, stateNode);
 17870         } else {
 20707         } else {
 17871           appendChild(parent, node.stateNode);
 20708           appendChild(parent, stateNode);
 17872         }
 20709         }
 17873       }
 20710       }
 17874     } else if (node.tag === HostPortal) {
 20711     } else if (node.tag === HostPortal) {
 17875       // If the insertion itself is a portal, then we don't want to traverse
 20712       // If the insertion itself is a portal, then we don't want to traverse
 17876       // down its children. Instead, we'll get insertions from each child in
 20713       // down its children. Instead, we'll get insertions from each child in
 17892     node.sibling.return = node.return;
 20729     node.sibling.return = node.return;
 17893     node = node.sibling;
 20730     node = node.sibling;
 17894   }
 20731   }
 17895 }
 20732 }
 17896 
 20733 
 17897 function unmountHostComponents(current$$1) {
 20734 function unmountHostComponents(current$$1, renderPriorityLevel) {
 17898   // We only have the top Fiber that was deleted but we need to recurse down its
 20735   // We only have the top Fiber that was deleted but we need to recurse down its
 17899   var node = current$$1;
 20736   var node = current$$1;
 17900 
 20737 
 17901   // Each iteration, currentParent is populated with node's host parent if not
 20738   // Each iteration, currentParent is populated with node's host parent if not
 17902   // currentParentIsValid.
 20739   // currentParentIsValid.
 17908 
 20745 
 17909   while (true) {
 20746   while (true) {
 17910     if (!currentParentIsValid) {
 20747     if (!currentParentIsValid) {
 17911       var parent = node.return;
 20748       var parent = node.return;
 17912       findParent: while (true) {
 20749       findParent: while (true) {
 17913         !(parent !== null) ? invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 20750         (function () {
       
 20751           if (!(parent !== null)) {
       
 20752             {
       
 20753               throw ReactError(Error('Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'));
       
 20754             }
       
 20755           }
       
 20756         })();
       
 20757         var parentStateNode = parent.stateNode;
 17914         switch (parent.tag) {
 20758         switch (parent.tag) {
 17915           case HostComponent:
 20759           case HostComponent:
 17916             currentParent = parent.stateNode;
 20760             currentParent = parentStateNode;
 17917             currentParentIsContainer = false;
 20761             currentParentIsContainer = false;
 17918             break findParent;
 20762             break findParent;
 17919           case HostRoot:
 20763           case HostRoot:
 17920             currentParent = parent.stateNode.containerInfo;
 20764             currentParent = parentStateNode.containerInfo;
 17921             currentParentIsContainer = true;
 20765             currentParentIsContainer = true;
 17922             break findParent;
 20766             break findParent;
 17923           case HostPortal:
 20767           case HostPortal:
 17924             currentParent = parent.stateNode.containerInfo;
 20768             currentParent = parentStateNode.containerInfo;
 17925             currentParentIsContainer = true;
 20769             currentParentIsContainer = true;
 17926             break findParent;
 20770             break findParent;
       
 20771           case FundamentalComponent:
       
 20772             if (enableFundamentalAPI) {
       
 20773               currentParent = parentStateNode.instance;
       
 20774               currentParentIsContainer = false;
       
 20775             }
 17927         }
 20776         }
 17928         parent = parent.return;
 20777         parent = parent.return;
 17929       }
 20778       }
 17930       currentParentIsValid = true;
 20779       currentParentIsValid = true;
 17931     }
 20780     }
 17932 
 20781 
 17933     if (node.tag === HostComponent || node.tag === HostText) {
 20782     if (node.tag === HostComponent || node.tag === HostText) {
 17934       commitNestedUnmounts(node);
 20783       commitNestedUnmounts(node, renderPriorityLevel);
 17935       // After all the children have unmounted, it is now safe to remove the
 20784       // After all the children have unmounted, it is now safe to remove the
 17936       // node from the tree.
 20785       // node from the tree.
 17937       if (currentParentIsContainer) {
 20786       if (currentParentIsContainer) {
 17938         removeChildFromContainer(currentParent, node.stateNode);
 20787         removeChildFromContainer(currentParent, node.stateNode);
 17939       } else {
 20788       } else {
 17940         removeChild(currentParent, node.stateNode);
 20789         removeChild(currentParent, node.stateNode);
 17941       }
 20790       }
 17942       // Don't visit children because we already visited them.
 20791       // Don't visit children because we already visited them.
       
 20792     } else if (node.tag === FundamentalComponent) {
       
 20793       var fundamentalNode = node.stateNode.instance;
       
 20794       commitNestedUnmounts(node, renderPriorityLevel);
       
 20795       // After all the children have unmounted, it is now safe to remove the
       
 20796       // node from the tree.
       
 20797       if (currentParentIsContainer) {
       
 20798         removeChildFromContainer(currentParent, fundamentalNode);
       
 20799       } else {
       
 20800         removeChild(currentParent, fundamentalNode);
       
 20801       }
 17943     } else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
 20802     } else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
 17944       // Delete the dehydrated suspense boundary and all of its content.
 20803       // Delete the dehydrated suspense boundary and all of its content.
 17945       if (currentParentIsContainer) {
 20804       if (currentParentIsContainer) {
 17946         clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
 20805         clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
 17947       } else {
 20806       } else {
 17957         node.child.return = node;
 20816         node.child.return = node;
 17958         node = node.child;
 20817         node = node.child;
 17959         continue;
 20818         continue;
 17960       }
 20819       }
 17961     } else {
 20820     } else {
 17962       commitUnmount(node);
 20821       commitUnmount(node, renderPriorityLevel);
 17963       // Visit children because we may find more host components below.
 20822       // Visit children because we may find more host components below.
 17964       if (node.child !== null) {
 20823       if (node.child !== null) {
 17965         node.child.return = node;
 20824         node.child.return = node;
 17966         node = node.child;
 20825         node = node.child;
 17967         continue;
 20826         continue;
 17984     node.sibling.return = node.return;
 20843     node.sibling.return = node.return;
 17985     node = node.sibling;
 20844     node = node.sibling;
 17986   }
 20845   }
 17987 }
 20846 }
 17988 
 20847 
 17989 function commitDeletion(current$$1) {
 20848 function commitDeletion(current$$1, renderPriorityLevel) {
 17990   if (supportsMutation) {
 20849   if (supportsMutation) {
 17991     // Recursively delete all host nodes from the parent.
 20850     // Recursively delete all host nodes from the parent.
 17992     // Detach refs and call componentWillUnmount() on the whole subtree.
 20851     // Detach refs and call componentWillUnmount() on the whole subtree.
 17993     unmountHostComponents(current$$1);
 20852     unmountHostComponents(current$$1, renderPriorityLevel);
 17994   } else {
 20853   } else {
 17995     // Detach refs and call componentWillUnmount() on the whole subtree.
 20854     // Detach refs and call componentWillUnmount() on the whole subtree.
 17996     commitNestedUnmounts(current$$1);
 20855     commitNestedUnmounts(current$$1, renderPriorityLevel);
 17997   }
 20856   }
 17998   detachFiber(current$$1);
 20857   detachFiber(current$$1);
 17999 }
 20858 }
 18000 
 20859 
 18001 function commitWork(current$$1, finishedWork) {
 20860 function commitWork(current$$1, finishedWork) {
 18007       case SimpleMemoComponent:
 20866       case SimpleMemoComponent:
 18008         {
 20867         {
 18009           // Note: We currently never use MountMutation, but useLayout uses
 20868           // Note: We currently never use MountMutation, but useLayout uses
 18010           // UnmountMutation.
 20869           // UnmountMutation.
 18011           commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
 20870           commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
       
 20871           return;
       
 20872         }
       
 20873       case Profiler:
       
 20874         {
       
 20875           return;
       
 20876         }
       
 20877       case SuspenseComponent:
       
 20878         {
       
 20879           commitSuspenseComponent(finishedWork);
       
 20880           attachSuspenseRetryListeners(finishedWork);
       
 20881           return;
       
 20882         }
       
 20883       case SuspenseListComponent:
       
 20884         {
       
 20885           attachSuspenseRetryListeners(finishedWork);
 18012           return;
 20886           return;
 18013         }
 20887         }
 18014     }
 20888     }
 18015 
 20889 
 18016     commitContainer(finishedWork);
 20890     commitContainer(finishedWork);
 18052         }
 20926         }
 18053         return;
 20927         return;
 18054       }
 20928       }
 18055     case HostText:
 20929     case HostText:
 18056       {
 20930       {
 18057         !(finishedWork.stateNode !== null) ? invariant(false, 'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.') : void 0;
 20931         (function () {
       
 20932           if (!(finishedWork.stateNode !== null)) {
       
 20933             {
       
 20934               throw ReactError(Error('This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.'));
       
 20935             }
       
 20936           }
       
 20937         })();
 18058         var textInstance = finishedWork.stateNode;
 20938         var textInstance = finishedWork.stateNode;
 18059         var newText = finishedWork.memoizedProps;
 20939         var newText = finishedWork.memoizedProps;
 18060         // For hydration we reuse the update path but we treat the oldProps
 20940         // For hydration we reuse the update path but we treat the oldProps
 18061         // as the newProps. The updatePayload will contain the real change in
 20941         // as the newProps. The updatePayload will contain the real change in
 18062         // this case.
 20942         // this case.
 18072       {
 20952       {
 18073         return;
 20953         return;
 18074       }
 20954       }
 18075     case SuspenseComponent:
 20955     case SuspenseComponent:
 18076       {
 20956       {
 18077         var newState = finishedWork.memoizedState;
 20957         commitSuspenseComponent(finishedWork);
 18078 
 20958         attachSuspenseRetryListeners(finishedWork);
 18079         var newDidTimeout = void 0;
 20959         return;
 18080         var primaryChildParent = finishedWork;
 20960       }
 18081         if (newState === null) {
 20961     case SuspenseListComponent:
 18082           newDidTimeout = false;
 20962       {
 18083         } else {
 20963         attachSuspenseRetryListeners(finishedWork);
 18084           newDidTimeout = true;
       
 18085           primaryChildParent = finishedWork.child;
       
 18086           if (newState.timedOutAt === NoWork) {
       
 18087             // If the children had not already timed out, record the time.
       
 18088             // This is used to compute the elapsed time during subsequent
       
 18089             // attempts to render the children.
       
 18090             newState.timedOutAt = requestCurrentTime();
       
 18091           }
       
 18092         }
       
 18093 
       
 18094         if (primaryChildParent !== null) {
       
 18095           hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
       
 18096         }
       
 18097 
       
 18098         // If this boundary just timed out, then it will have a set of thenables.
       
 18099         // For each thenable, attach a listener so that when it resolves, React
       
 18100         // attempts to re-render the boundary in the primary (pre-timeout) state.
       
 18101         var thenables = finishedWork.updateQueue;
       
 18102         if (thenables !== null) {
       
 18103           finishedWork.updateQueue = null;
       
 18104           var retryCache = finishedWork.stateNode;
       
 18105           if (retryCache === null) {
       
 18106             retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
       
 18107           }
       
 18108           thenables.forEach(function (thenable) {
       
 18109             // Memoize using the boundary fiber to prevent redundant listeners.
       
 18110             var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
       
 18111             if (enableSchedulerTracing) {
       
 18112               retry = unstable_wrap(retry);
       
 18113             }
       
 18114             if (!retryCache.has(thenable)) {
       
 18115               retryCache.add(thenable);
       
 18116               thenable.then(retry, retry);
       
 18117             }
       
 18118           });
       
 18119         }
       
 18120 
       
 18121         return;
 20964         return;
 18122       }
 20965       }
 18123     case IncompleteClassComponent:
 20966     case IncompleteClassComponent:
 18124       {
 20967       {
 18125         return;
 20968         return;
 18126       }
 20969       }
       
 20970     case FundamentalComponent:
       
 20971       {
       
 20972         if (enableFundamentalAPI) {
       
 20973           var fundamentalInstance = finishedWork.stateNode;
       
 20974           updateFundamentalComponent(fundamentalInstance);
       
 20975         }
       
 20976         return;
       
 20977       }
 18127     default:
 20978     default:
 18128       {
 20979       {
 18129         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
 20980         (function () {
 18130       }
 20981           {
       
 20982             {
       
 20983               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
       
 20984             }
       
 20985           }
       
 20986         })();
       
 20987       }
       
 20988   }
       
 20989 }
       
 20990 
       
 20991 function commitSuspenseComponent(finishedWork) {
       
 20992   var newState = finishedWork.memoizedState;
       
 20993 
       
 20994   var newDidTimeout = void 0;
       
 20995   var primaryChildParent = finishedWork;
       
 20996   if (newState === null) {
       
 20997     newDidTimeout = false;
       
 20998   } else {
       
 20999     newDidTimeout = true;
       
 21000     primaryChildParent = finishedWork.child;
       
 21001     markCommitTimeOfFallback();
       
 21002   }
       
 21003 
       
 21004   if (supportsMutation && primaryChildParent !== null) {
       
 21005     hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
       
 21006   }
       
 21007 
       
 21008   if (enableSuspenseCallback && newState !== null) {
       
 21009     var suspenseCallback = finishedWork.memoizedProps.suspenseCallback;
       
 21010     if (typeof suspenseCallback === 'function') {
       
 21011       var thenables = finishedWork.updateQueue;
       
 21012       if (thenables !== null) {
       
 21013         suspenseCallback(new Set(thenables));
       
 21014       }
       
 21015     } else {
       
 21016       if (suspenseCallback !== undefined) {
       
 21017         warning$1(false, 'Unexpected type for suspenseCallback.');
       
 21018       }
       
 21019     }
       
 21020   }
       
 21021 }
       
 21022 
       
 21023 function attachSuspenseRetryListeners(finishedWork) {
       
 21024   // If this boundary just timed out, then it will have a set of thenables.
       
 21025   // For each thenable, attach a listener so that when it resolves, React
       
 21026   var thenables = finishedWork.updateQueue;
       
 21027   if (thenables !== null) {
       
 21028     finishedWork.updateQueue = null;
       
 21029     var retryCache = finishedWork.stateNode;
       
 21030     if (retryCache === null) {
       
 21031       retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
       
 21032     }
       
 21033     thenables.forEach(function (thenable) {
       
 21034       // Memoize using the boundary fiber to prevent redundant listeners.
       
 21035       var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
       
 21036       if (!retryCache.has(thenable)) {
       
 21037         if (enableSchedulerTracing) {
       
 21038           retry = unstable_wrap(retry);
       
 21039         }
       
 21040         retryCache.add(thenable);
       
 21041         thenable.then(retry, retry);
       
 21042       }
       
 21043     });
 18131   }
 21044   }
 18132 }
 21045 }
 18133 
 21046 
 18134 function commitResetTextContent(current$$1) {
 21047 function commitResetTextContent(current$$1) {
 18135   if (!supportsMutation) {
 21048   if (!supportsMutation) {
 18137   }
 21050   }
 18138   resetTextContent(current$$1.stateNode);
 21051   resetTextContent(current$$1.stateNode);
 18139 }
 21052 }
 18140 
 21053 
 18141 var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
 21054 var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
 18142 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
 21055 var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map;
 18143 
 21056 
 18144 function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
 21057 function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
 18145   var update = createUpdate(expirationTime);
 21058   var update = createUpdate(expirationTime, null);
 18146   // Unmount the root by rendering null.
 21059   // Unmount the root by rendering null.
 18147   update.tag = CaptureUpdate;
 21060   update.tag = CaptureUpdate;
 18148   // Caution: React DevTools currently depends on this property
 21061   // Caution: React DevTools currently depends on this property
 18149   // being called "element".
 21062   // being called "element".
 18150   update.payload = { element: null };
 21063   update.payload = { element: null };
 18155   };
 21068   };
 18156   return update;
 21069   return update;
 18157 }
 21070 }
 18158 
 21071 
 18159 function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
 21072 function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
 18160   var update = createUpdate(expirationTime);
 21073   var update = createUpdate(expirationTime, null);
 18161   update.tag = CaptureUpdate;
 21074   update.tag = CaptureUpdate;
 18162   var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
 21075   var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
 18163   if (typeof getDerivedStateFromError === 'function') {
 21076   if (typeof getDerivedStateFromError === 'function') {
 18164     var error = errorInfo.value;
 21077     var error = errorInfo.value;
 18165     update.payload = function () {
 21078     update.payload = function () {
       
 21079       logError(fiber, errorInfo);
 18166       return getDerivedStateFromError(error);
 21080       return getDerivedStateFromError(error);
 18167     };
 21081     };
 18168   }
 21082   }
 18169 
 21083 
 18170   var inst = fiber.stateNode;
 21084   var inst = fiber.stateNode;
 18171   if (inst !== null && typeof inst.componentDidCatch === 'function') {
 21085   if (inst !== null && typeof inst.componentDidCatch === 'function') {
 18172     update.callback = function callback() {
 21086     update.callback = function callback() {
       
 21087       {
       
 21088         markFailedErrorBoundaryForHotReloading(fiber);
       
 21089       }
 18173       if (typeof getDerivedStateFromError !== 'function') {
 21090       if (typeof getDerivedStateFromError !== 'function') {
 18174         // To preserve the preexisting retry behavior of error boundaries,
 21091         // To preserve the preexisting retry behavior of error boundaries,
 18175         // we keep track of which ones already failed during this batch.
 21092         // we keep track of which ones already failed during this batch.
 18176         // This gets reset before we yield back to the browser.
 21093         // This gets reset before we yield back to the browser.
 18177         // TODO: Warn in strict mode if getDerivedStateFromError is
 21094         // TODO: Warn in strict mode if getDerivedStateFromError is
 18178         // not defined.
 21095         // not defined.
 18179         markLegacyErrorBoundaryAsFailed(this);
 21096         markLegacyErrorBoundaryAsFailed(this);
       
 21097 
       
 21098         // Only log here if componentDidCatch is the only error boundary method defined
       
 21099         logError(fiber, errorInfo);
 18180       }
 21100       }
 18181       var error = errorInfo.value;
 21101       var error = errorInfo.value;
 18182       var stack = errorInfo.stack;
 21102       var stack = errorInfo.stack;
 18183       logError(fiber, errorInfo);
       
 18184       this.componentDidCatch(error, {
 21103       this.componentDidCatch(error, {
 18185         componentStack: stack !== null ? stack : ''
 21104         componentStack: stack !== null ? stack : ''
 18186       });
 21105       });
 18187       {
 21106       {
 18188         if (typeof getDerivedStateFromError !== 'function') {
 21107         if (typeof getDerivedStateFromError !== 'function') {
 18191           // If no state update is scheduled then the boundary will swallow the error.
 21110           // If no state update is scheduled then the boundary will swallow the error.
 18192           !(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
 21111           !(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
 18193         }
 21112         }
 18194       }
 21113       }
 18195     };
 21114     };
       
 21115   } else {
       
 21116     update.callback = function () {
       
 21117       markFailedErrorBoundaryForHotReloading(fiber);
       
 21118     };
 18196   }
 21119   }
 18197   return update;
 21120   return update;
 18198 }
 21121 }
 18199 
 21122 
 18200 function attachPingListener(root, renderExpirationTime, thenable) {
 21123 function attachPingListener(root, renderExpirationTime, thenable) {
 18202   // only if one does not already exist for the current render expiration
 21125   // only if one does not already exist for the current render expiration
 18203   // time (which acts like a "thread ID" here).
 21126   // time (which acts like a "thread ID" here).
 18204   var pingCache = root.pingCache;
 21127   var pingCache = root.pingCache;
 18205   var threadIDs = void 0;
 21128   var threadIDs = void 0;
 18206   if (pingCache === null) {
 21129   if (pingCache === null) {
 18207     pingCache = root.pingCache = new PossiblyWeakMap();
 21130     pingCache = root.pingCache = new PossiblyWeakMap$1();
 18208     threadIDs = new Set();
 21131     threadIDs = new Set();
 18209     pingCache.set(thenable, threadIDs);
 21132     pingCache.set(thenable, threadIDs);
 18210   } else {
 21133   } else {
 18211     threadIDs = pingCache.get(thenable);
 21134     threadIDs = pingCache.get(thenable);
 18212     if (threadIDs === undefined) {
 21135     if (threadIDs === undefined) {
 18233 
 21156 
 18234   if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
 21157   if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
 18235     // This is a thenable.
 21158     // This is a thenable.
 18236     var thenable = value;
 21159     var thenable = value;
 18237 
 21160 
 18238     // Find the earliest timeout threshold of all the placeholders in the
 21161     checkForWrongSuspensePriorityInDEV(sourceFiber);
 18239     // ancestor path. We could avoid this traversal by storing the thresholds on
 21162 
 18240     // the stack, but we choose not to because we only hit this path if we're
 21163     var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext);
 18241     // IO-bound (i.e. if something suspends). Whereas the stack is used even in
 21164 
 18242     // the non-IO- bound case.
 21165     // Schedule the nearest Suspense to re-render the timed out view.
 18243     var _workInProgress = returnFiber;
 21166     var _workInProgress = returnFiber;
 18244     var earliestTimeoutMs = -1;
       
 18245     var startTimeMs = -1;
       
 18246     do {
 21167     do {
 18247       if (_workInProgress.tag === SuspenseComponent) {
 21168       if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
 18248         var current$$1 = _workInProgress.alternate;
       
 18249         if (current$$1 !== null) {
       
 18250           var currentState = current$$1.memoizedState;
       
 18251           if (currentState !== null) {
       
 18252             // Reached a boundary that already timed out. Do not search
       
 18253             // any further.
       
 18254             var timedOutAt = currentState.timedOutAt;
       
 18255             startTimeMs = expirationTimeToMs(timedOutAt);
       
 18256             // Do not search any further.
       
 18257             break;
       
 18258           }
       
 18259         }
       
 18260         var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
       
 18261         if (typeof timeoutPropMs === 'number') {
       
 18262           if (timeoutPropMs <= 0) {
       
 18263             earliestTimeoutMs = 0;
       
 18264           } else if (earliestTimeoutMs === -1 || timeoutPropMs < earliestTimeoutMs) {
       
 18265             earliestTimeoutMs = timeoutPropMs;
       
 18266           }
       
 18267         }
       
 18268       }
       
 18269       // If there is a DehydratedSuspenseComponent we don't have to do anything because
       
 18270       // if something suspends inside it, we will simply leave that as dehydrated. It
       
 18271       // will never timeout.
       
 18272       _workInProgress = _workInProgress.return;
       
 18273     } while (_workInProgress !== null);
       
 18274 
       
 18275     // Schedule the nearest Suspense to re-render the timed out view.
       
 18276     _workInProgress = returnFiber;
       
 18277     do {
       
 18278       if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress)) {
       
 18279         // Found the nearest boundary.
 21169         // Found the nearest boundary.
 18280 
 21170 
 18281         // Stash the promise on the boundary fiber. If the boundary times out, we'll
 21171         // Stash the promise on the boundary fiber. If the boundary times out, we'll
 18282         var thenables = _workInProgress.updateQueue;
 21172         var thenables = _workInProgress.updateQueue;
 18283         if (thenables === null) {
 21173         if (thenables === null) {
 18286           _workInProgress.updateQueue = updateQueue;
 21176           _workInProgress.updateQueue = updateQueue;
 18287         } else {
 21177         } else {
 18288           thenables.add(thenable);
 21178           thenables.add(thenable);
 18289         }
 21179         }
 18290 
 21180 
 18291         // If the boundary is outside of concurrent mode, we should *not*
 21181         // If the boundary is outside of batched mode, we should *not*
 18292         // suspend the commit. Pretend as if the suspended component rendered
 21182         // suspend the commit. Pretend as if the suspended component rendered
 18293         // null and keep rendering. In the commit phase, we'll schedule a
 21183         // null and keep rendering. In the commit phase, we'll schedule a
 18294         // subsequent synchronous update to re-render the Suspense.
 21184         // subsequent synchronous update to re-render the Suspense.
 18295         //
 21185         //
 18296         // Note: It doesn't matter whether the component that suspended was
 21186         // Note: It doesn't matter whether the component that suspended was
 18297         // inside a concurrent mode tree. If the Suspense is outside of it, we
 21187         // inside a batched mode tree. If the Suspense is outside of it, we
 18298         // should *not* suspend the commit.
 21188         // should *not* suspend the commit.
 18299         if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
 21189         if ((_workInProgress.mode & BatchedMode) === NoMode) {
 18300           _workInProgress.effectTag |= DidCapture;
 21190           _workInProgress.effectTag |= DidCapture;
 18301 
 21191 
 18302           // We're going to commit this fiber even though it didn't complete.
 21192           // We're going to commit this fiber even though it didn't complete.
 18303           // But we shouldn't call any lifecycle methods or callbacks. Remove
 21193           // But we shouldn't call any lifecycle methods or callbacks. Remove
 18304           // all lifecycle effect tags.
 21194           // all lifecycle effect tags.
 18311               // completed class component. For example, we should not call
 21201               // completed class component. For example, we should not call
 18312               // componentWillUnmount if it is deleted.
 21202               // componentWillUnmount if it is deleted.
 18313               sourceFiber.tag = IncompleteClassComponent;
 21203               sourceFiber.tag = IncompleteClassComponent;
 18314             } else {
 21204             } else {
 18315               // When we try rendering again, we should not reuse the current fiber,
 21205               // When we try rendering again, we should not reuse the current fiber,
 18316               // since it's known to be in an inconsistent state. Use a force updte to
 21206               // since it's known to be in an inconsistent state. Use a force update to
 18317               // prevent a bail out.
 21207               // prevent a bail out.
 18318               var update = createUpdate(Sync);
 21208               var update = createUpdate(Sync, null);
 18319               update.tag = ForceUpdate;
 21209               update.tag = ForceUpdate;
 18320               enqueueUpdate(sourceFiber, update);
 21210               enqueueUpdate(sourceFiber, update);
 18321             }
 21211             }
 18322           }
 21212           }
 18323 
 21213 
 18329           return;
 21219           return;
 18330         }
 21220         }
 18331 
 21221 
 18332         // Confirmed that the boundary is in a concurrent mode tree. Continue
 21222         // Confirmed that the boundary is in a concurrent mode tree. Continue
 18333         // with the normal suspend path.
 21223         // with the normal suspend path.
       
 21224         //
       
 21225         // After this we'll use a set of heuristics to determine whether this
       
 21226         // render pass will run to completion or restart or "suspend" the commit.
       
 21227         // The actual logic for this is spread out in different places.
       
 21228         //
       
 21229         // This first principle is that if we're going to suspend when we complete
       
 21230         // a root, then we should also restart if we get an update or ping that
       
 21231         // might unsuspend it, and vice versa. The only reason to suspend is
       
 21232         // because you think you might want to restart before committing. However,
       
 21233         // it doesn't make sense to restart only while in the period we're suspended.
       
 21234         //
       
 21235         // Restarting too aggressively is also not good because it starves out any
       
 21236         // intermediate loading state. So we use heuristics to determine when.
       
 21237 
       
 21238         // Suspense Heuristics
       
 21239         //
       
 21240         // If nothing threw a Promise or all the same fallbacks are already showing,
       
 21241         // then don't suspend/restart.
       
 21242         //
       
 21243         // If this is an initial render of a new tree of Suspense boundaries and
       
 21244         // those trigger a fallback, then don't suspend/restart. We want to ensure
       
 21245         // that we can show the initial loading state as quickly as possible.
       
 21246         //
       
 21247         // If we hit a "Delayed" case, such as when we'd switch from content back into
       
 21248         // a fallback, then we should always suspend/restart. SuspenseConfig applies to
       
 21249         // this case. If none is defined, JND is used instead.
       
 21250         //
       
 21251         // If we're already showing a fallback and it gets "retried", allowing us to show
       
 21252         // another level, but there's still an inner boundary that would show a fallback,
       
 21253         // then we suspend/restart for 500ms since the last time we showed a fallback
       
 21254         // anywhere in the tree. This effectively throttles progressive loading into a
       
 21255         // consistent train of commits. This also gives us an opportunity to restart to
       
 21256         // get to the completed state slightly earlier.
       
 21257         //
       
 21258         // If there's ambiguity due to batching it's resolved in preference of:
       
 21259         // 1) "delayed", 2) "initial render", 3) "retry".
       
 21260         //
       
 21261         // We want to ensure that a "busy" state doesn't get force committed. We want to
       
 21262         // ensure that new initial loading states can commit as soon as possible.
 18334 
 21263 
 18335         attachPingListener(root, renderExpirationTime, thenable);
 21264         attachPingListener(root, renderExpirationTime, thenable);
 18336 
       
 18337         var absoluteTimeoutMs = void 0;
       
 18338         if (earliestTimeoutMs === -1) {
       
 18339           // If no explicit threshold is given, default to an arbitrarily large
       
 18340           // value. The actual size doesn't matter because the threshold for the
       
 18341           // whole tree will be clamped to the expiration time.
       
 18342           absoluteTimeoutMs = maxSigned31BitInt;
       
 18343         } else {
       
 18344           if (startTimeMs === -1) {
       
 18345             // This suspend happened outside of any already timed-out
       
 18346             // placeholders. We don't know exactly when the update was
       
 18347             // scheduled, but we can infer an approximate start time from the
       
 18348             // expiration time. First, find the earliest uncommitted expiration
       
 18349             // time in the tree, including work that is suspended. Then subtract
       
 18350             // the offset used to compute an async update's expiration time.
       
 18351             // This will cause high priority (interactive) work to expire
       
 18352             // earlier than necessary, but we can account for this by adjusting
       
 18353             // for the Just Noticeable Difference.
       
 18354             var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
       
 18355             var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
       
 18356             startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
       
 18357           }
       
 18358           absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
       
 18359         }
       
 18360 
       
 18361         // Mark the earliest timeout in the suspended fiber's ancestor path.
       
 18362         // After completing the root, we'll take the largest of all the
       
 18363         // suspended fiber's timeouts and use it to compute a timeout for the
       
 18364         // whole tree.
       
 18365         renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
       
 18366 
 21265 
 18367         _workInProgress.effectTag |= ShouldCapture;
 21266         _workInProgress.effectTag |= ShouldCapture;
 18368         _workInProgress.expirationTime = renderExpirationTime;
 21267         _workInProgress.expirationTime = renderExpirationTime;
       
 21268 
 18369         return;
 21269         return;
 18370       } else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
 21270       } else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
 18371         attachPingListener(root, renderExpirationTime, thenable);
 21271         attachPingListener(root, renderExpirationTime, thenable);
 18372 
 21272 
 18373         // Since we already have a current fiber, we can eagerly add a retry listener.
 21273         // Since we already have a current fiber, we can eagerly add a retry listener.
 18374         var retryCache = _workInProgress.memoizedState;
 21274         var retryCache = _workInProgress.memoizedState;
 18375         if (retryCache === null) {
 21275         if (retryCache === null) {
 18376           retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
 21276           retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
 18377           var _current = _workInProgress.alternate;
 21277           var current$$1 = _workInProgress.alternate;
 18378           !_current ? invariant(false, 'A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.') : void 0;
 21278           (function () {
 18379           _current.memoizedState = retryCache;
 21279             if (!current$$1) {
       
 21280               {
       
 21281                 throw ReactError(Error('A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.'));
       
 21282               }
       
 21283             }
       
 21284           })();
       
 21285           current$$1.memoizedState = retryCache;
 18380         }
 21286         }
 18381         // Memoize using the boundary fiber to prevent redundant listeners.
 21287         // Memoize using the boundary fiber to prevent redundant listeners.
 18382         if (!retryCache.has(thenable)) {
 21288         if (!retryCache.has(thenable)) {
 18383           retryCache.add(thenable);
 21289           retryCache.add(thenable);
 18384           var retry = retryTimedOutBoundary.bind(null, _workInProgress, thenable);
 21290           var retry = resolveRetryThenable.bind(null, _workInProgress, thenable);
 18385           if (enableSchedulerTracing) {
 21291           if (enableSchedulerTracing) {
 18386             retry = unstable_wrap(retry);
 21292             retry = unstable_wrap(retry);
 18387           }
 21293           }
 18388           thenable.then(retry, retry);
 21294           thenable.then(retry, retry);
 18389         }
 21295         }
 18436     }
 21342     }
 18437     workInProgress = workInProgress.return;
 21343     workInProgress = workInProgress.return;
 18438   } while (workInProgress !== null);
 21344   } while (workInProgress !== null);
 18439 }
 21345 }
 18440 
 21346 
 18441 function unwindWork(workInProgress, renderExpirationTime) {
 21347 // The scheduler is imported here *only* to detect whether it's been mocked
 18442   switch (workInProgress.tag) {
 21348 // DEV stuff
 18443     case ClassComponent:
 21349 var ceil = Math.ceil;
 18444       {
       
 18445         var Component = workInProgress.type;
       
 18446         if (isContextProvider(Component)) {
       
 18447           popContext(workInProgress);
       
 18448         }
       
 18449         var effectTag = workInProgress.effectTag;
       
 18450         if (effectTag & ShouldCapture) {
       
 18451           workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
       
 18452           return workInProgress;
       
 18453         }
       
 18454         return null;
       
 18455       }
       
 18456     case HostRoot:
       
 18457       {
       
 18458         popHostContainer(workInProgress);
       
 18459         popTopLevelContextObject(workInProgress);
       
 18460         var _effectTag = workInProgress.effectTag;
       
 18461         !((_effectTag & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
       
 18462         workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
       
 18463         return workInProgress;
       
 18464       }
       
 18465     case HostComponent:
       
 18466       {
       
 18467         // TODO: popHydrationState
       
 18468         popHostContext(workInProgress);
       
 18469         return null;
       
 18470       }
       
 18471     case SuspenseComponent:
       
 18472       {
       
 18473         var _effectTag2 = workInProgress.effectTag;
       
 18474         if (_effectTag2 & ShouldCapture) {
       
 18475           workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
       
 18476           // Captured a suspense effect. Re-render the boundary.
       
 18477           return workInProgress;
       
 18478         }
       
 18479         return null;
       
 18480       }
       
 18481     case DehydratedSuspenseComponent:
       
 18482       {
       
 18483         if (enableSuspenseServerRenderer) {
       
 18484           // TODO: popHydrationState
       
 18485           var _effectTag3 = workInProgress.effectTag;
       
 18486           if (_effectTag3 & ShouldCapture) {
       
 18487             workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
       
 18488             // Captured a suspense effect. Re-render the boundary.
       
 18489             return workInProgress;
       
 18490           }
       
 18491         }
       
 18492         return null;
       
 18493       }
       
 18494     case HostPortal:
       
 18495       popHostContainer(workInProgress);
       
 18496       return null;
       
 18497     case ContextProvider:
       
 18498       popProvider(workInProgress);
       
 18499       return null;
       
 18500     default:
       
 18501       return null;
       
 18502   }
       
 18503 }
       
 18504 
       
 18505 function unwindInterruptedWork(interruptedWork) {
       
 18506   switch (interruptedWork.tag) {
       
 18507     case ClassComponent:
       
 18508       {
       
 18509         var childContextTypes = interruptedWork.type.childContextTypes;
       
 18510         if (childContextTypes !== null && childContextTypes !== undefined) {
       
 18511           popContext(interruptedWork);
       
 18512         }
       
 18513         break;
       
 18514       }
       
 18515     case HostRoot:
       
 18516       {
       
 18517         popHostContainer(interruptedWork);
       
 18518         popTopLevelContextObject(interruptedWork);
       
 18519         break;
       
 18520       }
       
 18521     case HostComponent:
       
 18522       {
       
 18523         popHostContext(interruptedWork);
       
 18524         break;
       
 18525       }
       
 18526     case HostPortal:
       
 18527       popHostContainer(interruptedWork);
       
 18528       break;
       
 18529     case ContextProvider:
       
 18530       popProvider(interruptedWork);
       
 18531       break;
       
 18532     default:
       
 18533       break;
       
 18534   }
       
 18535 }
       
 18536 
 21350 
 18537 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
 21351 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
 18538 var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
 21352 var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
 18539 
 21353 var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
 18540 
 21354 
 18541 var didWarnAboutStateTransition = void 0;
 21355 
 18542 var didWarnSetStateChildContext = void 0;
 21356 var NoContext = /*                    */0;
 18543 var warnAboutUpdateOnUnmounted = void 0;
 21357 var BatchedContext = /*               */1;
 18544 var warnAboutInvalidUpdates = void 0;
 21358 var EventContext = /*                 */2;
 18545 
 21359 var DiscreteEventContext = /*         */4;
 18546 if (enableSchedulerTracing) {
 21360 var LegacyUnbatchedContext = /*       */8;
 18547   // Provide explicit error message when production+profiling bundle of e.g. react-dom
 21361 var RenderContext = /*                */16;
 18548   // is used with production (non-profiling) bundle of scheduler/tracing
 21362 var CommitContext = /*                */32;
 18549   !(__interactionsRef != null && __interactionsRef.current != null) ? invariant(false, 'It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling') : void 0;
 21363 
 18550 }
 21364 var RootIncomplete = 0;
 18551 
 21365 var RootErrored = 1;
 18552 {
 21366 var RootSuspended = 2;
 18553   didWarnAboutStateTransition = false;
 21367 var RootSuspendedWithDelay = 3;
 18554   didWarnSetStateChildContext = false;
 21368 var RootCompleted = 4;
 18555   var didWarnStateUpdateForUnmountedComponent = {};
 21369 
 18556 
 21370 // Describes where we are in the React execution stack
 18557   warnAboutUpdateOnUnmounted = function (fiber, isClass) {
 21371 var executionContext = NoContext;
 18558     // We show the whole stack but dedupe on the top component's name because
 21372 // The root we're working on
 18559     // the problematic code almost always lies inside that component.
 21373 var workInProgressRoot = null;
 18560     var componentName = getComponentName(fiber.type) || 'ReactComponent';
 21374 // The fiber we're working on
 18561     if (didWarnStateUpdateForUnmountedComponent[componentName]) {
 21375 var workInProgress = null;
 18562       return;
 21376 // The expiration time we're rendering
 18563     }
 21377 var renderExpirationTime = NoWork;
 18564     warningWithoutStack$1(false, "Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', isClass ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
 21378 // Whether to root completed, errored, suspended, etc.
 18565     didWarnStateUpdateForUnmountedComponent[componentName] = true;
 21379 var workInProgressRootExitStatus = RootIncomplete;
 18566   };
 21380 // Most recent event time among processed updates during this render.
 18567 
 21381 // This is conceptually a time stamp but expressed in terms of an ExpirationTime
 18568   warnAboutInvalidUpdates = function (instance) {
 21382 // because we deal mostly with expiration times in the hot path, so this avoids
 18569     switch (phase) {
 21383 // the conversion happening in the hot path.
 18570       case 'getChildContext':
 21384 var workInProgressRootLatestProcessedExpirationTime = Sync;
 18571         if (didWarnSetStateChildContext) {
 21385 var workInProgressRootLatestSuspenseTimeout = Sync;
 18572           return;
 21386 var workInProgressRootCanSuspendUsingConfig = null;
 18573         }
 21387 // If we're pinged while rendering we don't always restart immediately.
 18574         warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
 21388 // This flag determines if it might be worthwhile to restart if an opportunity
 18575         didWarnSetStateChildContext = true;
 21389 // happens latere.
       
 21390 var workInProgressRootHasPendingPing = false;
       
 21391 // The most recent time we committed a fallback. This lets us ensure a train
       
 21392 // model where we don't commit new loading states in too quick succession.
       
 21393 var globalMostRecentFallbackTime = 0;
       
 21394 var FALLBACK_THROTTLE_MS = 500;
       
 21395 
       
 21396 var nextEffect = null;
       
 21397 var hasUncaughtError = false;
       
 21398 var firstUncaughtError = null;
       
 21399 var legacyErrorBoundariesThatAlreadyFailed = null;
       
 21400 
       
 21401 var rootDoesHavePassiveEffects = false;
       
 21402 var rootWithPendingPassiveEffects = null;
       
 21403 var pendingPassiveEffectsRenderPriority = NoPriority;
       
 21404 var pendingPassiveEffectsExpirationTime = NoWork;
       
 21405 
       
 21406 var rootsWithPendingDiscreteUpdates = null;
       
 21407 
       
 21408 // Use these to prevent an infinite loop of nested updates
       
 21409 var NESTED_UPDATE_LIMIT = 50;
       
 21410 var nestedUpdateCount = 0;
       
 21411 var rootWithNestedUpdates = null;
       
 21412 
       
 21413 var NESTED_PASSIVE_UPDATE_LIMIT = 50;
       
 21414 var nestedPassiveUpdateCount = 0;
       
 21415 
       
 21416 var interruptedBy = null;
       
 21417 
       
 21418 // Marks the need to reschedule pending interactions at these expiration times
       
 21419 // during the commit phase. This enables them to be traced across components
       
 21420 // that spawn new work during render. E.g. hidden boundaries, suspended SSR
       
 21421 // hydration or SuspenseList.
       
 21422 var spawnedWorkDuringRender = null;
       
 21423 
       
 21424 // Expiration times are computed by adding to the current time (the start
       
 21425 // time). However, if two updates are scheduled within the same event, we
       
 21426 // should treat their start times as simultaneous, even if the actual clock
       
 21427 // time has advanced between the first and second call.
       
 21428 
       
 21429 // In other words, because expiration times determine how updates are batched,
       
 21430 // we want all updates of like priority that occur within the same event to
       
 21431 // receive the same expiration time. Otherwise we get tearing.
       
 21432 var currentEventTime = NoWork;
       
 21433 
       
 21434 function requestCurrentTime() {
       
 21435   if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
       
 21436     // We're inside React, so it's fine to read the actual time.
       
 21437     return msToExpirationTime(now());
       
 21438   }
       
 21439   // We're not inside React, so we may be in the middle of a browser event.
       
 21440   if (currentEventTime !== NoWork) {
       
 21441     // Use the same start time for all updates until we enter React again.
       
 21442     return currentEventTime;
       
 21443   }
       
 21444   // This is the first update since React yielded. Compute a new start time.
       
 21445   currentEventTime = msToExpirationTime(now());
       
 21446   return currentEventTime;
       
 21447 }
       
 21448 
       
 21449 function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
       
 21450   var mode = fiber.mode;
       
 21451   if ((mode & BatchedMode) === NoMode) {
       
 21452     return Sync;
       
 21453   }
       
 21454 
       
 21455   var priorityLevel = getCurrentPriorityLevel();
       
 21456   if ((mode & ConcurrentMode) === NoMode) {
       
 21457     return priorityLevel === ImmediatePriority ? Sync : Batched;
       
 21458   }
       
 21459 
       
 21460   if ((executionContext & RenderContext) !== NoContext) {
       
 21461     // Use whatever time we're already rendering
       
 21462     return renderExpirationTime;
       
 21463   }
       
 21464 
       
 21465   var expirationTime = void 0;
       
 21466   if (suspenseConfig !== null) {
       
 21467     // Compute an expiration time based on the Suspense timeout.
       
 21468     expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
       
 21469   } else {
       
 21470     // Compute an expiration time based on the Scheduler priority.
       
 21471     switch (priorityLevel) {
       
 21472       case ImmediatePriority:
       
 21473         expirationTime = Sync;
 18576         break;
 21474         break;
 18577       case 'render':
 21475       case UserBlockingPriority$2:
 18578         if (didWarnAboutStateTransition) {
 21476         // TODO: Rename this to computeUserBlockingExpiration
 18579           return;
 21477         expirationTime = computeInteractiveExpiration(currentTime);
 18580         }
       
 18581         warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as within ' + '`render`). Render methods should be a pure function of props and state.');
       
 18582         didWarnAboutStateTransition = true;
       
 18583         break;
 21478         break;
 18584     }
 21479       case NormalPriority:
 18585   };
 21480       case LowPriority:
 18586 }
 21481         // TODO: Handle LowPriority
 18587 
 21482         // TODO: Rename this to... something better.
 18588 // Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
 21483         expirationTime = computeAsyncExpiration(currentTime);
 18589 var lastUniqueAsyncExpiration = Sync - 1;
       
 18590 
       
 18591 var isWorking = false;
       
 18592 
       
 18593 // The next work in progress fiber that we're currently working on.
       
 18594 var nextUnitOfWork = null;
       
 18595 var nextRoot = null;
       
 18596 // The time at which we're currently rendering work.
       
 18597 var nextRenderExpirationTime = NoWork;
       
 18598 var nextLatestAbsoluteTimeoutMs = -1;
       
 18599 var nextRenderDidError = false;
       
 18600 
       
 18601 // The next fiber with an effect that we're currently committing.
       
 18602 var nextEffect = null;
       
 18603 
       
 18604 var isCommitting$1 = false;
       
 18605 var rootWithPendingPassiveEffects = null;
       
 18606 var passiveEffectCallbackHandle = null;
       
 18607 var passiveEffectCallback = null;
       
 18608 
       
 18609 var legacyErrorBoundariesThatAlreadyFailed = null;
       
 18610 
       
 18611 // Used for performance tracking.
       
 18612 var interruptedBy = null;
       
 18613 
       
 18614 var stashedWorkInProgressProperties = void 0;
       
 18615 var replayUnitOfWork = void 0;
       
 18616 var mayReplayFailedUnitOfWork = void 0;
       
 18617 var isReplayingFailedUnitOfWork = void 0;
       
 18618 var originalReplayError = void 0;
       
 18619 var rethrowOriginalError = void 0;
       
 18620 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 18621   stashedWorkInProgressProperties = null;
       
 18622   mayReplayFailedUnitOfWork = true;
       
 18623   isReplayingFailedUnitOfWork = false;
       
 18624   originalReplayError = null;
       
 18625   replayUnitOfWork = function (failedUnitOfWork, thrownValue, isYieldy) {
       
 18626     if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') {
       
 18627       // Don't replay promises. Treat everything else like an error.
       
 18628       // TODO: Need to figure out a different strategy if/when we add
       
 18629       // support for catching other types.
       
 18630       return;
       
 18631     }
       
 18632 
       
 18633     // Restore the original state of the work-in-progress
       
 18634     if (stashedWorkInProgressProperties === null) {
       
 18635       // This should never happen. Don't throw because this code is DEV-only.
       
 18636       warningWithoutStack$1(false, 'Could not replay rendering after an error. This is likely a bug in React. ' + 'Please file an issue.');
       
 18637       return;
       
 18638     }
       
 18639     assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties);
       
 18640 
       
 18641     switch (failedUnitOfWork.tag) {
       
 18642       case HostRoot:
       
 18643         popHostContainer(failedUnitOfWork);
       
 18644         popTopLevelContextObject(failedUnitOfWork);
       
 18645         break;
 21484         break;
 18646       case HostComponent:
 21485       case IdlePriority:
 18647         popHostContext(failedUnitOfWork);
 21486         expirationTime = Never;
 18648         break;
 21487         break;
 18649       case ClassComponent:
 21488       default:
 18650         {
 21489         (function () {
 18651           var Component = failedUnitOfWork.type;
 21490           {
 18652           if (isContextProvider(Component)) {
 21491             {
 18653             popContext(failedUnitOfWork);
 21492               throw ReactError(Error('Expected a valid priority level'));
 18654           }
       
 18655           break;
       
 18656         }
       
 18657       case HostPortal:
       
 18658         popHostContainer(failedUnitOfWork);
       
 18659         break;
       
 18660       case ContextProvider:
       
 18661         popProvider(failedUnitOfWork);
       
 18662         break;
       
 18663     }
       
 18664     // Replay the begin phase.
       
 18665     isReplayingFailedUnitOfWork = true;
       
 18666     originalReplayError = thrownValue;
       
 18667     invokeGuardedCallback(null, workLoop, null, isYieldy);
       
 18668     isReplayingFailedUnitOfWork = false;
       
 18669     originalReplayError = null;
       
 18670     if (hasCaughtError()) {
       
 18671       var replayError = clearCaughtError();
       
 18672       if (replayError != null && thrownValue != null) {
       
 18673         try {
       
 18674           // Reading the expando property is intentionally
       
 18675           // inside `try` because it might be a getter or Proxy.
       
 18676           if (replayError._suppressLogging) {
       
 18677             // Also suppress logging for the original error.
       
 18678             thrownValue._suppressLogging = true;
       
 18679           }
       
 18680         } catch (inner) {
       
 18681           // Ignore.
       
 18682         }
       
 18683       }
       
 18684     } else {
       
 18685       // If the begin phase did not fail the second time, set this pointer
       
 18686       // back to the original value.
       
 18687       nextUnitOfWork = failedUnitOfWork;
       
 18688     }
       
 18689   };
       
 18690   rethrowOriginalError = function () {
       
 18691     throw originalReplayError;
       
 18692   };
       
 18693 }
       
 18694 
       
 18695 function resetStack() {
       
 18696   if (nextUnitOfWork !== null) {
       
 18697     var interruptedWork = nextUnitOfWork.return;
       
 18698     while (interruptedWork !== null) {
       
 18699       unwindInterruptedWork(interruptedWork);
       
 18700       interruptedWork = interruptedWork.return;
       
 18701     }
       
 18702   }
       
 18703 
       
 18704   {
       
 18705     ReactStrictModeWarnings.discardPendingWarnings();
       
 18706     checkThatStackIsEmpty();
       
 18707   }
       
 18708 
       
 18709   nextRoot = null;
       
 18710   nextRenderExpirationTime = NoWork;
       
 18711   nextLatestAbsoluteTimeoutMs = -1;
       
 18712   nextRenderDidError = false;
       
 18713   nextUnitOfWork = null;
       
 18714 }
       
 18715 
       
 18716 function commitAllHostEffects() {
       
 18717   while (nextEffect !== null) {
       
 18718     {
       
 18719       setCurrentFiber(nextEffect);
       
 18720     }
       
 18721     recordEffect();
       
 18722 
       
 18723     var effectTag = nextEffect.effectTag;
       
 18724 
       
 18725     if (effectTag & ContentReset) {
       
 18726       commitResetTextContent(nextEffect);
       
 18727     }
       
 18728 
       
 18729     if (effectTag & Ref) {
       
 18730       var current$$1 = nextEffect.alternate;
       
 18731       if (current$$1 !== null) {
       
 18732         commitDetachRef(current$$1);
       
 18733       }
       
 18734     }
       
 18735 
       
 18736     // The following switch statement is only concerned about placement,
       
 18737     // updates, and deletions. To avoid needing to add a case for every
       
 18738     // possible bitmap value, we remove the secondary effects from the
       
 18739     // effect tag and switch on that value.
       
 18740     var primaryEffectTag = effectTag & (Placement | Update | Deletion);
       
 18741     switch (primaryEffectTag) {
       
 18742       case Placement:
       
 18743         {
       
 18744           commitPlacement(nextEffect);
       
 18745           // Clear the "placement" from effect tag so that we know that this is inserted, before
       
 18746           // any life-cycles like componentDidMount gets called.
       
 18747           // TODO: findDOMNode doesn't rely on this any more but isMounted
       
 18748           // does and isMounted is deprecated anyway so we should be able
       
 18749           // to kill this.
       
 18750           nextEffect.effectTag &= ~Placement;
       
 18751           break;
       
 18752         }
       
 18753       case PlacementAndUpdate:
       
 18754         {
       
 18755           // Placement
       
 18756           commitPlacement(nextEffect);
       
 18757           // Clear the "placement" from effect tag so that we know that this is inserted, before
       
 18758           // any life-cycles like componentDidMount gets called.
       
 18759           nextEffect.effectTag &= ~Placement;
       
 18760 
       
 18761           // Update
       
 18762           var _current = nextEffect.alternate;
       
 18763           commitWork(_current, nextEffect);
       
 18764           break;
       
 18765         }
       
 18766       case Update:
       
 18767         {
       
 18768           var _current2 = nextEffect.alternate;
       
 18769           commitWork(_current2, nextEffect);
       
 18770           break;
       
 18771         }
       
 18772       case Deletion:
       
 18773         {
       
 18774           commitDeletion(nextEffect);
       
 18775           break;
       
 18776         }
       
 18777     }
       
 18778     nextEffect = nextEffect.nextEffect;
       
 18779   }
       
 18780 
       
 18781   {
       
 18782     resetCurrentFiber();
       
 18783   }
       
 18784 }
       
 18785 
       
 18786 function commitBeforeMutationLifecycles() {
       
 18787   while (nextEffect !== null) {
       
 18788     {
       
 18789       setCurrentFiber(nextEffect);
       
 18790     }
       
 18791 
       
 18792     var effectTag = nextEffect.effectTag;
       
 18793     if (effectTag & Snapshot) {
       
 18794       recordEffect();
       
 18795       var current$$1 = nextEffect.alternate;
       
 18796       commitBeforeMutationLifeCycles(current$$1, nextEffect);
       
 18797     }
       
 18798 
       
 18799     nextEffect = nextEffect.nextEffect;
       
 18800   }
       
 18801 
       
 18802   {
       
 18803     resetCurrentFiber();
       
 18804   }
       
 18805 }
       
 18806 
       
 18807 function commitAllLifeCycles(finishedRoot, committedExpirationTime) {
       
 18808   {
       
 18809     ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
       
 18810     ReactStrictModeWarnings.flushLegacyContextWarning();
       
 18811 
       
 18812     if (warnAboutDeprecatedLifecycles) {
       
 18813       ReactStrictModeWarnings.flushPendingDeprecationWarnings();
       
 18814     }
       
 18815   }
       
 18816   while (nextEffect !== null) {
       
 18817     {
       
 18818       setCurrentFiber(nextEffect);
       
 18819     }
       
 18820     var effectTag = nextEffect.effectTag;
       
 18821 
       
 18822     if (effectTag & (Update | Callback)) {
       
 18823       recordEffect();
       
 18824       var current$$1 = nextEffect.alternate;
       
 18825       commitLifeCycles(finishedRoot, current$$1, nextEffect, committedExpirationTime);
       
 18826     }
       
 18827 
       
 18828     if (effectTag & Ref) {
       
 18829       recordEffect();
       
 18830       commitAttachRef(nextEffect);
       
 18831     }
       
 18832 
       
 18833     if (effectTag & Passive) {
       
 18834       rootWithPendingPassiveEffects = finishedRoot;
       
 18835     }
       
 18836 
       
 18837     nextEffect = nextEffect.nextEffect;
       
 18838   }
       
 18839   {
       
 18840     resetCurrentFiber();
       
 18841   }
       
 18842 }
       
 18843 
       
 18844 function commitPassiveEffects(root, firstEffect) {
       
 18845   rootWithPendingPassiveEffects = null;
       
 18846   passiveEffectCallbackHandle = null;
       
 18847   passiveEffectCallback = null;
       
 18848 
       
 18849   // Set this to true to prevent re-entrancy
       
 18850   var previousIsRendering = isRendering;
       
 18851   isRendering = true;
       
 18852 
       
 18853   var effect = firstEffect;
       
 18854   do {
       
 18855     {
       
 18856       setCurrentFiber(effect);
       
 18857     }
       
 18858 
       
 18859     if (effect.effectTag & Passive) {
       
 18860       var didError = false;
       
 18861       var error = void 0;
       
 18862       {
       
 18863         invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
       
 18864         if (hasCaughtError()) {
       
 18865           didError = true;
       
 18866           error = clearCaughtError();
       
 18867         }
       
 18868       }
       
 18869       if (didError) {
       
 18870         captureCommitPhaseError(effect, error);
       
 18871       }
       
 18872     }
       
 18873     effect = effect.nextEffect;
       
 18874   } while (effect !== null);
       
 18875   {
       
 18876     resetCurrentFiber();
       
 18877   }
       
 18878 
       
 18879   isRendering = previousIsRendering;
       
 18880 
       
 18881   // Check if work was scheduled by one of the effects
       
 18882   var rootExpirationTime = root.expirationTime;
       
 18883   if (rootExpirationTime !== NoWork) {
       
 18884     requestWork(root, rootExpirationTime);
       
 18885   }
       
 18886   // Flush any sync work that was scheduled by effects
       
 18887   if (!isBatchingUpdates && !isRendering) {
       
 18888     performSyncWork();
       
 18889   }
       
 18890 }
       
 18891 
       
 18892 function isAlreadyFailedLegacyErrorBoundary(instance) {
       
 18893   return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
       
 18894 }
       
 18895 
       
 18896 function markLegacyErrorBoundaryAsFailed(instance) {
       
 18897   if (legacyErrorBoundariesThatAlreadyFailed === null) {
       
 18898     legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
       
 18899   } else {
       
 18900     legacyErrorBoundariesThatAlreadyFailed.add(instance);
       
 18901   }
       
 18902 }
       
 18903 
       
 18904 function flushPassiveEffects() {
       
 18905   if (passiveEffectCallbackHandle !== null) {
       
 18906     cancelPassiveEffects(passiveEffectCallbackHandle);
       
 18907   }
       
 18908   if (passiveEffectCallback !== null) {
       
 18909     // We call the scheduled callback instead of commitPassiveEffects directly
       
 18910     // to ensure tracing works correctly.
       
 18911     passiveEffectCallback();
       
 18912   }
       
 18913 }
       
 18914 
       
 18915 function commitRoot(root, finishedWork) {
       
 18916   isWorking = true;
       
 18917   isCommitting$1 = true;
       
 18918   startCommitTimer();
       
 18919 
       
 18920   !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18921   var committedExpirationTime = root.pendingCommitExpirationTime;
       
 18922   !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18923   root.pendingCommitExpirationTime = NoWork;
       
 18924 
       
 18925   // Update the pending priority levels to account for the work that we are
       
 18926   // about to commit. This needs to happen before calling the lifecycles, since
       
 18927   // they may schedule additional updates.
       
 18928   var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
       
 18929   var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
       
 18930   var earliestRemainingTimeBeforeCommit = childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
       
 18931   markCommittedPriorityLevels(root, earliestRemainingTimeBeforeCommit);
       
 18932 
       
 18933   var prevInteractions = null;
       
 18934   if (enableSchedulerTracing) {
       
 18935     // Restore any pending interactions at this point,
       
 18936     // So that cascading work triggered during the render phase will be accounted for.
       
 18937     prevInteractions = __interactionsRef.current;
       
 18938     __interactionsRef.current = root.memoizedInteractions;
       
 18939   }
       
 18940 
       
 18941   // Reset this to null before calling lifecycles
       
 18942   ReactCurrentOwner$2.current = null;
       
 18943 
       
 18944   var firstEffect = void 0;
       
 18945   if (finishedWork.effectTag > PerformedWork) {
       
 18946     // A fiber's effect list consists only of its children, not itself. So if
       
 18947     // the root has an effect, we need to add it to the end of the list. The
       
 18948     // resulting list is the set that would belong to the root's parent, if
       
 18949     // it had one; that is, all the effects in the tree including the root.
       
 18950     if (finishedWork.lastEffect !== null) {
       
 18951       finishedWork.lastEffect.nextEffect = finishedWork;
       
 18952       firstEffect = finishedWork.firstEffect;
       
 18953     } else {
       
 18954       firstEffect = finishedWork;
       
 18955     }
       
 18956   } else {
       
 18957     // There is no effect on the root.
       
 18958     firstEffect = finishedWork.firstEffect;
       
 18959   }
       
 18960 
       
 18961   prepareForCommit(root.containerInfo);
       
 18962 
       
 18963   // Invoke instances of getSnapshotBeforeUpdate before mutation.
       
 18964   nextEffect = firstEffect;
       
 18965   startCommitSnapshotEffectsTimer();
       
 18966   while (nextEffect !== null) {
       
 18967     var didError = false;
       
 18968     var error = void 0;
       
 18969     {
       
 18970       invokeGuardedCallback(null, commitBeforeMutationLifecycles, null);
       
 18971       if (hasCaughtError()) {
       
 18972         didError = true;
       
 18973         error = clearCaughtError();
       
 18974       }
       
 18975     }
       
 18976     if (didError) {
       
 18977       !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18978       captureCommitPhaseError(nextEffect, error);
       
 18979       // Clean-up
       
 18980       if (nextEffect !== null) {
       
 18981         nextEffect = nextEffect.nextEffect;
       
 18982       }
       
 18983     }
       
 18984   }
       
 18985   stopCommitSnapshotEffectsTimer();
       
 18986 
       
 18987   if (enableProfilerTimer) {
       
 18988     // Mark the current commit time to be shared by all Profilers in this batch.
       
 18989     // This enables them to be grouped later.
       
 18990     recordCommitTime();
       
 18991   }
       
 18992 
       
 18993   // Commit all the side-effects within a tree. We'll do this in two passes.
       
 18994   // The first pass performs all the host insertions, updates, deletions and
       
 18995   // ref unmounts.
       
 18996   nextEffect = firstEffect;
       
 18997   startCommitHostEffectsTimer();
       
 18998   while (nextEffect !== null) {
       
 18999     var _didError = false;
       
 19000     var _error = void 0;
       
 19001     {
       
 19002       invokeGuardedCallback(null, commitAllHostEffects, null);
       
 19003       if (hasCaughtError()) {
       
 19004         _didError = true;
       
 19005         _error = clearCaughtError();
       
 19006       }
       
 19007     }
       
 19008     if (_didError) {
       
 19009       !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19010       captureCommitPhaseError(nextEffect, _error);
       
 19011       // Clean-up
       
 19012       if (nextEffect !== null) {
       
 19013         nextEffect = nextEffect.nextEffect;
       
 19014       }
       
 19015     }
       
 19016   }
       
 19017   stopCommitHostEffectsTimer();
       
 19018 
       
 19019   resetAfterCommit(root.containerInfo);
       
 19020 
       
 19021   // The work-in-progress tree is now the current tree. This must come after
       
 19022   // the first pass of the commit phase, so that the previous tree is still
       
 19023   // current during componentWillUnmount, but before the second pass, so that
       
 19024   // the finished work is current during componentDidMount/Update.
       
 19025   root.current = finishedWork;
       
 19026 
       
 19027   // In the second pass we'll perform all life-cycles and ref callbacks.
       
 19028   // Life-cycles happen as a separate pass so that all placements, updates,
       
 19029   // and deletions in the entire tree have already been invoked.
       
 19030   // This pass also triggers any renderer-specific initial effects.
       
 19031   nextEffect = firstEffect;
       
 19032   startCommitLifeCyclesTimer();
       
 19033   while (nextEffect !== null) {
       
 19034     var _didError2 = false;
       
 19035     var _error2 = void 0;
       
 19036     {
       
 19037       invokeGuardedCallback(null, commitAllLifeCycles, null, root, committedExpirationTime);
       
 19038       if (hasCaughtError()) {
       
 19039         _didError2 = true;
       
 19040         _error2 = clearCaughtError();
       
 19041       }
       
 19042     }
       
 19043     if (_didError2) {
       
 19044       !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19045       captureCommitPhaseError(nextEffect, _error2);
       
 19046       if (nextEffect !== null) {
       
 19047         nextEffect = nextEffect.nextEffect;
       
 19048       }
       
 19049     }
       
 19050   }
       
 19051 
       
 19052   if (firstEffect !== null && rootWithPendingPassiveEffects !== null) {
       
 19053     // This commit included a passive effect. These do not need to fire until
       
 19054     // after the next paint. Schedule an callback to fire them in an async
       
 19055     // event. To ensure serial execution, the callback will be flushed early if
       
 19056     // we enter rootWithPendingPassiveEffects commit phase before then.
       
 19057     var callback = commitPassiveEffects.bind(null, root, firstEffect);
       
 19058     if (enableSchedulerTracing) {
       
 19059       // TODO: Avoid this extra callback by mutating the tracing ref directly,
       
 19060       // like we do at the beginning of commitRoot. I've opted not to do that
       
 19061       // here because that code is still in flux.
       
 19062       callback = unstable_wrap(callback);
       
 19063     }
       
 19064     passiveEffectCallbackHandle = unstable_runWithPriority(unstable_NormalPriority, function () {
       
 19065       return schedulePassiveEffects(callback);
       
 19066     });
       
 19067     passiveEffectCallback = callback;
       
 19068   }
       
 19069 
       
 19070   isCommitting$1 = false;
       
 19071   isWorking = false;
       
 19072   stopCommitLifeCyclesTimer();
       
 19073   stopCommitTimer();
       
 19074   onCommitRoot(finishedWork.stateNode);
       
 19075   if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19076     ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork);
       
 19077   }
       
 19078 
       
 19079   var updateExpirationTimeAfterCommit = finishedWork.expirationTime;
       
 19080   var childExpirationTimeAfterCommit = finishedWork.childExpirationTime;
       
 19081   var earliestRemainingTimeAfterCommit = childExpirationTimeAfterCommit > updateExpirationTimeAfterCommit ? childExpirationTimeAfterCommit : updateExpirationTimeAfterCommit;
       
 19082   if (earliestRemainingTimeAfterCommit === NoWork) {
       
 19083     // If there's no remaining work, we can clear the set of already failed
       
 19084     // error boundaries.
       
 19085     legacyErrorBoundariesThatAlreadyFailed = null;
       
 19086   }
       
 19087   onCommit(root, earliestRemainingTimeAfterCommit);
       
 19088 
       
 19089   if (enableSchedulerTracing) {
       
 19090     __interactionsRef.current = prevInteractions;
       
 19091 
       
 19092     var subscriber = void 0;
       
 19093 
       
 19094     try {
       
 19095       subscriber = __subscriberRef.current;
       
 19096       if (subscriber !== null && root.memoizedInteractions.size > 0) {
       
 19097         var threadID = computeThreadID(committedExpirationTime, root.interactionThreadID);
       
 19098         subscriber.onWorkStopped(root.memoizedInteractions, threadID);
       
 19099       }
       
 19100     } catch (error) {
       
 19101       // It's not safe for commitRoot() to throw.
       
 19102       // Store the error for now and we'll re-throw in finishRendering().
       
 19103       if (!hasUnhandledError) {
       
 19104         hasUnhandledError = true;
       
 19105         unhandledError = error;
       
 19106       }
       
 19107     } finally {
       
 19108       // Clear completed interactions from the pending Map.
       
 19109       // Unless the render was suspended or cascading work was scheduled,
       
 19110       // In which case– leave pending interactions until the subsequent render.
       
 19111       var pendingInteractionMap = root.pendingInteractionMap;
       
 19112       pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 19113         // Only decrement the pending interaction count if we're done.
       
 19114         // If there's still work at the current priority,
       
 19115         // That indicates that we are waiting for suspense data.
       
 19116         if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
       
 19117           pendingInteractionMap.delete(scheduledExpirationTime);
       
 19118 
       
 19119           scheduledInteractions.forEach(function (interaction) {
       
 19120             interaction.__count--;
       
 19121 
       
 19122             if (subscriber !== null && interaction.__count === 0) {
       
 19123               try {
       
 19124                 subscriber.onInteractionScheduledWorkCompleted(interaction);
       
 19125               } catch (error) {
       
 19126                 // It's not safe for commitRoot() to throw.
       
 19127                 // Store the error for now and we'll re-throw in finishRendering().
       
 19128                 if (!hasUnhandledError) {
       
 19129                   hasUnhandledError = true;
       
 19130                   unhandledError = error;
       
 19131                 }
       
 19132               }
       
 19133             }
       
 19134           });
       
 19135         }
       
 19136       });
       
 19137     }
       
 19138   }
       
 19139 }
       
 19140 
       
 19141 function resetChildExpirationTime(workInProgress, renderTime) {
       
 19142   if (renderTime !== Never && workInProgress.childExpirationTime === Never) {
       
 19143     // The children of this component are hidden. Don't bubble their
       
 19144     // expiration times.
       
 19145     return;
       
 19146   }
       
 19147 
       
 19148   var newChildExpirationTime = NoWork;
       
 19149 
       
 19150   // Bubble up the earliest expiration time.
       
 19151   if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 19152     // We're in profiling mode.
       
 19153     // Let's use this same traversal to update the render durations.
       
 19154     var actualDuration = workInProgress.actualDuration;
       
 19155     var treeBaseDuration = workInProgress.selfBaseDuration;
       
 19156 
       
 19157     // When a fiber is cloned, its actualDuration is reset to 0.
       
 19158     // This value will only be updated if work is done on the fiber (i.e. it doesn't bailout).
       
 19159     // When work is done, it should bubble to the parent's actualDuration.
       
 19160     // If the fiber has not been cloned though, (meaning no work was done),
       
 19161     // Then this value will reflect the amount of time spent working on a previous render.
       
 19162     // In that case it should not bubble.
       
 19163     // We determine whether it was cloned by comparing the child pointer.
       
 19164     var shouldBubbleActualDurations = workInProgress.alternate === null || workInProgress.child !== workInProgress.alternate.child;
       
 19165 
       
 19166     var child = workInProgress.child;
       
 19167     while (child !== null) {
       
 19168       var childUpdateExpirationTime = child.expirationTime;
       
 19169       var childChildExpirationTime = child.childExpirationTime;
       
 19170       if (childUpdateExpirationTime > newChildExpirationTime) {
       
 19171         newChildExpirationTime = childUpdateExpirationTime;
       
 19172       }
       
 19173       if (childChildExpirationTime > newChildExpirationTime) {
       
 19174         newChildExpirationTime = childChildExpirationTime;
       
 19175       }
       
 19176       if (shouldBubbleActualDurations) {
       
 19177         actualDuration += child.actualDuration;
       
 19178       }
       
 19179       treeBaseDuration += child.treeBaseDuration;
       
 19180       child = child.sibling;
       
 19181     }
       
 19182     workInProgress.actualDuration = actualDuration;
       
 19183     workInProgress.treeBaseDuration = treeBaseDuration;
       
 19184   } else {
       
 19185     var _child = workInProgress.child;
       
 19186     while (_child !== null) {
       
 19187       var _childUpdateExpirationTime = _child.expirationTime;
       
 19188       var _childChildExpirationTime = _child.childExpirationTime;
       
 19189       if (_childUpdateExpirationTime > newChildExpirationTime) {
       
 19190         newChildExpirationTime = _childUpdateExpirationTime;
       
 19191       }
       
 19192       if (_childChildExpirationTime > newChildExpirationTime) {
       
 19193         newChildExpirationTime = _childChildExpirationTime;
       
 19194       }
       
 19195       _child = _child.sibling;
       
 19196     }
       
 19197   }
       
 19198 
       
 19199   workInProgress.childExpirationTime = newChildExpirationTime;
       
 19200 }
       
 19201 
       
 19202 function completeUnitOfWork(workInProgress) {
       
 19203   // Attempt to complete the current unit of work, then move to the
       
 19204   // next sibling. If there are no more siblings, return to the
       
 19205   // parent fiber.
       
 19206   while (true) {
       
 19207     // The current, flushed, state of this fiber is the alternate.
       
 19208     // Ideally nothing should rely on this, but relying on it here
       
 19209     // means that we don't need an additional field on the work in
       
 19210     // progress.
       
 19211     var current$$1 = workInProgress.alternate;
       
 19212     {
       
 19213       setCurrentFiber(workInProgress);
       
 19214     }
       
 19215 
       
 19216     var returnFiber = workInProgress.return;
       
 19217     var siblingFiber = workInProgress.sibling;
       
 19218 
       
 19219     if ((workInProgress.effectTag & Incomplete) === NoEffect) {
       
 19220       if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19221         // Don't replay if it fails during completion phase.
       
 19222         mayReplayFailedUnitOfWork = false;
       
 19223       }
       
 19224       // This fiber completed.
       
 19225       // Remember we're completing this unit so we can find a boundary if it fails.
       
 19226       nextUnitOfWork = workInProgress;
       
 19227       if (enableProfilerTimer) {
       
 19228         if (workInProgress.mode & ProfileMode) {
       
 19229           startProfilerTimer(workInProgress);
       
 19230         }
       
 19231         nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19232         if (workInProgress.mode & ProfileMode) {
       
 19233           // Update render duration assuming we didn't error.
       
 19234           stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 19235         }
       
 19236       } else {
       
 19237         nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19238       }
       
 19239       if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19240         // We're out of completion phase so replaying is fine now.
       
 19241         mayReplayFailedUnitOfWork = true;
       
 19242       }
       
 19243       stopWorkTimer(workInProgress);
       
 19244       resetChildExpirationTime(workInProgress, nextRenderExpirationTime);
       
 19245       {
       
 19246         resetCurrentFiber();
       
 19247       }
       
 19248 
       
 19249       if (nextUnitOfWork !== null) {
       
 19250         // Completing this fiber spawned new work. Work on that next.
       
 19251         return nextUnitOfWork;
       
 19252       }
       
 19253 
       
 19254       if (returnFiber !== null &&
       
 19255       // Do not append effects to parents if a sibling failed to complete
       
 19256       (returnFiber.effectTag & Incomplete) === NoEffect) {
       
 19257         // Append all the effects of the subtree and this fiber onto the effect
       
 19258         // list of the parent. The completion order of the children affects the
       
 19259         // side-effect order.
       
 19260         if (returnFiber.firstEffect === null) {
       
 19261           returnFiber.firstEffect = workInProgress.firstEffect;
       
 19262         }
       
 19263         if (workInProgress.lastEffect !== null) {
       
 19264           if (returnFiber.lastEffect !== null) {
       
 19265             returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
       
 19266           }
       
 19267           returnFiber.lastEffect = workInProgress.lastEffect;
       
 19268         }
       
 19269 
       
 19270         // If this fiber had side-effects, we append it AFTER the children's
       
 19271         // side-effects. We can perform certain side-effects earlier if
       
 19272         // needed, by doing multiple passes over the effect list. We don't want
       
 19273         // to schedule our own side-effect on our own list because if end up
       
 19274         // reusing children we'll schedule this effect onto itself since we're
       
 19275         // at the end.
       
 19276         var effectTag = workInProgress.effectTag;
       
 19277         // Skip both NoWork and PerformedWork tags when creating the effect list.
       
 19278         // PerformedWork effect is read by React DevTools but shouldn't be committed.
       
 19279         if (effectTag > PerformedWork) {
       
 19280           if (returnFiber.lastEffect !== null) {
       
 19281             returnFiber.lastEffect.nextEffect = workInProgress;
       
 19282           } else {
       
 19283             returnFiber.firstEffect = workInProgress;
       
 19284           }
       
 19285           returnFiber.lastEffect = workInProgress;
       
 19286         }
       
 19287       }
       
 19288 
       
 19289       if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19290         ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
       
 19291       }
       
 19292 
       
 19293       if (siblingFiber !== null) {
       
 19294         // If there is more work to do in this returnFiber, do that next.
       
 19295         return siblingFiber;
       
 19296       } else if (returnFiber !== null) {
       
 19297         // If there's no more work in this returnFiber. Complete the returnFiber.
       
 19298         workInProgress = returnFiber;
       
 19299         continue;
       
 19300       } else {
       
 19301         // We've reached the root.
       
 19302         return null;
       
 19303       }
       
 19304     } else {
       
 19305       if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 19306         // Record the render duration for the fiber that errored.
       
 19307         stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 19308 
       
 19309         // Include the time spent working on failed children before continuing.
       
 19310         var actualDuration = workInProgress.actualDuration;
       
 19311         var child = workInProgress.child;
       
 19312         while (child !== null) {
       
 19313           actualDuration += child.actualDuration;
       
 19314           child = child.sibling;
       
 19315         }
       
 19316         workInProgress.actualDuration = actualDuration;
       
 19317       }
       
 19318 
       
 19319       // This fiber did not complete because something threw. Pop values off
       
 19320       // the stack without entering the complete phase. If this is a boundary,
       
 19321       // capture values if possible.
       
 19322       var next = unwindWork(workInProgress, nextRenderExpirationTime);
       
 19323       // Because this fiber did not complete, don't reset its expiration time.
       
 19324       if (workInProgress.effectTag & DidCapture) {
       
 19325         // Restarting an error boundary
       
 19326         stopFailedWorkTimer(workInProgress);
       
 19327       } else {
       
 19328         stopWorkTimer(workInProgress);
       
 19329       }
       
 19330 
       
 19331       {
       
 19332         resetCurrentFiber();
       
 19333       }
       
 19334 
       
 19335       if (next !== null) {
       
 19336         stopWorkTimer(workInProgress);
       
 19337         if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19338           ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
       
 19339         }
       
 19340 
       
 19341         // If completing this work spawned new work, do that next. We'll come
       
 19342         // back here again.
       
 19343         // Since we're restarting, remove anything that is not a host effect
       
 19344         // from the effect tag.
       
 19345         next.effectTag &= HostEffectMask;
       
 19346         return next;
       
 19347       }
       
 19348 
       
 19349       if (returnFiber !== null) {
       
 19350         // Mark the parent fiber as incomplete and clear its effect list.
       
 19351         returnFiber.firstEffect = returnFiber.lastEffect = null;
       
 19352         returnFiber.effectTag |= Incomplete;
       
 19353       }
       
 19354 
       
 19355       if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19356         ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
       
 19357       }
       
 19358 
       
 19359       if (siblingFiber !== null) {
       
 19360         // If there is more work to do in this returnFiber, do that next.
       
 19361         return siblingFiber;
       
 19362       } else if (returnFiber !== null) {
       
 19363         // If there's no more work in this returnFiber. Complete the returnFiber.
       
 19364         workInProgress = returnFiber;
       
 19365         continue;
       
 19366       } else {
       
 19367         return null;
       
 19368       }
       
 19369     }
       
 19370   }
       
 19371 
       
 19372   // Without this explicit null return Flow complains of invalid return type
       
 19373   // TODO Remove the above while(true) loop
       
 19374   // eslint-disable-next-line no-unreachable
       
 19375   return null;
       
 19376 }
       
 19377 
       
 19378 function performUnitOfWork(workInProgress) {
       
 19379   // The current, flushed, state of this fiber is the alternate.
       
 19380   // Ideally nothing should rely on this, but relying on it here
       
 19381   // means that we don't need an additional field on the work in
       
 19382   // progress.
       
 19383   var current$$1 = workInProgress.alternate;
       
 19384 
       
 19385   // See if beginning this work spawns more work.
       
 19386   startWorkTimer(workInProgress);
       
 19387   {
       
 19388     setCurrentFiber(workInProgress);
       
 19389   }
       
 19390 
       
 19391   if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19392     stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress);
       
 19393   }
       
 19394 
       
 19395   var next = void 0;
       
 19396   if (enableProfilerTimer) {
       
 19397     if (workInProgress.mode & ProfileMode) {
       
 19398       startProfilerTimer(workInProgress);
       
 19399     }
       
 19400 
       
 19401     next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19402     workInProgress.memoizedProps = workInProgress.pendingProps;
       
 19403 
       
 19404     if (workInProgress.mode & ProfileMode) {
       
 19405       // Record the render duration assuming we didn't bailout (or error).
       
 19406       stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
       
 19407     }
       
 19408   } else {
       
 19409     next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19410     workInProgress.memoizedProps = workInProgress.pendingProps;
       
 19411   }
       
 19412 
       
 19413   {
       
 19414     resetCurrentFiber();
       
 19415     if (isReplayingFailedUnitOfWork) {
       
 19416       // Currently replaying a failed unit of work. This should be unreachable,
       
 19417       // because the render phase is meant to be idempotent, and it should
       
 19418       // have thrown again. Since it didn't, rethrow the original error, so
       
 19419       // React's internal stack is not misaligned.
       
 19420       rethrowOriginalError();
       
 19421     }
       
 19422   }
       
 19423   if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19424     ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
       
 19425   }
       
 19426 
       
 19427   if (next === null) {
       
 19428     // If this doesn't spawn new work, complete the current work.
       
 19429     next = completeUnitOfWork(workInProgress);
       
 19430   }
       
 19431 
       
 19432   ReactCurrentOwner$2.current = null;
       
 19433 
       
 19434   return next;
       
 19435 }
       
 19436 
       
 19437 function workLoop(isYieldy) {
       
 19438   if (!isYieldy) {
       
 19439     // Flush work without yielding
       
 19440     while (nextUnitOfWork !== null) {
       
 19441       nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
       
 19442     }
       
 19443   } else {
       
 19444     // Flush asynchronous work until there's a higher priority event
       
 19445     while (nextUnitOfWork !== null && !shouldYieldToRenderer()) {
       
 19446       nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
       
 19447     }
       
 19448   }
       
 19449 }
       
 19450 
       
 19451 function renderRoot(root, isYieldy) {
       
 19452   !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19453 
       
 19454   flushPassiveEffects();
       
 19455 
       
 19456   isWorking = true;
       
 19457   var previousDispatcher = ReactCurrentDispatcher.current;
       
 19458   ReactCurrentDispatcher.current = ContextOnlyDispatcher;
       
 19459 
       
 19460   var expirationTime = root.nextExpirationTimeToWorkOn;
       
 19461 
       
 19462   // Check if we're starting from a fresh stack, or if we're resuming from
       
 19463   // previously yielded work.
       
 19464   if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
       
 19465     // Reset the stack and start working from the root.
       
 19466     resetStack();
       
 19467     nextRoot = root;
       
 19468     nextRenderExpirationTime = expirationTime;
       
 19469     nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
       
 19470     root.pendingCommitExpirationTime = NoWork;
       
 19471 
       
 19472     if (enableSchedulerTracing) {
       
 19473       // Determine which interactions this batch of work currently includes,
       
 19474       // So that we can accurately attribute time spent working on it,
       
 19475       var interactions = new Set();
       
 19476       root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 19477         if (scheduledExpirationTime >= expirationTime) {
       
 19478           scheduledInteractions.forEach(function (interaction) {
       
 19479             return interactions.add(interaction);
       
 19480           });
       
 19481         }
       
 19482       });
       
 19483 
       
 19484       // Store the current set of interactions on the FiberRoot for a few reasons:
       
 19485       // We can re-use it in hot functions like renderRoot() without having to recalculate it.
       
 19486       // We will also use it in commitWork() to pass to any Profiler onRender() hooks.
       
 19487       // This also provides DevTools with a way to access it when the onCommitRoot() hook is called.
       
 19488       root.memoizedInteractions = interactions;
       
 19489 
       
 19490       if (interactions.size > 0) {
       
 19491         var subscriber = __subscriberRef.current;
       
 19492         if (subscriber !== null) {
       
 19493           var threadID = computeThreadID(expirationTime, root.interactionThreadID);
       
 19494           try {
       
 19495             subscriber.onWorkStarted(interactions, threadID);
       
 19496           } catch (error) {
       
 19497             // Work thrown by an interaction tracing subscriber should be rethrown,
       
 19498             // But only once it's safe (to avoid leaving the scheduler in an invalid state).
       
 19499             // Store the error for now and we'll re-throw in finishRendering().
       
 19500             if (!hasUnhandledError) {
       
 19501               hasUnhandledError = true;
       
 19502               unhandledError = error;
       
 19503             }
 21493             }
 19504           }
 21494           }
 19505         }
 21495         })();
 19506       }
 21496     }
 19507     }
 21497   }
 19508   }
 21498 
 19509 
 21499   // If we're in the middle of rendering a tree, do not update at the same
 19510   var prevInteractions = null;
 21500   // expiration time that is already rendering.
 19511   if (enableSchedulerTracing) {
 21501   // TODO: We shouldn't have to do this if the update is on a different root.
 19512     // We're about to start new traced work.
 21502   // Refactor computeExpirationForFiber + scheduleUpdate so we have access to
 19513     // Restore pending interactions so cascading work triggered during the render phase will be accounted for.
 21503   // the root when we check for this condition.
 19514     prevInteractions = __interactionsRef.current;
 21504   if (workInProgressRoot !== null && expirationTime === renderExpirationTime) {
 19515     __interactionsRef.current = root.memoizedInteractions;
 21505     // This is a trick to move this update into a separate batch
 19516   }
 21506     expirationTime -= 1;
 19517 
 21507   }
 19518   var didFatal = false;
 21508 
 19519 
 21509   return expirationTime;
 19520   startWorkLoopTimer(nextUnitOfWork);
 21510 }
 19521 
 21511 
 19522   do {
 21512 var lastUniqueAsyncExpiration = NoWork;
 19523     try {
       
 19524       workLoop(isYieldy);
       
 19525     } catch (thrownValue) {
       
 19526       resetContextDependences();
       
 19527       resetHooks();
       
 19528 
       
 19529       // Reset in case completion throws.
       
 19530       // This is only used in DEV and when replaying is on.
       
 19531       var mayReplay = void 0;
       
 19532       if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19533         mayReplay = mayReplayFailedUnitOfWork;
       
 19534         mayReplayFailedUnitOfWork = true;
       
 19535       }
       
 19536 
       
 19537       if (nextUnitOfWork === null) {
       
 19538         // This is a fatal error.
       
 19539         didFatal = true;
       
 19540         onUncaughtError(thrownValue);
       
 19541       } else {
       
 19542         if (enableProfilerTimer && nextUnitOfWork.mode & ProfileMode) {
       
 19543           // Record the time spent rendering before an error was thrown.
       
 19544           // This avoids inaccurate Profiler durations in the case of a suspended render.
       
 19545           stopProfilerTimerIfRunningAndRecordDelta(nextUnitOfWork, true);
       
 19546         }
       
 19547 
       
 19548         {
       
 19549           // Reset global debug state
       
 19550           // We assume this is defined in DEV
       
 19551           resetCurrentlyProcessingQueue();
       
 19552         }
       
 19553 
       
 19554         if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19555           if (mayReplay) {
       
 19556             var failedUnitOfWork = nextUnitOfWork;
       
 19557             replayUnitOfWork(failedUnitOfWork, thrownValue, isYieldy);
       
 19558           }
       
 19559         }
       
 19560 
       
 19561         // TODO: we already know this isn't true in some cases.
       
 19562         // At least this shows a nicer error message until we figure out the cause.
       
 19563         // https://github.com/facebook/react/issues/12449#issuecomment-386727431
       
 19564         !(nextUnitOfWork !== null) ? invariant(false, 'Failed to replay rendering after an error. This is likely caused by a bug in React. Please file an issue with a reproducing case to help us find it.') : void 0;
       
 19565 
       
 19566         var sourceFiber = nextUnitOfWork;
       
 19567         var returnFiber = sourceFiber.return;
       
 19568         if (returnFiber === null) {
       
 19569           // This is the root. The root could capture its own errors. However,
       
 19570           // we don't know if it errors before or after we pushed the host
       
 19571           // context. This information is needed to avoid a stack mismatch.
       
 19572           // Because we're not sure, treat this as a fatal error. We could track
       
 19573           // which phase it fails in, but doesn't seem worth it. At least
       
 19574           // for now.
       
 19575           didFatal = true;
       
 19576           onUncaughtError(thrownValue);
       
 19577         } else {
       
 19578           throwException(root, returnFiber, sourceFiber, thrownValue, nextRenderExpirationTime);
       
 19579           nextUnitOfWork = completeUnitOfWork(sourceFiber);
       
 19580           continue;
       
 19581         }
       
 19582       }
       
 19583     }
       
 19584     break;
       
 19585   } while (true);
       
 19586 
       
 19587   if (enableSchedulerTracing) {
       
 19588     // Traced work is done for now; restore the previous interactions.
       
 19589     __interactionsRef.current = prevInteractions;
       
 19590   }
       
 19591 
       
 19592   // We're done performing work. Time to clean up.
       
 19593   isWorking = false;
       
 19594   ReactCurrentDispatcher.current = previousDispatcher;
       
 19595   resetContextDependences();
       
 19596   resetHooks();
       
 19597 
       
 19598   // Yield back to main thread.
       
 19599   if (didFatal) {
       
 19600     var _didCompleteRoot = false;
       
 19601     stopWorkLoopTimer(interruptedBy, _didCompleteRoot);
       
 19602     interruptedBy = null;
       
 19603     // There was a fatal error.
       
 19604     {
       
 19605       resetStackAfterFatalErrorInDev();
       
 19606     }
       
 19607     // `nextRoot` points to the in-progress root. A non-null value indicates
       
 19608     // that we're in the middle of an async render. Set it to null to indicate
       
 19609     // there's no more work to be done in the current batch.
       
 19610     nextRoot = null;
       
 19611     onFatal(root);
       
 19612     return;
       
 19613   }
       
 19614 
       
 19615   if (nextUnitOfWork !== null) {
       
 19616     // There's still remaining async work in this tree, but we ran out of time
       
 19617     // in the current frame. Yield back to the renderer. Unless we're
       
 19618     // interrupted by a higher priority update, we'll continue later from where
       
 19619     // we left off.
       
 19620     var _didCompleteRoot2 = false;
       
 19621     stopWorkLoopTimer(interruptedBy, _didCompleteRoot2);
       
 19622     interruptedBy = null;
       
 19623     onYield(root);
       
 19624     return;
       
 19625   }
       
 19626 
       
 19627   // We completed the whole tree.
       
 19628   var didCompleteRoot = true;
       
 19629   stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 19630   var rootWorkInProgress = root.current.alternate;
       
 19631   !(rootWorkInProgress !== null) ? invariant(false, 'Finished root should have a work-in-progress. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19632 
       
 19633   // `nextRoot` points to the in-progress root. A non-null value indicates
       
 19634   // that we're in the middle of an async render. Set it to null to indicate
       
 19635   // there's no more work to be done in the current batch.
       
 19636   nextRoot = null;
       
 19637   interruptedBy = null;
       
 19638 
       
 19639   if (nextRenderDidError) {
       
 19640     // There was an error
       
 19641     if (hasLowerPriorityWork(root, expirationTime)) {
       
 19642       // There's lower priority work. If so, it may have the effect of fixing
       
 19643       // the exception that was just thrown. Exit without committing. This is
       
 19644       // similar to a suspend, but without a timeout because we're not waiting
       
 19645       // for a promise to resolve. React will restart at the lower
       
 19646       // priority level.
       
 19647       markSuspendedPriorityLevel(root, expirationTime);
       
 19648       var suspendedExpirationTime = expirationTime;
       
 19649       var rootExpirationTime = root.expirationTime;
       
 19650       onSuspend(root, rootWorkInProgress, suspendedExpirationTime, rootExpirationTime, -1 // Indicates no timeout
       
 19651       );
       
 19652       return;
       
 19653     } else if (
       
 19654     // There's no lower priority work, but we're rendering asynchronously.
       
 19655     // Synchronously attempt to render the same level one more time. This is
       
 19656     // similar to a suspend, but without a timeout because we're not waiting
       
 19657     // for a promise to resolve.
       
 19658     !root.didError && isYieldy) {
       
 19659       root.didError = true;
       
 19660       var _suspendedExpirationTime = root.nextExpirationTimeToWorkOn = expirationTime;
       
 19661       var _rootExpirationTime = root.expirationTime = Sync;
       
 19662       onSuspend(root, rootWorkInProgress, _suspendedExpirationTime, _rootExpirationTime, -1 // Indicates no timeout
       
 19663       );
       
 19664       return;
       
 19665     }
       
 19666   }
       
 19667 
       
 19668   if (isYieldy && nextLatestAbsoluteTimeoutMs !== -1) {
       
 19669     // The tree was suspended.
       
 19670     var _suspendedExpirationTime2 = expirationTime;
       
 19671     markSuspendedPriorityLevel(root, _suspendedExpirationTime2);
       
 19672 
       
 19673     // Find the earliest uncommitted expiration time in the tree, including
       
 19674     // work that is suspended. The timeout threshold cannot be longer than
       
 19675     // the overall expiration.
       
 19676     var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, expirationTime);
       
 19677     var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
       
 19678     if (earliestExpirationTimeMs < nextLatestAbsoluteTimeoutMs) {
       
 19679       nextLatestAbsoluteTimeoutMs = earliestExpirationTimeMs;
       
 19680     }
       
 19681 
       
 19682     // Subtract the current time from the absolute timeout to get the number
       
 19683     // of milliseconds until the timeout. In other words, convert an absolute
       
 19684     // timestamp to a relative time. This is the value that is passed
       
 19685     // to `setTimeout`.
       
 19686     var currentTimeMs = expirationTimeToMs(requestCurrentTime());
       
 19687     var msUntilTimeout = nextLatestAbsoluteTimeoutMs - currentTimeMs;
       
 19688     msUntilTimeout = msUntilTimeout < 0 ? 0 : msUntilTimeout;
       
 19689 
       
 19690     // TODO: Account for the Just Noticeable Difference
       
 19691 
       
 19692     var _rootExpirationTime2 = root.expirationTime;
       
 19693     onSuspend(root, rootWorkInProgress, _suspendedExpirationTime2, _rootExpirationTime2, msUntilTimeout);
       
 19694     return;
       
 19695   }
       
 19696 
       
 19697   // Ready to commit.
       
 19698   onComplete(root, rootWorkInProgress, expirationTime);
       
 19699 }
       
 19700 
       
 19701 function captureCommitPhaseError(sourceFiber, value) {
       
 19702   var expirationTime = Sync;
       
 19703   var fiber = sourceFiber.return;
       
 19704   while (fiber !== null) {
       
 19705     switch (fiber.tag) {
       
 19706       case ClassComponent:
       
 19707         var ctor = fiber.type;
       
 19708         var instance = fiber.stateNode;
       
 19709         if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
       
 19710           var errorInfo = createCapturedValue(value, sourceFiber);
       
 19711           var update = createClassErrorUpdate(fiber, errorInfo, expirationTime);
       
 19712           enqueueUpdate(fiber, update);
       
 19713           scheduleWork(fiber, expirationTime);
       
 19714           return;
       
 19715         }
       
 19716         break;
       
 19717       case HostRoot:
       
 19718         {
       
 19719           var _errorInfo = createCapturedValue(value, sourceFiber);
       
 19720           var _update = createRootErrorUpdate(fiber, _errorInfo, expirationTime);
       
 19721           enqueueUpdate(fiber, _update);
       
 19722           scheduleWork(fiber, expirationTime);
       
 19723           return;
       
 19724         }
       
 19725     }
       
 19726     fiber = fiber.return;
       
 19727   }
       
 19728 
       
 19729   if (sourceFiber.tag === HostRoot) {
       
 19730     // Error was thrown at the root. There is no parent, so the root
       
 19731     // itself should capture it.
       
 19732     var rootFiber = sourceFiber;
       
 19733     var _errorInfo2 = createCapturedValue(value, rootFiber);
       
 19734     var _update2 = createRootErrorUpdate(rootFiber, _errorInfo2, expirationTime);
       
 19735     enqueueUpdate(rootFiber, _update2);
       
 19736     scheduleWork(rootFiber, expirationTime);
       
 19737   }
       
 19738 }
       
 19739 
       
 19740 function computeThreadID(expirationTime, interactionThreadID) {
       
 19741   // Interaction threads are unique per root and expiration time.
       
 19742   return expirationTime * 1000 + interactionThreadID;
       
 19743 }
       
 19744 
       
 19745 // Creates a unique async expiration time.
       
 19746 function computeUniqueAsyncExpiration() {
 21513 function computeUniqueAsyncExpiration() {
 19747   var currentTime = requestCurrentTime();
 21514   var currentTime = requestCurrentTime();
 19748   var result = computeAsyncExpiration(currentTime);
 21515   var result = computeAsyncExpiration(currentTime);
 19749   if (result >= lastUniqueAsyncExpiration) {
 21516   if (result <= lastUniqueAsyncExpiration) {
 19750     // Since we assume the current time monotonically increases, we only hit
 21517     // Since we assume the current time monotonically increases, we only hit
 19751     // this branch when computeUniqueAsyncExpiration is fired multiple times
 21518     // this branch when computeUniqueAsyncExpiration is fired multiple times
 19752     // within a 200ms window (or whatever the async bucket size is).
 21519     // within a 200ms window (or whatever the async bucket size is).
 19753     result = lastUniqueAsyncExpiration - 1;
 21520     result -= 1;
 19754   }
 21521   }
 19755   lastUniqueAsyncExpiration = result;
 21522   lastUniqueAsyncExpiration = result;
 19756   return lastUniqueAsyncExpiration;
 21523   return result;
 19757 }
 21524 }
 19758 
 21525 
 19759 function computeExpirationForFiber(currentTime, fiber) {
 21526 function scheduleUpdateOnFiber(fiber, expirationTime) {
 19760   var priorityLevel = unstable_getCurrentPriorityLevel();
 21527   checkForNestedUpdates();
 19761 
 21528   warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
 19762   var expirationTime = void 0;
 21529 
 19763   if ((fiber.mode & ConcurrentMode) === NoContext) {
 21530   var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime);
 19764     // Outside of concurrent mode, updates are always synchronous.
 21531   if (root === null) {
 19765     expirationTime = Sync;
 21532     warnAboutUpdateOnUnmountedFiberInDEV(fiber);
 19766   } else if (isWorking && !isCommitting$1) {
 21533     return;
 19767     // During render phase, updates expire during as the current render.
 21534   }
 19768     expirationTime = nextRenderExpirationTime;
 21535 
       
 21536   root.pingTime = NoWork;
       
 21537 
       
 21538   checkForInterruption(fiber, expirationTime);
       
 21539   recordScheduleUpdate();
       
 21540 
       
 21541   // TODO: computeExpirationForFiber also reads the priority. Pass the
       
 21542   // priority as an argument to that function and this one.
       
 21543   var priorityLevel = getCurrentPriorityLevel();
       
 21544 
       
 21545   if (expirationTime === Sync) {
       
 21546     if (
       
 21547     // Check if we're inside unbatchedUpdates
       
 21548     (executionContext & LegacyUnbatchedContext) !== NoContext &&
       
 21549     // Check if we're not already rendering
       
 21550     (executionContext & (RenderContext | CommitContext)) === NoContext) {
       
 21551       // Register pending interactions on the root to avoid losing traced interaction data.
       
 21552       schedulePendingInteractions(root, expirationTime);
       
 21553 
       
 21554       // This is a legacy edge case. The initial mount of a ReactDOM.render-ed
       
 21555       // root inside of batchedUpdates should be synchronous, but layout updates
       
 21556       // should be deferred until the end of the batch.
       
 21557       var callback = renderRoot(root, Sync, true);
       
 21558       while (callback !== null) {
       
 21559         callback = callback(true);
       
 21560       }
       
 21561     } else {
       
 21562       scheduleCallbackForRoot(root, ImmediatePriority, Sync);
       
 21563       if (executionContext === NoContext) {
       
 21564         // Flush the synchronous work now, wnless we're already working or inside
       
 21565         // a batch. This is intentionally inside scheduleUpdateOnFiber instead of
       
 21566         // scheduleCallbackForFiber to preserve the ability to schedule a callback
       
 21567         // without immediately flushing it. We only do this for user-initiated
       
 21568         // updates, to preserve historical behavior of sync mode.
       
 21569         flushSyncCallbackQueue();
       
 21570       }
       
 21571     }
 19769   } else {
 21572   } else {
 19770     switch (priorityLevel) {
 21573     scheduleCallbackForRoot(root, priorityLevel, expirationTime);
 19771       case unstable_ImmediatePriority:
 21574   }
 19772         expirationTime = Sync;
 21575 
 19773         break;
 21576   if ((executionContext & DiscreteEventContext) !== NoContext && (
 19774       case unstable_UserBlockingPriority:
 21577   // Only updates at user-blocking priority or greater are considered
 19775         expirationTime = computeInteractiveExpiration(currentTime);
 21578   // discrete, even inside a discrete event.
 19776         break;
 21579   priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority)) {
 19777       case unstable_NormalPriority:
 21580     // This is the result of a discrete event. Track the lowest priority
 19778         // This is a normal, concurrent update
 21581     // discrete update per root so we can flush them early, if needed.
 19779         expirationTime = computeAsyncExpiration(currentTime);
 21582     if (rootsWithPendingDiscreteUpdates === null) {
 19780         break;
 21583       rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]);
 19781       case unstable_LowPriority:
 21584     } else {
 19782       case unstable_IdlePriority:
 21585       var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root);
 19783         expirationTime = Never;
 21586       if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) {
 19784         break;
 21587         rootsWithPendingDiscreteUpdates.set(root, expirationTime);
 19785       default:
 21588       }
 19786         invariant(false, 'Unknown priority level. This error is likely caused by a bug in React. Please file an issue.');
 21589     }
 19787     }
 21590   }
 19788 
 21591 }
 19789     // If we're in the middle of rendering a tree, do not update at the same
 21592 var scheduleWork = scheduleUpdateOnFiber;
 19790     // expiration time that is already rendering.
 21593 
 19791     if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
 21594 // This is split into a separate function so we can mark a fiber with pending
 19792       expirationTime -= 1;
 21595 // work without treating it as a typical update that originates from an event;
 19793     }
 21596 // e.g. retrying a Suspense boundary isn't an update, but it does schedule work
 19794   }
 21597 // on a fiber.
 19795 
 21598 function markUpdateTimeFromFiberToRoot(fiber, expirationTime) {
 19796   // Keep track of the lowest pending interactive expiration time. This
       
 19797   // allows us to synchronously flush all interactive updates
       
 19798   // when needed.
       
 19799   // TODO: Move this to renderer?
       
 19800   if (priorityLevel === unstable_UserBlockingPriority && (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime)) {
       
 19801     lowestPriorityPendingInteractiveExpirationTime = expirationTime;
       
 19802   }
       
 19803 
       
 19804   return expirationTime;
       
 19805 }
       
 19806 
       
 19807 function renderDidSuspend(root, absoluteTimeoutMs, suspendedTime) {
       
 19808   // Schedule the timeout.
       
 19809   if (absoluteTimeoutMs >= 0 && nextLatestAbsoluteTimeoutMs < absoluteTimeoutMs) {
       
 19810     nextLatestAbsoluteTimeoutMs = absoluteTimeoutMs;
       
 19811   }
       
 19812 }
       
 19813 
       
 19814 function renderDidError() {
       
 19815   nextRenderDidError = true;
       
 19816 }
       
 19817 
       
 19818 function pingSuspendedRoot(root, thenable, pingTime) {
       
 19819   // A promise that previously suspended React from committing has resolved.
       
 19820   // If React is still suspended, try again at the previous level (pingTime).
       
 19821 
       
 19822   var pingCache = root.pingCache;
       
 19823   if (pingCache !== null) {
       
 19824     // The thenable resolved, so we no longer need to memoize, because it will
       
 19825     // never be thrown again.
       
 19826     pingCache.delete(thenable);
       
 19827   }
       
 19828 
       
 19829   if (nextRoot !== null && nextRenderExpirationTime === pingTime) {
       
 19830     // Received a ping at the same priority level at which we're currently
       
 19831     // rendering. Restart from the root.
       
 19832     nextRoot = null;
       
 19833   } else {
       
 19834     // Confirm that the root is still suspended at this level. Otherwise exit.
       
 19835     if (isPriorityLevelSuspended(root, pingTime)) {
       
 19836       // Ping at the original level
       
 19837       markPingedPriorityLevel(root, pingTime);
       
 19838       var rootExpirationTime = root.expirationTime;
       
 19839       if (rootExpirationTime !== NoWork) {
       
 19840         requestWork(root, rootExpirationTime);
       
 19841       }
       
 19842     }
       
 19843   }
       
 19844 }
       
 19845 
       
 19846 function retryTimedOutBoundary(boundaryFiber, thenable) {
       
 19847   // The boundary fiber (a Suspense component) previously timed out and was
       
 19848   // rendered in its fallback state. One of the promises that suspended it has
       
 19849   // resolved, which means at least part of the tree was likely unblocked. Try
       
 19850   var retryCache = void 0;
       
 19851   if (enableSuspenseServerRenderer) {
       
 19852     switch (boundaryFiber.tag) {
       
 19853       case SuspenseComponent:
       
 19854         retryCache = boundaryFiber.stateNode;
       
 19855         break;
       
 19856       case DehydratedSuspenseComponent:
       
 19857         retryCache = boundaryFiber.memoizedState;
       
 19858         break;
       
 19859       default:
       
 19860         invariant(false, 'Pinged unknown suspense boundary type. This is probably a bug in React.');
       
 19861     }
       
 19862   } else {
       
 19863     retryCache = boundaryFiber.stateNode;
       
 19864   }
       
 19865   if (retryCache !== null) {
       
 19866     // The thenable resolved, so we no longer need to memoize, because it will
       
 19867     // never be thrown again.
       
 19868     retryCache.delete(thenable);
       
 19869   }
       
 19870 
       
 19871   var currentTime = requestCurrentTime();
       
 19872   var retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
       
 19873   var root = scheduleWorkToRoot(boundaryFiber, retryTime);
       
 19874   if (root !== null) {
       
 19875     markPendingPriorityLevel(root, retryTime);
       
 19876     var rootExpirationTime = root.expirationTime;
       
 19877     if (rootExpirationTime !== NoWork) {
       
 19878       requestWork(root, rootExpirationTime);
       
 19879     }
       
 19880   }
       
 19881 }
       
 19882 
       
 19883 function scheduleWorkToRoot(fiber, expirationTime) {
       
 19884   recordScheduleUpdate();
       
 19885 
       
 19886   {
       
 19887     if (fiber.tag === ClassComponent) {
       
 19888       var instance = fiber.stateNode;
       
 19889       warnAboutInvalidUpdates(instance);
       
 19890     }
       
 19891   }
       
 19892 
       
 19893   // Update the source fiber's expiration time
 21599   // Update the source fiber's expiration time
 19894   if (fiber.expirationTime < expirationTime) {
 21600   if (fiber.expirationTime < expirationTime) {
 19895     fiber.expirationTime = expirationTime;
 21601     fiber.expirationTime = expirationTime;
 19896   }
 21602   }
 19897   var alternate = fiber.alternate;
 21603   var alternate = fiber.alternate;
 19920       }
 21626       }
 19921       node = node.return;
 21627       node = node.return;
 19922     }
 21628     }
 19923   }
 21629   }
 19924 
 21630 
 19925   if (enableSchedulerTracing) {
 21631   if (root !== null) {
 19926     if (root !== null) {
 21632     // Update the first and last pending expiration times in this root
 19927       var interactions = __interactionsRef.current;
 21633     var firstPendingTime = root.firstPendingTime;
 19928       if (interactions.size > 0) {
 21634     if (expirationTime > firstPendingTime) {
 19929         var pendingInteractionMap = root.pendingInteractionMap;
 21635       root.firstPendingTime = expirationTime;
 19930         var pendingInteractions = pendingInteractionMap.get(expirationTime);
 21636     }
 19931         if (pendingInteractions != null) {
 21637     var lastPendingTime = root.lastPendingTime;
 19932           interactions.forEach(function (interaction) {
 21638     if (lastPendingTime === NoWork || expirationTime < lastPendingTime) {
 19933             if (!pendingInteractions.has(interaction)) {
 21639       root.lastPendingTime = expirationTime;
 19934               // Update the pending async work count for previously unscheduled interaction.
 21640     }
 19935               interaction.__count++;
 21641   }
 19936             }
 21642 
 19937 
       
 19938             pendingInteractions.add(interaction);
       
 19939           });
       
 19940         } else {
       
 19941           pendingInteractionMap.set(expirationTime, new Set(interactions));
       
 19942 
       
 19943           // Update the pending async work count for the current interactions.
       
 19944           interactions.forEach(function (interaction) {
       
 19945             interaction.__count++;
       
 19946           });
       
 19947         }
       
 19948 
       
 19949         var subscriber = __subscriberRef.current;
       
 19950         if (subscriber !== null) {
       
 19951           var threadID = computeThreadID(expirationTime, root.interactionThreadID);
       
 19952           subscriber.onWorkScheduled(interactions, threadID);
       
 19953         }
       
 19954       }
       
 19955     }
       
 19956   }
       
 19957   return root;
 21643   return root;
 19958 }
 21644 }
 19959 
 21645 
 19960 function warnIfNotCurrentlyBatchingInDev(fiber) {
 21646 // Use this function, along with runRootCallback, to ensure that only a single
 19961   {
 21647 // callback per root is scheduled. It's still possible to call renderRoot
 19962     if (isRendering === false && isBatchingUpdates === false) {
 21648 // directly, but scheduling via this function helps avoid excessive callbacks.
 19963       warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see in the browser." + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
 21649 // It works by storing the callback node and expiration time on the root. When a
 19964     }
 21650 // new callback comes in, it compares the expiration time to determine if it
 19965   }
 21651 // should cancel the previous one. It also relies on commitRoot scheduling a
 19966 }
 21652 // callback to render the next level, because that means we don't need a
 19967 
 21653 // separate callback per expiration time.
 19968 function scheduleWork(fiber, expirationTime) {
 21654 function scheduleCallbackForRoot(root, priorityLevel, expirationTime) {
 19969   var root = scheduleWorkToRoot(fiber, expirationTime);
 21655   var existingCallbackExpirationTime = root.callbackExpirationTime;
 19970   if (root === null) {
 21656   if (existingCallbackExpirationTime < expirationTime) {
 19971     {
 21657     // New callback has higher priority than the existing one.
 19972       switch (fiber.tag) {
 21658     var existingCallbackNode = root.callbackNode;
 19973         case ClassComponent:
 21659     if (existingCallbackNode !== null) {
 19974           warnAboutUpdateOnUnmounted(fiber, true);
 21660       cancelCallback(existingCallbackNode);
 19975           break;
 21661     }
 19976         case FunctionComponent:
 21662     root.callbackExpirationTime = expirationTime;
 19977         case ForwardRef:
 21663 
 19978         case MemoComponent:
 21664     if (expirationTime === Sync) {
 19979         case SimpleMemoComponent:
 21665       // Sync React callbacks are scheduled on a special internal queue
 19980           warnAboutUpdateOnUnmounted(fiber, false);
 21666       root.callbackNode = scheduleSyncCallback(runRootCallback.bind(null, root, renderRoot.bind(null, root, expirationTime)));
 19981           break;
 21667     } else {
 19982       }
 21668       var options = null;
 19983     }
 21669       if (!disableSchedulerTimeoutBasedOnReactExpirationTime && expirationTime !== Never) {
       
 21670         var timeout = expirationTimeToMs(expirationTime) - now();
       
 21671         options = { timeout: timeout };
       
 21672       }
       
 21673 
       
 21674       root.callbackNode = scheduleCallback(priorityLevel, runRootCallback.bind(null, root, renderRoot.bind(null, root, expirationTime)), options);
       
 21675       if (enableUserTimingAPI && expirationTime !== Sync && (executionContext & (RenderContext | CommitContext)) === NoContext) {
       
 21676         // Scheduled an async callback, and we're not already working. Add an
       
 21677         // entry to the flamegraph that shows we're waiting for a callback
       
 21678         // to fire.
       
 21679         startRequestCallbackTimer();
       
 21680       }
       
 21681     }
       
 21682   }
       
 21683 
       
 21684   // Associate the current interactions with this new root+priority.
       
 21685   schedulePendingInteractions(root, expirationTime);
       
 21686 }
       
 21687 
       
 21688 function runRootCallback(root, callback, isSync) {
       
 21689   var prevCallbackNode = root.callbackNode;
       
 21690   var continuation = null;
       
 21691   try {
       
 21692     continuation = callback(isSync);
       
 21693     if (continuation !== null) {
       
 21694       return runRootCallback.bind(null, root, continuation);
       
 21695     } else {
       
 21696       return null;
       
 21697     }
       
 21698   } finally {
       
 21699     // If the callback exits without returning a continuation, remove the
       
 21700     // corresponding callback node from the root. Unless the callback node
       
 21701     // has changed, which implies that it was already cancelled by a high
       
 21702     // priority update.
       
 21703     if (continuation === null && prevCallbackNode === root.callbackNode) {
       
 21704       root.callbackNode = null;
       
 21705       root.callbackExpirationTime = NoWork;
       
 21706     }
       
 21707   }
       
 21708 }
       
 21709 
       
 21710 function flushRoot(root, expirationTime) {
       
 21711   if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
       
 21712     (function () {
       
 21713       {
       
 21714         {
       
 21715           throw ReactError(Error('work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.'));
       
 21716         }
       
 21717       }
       
 21718     })();
       
 21719   }
       
 21720   scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
       
 21721   flushSyncCallbackQueue();
       
 21722 }
       
 21723 
       
 21724 function flushDiscreteUpdates() {
       
 21725   // TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
       
 21726   // However, `act` uses `batchedUpdates`, so there's no way to distinguish
       
 21727   // those two cases. Need to fix this before exposing flushDiscreteUpdates
       
 21728   // as a public API.
       
 21729   if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
       
 21730     if (true && (executionContext & RenderContext) !== NoContext) {
       
 21731       warning$1(false, 'unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
       
 21732     }
       
 21733     // We're already rendering, so we can't synchronously flush pending work.
       
 21734     // This is probably a nested event dispatch triggered by a lifecycle/effect,
       
 21735     // like `el.focus()`. Exit.
 19984     return;
 21736     return;
 19985   }
 21737   }
 19986 
 21738   flushPendingDiscreteUpdates();
 19987   if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime > nextRenderExpirationTime) {
 21739   if (!revertPassiveEffectsChange) {
 19988     // This is an interruption. (Used for performance tracking.)
 21740     // If the discrete updates scheduled passive effects, flush them now so that
 19989     interruptedBy = fiber;
 21741     // they fire before the next serial event.
 19990     resetStack();
 21742     flushPassiveEffects();
 19991   }
 21743   }
 19992   markPendingPriorityLevel(root, expirationTime);
 21744 }
 19993   if (
 21745 
 19994   // If we're in the render phase, we don't need to schedule this root
 21746 function resolveLocksOnRoot(root, expirationTime) {
 19995   // for an update, because we'll do it before we exit...
 21747   var firstBatch = root.firstBatch;
 19996   !isWorking || isCommitting$1 ||
 21748   if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
 19997   // ...unless this is a different root than the one we're rendering.
 21749     scheduleCallback(NormalPriority, function () {
 19998   nextRoot !== root) {
 21750       firstBatch._onComplete();
 19999     var rootExpirationTime = root.expirationTime;
 21751       return null;
 20000     requestWork(root, rootExpirationTime);
 21752     });
 20001   }
 21753     return true;
 20002   if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
       
 20003     // Reset this back to zero so subsequent updates don't throw.
       
 20004     nestedUpdateCount = 0;
       
 20005     invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
       
 20006   }
       
 20007 }
       
 20008 
       
 20009 function syncUpdates(fn, a, b, c, d) {
       
 20010   return unstable_runWithPriority(unstable_ImmediatePriority, function () {
       
 20011     return fn(a, b, c, d);
       
 20012   });
       
 20013 }
       
 20014 
       
 20015 // TODO: Everything below this is written as if it has been lifted to the
       
 20016 // renderers. I'll do this in a follow-up.
       
 20017 
       
 20018 // Linked-list of roots
       
 20019 var firstScheduledRoot = null;
       
 20020 var lastScheduledRoot = null;
       
 20021 
       
 20022 var callbackExpirationTime = NoWork;
       
 20023 var callbackID = void 0;
       
 20024 var isRendering = false;
       
 20025 var nextFlushedRoot = null;
       
 20026 var nextFlushedExpirationTime = NoWork;
       
 20027 var lowestPriorityPendingInteractiveExpirationTime = NoWork;
       
 20028 var hasUnhandledError = false;
       
 20029 var unhandledError = null;
       
 20030 
       
 20031 var isBatchingUpdates = false;
       
 20032 var isUnbatchingUpdates = false;
       
 20033 
       
 20034 var completedBatches = null;
       
 20035 
       
 20036 var originalStartTimeMs = unstable_now();
       
 20037 var currentRendererTime = msToExpirationTime(originalStartTimeMs);
       
 20038 var currentSchedulerTime = currentRendererTime;
       
 20039 
       
 20040 // Use these to prevent an infinite loop of nested updates
       
 20041 var NESTED_UPDATE_LIMIT = 50;
       
 20042 var nestedUpdateCount = 0;
       
 20043 var lastCommittedRootDuringThisBatch = null;
       
 20044 
       
 20045 function recomputeCurrentRendererTime() {
       
 20046   var currentTimeMs = unstable_now() - originalStartTimeMs;
       
 20047   currentRendererTime = msToExpirationTime(currentTimeMs);
       
 20048 }
       
 20049 
       
 20050 function scheduleCallbackWithExpirationTime(root, expirationTime) {
       
 20051   if (callbackExpirationTime !== NoWork) {
       
 20052     // A callback is already scheduled. Check its expiration time (timeout).
       
 20053     if (expirationTime < callbackExpirationTime) {
       
 20054       // Existing callback has sufficient timeout. Exit.
       
 20055       return;
       
 20056     } else {
       
 20057       if (callbackID !== null) {
       
 20058         // Existing callback has insufficient timeout. Cancel and schedule a
       
 20059         // new one.
       
 20060         unstable_cancelCallback(callbackID);
       
 20061       }
       
 20062     }
       
 20063     // The request callback timer is already running. Don't start a new one.
       
 20064   } else {
 21754   } else {
 20065     startRequestCallbackTimer();
 21755     return false;
 20066   }
 21756   }
 20067 
 21757 }
 20068   callbackExpirationTime = expirationTime;
 21758 
 20069   var currentMs = unstable_now() - originalStartTimeMs;
 21759 
 20070   var expirationTimeMs = expirationTimeToMs(expirationTime);
 21760 
 20071   var timeout = expirationTimeMs - currentMs;
 21761 
 20072   callbackID = unstable_scheduleCallback(performAsyncWork, { timeout: timeout });
 21762 
 20073 }
 21763 function flushPendingDiscreteUpdates() {
 20074 
 21764   if (rootsWithPendingDiscreteUpdates !== null) {
 20075 // For every call to renderRoot, one of onFatal, onComplete, onSuspend, and
 21765     // For each root with pending discrete updates, schedule a callback to
 20076 // onYield is called upon exiting. We use these in lieu of returning a tuple.
 21766     // immediately flush them.
 20077 // I've also chosen not to inline them into renderRoot because these will
 21767     var roots = rootsWithPendingDiscreteUpdates;
 20078 // eventually be lifted into the renderer.
 21768     rootsWithPendingDiscreteUpdates = null;
 20079 function onFatal(root) {
 21769     roots.forEach(function (expirationTime, root) {
 20080   root.finishedWork = null;
 21770       scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
 20081 }
 21771     });
 20082 
 21772     // Now flush the immediate queue.
 20083 function onComplete(root, finishedWork, expirationTime) {
 21773     flushSyncCallbackQueue();
 20084   root.pendingCommitExpirationTime = expirationTime;
 21774   }
 20085   root.finishedWork = finishedWork;
 21775 }
 20086 }
 21776 
 20087 
       
 20088 function onSuspend(root, finishedWork, suspendedExpirationTime, rootExpirationTime, msUntilTimeout) {
       
 20089   root.expirationTime = rootExpirationTime;
       
 20090   if (msUntilTimeout === 0 && !shouldYieldToRenderer()) {
       
 20091     // Don't wait an additional tick. Commit the tree immediately.
       
 20092     root.pendingCommitExpirationTime = suspendedExpirationTime;
       
 20093     root.finishedWork = finishedWork;
       
 20094   } else if (msUntilTimeout > 0) {
       
 20095     // Wait `msUntilTimeout` milliseconds before committing.
       
 20096     root.timeoutHandle = scheduleTimeout(onTimeout.bind(null, root, finishedWork, suspendedExpirationTime), msUntilTimeout);
       
 20097   }
       
 20098 }
       
 20099 
       
 20100 function onYield(root) {
       
 20101   root.finishedWork = null;
       
 20102 }
       
 20103 
       
 20104 function onTimeout(root, finishedWork, suspendedExpirationTime) {
       
 20105   // The root timed out. Commit it.
       
 20106   root.pendingCommitExpirationTime = suspendedExpirationTime;
       
 20107   root.finishedWork = finishedWork;
       
 20108   // Read the current time before entering the commit phase. We can be
       
 20109   // certain this won't cause tearing related to batching of event updates
       
 20110   // because we're at the top of a timer event.
       
 20111   recomputeCurrentRendererTime();
       
 20112   currentSchedulerTime = currentRendererTime;
       
 20113   flushRoot(root, suspendedExpirationTime);
       
 20114 }
       
 20115 
       
 20116 function onCommit(root, expirationTime) {
       
 20117   root.expirationTime = expirationTime;
       
 20118   root.finishedWork = null;
       
 20119 }
       
 20120 
       
 20121 function requestCurrentTime() {
       
 20122   // requestCurrentTime is called by the scheduler to compute an expiration
       
 20123   // time.
       
 20124   //
       
 20125   // Expiration times are computed by adding to the current time (the start
       
 20126   // time). However, if two updates are scheduled within the same event, we
       
 20127   // should treat their start times as simultaneous, even if the actual clock
       
 20128   // time has advanced between the first and second call.
       
 20129 
       
 20130   // In other words, because expiration times determine how updates are batched,
       
 20131   // we want all updates of like priority that occur within the same event to
       
 20132   // receive the same expiration time. Otherwise we get tearing.
       
 20133   //
       
 20134   // We keep track of two separate times: the current "renderer" time and the
       
 20135   // current "scheduler" time. The renderer time can be updated whenever; it
       
 20136   // only exists to minimize the calls performance.now.
       
 20137   //
       
 20138   // But the scheduler time can only be updated if there's no pending work, or
       
 20139   // if we know for certain that we're not in the middle of an event.
       
 20140 
       
 20141   if (isRendering) {
       
 20142     // We're already rendering. Return the most recently read time.
       
 20143     return currentSchedulerTime;
       
 20144   }
       
 20145   // Check if there's pending work.
       
 20146   findHighestPriorityRoot();
       
 20147   if (nextFlushedExpirationTime === NoWork || nextFlushedExpirationTime === Never) {
       
 20148     // If there's no pending work, or if the pending work is offscreen, we can
       
 20149     // read the current time without risk of tearing.
       
 20150     recomputeCurrentRendererTime();
       
 20151     currentSchedulerTime = currentRendererTime;
       
 20152     return currentSchedulerTime;
       
 20153   }
       
 20154   // There's already pending work. We might be in the middle of a browser
       
 20155   // event. If we were to read the current time, it could cause multiple updates
       
 20156   // within the same event to receive different expiration times, leading to
       
 20157   // tearing. Return the last read time. During the next idle callback, the
       
 20158   // time will be updated.
       
 20159   return currentSchedulerTime;
       
 20160 }
       
 20161 
       
 20162 // requestWork is called by the scheduler whenever a root receives an update.
       
 20163 // It's up to the renderer to call renderRoot at some point in the future.
       
 20164 function requestWork(root, expirationTime) {
       
 20165   addRootToSchedule(root, expirationTime);
       
 20166   if (isRendering) {
       
 20167     // Prevent reentrancy. Remaining work will be scheduled at the end of
       
 20168     // the currently rendering batch.
       
 20169     return;
       
 20170   }
       
 20171 
       
 20172   if (isBatchingUpdates) {
       
 20173     // Flush work at the end of the batch.
       
 20174     if (isUnbatchingUpdates) {
       
 20175       // ...unless we're inside unbatchedUpdates, in which case we should
       
 20176       // flush it now.
       
 20177       nextFlushedRoot = root;
       
 20178       nextFlushedExpirationTime = Sync;
       
 20179       performWorkOnRoot(root, Sync, false);
       
 20180     }
       
 20181     return;
       
 20182   }
       
 20183 
       
 20184   // TODO: Get rid of Sync and use current time?
       
 20185   if (expirationTime === Sync) {
       
 20186     performSyncWork();
       
 20187   } else {
       
 20188     scheduleCallbackWithExpirationTime(root, expirationTime);
       
 20189   }
       
 20190 }
       
 20191 
       
 20192 function addRootToSchedule(root, expirationTime) {
       
 20193   // Add the root to the schedule.
       
 20194   // Check if this root is already part of the schedule.
       
 20195   if (root.nextScheduledRoot === null) {
       
 20196     // This root is not already scheduled. Add it.
       
 20197     root.expirationTime = expirationTime;
       
 20198     if (lastScheduledRoot === null) {
       
 20199       firstScheduledRoot = lastScheduledRoot = root;
       
 20200       root.nextScheduledRoot = root;
       
 20201     } else {
       
 20202       lastScheduledRoot.nextScheduledRoot = root;
       
 20203       lastScheduledRoot = root;
       
 20204       lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
       
 20205     }
       
 20206   } else {
       
 20207     // This root is already scheduled, but its priority may have increased.
       
 20208     var remainingExpirationTime = root.expirationTime;
       
 20209     if (expirationTime > remainingExpirationTime) {
       
 20210       // Update the priority.
       
 20211       root.expirationTime = expirationTime;
       
 20212     }
       
 20213   }
       
 20214 }
       
 20215 
       
 20216 function findHighestPriorityRoot() {
       
 20217   var highestPriorityWork = NoWork;
       
 20218   var highestPriorityRoot = null;
       
 20219   if (lastScheduledRoot !== null) {
       
 20220     var previousScheduledRoot = lastScheduledRoot;
       
 20221     var root = firstScheduledRoot;
       
 20222     while (root !== null) {
       
 20223       var remainingExpirationTime = root.expirationTime;
       
 20224       if (remainingExpirationTime === NoWork) {
       
 20225         // This root no longer has work. Remove it from the scheduler.
       
 20226 
       
 20227         // TODO: This check is redudant, but Flow is confused by the branch
       
 20228         // below where we set lastScheduledRoot to null, even though we break
       
 20229         // from the loop right after.
       
 20230         !(previousScheduledRoot !== null && lastScheduledRoot !== null) ? invariant(false, 'Should have a previous and last root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 20231         if (root === root.nextScheduledRoot) {
       
 20232           // This is the only root in the list.
       
 20233           root.nextScheduledRoot = null;
       
 20234           firstScheduledRoot = lastScheduledRoot = null;
       
 20235           break;
       
 20236         } else if (root === firstScheduledRoot) {
       
 20237           // This is the first root in the list.
       
 20238           var next = root.nextScheduledRoot;
       
 20239           firstScheduledRoot = next;
       
 20240           lastScheduledRoot.nextScheduledRoot = next;
       
 20241           root.nextScheduledRoot = null;
       
 20242         } else if (root === lastScheduledRoot) {
       
 20243           // This is the last root in the list.
       
 20244           lastScheduledRoot = previousScheduledRoot;
       
 20245           lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
       
 20246           root.nextScheduledRoot = null;
       
 20247           break;
       
 20248         } else {
       
 20249           previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot;
       
 20250           root.nextScheduledRoot = null;
       
 20251         }
       
 20252         root = previousScheduledRoot.nextScheduledRoot;
       
 20253       } else {
       
 20254         if (remainingExpirationTime > highestPriorityWork) {
       
 20255           // Update the priority, if it's higher
       
 20256           highestPriorityWork = remainingExpirationTime;
       
 20257           highestPriorityRoot = root;
       
 20258         }
       
 20259         if (root === lastScheduledRoot) {
       
 20260           break;
       
 20261         }
       
 20262         if (highestPriorityWork === Sync) {
       
 20263           // Sync is highest priority by definition so
       
 20264           // we can stop searching.
       
 20265           break;
       
 20266         }
       
 20267         previousScheduledRoot = root;
       
 20268         root = root.nextScheduledRoot;
       
 20269       }
       
 20270     }
       
 20271   }
       
 20272 
       
 20273   nextFlushedRoot = highestPriorityRoot;
       
 20274   nextFlushedExpirationTime = highestPriorityWork;
       
 20275 }
       
 20276 
       
 20277 // TODO: This wrapper exists because many of the older tests (the ones that use
       
 20278 // flushDeferredPri) rely on the number of times `shouldYield` is called. We
       
 20279 // should get rid of it.
       
 20280 var didYield = false;
       
 20281 function shouldYieldToRenderer() {
       
 20282   if (didYield) {
       
 20283     return true;
       
 20284   }
       
 20285   if (unstable_shouldYield()) {
       
 20286     didYield = true;
       
 20287     return true;
       
 20288   }
       
 20289   return false;
       
 20290 }
       
 20291 
       
 20292 function performAsyncWork() {
       
 20293   try {
       
 20294     if (!shouldYieldToRenderer()) {
       
 20295       // The callback timed out. That means at least one update has expired.
       
 20296       // Iterate through the root schedule. If they contain expired work, set
       
 20297       // the next render expiration time to the current time. This has the effect
       
 20298       // of flushing all expired work in a single batch, instead of flushing each
       
 20299       // level one at a time.
       
 20300       if (firstScheduledRoot !== null) {
       
 20301         recomputeCurrentRendererTime();
       
 20302         var root = firstScheduledRoot;
       
 20303         do {
       
 20304           didExpireAtExpirationTime(root, currentRendererTime);
       
 20305           // The root schedule is circular, so this is never null.
       
 20306           root = root.nextScheduledRoot;
       
 20307         } while (root !== firstScheduledRoot);
       
 20308       }
       
 20309     }
       
 20310     performWork(NoWork, true);
       
 20311   } finally {
       
 20312     didYield = false;
       
 20313   }
       
 20314 }
       
 20315 
       
 20316 function performSyncWork() {
       
 20317   performWork(Sync, false);
       
 20318 }
       
 20319 
       
 20320 function performWork(minExpirationTime, isYieldy) {
       
 20321   // Keep working on roots until there's no more work, or until there's a higher
       
 20322   // priority event.
       
 20323   findHighestPriorityRoot();
       
 20324 
       
 20325   if (isYieldy) {
       
 20326     recomputeCurrentRendererTime();
       
 20327     currentSchedulerTime = currentRendererTime;
       
 20328 
       
 20329     if (enableUserTimingAPI) {
       
 20330       var didExpire = nextFlushedExpirationTime > currentRendererTime;
       
 20331       var timeout = expirationTimeToMs(nextFlushedExpirationTime);
       
 20332       stopRequestCallbackTimer(didExpire, timeout);
       
 20333     }
       
 20334 
       
 20335     while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && minExpirationTime <= nextFlushedExpirationTime && !(didYield && currentRendererTime > nextFlushedExpirationTime)) {
       
 20336       performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, currentRendererTime > nextFlushedExpirationTime);
       
 20337       findHighestPriorityRoot();
       
 20338       recomputeCurrentRendererTime();
       
 20339       currentSchedulerTime = currentRendererTime;
       
 20340     }
       
 20341   } else {
       
 20342     while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && minExpirationTime <= nextFlushedExpirationTime) {
       
 20343       performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
       
 20344       findHighestPriorityRoot();
       
 20345     }
       
 20346   }
       
 20347 
       
 20348   // We're done flushing work. Either we ran out of time in this callback,
       
 20349   // or there's no more work left with sufficient priority.
       
 20350 
       
 20351   // If we're inside a callback, set this to false since we just completed it.
       
 20352   if (isYieldy) {
       
 20353     callbackExpirationTime = NoWork;
       
 20354     callbackID = null;
       
 20355   }
       
 20356   // If there's work left over, schedule a new callback.
       
 20357   if (nextFlushedExpirationTime !== NoWork) {
       
 20358     scheduleCallbackWithExpirationTime(nextFlushedRoot, nextFlushedExpirationTime);
       
 20359   }
       
 20360 
       
 20361   // Clean-up.
       
 20362   finishRendering();
       
 20363 }
       
 20364 
       
 20365 function flushRoot(root, expirationTime) {
       
 20366   !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0;
       
 20367   // Perform work on root as if the given expiration time is the current time.
       
 20368   // This has the effect of synchronously flushing all work up to and
       
 20369   // including the given time.
       
 20370   nextFlushedRoot = root;
       
 20371   nextFlushedExpirationTime = expirationTime;
       
 20372   performWorkOnRoot(root, expirationTime, false);
       
 20373   // Flush any sync work that was scheduled by lifecycles
       
 20374   performSyncWork();
       
 20375 }
       
 20376 
       
 20377 function finishRendering() {
       
 20378   nestedUpdateCount = 0;
       
 20379   lastCommittedRootDuringThisBatch = null;
       
 20380 
       
 20381   if (completedBatches !== null) {
       
 20382     var batches = completedBatches;
       
 20383     completedBatches = null;
       
 20384     for (var i = 0; i < batches.length; i++) {
       
 20385       var batch = batches[i];
       
 20386       try {
       
 20387         batch._onComplete();
       
 20388       } catch (error) {
       
 20389         if (!hasUnhandledError) {
       
 20390           hasUnhandledError = true;
       
 20391           unhandledError = error;
       
 20392         }
       
 20393       }
       
 20394     }
       
 20395   }
       
 20396 
       
 20397   if (hasUnhandledError) {
       
 20398     var error = unhandledError;
       
 20399     unhandledError = null;
       
 20400     hasUnhandledError = false;
       
 20401     throw error;
       
 20402   }
       
 20403 }
       
 20404 
       
 20405 function performWorkOnRoot(root, expirationTime, isYieldy) {
       
 20406   !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 20407 
       
 20408   isRendering = true;
       
 20409 
       
 20410   // Check if this is async work or sync/expired work.
       
 20411   if (!isYieldy) {
       
 20412     // Flush work without yielding.
       
 20413     // TODO: Non-yieldy work does not necessarily imply expired work. A renderer
       
 20414     // may want to perform some work without yielding, but also without
       
 20415     // requiring the root to complete (by triggering placeholders).
       
 20416 
       
 20417     var finishedWork = root.finishedWork;
       
 20418     if (finishedWork !== null) {
       
 20419       // This root is already complete. We can commit it.
       
 20420       completeRoot(root, finishedWork, expirationTime);
       
 20421     } else {
       
 20422       root.finishedWork = null;
       
 20423       // If this root previously suspended, clear its existing timeout, since
       
 20424       // we're about to try rendering again.
       
 20425       var timeoutHandle = root.timeoutHandle;
       
 20426       if (timeoutHandle !== noTimeout) {
       
 20427         root.timeoutHandle = noTimeout;
       
 20428         // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
       
 20429         cancelTimeout(timeoutHandle);
       
 20430       }
       
 20431       renderRoot(root, isYieldy);
       
 20432       finishedWork = root.finishedWork;
       
 20433       if (finishedWork !== null) {
       
 20434         // We've completed the root. Commit it.
       
 20435         completeRoot(root, finishedWork, expirationTime);
       
 20436       }
       
 20437     }
       
 20438   } else {
       
 20439     // Flush async work.
       
 20440     var _finishedWork = root.finishedWork;
       
 20441     if (_finishedWork !== null) {
       
 20442       // This root is already complete. We can commit it.
       
 20443       completeRoot(root, _finishedWork, expirationTime);
       
 20444     } else {
       
 20445       root.finishedWork = null;
       
 20446       // If this root previously suspended, clear its existing timeout, since
       
 20447       // we're about to try rendering again.
       
 20448       var _timeoutHandle = root.timeoutHandle;
       
 20449       if (_timeoutHandle !== noTimeout) {
       
 20450         root.timeoutHandle = noTimeout;
       
 20451         // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
       
 20452         cancelTimeout(_timeoutHandle);
       
 20453       }
       
 20454       renderRoot(root, isYieldy);
       
 20455       _finishedWork = root.finishedWork;
       
 20456       if (_finishedWork !== null) {
       
 20457         // We've completed the root. Check the if we should yield one more time
       
 20458         // before committing.
       
 20459         if (!shouldYieldToRenderer()) {
       
 20460           // Still time left. Commit the root.
       
 20461           completeRoot(root, _finishedWork, expirationTime);
       
 20462         } else {
       
 20463           // There's no time left. Mark this root as complete. We'll come
       
 20464           // back and commit it later.
       
 20465           root.finishedWork = _finishedWork;
       
 20466         }
       
 20467       }
       
 20468     }
       
 20469   }
       
 20470 
       
 20471   isRendering = false;
       
 20472 }
       
 20473 
       
 20474 function completeRoot(root, finishedWork, expirationTime) {
       
 20475   // Check if there's a batch that matches this expiration time.
       
 20476   var firstBatch = root.firstBatch;
       
 20477   if (firstBatch !== null && firstBatch._expirationTime >= expirationTime) {
       
 20478     if (completedBatches === null) {
       
 20479       completedBatches = [firstBatch];
       
 20480     } else {
       
 20481       completedBatches.push(firstBatch);
       
 20482     }
       
 20483     if (firstBatch._defer) {
       
 20484       // This root is blocked from committing by a batch. Unschedule it until
       
 20485       // we receive another update.
       
 20486       root.finishedWork = finishedWork;
       
 20487       root.expirationTime = NoWork;
       
 20488       return;
       
 20489     }
       
 20490   }
       
 20491 
       
 20492   // Commit the root.
       
 20493   root.finishedWork = null;
       
 20494 
       
 20495   // Check if this is a nested update (a sync update scheduled during the
       
 20496   // commit phase).
       
 20497   if (root === lastCommittedRootDuringThisBatch) {
       
 20498     // If the next root is the same as the previous root, this is a nested
       
 20499     // update. To prevent an infinite loop, increment the nested update count.
       
 20500     nestedUpdateCount++;
       
 20501   } else {
       
 20502     // Reset whenever we switch roots.
       
 20503     lastCommittedRootDuringThisBatch = root;
       
 20504     nestedUpdateCount = 0;
       
 20505   }
       
 20506   unstable_runWithPriority(unstable_ImmediatePriority, function () {
       
 20507     commitRoot(root, finishedWork);
       
 20508   });
       
 20509 }
       
 20510 
       
 20511 function onUncaughtError(error) {
       
 20512   !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 20513   // Unschedule this root so we don't work on it again until there's
       
 20514   // another update.
       
 20515   nextFlushedRoot.expirationTime = NoWork;
       
 20516   if (!hasUnhandledError) {
       
 20517     hasUnhandledError = true;
       
 20518     unhandledError = error;
       
 20519   }
       
 20520 }
       
 20521 
       
 20522 // TODO: Batching should be implemented at the renderer level, not inside
       
 20523 // the reconciler.
       
 20524 function batchedUpdates$1(fn, a) {
 21777 function batchedUpdates$1(fn, a) {
 20525   var previousIsBatchingUpdates = isBatchingUpdates;
 21778   var prevExecutionContext = executionContext;
 20526   isBatchingUpdates = true;
 21779   executionContext |= BatchedContext;
 20527   try {
 21780   try {
 20528     return fn(a);
 21781     return fn(a);
 20529   } finally {
 21782   } finally {
 20530     isBatchingUpdates = previousIsBatchingUpdates;
 21783     executionContext = prevExecutionContext;
 20531     if (!isBatchingUpdates && !isRendering) {
 21784     if (executionContext === NoContext) {
 20532       performSyncWork();
 21785       // Flush the immediate callbacks that were scheduled during this batch
 20533     }
 21786       flushSyncCallbackQueue();
 20534   }
 21787     }
 20535 }
 21788   }
 20536 
 21789 }
 20537 // TODO: Batching should be implemented at the renderer level, not inside
 21790 
 20538 // the reconciler.
 21791 function batchedEventUpdates$1(fn, a) {
       
 21792   var prevExecutionContext = executionContext;
       
 21793   executionContext |= EventContext;
       
 21794   try {
       
 21795     return fn(a);
       
 21796   } finally {
       
 21797     executionContext = prevExecutionContext;
       
 21798     if (executionContext === NoContext) {
       
 21799       // Flush the immediate callbacks that were scheduled during this batch
       
 21800       flushSyncCallbackQueue();
       
 21801     }
       
 21802   }
       
 21803 }
       
 21804 
       
 21805 function discreteUpdates$1(fn, a, b, c) {
       
 21806   var prevExecutionContext = executionContext;
       
 21807   executionContext |= DiscreteEventContext;
       
 21808   try {
       
 21809     // Should this
       
 21810     return runWithPriority$2(UserBlockingPriority$2, fn.bind(null, a, b, c));
       
 21811   } finally {
       
 21812     executionContext = prevExecutionContext;
       
 21813     if (executionContext === NoContext) {
       
 21814       // Flush the immediate callbacks that were scheduled during this batch
       
 21815       flushSyncCallbackQueue();
       
 21816     }
       
 21817   }
       
 21818 }
       
 21819 
 20539 function unbatchedUpdates(fn, a) {
 21820 function unbatchedUpdates(fn, a) {
 20540   if (isBatchingUpdates && !isUnbatchingUpdates) {
 21821   var prevExecutionContext = executionContext;
 20541     isUnbatchingUpdates = true;
 21822   executionContext &= ~BatchedContext;
       
 21823   executionContext |= LegacyUnbatchedContext;
       
 21824   try {
       
 21825     return fn(a);
       
 21826   } finally {
       
 21827     executionContext = prevExecutionContext;
       
 21828     if (executionContext === NoContext) {
       
 21829       // Flush the immediate callbacks that were scheduled during this batch
       
 21830       flushSyncCallbackQueue();
       
 21831     }
       
 21832   }
       
 21833 }
       
 21834 
       
 21835 function flushSync(fn, a) {
       
 21836   if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
       
 21837     (function () {
       
 21838       {
       
 21839         {
       
 21840           throw ReactError(Error('flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.'));
       
 21841         }
       
 21842       }
       
 21843     })();
       
 21844   }
       
 21845   var prevExecutionContext = executionContext;
       
 21846   executionContext |= BatchedContext;
       
 21847   try {
       
 21848     return runWithPriority$2(ImmediatePriority, fn.bind(null, a));
       
 21849   } finally {
       
 21850     executionContext = prevExecutionContext;
       
 21851     // Flush the immediate callbacks that were scheduled during this batch.
       
 21852     // Note that this will happen even if batchedUpdates is higher up
       
 21853     // the stack.
       
 21854     flushSyncCallbackQueue();
       
 21855   }
       
 21856 }
       
 21857 
       
 21858 function flushControlled(fn) {
       
 21859   var prevExecutionContext = executionContext;
       
 21860   executionContext |= BatchedContext;
       
 21861   try {
       
 21862     runWithPriority$2(ImmediatePriority, fn);
       
 21863   } finally {
       
 21864     executionContext = prevExecutionContext;
       
 21865     if (executionContext === NoContext) {
       
 21866       // Flush the immediate callbacks that were scheduled during this batch
       
 21867       flushSyncCallbackQueue();
       
 21868     }
       
 21869   }
       
 21870 }
       
 21871 
       
 21872 function prepareFreshStack(root, expirationTime) {
       
 21873   root.finishedWork = null;
       
 21874   root.finishedExpirationTime = NoWork;
       
 21875 
       
 21876   var timeoutHandle = root.timeoutHandle;
       
 21877   if (timeoutHandle !== noTimeout) {
       
 21878     // The root previous suspended and scheduled a timeout to commit a fallback
       
 21879     // state. Now that we have additional work, cancel the timeout.
       
 21880     root.timeoutHandle = noTimeout;
       
 21881     // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
       
 21882     cancelTimeout(timeoutHandle);
       
 21883   }
       
 21884 
       
 21885   if (workInProgress !== null) {
       
 21886     var interruptedWork = workInProgress.return;
       
 21887     while (interruptedWork !== null) {
       
 21888       unwindInterruptedWork(interruptedWork);
       
 21889       interruptedWork = interruptedWork.return;
       
 21890     }
       
 21891   }
       
 21892   workInProgressRoot = root;
       
 21893   workInProgress = createWorkInProgress(root.current, null, expirationTime);
       
 21894   renderExpirationTime = expirationTime;
       
 21895   workInProgressRootExitStatus = RootIncomplete;
       
 21896   workInProgressRootLatestProcessedExpirationTime = Sync;
       
 21897   workInProgressRootLatestSuspenseTimeout = Sync;
       
 21898   workInProgressRootCanSuspendUsingConfig = null;
       
 21899   workInProgressRootHasPendingPing = false;
       
 21900 
       
 21901   if (enableSchedulerTracing) {
       
 21902     spawnedWorkDuringRender = null;
       
 21903   }
       
 21904 
       
 21905   {
       
 21906     ReactStrictModeWarnings.discardPendingWarnings();
       
 21907     componentsThatTriggeredHighPriSuspend = null;
       
 21908   }
       
 21909 }
       
 21910 
       
 21911 function renderRoot(root, expirationTime, isSync) {
       
 21912   (function () {
       
 21913     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
       
 21914       {
       
 21915         throw ReactError(Error('Should not already be working.'));
       
 21916       }
       
 21917     }
       
 21918   })();
       
 21919 
       
 21920   if (enableUserTimingAPI && expirationTime !== Sync) {
       
 21921     var didExpire = isSync;
       
 21922     stopRequestCallbackTimer(didExpire);
       
 21923   }
       
 21924 
       
 21925   if (root.firstPendingTime < expirationTime) {
       
 21926     // If there's no work left at this expiration time, exit immediately. This
       
 21927     // happens when multiple callbacks are scheduled for a single root, but an
       
 21928     // earlier callback flushes the work of a later one.
       
 21929     return null;
       
 21930   }
       
 21931 
       
 21932   if (isSync && root.finishedExpirationTime === expirationTime) {
       
 21933     // There's already a pending commit at this expiration time.
       
 21934     // TODO: This is poorly factored. This case only exists for the
       
 21935     // batch.commit() API.
       
 21936     return commitRoot.bind(null, root);
       
 21937   }
       
 21938 
       
 21939   flushPassiveEffects();
       
 21940 
       
 21941   // If the root or expiration time have changed, throw out the existing stack
       
 21942   // and prepare a fresh one. Otherwise we'll continue where we left off.
       
 21943   if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) {
       
 21944     prepareFreshStack(root, expirationTime);
       
 21945     startWorkOnPendingInteractions(root, expirationTime);
       
 21946   } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
       
 21947     // We could've received an update at a lower priority while we yielded.
       
 21948     // We're suspended in a delayed state. Once we complete this render we're
       
 21949     // just going to try to recover at the last pending time anyway so we might
       
 21950     // as well start doing that eagerly.
       
 21951     // Ideally we should be able to do this even for retries but we don't yet
       
 21952     // know if we're going to process an update which wants to commit earlier,
       
 21953     // and this path happens very early so it would happen too often. Instead,
       
 21954     // for that case, we'll wait until we complete.
       
 21955     if (workInProgressRootHasPendingPing) {
       
 21956       // We have a ping at this expiration. Let's restart to see if we get unblocked.
       
 21957       prepareFreshStack(root, expirationTime);
       
 21958     } else {
       
 21959       var lastPendingTime = root.lastPendingTime;
       
 21960       if (lastPendingTime < expirationTime) {
       
 21961         // There's lower priority work. It might be unsuspended. Try rendering
       
 21962         // at that level immediately, while preserving the position in the queue.
       
 21963         return renderRoot.bind(null, root, lastPendingTime);
       
 21964       }
       
 21965     }
       
 21966   }
       
 21967 
       
 21968   // If we have a work-in-progress fiber, it means there's still work to do
       
 21969   // in this root.
       
 21970   if (workInProgress !== null) {
       
 21971     var prevExecutionContext = executionContext;
       
 21972     executionContext |= RenderContext;
       
 21973     var prevDispatcher = ReactCurrentDispatcher.current;
       
 21974     if (prevDispatcher === null) {
       
 21975       // The React isomorphic package does not include a default dispatcher.
       
 21976       // Instead the first renderer will lazily attach one, in order to give
       
 21977       // nicer error messages.
       
 21978       prevDispatcher = ContextOnlyDispatcher;
       
 21979     }
       
 21980     ReactCurrentDispatcher.current = ContextOnlyDispatcher;
       
 21981     var prevInteractions = null;
       
 21982     if (enableSchedulerTracing) {
       
 21983       prevInteractions = __interactionsRef.current;
       
 21984       __interactionsRef.current = root.memoizedInteractions;
       
 21985     }
       
 21986 
       
 21987     startWorkLoopTimer(workInProgress);
       
 21988 
       
 21989     // TODO: Fork renderRoot into renderRootSync and renderRootAsync
       
 21990     if (isSync) {
       
 21991       if (expirationTime !== Sync) {
       
 21992         // An async update expired. There may be other expired updates on
       
 21993         // this root. We should render all the expired work in a
       
 21994         // single batch.
       
 21995         var currentTime = requestCurrentTime();
       
 21996         if (currentTime < expirationTime) {
       
 21997           // Restart at the current time.
       
 21998           executionContext = prevExecutionContext;
       
 21999           resetContextDependencies();
       
 22000           ReactCurrentDispatcher.current = prevDispatcher;
       
 22001           if (enableSchedulerTracing) {
       
 22002             __interactionsRef.current = prevInteractions;
       
 22003           }
       
 22004           return renderRoot.bind(null, root, currentTime);
       
 22005         }
       
 22006       }
       
 22007     } else {
       
 22008       // Since we know we're in a React event, we can clear the current
       
 22009       // event time. The next update will compute a new event time.
       
 22010       currentEventTime = NoWork;
       
 22011     }
       
 22012 
       
 22013     do {
       
 22014       try {
       
 22015         if (isSync) {
       
 22016           workLoopSync();
       
 22017         } else {
       
 22018           workLoop();
       
 22019         }
       
 22020         break;
       
 22021       } catch (thrownValue) {
       
 22022         // Reset module-level state that was set during the render phase.
       
 22023         resetContextDependencies();
       
 22024         resetHooks();
       
 22025 
       
 22026         var sourceFiber = workInProgress;
       
 22027         if (sourceFiber === null || sourceFiber.return === null) {
       
 22028           // Expected to be working on a non-root fiber. This is a fatal error
       
 22029           // because there's no ancestor that can handle it; the root is
       
 22030           // supposed to capture all errors that weren't caught by an error
       
 22031           // boundary.
       
 22032           prepareFreshStack(root, expirationTime);
       
 22033           executionContext = prevExecutionContext;
       
 22034           throw thrownValue;
       
 22035         }
       
 22036 
       
 22037         if (enableProfilerTimer && sourceFiber.mode & ProfileMode) {
       
 22038           // Record the time spent rendering before an error was thrown. This
       
 22039           // avoids inaccurate Profiler durations in the case of a
       
 22040           // suspended render.
       
 22041           stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true);
       
 22042         }
       
 22043 
       
 22044         var returnFiber = sourceFiber.return;
       
 22045         throwException(root, returnFiber, sourceFiber, thrownValue, renderExpirationTime);
       
 22046         workInProgress = completeUnitOfWork(sourceFiber);
       
 22047       }
       
 22048     } while (true);
       
 22049 
       
 22050     executionContext = prevExecutionContext;
       
 22051     resetContextDependencies();
       
 22052     ReactCurrentDispatcher.current = prevDispatcher;
       
 22053     if (enableSchedulerTracing) {
       
 22054       __interactionsRef.current = prevInteractions;
       
 22055     }
       
 22056 
       
 22057     if (workInProgress !== null) {
       
 22058       // There's still work left over. Return a continuation.
       
 22059       stopInterruptedWorkLoopTimer();
       
 22060       if (expirationTime !== Sync) {
       
 22061         startRequestCallbackTimer();
       
 22062       }
       
 22063       return renderRoot.bind(null, root, expirationTime);
       
 22064     }
       
 22065   }
       
 22066 
       
 22067   // We now have a consistent tree. The next step is either to commit it, or, if
       
 22068   // something suspended, wait to commit it after a timeout.
       
 22069   stopFinishedWorkLoopTimer();
       
 22070 
       
 22071   root.finishedWork = root.current.alternate;
       
 22072   root.finishedExpirationTime = expirationTime;
       
 22073 
       
 22074   var isLocked = resolveLocksOnRoot(root, expirationTime);
       
 22075   if (isLocked) {
       
 22076     // This root has a lock that prevents it from committing. Exit. If we begin
       
 22077     // work on the root again, without any intervening updates, it will finish
       
 22078     // without doing additional work.
       
 22079     return null;
       
 22080   }
       
 22081 
       
 22082   // Set this to null to indicate there's no in-progress render.
       
 22083   workInProgressRoot = null;
       
 22084 
       
 22085   switch (workInProgressRootExitStatus) {
       
 22086     case RootIncomplete:
       
 22087       {
       
 22088         (function () {
       
 22089           {
       
 22090             {
       
 22091               throw ReactError(Error('Should have a work-in-progress.'));
       
 22092             }
       
 22093           }
       
 22094         })();
       
 22095       }
       
 22096     // Flow knows about invariant, so it complains if I add a break statement,
       
 22097     // but eslint doesn't know about invariant, so it complains if I do.
       
 22098     // eslint-disable-next-line no-fallthrough
       
 22099     case RootErrored:
       
 22100       {
       
 22101         // An error was thrown. First check if there is lower priority work
       
 22102         // scheduled on this root.
       
 22103         var _lastPendingTime = root.lastPendingTime;
       
 22104         if (_lastPendingTime < expirationTime) {
       
 22105           // There's lower priority work. Before raising the error, try rendering
       
 22106           // at the lower priority to see if it fixes it. Use a continuation to
       
 22107           // maintain the existing priority and position in the queue.
       
 22108           return renderRoot.bind(null, root, _lastPendingTime);
       
 22109         }
       
 22110         if (!isSync) {
       
 22111           // If we're rendering asynchronously, it's possible the error was
       
 22112           // caused by tearing due to a mutation during an event. Try rendering
       
 22113           // one more time without yiedling to events.
       
 22114           prepareFreshStack(root, expirationTime);
       
 22115           scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
       
 22116           return null;
       
 22117         }
       
 22118         // If we're already rendering synchronously, commit the root in its
       
 22119         // errored state.
       
 22120         return commitRoot.bind(null, root);
       
 22121       }
       
 22122     case RootSuspended:
       
 22123       {
       
 22124         flushSuspensePriorityWarningInDEV();
       
 22125 
       
 22126         // We have an acceptable loading state. We need to figure out if we should
       
 22127         // immediately commit it or wait a bit.
       
 22128 
       
 22129         // If we have processed new updates during this render, we may now have a
       
 22130         // new loading state ready. We want to ensure that we commit that as soon as
       
 22131         // possible.
       
 22132         var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync;
       
 22133         if (hasNotProcessedNewUpdates && !isSync &&
       
 22134         // do not delay if we're inside an act() scope
       
 22135         !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
       
 22136           // If we have not processed any new updates during this pass, then this is
       
 22137           // either a retry of an existing fallback state or a hidden tree.
       
 22138           // Hidden trees shouldn't be batched with other work and after that's
       
 22139           // fixed it can only be a retry.
       
 22140           // We're going to throttle committing retries so that we don't show too
       
 22141           // many loading states too quickly.
       
 22142           var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now();
       
 22143           // Don't bother with a very short suspense time.
       
 22144           if (msUntilTimeout > 10) {
       
 22145             if (workInProgressRootHasPendingPing) {
       
 22146               // This render was pinged but we didn't get to restart earlier so try
       
 22147               // restarting now instead.
       
 22148               prepareFreshStack(root, expirationTime);
       
 22149               return renderRoot.bind(null, root, expirationTime);
       
 22150             }
       
 22151             var _lastPendingTime2 = root.lastPendingTime;
       
 22152             if (_lastPendingTime2 < expirationTime) {
       
 22153               // There's lower priority work. It might be unsuspended. Try rendering
       
 22154               // at that level.
       
 22155               return renderRoot.bind(null, root, _lastPendingTime2);
       
 22156             }
       
 22157             // The render is suspended, it hasn't timed out, and there's no lower
       
 22158             // priority work to do. Instead of committing the fallback
       
 22159             // immediately, wait for more data to arrive.
       
 22160             root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
       
 22161             return null;
       
 22162           }
       
 22163         }
       
 22164         // The work expired. Commit immediately.
       
 22165         return commitRoot.bind(null, root);
       
 22166       }
       
 22167     case RootSuspendedWithDelay:
       
 22168       {
       
 22169         flushSuspensePriorityWarningInDEV();
       
 22170 
       
 22171         if (!isSync &&
       
 22172         // do not delay if we're inside an act() scope
       
 22173         !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
       
 22174           // We're suspended in a state that should be avoided. We'll try to avoid committing
       
 22175           // it for as long as the timeouts let us.
       
 22176           if (workInProgressRootHasPendingPing) {
       
 22177             // This render was pinged but we didn't get to restart earlier so try
       
 22178             // restarting now instead.
       
 22179             prepareFreshStack(root, expirationTime);
       
 22180             return renderRoot.bind(null, root, expirationTime);
       
 22181           }
       
 22182           var _lastPendingTime3 = root.lastPendingTime;
       
 22183           if (_lastPendingTime3 < expirationTime) {
       
 22184             // There's lower priority work. It might be unsuspended. Try rendering
       
 22185             // at that level immediately.
       
 22186             return renderRoot.bind(null, root, _lastPendingTime3);
       
 22187           }
       
 22188 
       
 22189           var _msUntilTimeout = void 0;
       
 22190           if (workInProgressRootLatestSuspenseTimeout !== Sync) {
       
 22191             // We have processed a suspense config whose expiration time we can use as
       
 22192             // the timeout.
       
 22193             _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now();
       
 22194           } else if (workInProgressRootLatestProcessedExpirationTime === Sync) {
       
 22195             // This should never normally happen because only new updates cause
       
 22196             // delayed states, so we should have processed something. However,
       
 22197             // this could also happen in an offscreen tree.
       
 22198             _msUntilTimeout = 0;
       
 22199           } else {
       
 22200             // If we don't have a suspense config, we're going to use a heuristic to
       
 22201             var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime);
       
 22202             var currentTimeMs = now();
       
 22203             var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs;
       
 22204             var timeElapsed = currentTimeMs - eventTimeMs;
       
 22205             if (timeElapsed < 0) {
       
 22206               // We get this wrong some time since we estimate the time.
       
 22207               timeElapsed = 0;
       
 22208             }
       
 22209 
       
 22210             _msUntilTimeout = jnd(timeElapsed) - timeElapsed;
       
 22211 
       
 22212             // Clamp the timeout to the expiration time.
       
 22213             // TODO: Once the event time is exact instead of inferred from expiration time
       
 22214             // we don't need this.
       
 22215             if (timeUntilExpirationMs < _msUntilTimeout) {
       
 22216               _msUntilTimeout = timeUntilExpirationMs;
       
 22217             }
       
 22218           }
       
 22219 
       
 22220           // Don't bother with a very short suspense time.
       
 22221           if (_msUntilTimeout > 10) {
       
 22222             // The render is suspended, it hasn't timed out, and there's no lower
       
 22223             // priority work to do. Instead of committing the fallback
       
 22224             // immediately, wait for more data to arrive.
       
 22225             root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
       
 22226             return null;
       
 22227           }
       
 22228         }
       
 22229         // The work expired. Commit immediately.
       
 22230         return commitRoot.bind(null, root);
       
 22231       }
       
 22232     case RootCompleted:
       
 22233       {
       
 22234         // The work completed. Ready to commit.
       
 22235         if (!isSync &&
       
 22236         // do not delay if we're inside an act() scope
       
 22237         !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) {
       
 22238           // If we have exceeded the minimum loading delay, which probably
       
 22239           // means we have shown a spinner already, we might have to suspend
       
 22240           // a bit longer to ensure that the spinner is shown for enough time.
       
 22241           var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig);
       
 22242           if (_msUntilTimeout2 > 10) {
       
 22243             root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2);
       
 22244             return null;
       
 22245           }
       
 22246         }
       
 22247         return commitRoot.bind(null, root);
       
 22248       }
       
 22249     default:
       
 22250       {
       
 22251         (function () {
       
 22252           {
       
 22253             {
       
 22254               throw ReactError(Error('Unknown root exit status.'));
       
 22255             }
       
 22256           }
       
 22257         })();
       
 22258       }
       
 22259   }
       
 22260 }
       
 22261 
       
 22262 function markCommitTimeOfFallback() {
       
 22263   globalMostRecentFallbackTime = now();
       
 22264 }
       
 22265 
       
 22266 function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) {
       
 22267   if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Never) {
       
 22268     workInProgressRootLatestProcessedExpirationTime = expirationTime;
       
 22269   }
       
 22270   if (suspenseConfig !== null) {
       
 22271     if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Never) {
       
 22272       workInProgressRootLatestSuspenseTimeout = expirationTime;
       
 22273       // Most of the time we only have one config and getting wrong is not bad.
       
 22274       workInProgressRootCanSuspendUsingConfig = suspenseConfig;
       
 22275     }
       
 22276   }
       
 22277 }
       
 22278 
       
 22279 function renderDidSuspend() {
       
 22280   if (workInProgressRootExitStatus === RootIncomplete) {
       
 22281     workInProgressRootExitStatus = RootSuspended;
       
 22282   }
       
 22283 }
       
 22284 
       
 22285 function renderDidSuspendDelayIfPossible() {
       
 22286   if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
       
 22287     workInProgressRootExitStatus = RootSuspendedWithDelay;
       
 22288   }
       
 22289 }
       
 22290 
       
 22291 function renderDidError() {
       
 22292   if (workInProgressRootExitStatus !== RootCompleted) {
       
 22293     workInProgressRootExitStatus = RootErrored;
       
 22294   }
       
 22295 }
       
 22296 
       
 22297 // Called during render to determine if anything has suspended.
       
 22298 // Returns false if we're not sure.
       
 22299 function renderHasNotSuspendedYet() {
       
 22300   // If something errored or completed, we can't really be sure,
       
 22301   // so those are false.
       
 22302   return workInProgressRootExitStatus === RootIncomplete;
       
 22303 }
       
 22304 
       
 22305 function inferTimeFromExpirationTime(expirationTime) {
       
 22306   // We don't know exactly when the update was scheduled, but we can infer an
       
 22307   // approximate start time from the expiration time.
       
 22308   var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
       
 22309   return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
       
 22310 }
       
 22311 
       
 22312 function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) {
       
 22313   // We don't know exactly when the update was scheduled, but we can infer an
       
 22314   // approximate start time from the expiration time by subtracting the timeout
       
 22315   // that was added to the event time.
       
 22316   var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
       
 22317   return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
       
 22318 }
       
 22319 
       
 22320 function workLoopSync() {
       
 22321   // Already timed out, so perform work without checking if we need to yield.
       
 22322   while (workInProgress !== null) {
       
 22323     workInProgress = performUnitOfWork(workInProgress);
       
 22324   }
       
 22325 }
       
 22326 
       
 22327 function workLoop() {
       
 22328   // Perform work until Scheduler asks us to yield
       
 22329   while (workInProgress !== null && !shouldYield()) {
       
 22330     workInProgress = performUnitOfWork(workInProgress);
       
 22331   }
       
 22332 }
       
 22333 
       
 22334 function performUnitOfWork(unitOfWork) {
       
 22335   // The current, flushed, state of this fiber is the alternate. Ideally
       
 22336   // nothing should rely on this, but relying on it here means that we don't
       
 22337   // need an additional field on the work in progress.
       
 22338   var current$$1 = unitOfWork.alternate;
       
 22339 
       
 22340   startWorkTimer(unitOfWork);
       
 22341   setCurrentFiber(unitOfWork);
       
 22342 
       
 22343   var next = void 0;
       
 22344   if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) {
       
 22345     startProfilerTimer(unitOfWork);
       
 22346     next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
       
 22347     stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
       
 22348   } else {
       
 22349     next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
       
 22350   }
       
 22351 
       
 22352   resetCurrentFiber();
       
 22353   unitOfWork.memoizedProps = unitOfWork.pendingProps;
       
 22354   if (next === null) {
       
 22355     // If this doesn't spawn new work, complete the current work.
       
 22356     next = completeUnitOfWork(unitOfWork);
       
 22357   }
       
 22358 
       
 22359   ReactCurrentOwner$2.current = null;
       
 22360   return next;
       
 22361 }
       
 22362 
       
 22363 function completeUnitOfWork(unitOfWork) {
       
 22364   // Attempt to complete the current unit of work, then move to the next
       
 22365   // sibling. If there are no more siblings, return to the parent fiber.
       
 22366   workInProgress = unitOfWork;
       
 22367   do {
       
 22368     // The current, flushed, state of this fiber is the alternate. Ideally
       
 22369     // nothing should rely on this, but relying on it here means that we don't
       
 22370     // need an additional field on the work in progress.
       
 22371     var current$$1 = workInProgress.alternate;
       
 22372     var returnFiber = workInProgress.return;
       
 22373 
       
 22374     // Check if the work completed or if something threw.
       
 22375     if ((workInProgress.effectTag & Incomplete) === NoEffect) {
       
 22376       setCurrentFiber(workInProgress);
       
 22377       var next = void 0;
       
 22378       if (!enableProfilerTimer || (workInProgress.mode & ProfileMode) === NoMode) {
       
 22379         next = completeWork(current$$1, workInProgress, renderExpirationTime);
       
 22380       } else {
       
 22381         startProfilerTimer(workInProgress);
       
 22382         next = completeWork(current$$1, workInProgress, renderExpirationTime);
       
 22383         // Update render duration assuming we didn't error.
       
 22384         stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 22385       }
       
 22386       stopWorkTimer(workInProgress);
       
 22387       resetCurrentFiber();
       
 22388       resetChildExpirationTime(workInProgress);
       
 22389 
       
 22390       if (next !== null) {
       
 22391         // Completing this fiber spawned new work. Work on that next.
       
 22392         return next;
       
 22393       }
       
 22394 
       
 22395       if (returnFiber !== null &&
       
 22396       // Do not append effects to parents if a sibling failed to complete
       
 22397       (returnFiber.effectTag & Incomplete) === NoEffect) {
       
 22398         // Append all the effects of the subtree and this fiber onto the effect
       
 22399         // list of the parent. The completion order of the children affects the
       
 22400         // side-effect order.
       
 22401         if (returnFiber.firstEffect === null) {
       
 22402           returnFiber.firstEffect = workInProgress.firstEffect;
       
 22403         }
       
 22404         if (workInProgress.lastEffect !== null) {
       
 22405           if (returnFiber.lastEffect !== null) {
       
 22406             returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
       
 22407           }
       
 22408           returnFiber.lastEffect = workInProgress.lastEffect;
       
 22409         }
       
 22410 
       
 22411         // If this fiber had side-effects, we append it AFTER the children's
       
 22412         // side-effects. We can perform certain side-effects earlier if needed,
       
 22413         // by doing multiple passes over the effect list. We don't want to
       
 22414         // schedule our own side-effect on our own list because if end up
       
 22415         // reusing children we'll schedule this effect onto itself since we're
       
 22416         // at the end.
       
 22417         var effectTag = workInProgress.effectTag;
       
 22418 
       
 22419         // Skip both NoWork and PerformedWork tags when creating the effect
       
 22420         // list. PerformedWork effect is read by React DevTools but shouldn't be
       
 22421         // committed.
       
 22422         if (effectTag > PerformedWork) {
       
 22423           if (returnFiber.lastEffect !== null) {
       
 22424             returnFiber.lastEffect.nextEffect = workInProgress;
       
 22425           } else {
       
 22426             returnFiber.firstEffect = workInProgress;
       
 22427           }
       
 22428           returnFiber.lastEffect = workInProgress;
       
 22429         }
       
 22430       }
       
 22431     } else {
       
 22432       // This fiber did not complete because something threw. Pop values off
       
 22433       // the stack without entering the complete phase. If this is a boundary,
       
 22434       // capture values if possible.
       
 22435       var _next = unwindWork(workInProgress, renderExpirationTime);
       
 22436 
       
 22437       // Because this fiber did not complete, don't reset its expiration time.
       
 22438 
       
 22439       if (enableProfilerTimer && (workInProgress.mode & ProfileMode) !== NoMode) {
       
 22440         // Record the render duration for the fiber that errored.
       
 22441         stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 22442 
       
 22443         // Include the time spent working on failed children before continuing.
       
 22444         var actualDuration = workInProgress.actualDuration;
       
 22445         var child = workInProgress.child;
       
 22446         while (child !== null) {
       
 22447           actualDuration += child.actualDuration;
       
 22448           child = child.sibling;
       
 22449         }
       
 22450         workInProgress.actualDuration = actualDuration;
       
 22451       }
       
 22452 
       
 22453       if (_next !== null) {
       
 22454         // If completing this work spawned new work, do that next. We'll come
       
 22455         // back here again.
       
 22456         // Since we're restarting, remove anything that is not a host effect
       
 22457         // from the effect tag.
       
 22458         // TODO: The name stopFailedWorkTimer is misleading because Suspense
       
 22459         // also captures and restarts.
       
 22460         stopFailedWorkTimer(workInProgress);
       
 22461         _next.effectTag &= HostEffectMask;
       
 22462         return _next;
       
 22463       }
       
 22464       stopWorkTimer(workInProgress);
       
 22465 
       
 22466       if (returnFiber !== null) {
       
 22467         // Mark the parent fiber as incomplete and clear its effect list.
       
 22468         returnFiber.firstEffect = returnFiber.lastEffect = null;
       
 22469         returnFiber.effectTag |= Incomplete;
       
 22470       }
       
 22471     }
       
 22472 
       
 22473     var siblingFiber = workInProgress.sibling;
       
 22474     if (siblingFiber !== null) {
       
 22475       // If there is more work to do in this returnFiber, do that next.
       
 22476       return siblingFiber;
       
 22477     }
       
 22478     // Otherwise, return to the parent
       
 22479     workInProgress = returnFiber;
       
 22480   } while (workInProgress !== null);
       
 22481 
       
 22482   // We've reached the root.
       
 22483   if (workInProgressRootExitStatus === RootIncomplete) {
       
 22484     workInProgressRootExitStatus = RootCompleted;
       
 22485   }
       
 22486   return null;
       
 22487 }
       
 22488 
       
 22489 function resetChildExpirationTime(completedWork) {
       
 22490   if (renderExpirationTime !== Never && completedWork.childExpirationTime === Never) {
       
 22491     // The children of this component are hidden. Don't bubble their
       
 22492     // expiration times.
       
 22493     return;
       
 22494   }
       
 22495 
       
 22496   var newChildExpirationTime = NoWork;
       
 22497 
       
 22498   // Bubble up the earliest expiration time.
       
 22499   if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) {
       
 22500     // In profiling mode, resetChildExpirationTime is also used to reset
       
 22501     // profiler durations.
       
 22502     var actualDuration = completedWork.actualDuration;
       
 22503     var treeBaseDuration = completedWork.selfBaseDuration;
       
 22504 
       
 22505     // When a fiber is cloned, its actualDuration is reset to 0. This value will
       
 22506     // only be updated if work is done on the fiber (i.e. it doesn't bailout).
       
 22507     // When work is done, it should bubble to the parent's actualDuration. If
       
 22508     // the fiber has not been cloned though, (meaning no work was done), then
       
 22509     // this value will reflect the amount of time spent working on a previous
       
 22510     // render. In that case it should not bubble. We determine whether it was
       
 22511     // cloned by comparing the child pointer.
       
 22512     var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
       
 22513 
       
 22514     var child = completedWork.child;
       
 22515     while (child !== null) {
       
 22516       var childUpdateExpirationTime = child.expirationTime;
       
 22517       var childChildExpirationTime = child.childExpirationTime;
       
 22518       if (childUpdateExpirationTime > newChildExpirationTime) {
       
 22519         newChildExpirationTime = childUpdateExpirationTime;
       
 22520       }
       
 22521       if (childChildExpirationTime > newChildExpirationTime) {
       
 22522         newChildExpirationTime = childChildExpirationTime;
       
 22523       }
       
 22524       if (shouldBubbleActualDurations) {
       
 22525         actualDuration += child.actualDuration;
       
 22526       }
       
 22527       treeBaseDuration += child.treeBaseDuration;
       
 22528       child = child.sibling;
       
 22529     }
       
 22530     completedWork.actualDuration = actualDuration;
       
 22531     completedWork.treeBaseDuration = treeBaseDuration;
       
 22532   } else {
       
 22533     var _child = completedWork.child;
       
 22534     while (_child !== null) {
       
 22535       var _childUpdateExpirationTime = _child.expirationTime;
       
 22536       var _childChildExpirationTime = _child.childExpirationTime;
       
 22537       if (_childUpdateExpirationTime > newChildExpirationTime) {
       
 22538         newChildExpirationTime = _childUpdateExpirationTime;
       
 22539       }
       
 22540       if (_childChildExpirationTime > newChildExpirationTime) {
       
 22541         newChildExpirationTime = _childChildExpirationTime;
       
 22542       }
       
 22543       _child = _child.sibling;
       
 22544     }
       
 22545   }
       
 22546 
       
 22547   completedWork.childExpirationTime = newChildExpirationTime;
       
 22548 }
       
 22549 
       
 22550 function commitRoot(root) {
       
 22551   var renderPriorityLevel = getCurrentPriorityLevel();
       
 22552   runWithPriority$2(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel));
       
 22553   // If there are passive effects, schedule a callback to flush them. This goes
       
 22554   // outside commitRootImpl so that it inherits the priority of the render.
       
 22555   if (rootWithPendingPassiveEffects !== null) {
       
 22556     scheduleCallback(NormalPriority, function () {
       
 22557       flushPassiveEffects();
       
 22558       return null;
       
 22559     });
       
 22560   }
       
 22561   return null;
       
 22562 }
       
 22563 
       
 22564 function commitRootImpl(root, renderPriorityLevel) {
       
 22565   flushPassiveEffects();
       
 22566   flushRenderPhaseStrictModeWarningsInDEV();
       
 22567 
       
 22568   (function () {
       
 22569     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
       
 22570       {
       
 22571         throw ReactError(Error('Should not already be working.'));
       
 22572       }
       
 22573     }
       
 22574   })();
       
 22575 
       
 22576   var finishedWork = root.finishedWork;
       
 22577   var expirationTime = root.finishedExpirationTime;
       
 22578   if (finishedWork === null) {
       
 22579     return null;
       
 22580   }
       
 22581   root.finishedWork = null;
       
 22582   root.finishedExpirationTime = NoWork;
       
 22583 
       
 22584   (function () {
       
 22585     if (!(finishedWork !== root.current)) {
       
 22586       {
       
 22587         throw ReactError(Error('Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.'));
       
 22588       }
       
 22589     }
       
 22590   })();
       
 22591 
       
 22592   // commitRoot never returns a continuation; it always finishes synchronously.
       
 22593   // So we can clear these now to allow a new callback to be scheduled.
       
 22594   root.callbackNode = null;
       
 22595   root.callbackExpirationTime = NoWork;
       
 22596 
       
 22597   startCommitTimer();
       
 22598 
       
 22599   // Update the first and last pending times on this root. The new first
       
 22600   // pending time is whatever is left on the root fiber.
       
 22601   var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
       
 22602   var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
       
 22603   var firstPendingTimeBeforeCommit = childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
       
 22604   root.firstPendingTime = firstPendingTimeBeforeCommit;
       
 22605   if (firstPendingTimeBeforeCommit < root.lastPendingTime) {
       
 22606     // This usually means we've finished all the work, but it can also happen
       
 22607     // when something gets downprioritized during render, like a hidden tree.
       
 22608     root.lastPendingTime = firstPendingTimeBeforeCommit;
       
 22609   }
       
 22610 
       
 22611   if (root === workInProgressRoot) {
       
 22612     // We can reset these now that they are finished.
       
 22613     workInProgressRoot = null;
       
 22614     workInProgress = null;
       
 22615     renderExpirationTime = NoWork;
       
 22616   } else {}
       
 22617   // This indicates that the last root we worked on is not the same one that
       
 22618   // we're committing now. This most commonly happens when a suspended root
       
 22619   // times out.
       
 22620 
       
 22621 
       
 22622   // Get the list of effects.
       
 22623   var firstEffect = void 0;
       
 22624   if (finishedWork.effectTag > PerformedWork) {
       
 22625     // A fiber's effect list consists only of its children, not itself. So if
       
 22626     // the root has an effect, we need to add it to the end of the list. The
       
 22627     // resulting list is the set that would belong to the root's parent, if it
       
 22628     // had one; that is, all the effects in the tree including the root.
       
 22629     if (finishedWork.lastEffect !== null) {
       
 22630       finishedWork.lastEffect.nextEffect = finishedWork;
       
 22631       firstEffect = finishedWork.firstEffect;
       
 22632     } else {
       
 22633       firstEffect = finishedWork;
       
 22634     }
       
 22635   } else {
       
 22636     // There is no effect on the root.
       
 22637     firstEffect = finishedWork.firstEffect;
       
 22638   }
       
 22639 
       
 22640   if (firstEffect !== null) {
       
 22641     var prevExecutionContext = executionContext;
       
 22642     executionContext |= CommitContext;
       
 22643     var prevInteractions = null;
       
 22644     if (enableSchedulerTracing) {
       
 22645       prevInteractions = __interactionsRef.current;
       
 22646       __interactionsRef.current = root.memoizedInteractions;
       
 22647     }
       
 22648 
       
 22649     // Reset this to null before calling lifecycles
       
 22650     ReactCurrentOwner$2.current = null;
       
 22651 
       
 22652     // The commit phase is broken into several sub-phases. We do a separate pass
       
 22653     // of the effect list for each phase: all mutation effects come before all
       
 22654     // layout effects, and so on.
       
 22655 
       
 22656     // The first phase a "before mutation" phase. We use this phase to read the
       
 22657     // state of the host tree right before we mutate it. This is where
       
 22658     // getSnapshotBeforeUpdate is called.
       
 22659     startCommitSnapshotEffectsTimer();
       
 22660     prepareForCommit(root.containerInfo);
       
 22661     nextEffect = firstEffect;
       
 22662     do {
       
 22663       {
       
 22664         invokeGuardedCallback(null, commitBeforeMutationEffects, null);
       
 22665         if (hasCaughtError()) {
       
 22666           (function () {
       
 22667             if (!(nextEffect !== null)) {
       
 22668               {
       
 22669                 throw ReactError(Error('Should be working on an effect.'));
       
 22670               }
       
 22671             }
       
 22672           })();
       
 22673           var error = clearCaughtError();
       
 22674           captureCommitPhaseError(nextEffect, error);
       
 22675           nextEffect = nextEffect.nextEffect;
       
 22676         }
       
 22677       }
       
 22678     } while (nextEffect !== null);
       
 22679     stopCommitSnapshotEffectsTimer();
       
 22680 
       
 22681     if (enableProfilerTimer) {
       
 22682       // Mark the current commit time to be shared by all Profilers in this
       
 22683       // batch. This enables them to be grouped later.
       
 22684       recordCommitTime();
       
 22685     }
       
 22686 
       
 22687     // The next phase is the mutation phase, where we mutate the host tree.
       
 22688     startCommitHostEffectsTimer();
       
 22689     nextEffect = firstEffect;
       
 22690     do {
       
 22691       {
       
 22692         invokeGuardedCallback(null, commitMutationEffects, null, renderPriorityLevel);
       
 22693         if (hasCaughtError()) {
       
 22694           (function () {
       
 22695             if (!(nextEffect !== null)) {
       
 22696               {
       
 22697                 throw ReactError(Error('Should be working on an effect.'));
       
 22698               }
       
 22699             }
       
 22700           })();
       
 22701           var _error = clearCaughtError();
       
 22702           captureCommitPhaseError(nextEffect, _error);
       
 22703           nextEffect = nextEffect.nextEffect;
       
 22704         }
       
 22705       }
       
 22706     } while (nextEffect !== null);
       
 22707     stopCommitHostEffectsTimer();
       
 22708     resetAfterCommit(root.containerInfo);
       
 22709 
       
 22710     // The work-in-progress tree is now the current tree. This must come after
       
 22711     // the mutation phase, so that the previous tree is still current during
       
 22712     // componentWillUnmount, but before the layout phase, so that the finished
       
 22713     // work is current during componentDidMount/Update.
       
 22714     root.current = finishedWork;
       
 22715 
       
 22716     // The next phase is the layout phase, where we call effects that read
       
 22717     // the host tree after it's been mutated. The idiomatic use case for this is
       
 22718     // layout, but class component lifecycles also fire here for legacy reasons.
       
 22719     startCommitLifeCyclesTimer();
       
 22720     nextEffect = firstEffect;
       
 22721     do {
       
 22722       {
       
 22723         invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
       
 22724         if (hasCaughtError()) {
       
 22725           (function () {
       
 22726             if (!(nextEffect !== null)) {
       
 22727               {
       
 22728                 throw ReactError(Error('Should be working on an effect.'));
       
 22729               }
       
 22730             }
       
 22731           })();
       
 22732           var _error2 = clearCaughtError();
       
 22733           captureCommitPhaseError(nextEffect, _error2);
       
 22734           nextEffect = nextEffect.nextEffect;
       
 22735         }
       
 22736       }
       
 22737     } while (nextEffect !== null);
       
 22738     stopCommitLifeCyclesTimer();
       
 22739 
       
 22740     nextEffect = null;
       
 22741 
       
 22742     // Tell Scheduler to yield at the end of the frame, so the browser has an
       
 22743     // opportunity to paint.
       
 22744     requestPaint();
       
 22745 
       
 22746     if (enableSchedulerTracing) {
       
 22747       __interactionsRef.current = prevInteractions;
       
 22748     }
       
 22749     executionContext = prevExecutionContext;
       
 22750   } else {
       
 22751     // No effects.
       
 22752     root.current = finishedWork;
       
 22753     // Measure these anyway so the flamegraph explicitly shows that there were
       
 22754     // no effects.
       
 22755     // TODO: Maybe there's a better way to report this.
       
 22756     startCommitSnapshotEffectsTimer();
       
 22757     stopCommitSnapshotEffectsTimer();
       
 22758     if (enableProfilerTimer) {
       
 22759       recordCommitTime();
       
 22760     }
       
 22761     startCommitHostEffectsTimer();
       
 22762     stopCommitHostEffectsTimer();
       
 22763     startCommitLifeCyclesTimer();
       
 22764     stopCommitLifeCyclesTimer();
       
 22765   }
       
 22766 
       
 22767   stopCommitTimer();
       
 22768 
       
 22769   var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
       
 22770 
       
 22771   if (rootDoesHavePassiveEffects) {
       
 22772     // This commit has passive effects. Stash a reference to them. But don't
       
 22773     // schedule a callback until after flushing layout work.
       
 22774     rootDoesHavePassiveEffects = false;
       
 22775     rootWithPendingPassiveEffects = root;
       
 22776     pendingPassiveEffectsExpirationTime = expirationTime;
       
 22777     pendingPassiveEffectsRenderPriority = renderPriorityLevel;
       
 22778   } else {
       
 22779     // We are done with the effect chain at this point so let's clear the
       
 22780     // nextEffect pointers to assist with GC. If we have passive effects, we'll
       
 22781     // clear this in flushPassiveEffects.
       
 22782     nextEffect = firstEffect;
       
 22783     while (nextEffect !== null) {
       
 22784       var nextNextEffect = nextEffect.nextEffect;
       
 22785       nextEffect.nextEffect = null;
       
 22786       nextEffect = nextNextEffect;
       
 22787     }
       
 22788   }
       
 22789 
       
 22790   // Check if there's remaining work on this root
       
 22791   var remainingExpirationTime = root.firstPendingTime;
       
 22792   if (remainingExpirationTime !== NoWork) {
       
 22793     var currentTime = requestCurrentTime();
       
 22794     var priorityLevel = inferPriorityFromExpirationTime(currentTime, remainingExpirationTime);
       
 22795 
       
 22796     if (enableSchedulerTracing) {
       
 22797       if (spawnedWorkDuringRender !== null) {
       
 22798         var expirationTimes = spawnedWorkDuringRender;
       
 22799         spawnedWorkDuringRender = null;
       
 22800         for (var i = 0; i < expirationTimes.length; i++) {
       
 22801           scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
       
 22802         }
       
 22803       }
       
 22804     }
       
 22805 
       
 22806     scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime);
       
 22807   } else {
       
 22808     // If there's no remaining work, we can clear the set of already failed
       
 22809     // error boundaries.
       
 22810     legacyErrorBoundariesThatAlreadyFailed = null;
       
 22811   }
       
 22812 
       
 22813   if (enableSchedulerTracing) {
       
 22814     if (!rootDidHavePassiveEffects) {
       
 22815       // If there are no passive effects, then we can complete the pending interactions.
       
 22816       // Otherwise, we'll wait until after the passive effects are flushed.
       
 22817       // Wait to do this until after remaining work has been scheduled,
       
 22818       // so that we don't prematurely signal complete for interactions when there's e.g. hidden work.
       
 22819       finishPendingInteractions(root, expirationTime);
       
 22820     }
       
 22821   }
       
 22822 
       
 22823   onCommitRoot(finishedWork.stateNode, expirationTime);
       
 22824 
       
 22825   if (remainingExpirationTime === Sync) {
       
 22826     // Count the number of times the root synchronously re-renders without
       
 22827     // finishing. If there are too many, it indicates an infinite update loop.
       
 22828     if (root === rootWithNestedUpdates) {
       
 22829       nestedUpdateCount++;
       
 22830     } else {
       
 22831       nestedUpdateCount = 0;
       
 22832       rootWithNestedUpdates = root;
       
 22833     }
       
 22834   } else {
       
 22835     nestedUpdateCount = 0;
       
 22836   }
       
 22837 
       
 22838   if (hasUncaughtError) {
       
 22839     hasUncaughtError = false;
       
 22840     var _error3 = firstUncaughtError;
       
 22841     firstUncaughtError = null;
       
 22842     throw _error3;
       
 22843   }
       
 22844 
       
 22845   if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
       
 22846     // This is a legacy edge case. We just committed the initial mount of
       
 22847     // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
       
 22848     // synchronously, but layout updates should be deferred until the end
       
 22849     // of the batch.
       
 22850     return null;
       
 22851   }
       
 22852 
       
 22853   // If layout work was scheduled, flush it now.
       
 22854   flushSyncCallbackQueue();
       
 22855   return null;
       
 22856 }
       
 22857 
       
 22858 function commitBeforeMutationEffects() {
       
 22859   while (nextEffect !== null) {
       
 22860     if ((nextEffect.effectTag & Snapshot) !== NoEffect) {
       
 22861       setCurrentFiber(nextEffect);
       
 22862       recordEffect();
       
 22863 
       
 22864       var current$$1 = nextEffect.alternate;
       
 22865       commitBeforeMutationLifeCycles(current$$1, nextEffect);
       
 22866 
       
 22867       resetCurrentFiber();
       
 22868     }
       
 22869     nextEffect = nextEffect.nextEffect;
       
 22870   }
       
 22871 }
       
 22872 
       
 22873 function commitMutationEffects(renderPriorityLevel) {
       
 22874   // TODO: Should probably move the bulk of this function to commitWork.
       
 22875   while (nextEffect !== null) {
       
 22876     setCurrentFiber(nextEffect);
       
 22877 
       
 22878     var effectTag = nextEffect.effectTag;
       
 22879 
       
 22880     if (effectTag & ContentReset) {
       
 22881       commitResetTextContent(nextEffect);
       
 22882     }
       
 22883 
       
 22884     if (effectTag & Ref) {
       
 22885       var current$$1 = nextEffect.alternate;
       
 22886       if (current$$1 !== null) {
       
 22887         commitDetachRef(current$$1);
       
 22888       }
       
 22889     }
       
 22890 
       
 22891     // The following switch statement is only concerned about placement,
       
 22892     // updates, and deletions. To avoid needing to add a case for every possible
       
 22893     // bitmap value, we remove the secondary effects from the effect tag and
       
 22894     // switch on that value.
       
 22895     var primaryEffectTag = effectTag & (Placement | Update | Deletion);
       
 22896     switch (primaryEffectTag) {
       
 22897       case Placement:
       
 22898         {
       
 22899           commitPlacement(nextEffect);
       
 22900           // Clear the "placement" from effect tag so that we know that this is
       
 22901           // inserted, before any life-cycles like componentDidMount gets called.
       
 22902           // TODO: findDOMNode doesn't rely on this any more but isMounted does
       
 22903           // and isMounted is deprecated anyway so we should be able to kill this.
       
 22904           nextEffect.effectTag &= ~Placement;
       
 22905           break;
       
 22906         }
       
 22907       case PlacementAndUpdate:
       
 22908         {
       
 22909           // Placement
       
 22910           commitPlacement(nextEffect);
       
 22911           // Clear the "placement" from effect tag so that we know that this is
       
 22912           // inserted, before any life-cycles like componentDidMount gets called.
       
 22913           nextEffect.effectTag &= ~Placement;
       
 22914 
       
 22915           // Update
       
 22916           var _current = nextEffect.alternate;
       
 22917           commitWork(_current, nextEffect);
       
 22918           break;
       
 22919         }
       
 22920       case Update:
       
 22921         {
       
 22922           var _current2 = nextEffect.alternate;
       
 22923           commitWork(_current2, nextEffect);
       
 22924           break;
       
 22925         }
       
 22926       case Deletion:
       
 22927         {
       
 22928           commitDeletion(nextEffect, renderPriorityLevel);
       
 22929           break;
       
 22930         }
       
 22931     }
       
 22932 
       
 22933     // TODO: Only record a mutation effect if primaryEffectTag is non-zero.
       
 22934     recordEffect();
       
 22935 
       
 22936     resetCurrentFiber();
       
 22937     nextEffect = nextEffect.nextEffect;
       
 22938   }
       
 22939 }
       
 22940 
       
 22941 function commitLayoutEffects(root, committedExpirationTime) {
       
 22942   // TODO: Should probably move the bulk of this function to commitWork.
       
 22943   while (nextEffect !== null) {
       
 22944     setCurrentFiber(nextEffect);
       
 22945 
       
 22946     var effectTag = nextEffect.effectTag;
       
 22947 
       
 22948     if (effectTag & (Update | Callback)) {
       
 22949       recordEffect();
       
 22950       var current$$1 = nextEffect.alternate;
       
 22951       commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime);
       
 22952     }
       
 22953 
       
 22954     if (effectTag & Ref) {
       
 22955       recordEffect();
       
 22956       commitAttachRef(nextEffect);
       
 22957     }
       
 22958 
       
 22959     if (effectTag & Passive) {
       
 22960       rootDoesHavePassiveEffects = true;
       
 22961     }
       
 22962 
       
 22963     resetCurrentFiber();
       
 22964     nextEffect = nextEffect.nextEffect;
       
 22965   }
       
 22966 }
       
 22967 
       
 22968 function flushPassiveEffects() {
       
 22969   if (rootWithPendingPassiveEffects === null) {
       
 22970     return false;
       
 22971   }
       
 22972   var root = rootWithPendingPassiveEffects;
       
 22973   var expirationTime = pendingPassiveEffectsExpirationTime;
       
 22974   var renderPriorityLevel = pendingPassiveEffectsRenderPriority;
       
 22975   rootWithPendingPassiveEffects = null;
       
 22976   pendingPassiveEffectsExpirationTime = NoWork;
       
 22977   pendingPassiveEffectsRenderPriority = NoPriority;
       
 22978   var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
       
 22979   return runWithPriority$2(priorityLevel, flushPassiveEffectsImpl.bind(null, root, expirationTime));
       
 22980 }
       
 22981 
       
 22982 function flushPassiveEffectsImpl(root, expirationTime) {
       
 22983   var prevInteractions = null;
       
 22984   if (enableSchedulerTracing) {
       
 22985     prevInteractions = __interactionsRef.current;
       
 22986     __interactionsRef.current = root.memoizedInteractions;
       
 22987   }
       
 22988 
       
 22989   (function () {
       
 22990     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
       
 22991       {
       
 22992         throw ReactError(Error('Cannot flush passive effects while already rendering.'));
       
 22993       }
       
 22994     }
       
 22995   })();
       
 22996   var prevExecutionContext = executionContext;
       
 22997   executionContext |= CommitContext;
       
 22998 
       
 22999   // Note: This currently assumes there are no passive effects on the root
       
 23000   // fiber, because the root is not part of its own effect list. This could
       
 23001   // change in the future.
       
 23002   var effect = root.current.firstEffect;
       
 23003   while (effect !== null) {
       
 23004     {
       
 23005       setCurrentFiber(effect);
       
 23006       invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
       
 23007       if (hasCaughtError()) {
       
 23008         (function () {
       
 23009           if (!(effect !== null)) {
       
 23010             {
       
 23011               throw ReactError(Error('Should be working on an effect.'));
       
 23012             }
       
 23013           }
       
 23014         })();
       
 23015         var error = clearCaughtError();
       
 23016         captureCommitPhaseError(effect, error);
       
 23017       }
       
 23018       resetCurrentFiber();
       
 23019     }
       
 23020     var nextNextEffect = effect.nextEffect;
       
 23021     // Remove nextEffect pointer to assist GC
       
 23022     effect.nextEffect = null;
       
 23023     effect = nextNextEffect;
       
 23024   }
       
 23025 
       
 23026   if (enableSchedulerTracing) {
       
 23027     __interactionsRef.current = prevInteractions;
       
 23028     finishPendingInteractions(root, expirationTime);
       
 23029   }
       
 23030 
       
 23031   executionContext = prevExecutionContext;
       
 23032   flushSyncCallbackQueue();
       
 23033 
       
 23034   // If additional passive effects were scheduled, increment a counter. If this
       
 23035   // exceeds the limit, we'll fire a warning.
       
 23036   nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
       
 23037 
       
 23038   return true;
       
 23039 }
       
 23040 
       
 23041 function isAlreadyFailedLegacyErrorBoundary(instance) {
       
 23042   return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
       
 23043 }
       
 23044 
       
 23045 function markLegacyErrorBoundaryAsFailed(instance) {
       
 23046   if (legacyErrorBoundariesThatAlreadyFailed === null) {
       
 23047     legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
       
 23048   } else {
       
 23049     legacyErrorBoundariesThatAlreadyFailed.add(instance);
       
 23050   }
       
 23051 }
       
 23052 
       
 23053 function prepareToThrowUncaughtError(error) {
       
 23054   if (!hasUncaughtError) {
       
 23055     hasUncaughtError = true;
       
 23056     firstUncaughtError = error;
       
 23057   }
       
 23058 }
       
 23059 var onUncaughtError = prepareToThrowUncaughtError;
       
 23060 
       
 23061 function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
       
 23062   var errorInfo = createCapturedValue(error, sourceFiber);
       
 23063   var update = createRootErrorUpdate(rootFiber, errorInfo, Sync);
       
 23064   enqueueUpdate(rootFiber, update);
       
 23065   var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync);
       
 23066   if (root !== null) {
       
 23067     scheduleCallbackForRoot(root, ImmediatePriority, Sync);
       
 23068   }
       
 23069 }
       
 23070 
       
 23071 function captureCommitPhaseError(sourceFiber, error) {
       
 23072   if (sourceFiber.tag === HostRoot) {
       
 23073     // Error was thrown at the root. There is no parent, so the root
       
 23074     // itself should capture it.
       
 23075     captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
       
 23076     return;
       
 23077   }
       
 23078 
       
 23079   var fiber = sourceFiber.return;
       
 23080   while (fiber !== null) {
       
 23081     if (fiber.tag === HostRoot) {
       
 23082       captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
       
 23083       return;
       
 23084     } else if (fiber.tag === ClassComponent) {
       
 23085       var ctor = fiber.type;
       
 23086       var instance = fiber.stateNode;
       
 23087       if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
       
 23088         var errorInfo = createCapturedValue(error, sourceFiber);
       
 23089         var update = createClassErrorUpdate(fiber, errorInfo,
       
 23090         // TODO: This is always sync
       
 23091         Sync);
       
 23092         enqueueUpdate(fiber, update);
       
 23093         var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
       
 23094         if (root !== null) {
       
 23095           scheduleCallbackForRoot(root, ImmediatePriority, Sync);
       
 23096         }
       
 23097         return;
       
 23098       }
       
 23099     }
       
 23100     fiber = fiber.return;
       
 23101   }
       
 23102 }
       
 23103 
       
 23104 function pingSuspendedRoot(root, thenable, suspendedTime) {
       
 23105   var pingCache = root.pingCache;
       
 23106   if (pingCache !== null) {
       
 23107     // The thenable resolved, so we no longer need to memoize, because it will
       
 23108     // never be thrown again.
       
 23109     pingCache.delete(thenable);
       
 23110   }
       
 23111 
       
 23112   if (workInProgressRoot === root && renderExpirationTime === suspendedTime) {
       
 23113     // Received a ping at the same priority level at which we're currently
       
 23114     // rendering. We might want to restart this render. This should mirror
       
 23115     // the logic of whether or not a root suspends once it completes.
       
 23116 
       
 23117     // TODO: If we're rendering sync either due to Sync, Batched or expired,
       
 23118     // we should probably never restart.
       
 23119 
       
 23120     // If we're suspended with delay, we'll always suspend so we can always
       
 23121     // restart. If we're suspended without any updates, it might be a retry.
       
 23122     // If it's early in the retry we can restart. We can't know for sure
       
 23123     // whether we'll eventually process an update during this render pass,
       
 23124     // but it's somewhat unlikely that we get to a ping before that, since
       
 23125     // getting to the root most update is usually very fast.
       
 23126     if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
       
 23127       // Restart from the root. Don't need to schedule a ping because
       
 23128       // we're already working on this tree.
       
 23129       prepareFreshStack(root, renderExpirationTime);
       
 23130     } else {
       
 23131       // Even though we can't restart right now, we might get an
       
 23132       // opportunity later. So we mark this render as having a ping.
       
 23133       workInProgressRootHasPendingPing = true;
       
 23134     }
       
 23135     return;
       
 23136   }
       
 23137 
       
 23138   var lastPendingTime = root.lastPendingTime;
       
 23139   if (lastPendingTime < suspendedTime) {
       
 23140     // The root is no longer suspended at this time.
       
 23141     return;
       
 23142   }
       
 23143 
       
 23144   var pingTime = root.pingTime;
       
 23145   if (pingTime !== NoWork && pingTime < suspendedTime) {
       
 23146     // There's already a lower priority ping scheduled.
       
 23147     return;
       
 23148   }
       
 23149 
       
 23150   // Mark the time at which this ping was scheduled.
       
 23151   root.pingTime = suspendedTime;
       
 23152 
       
 23153   if (root.finishedExpirationTime === suspendedTime) {
       
 23154     // If there's a pending fallback waiting to commit, throw it away.
       
 23155     root.finishedExpirationTime = NoWork;
       
 23156     root.finishedWork = null;
       
 23157   }
       
 23158 
       
 23159   var currentTime = requestCurrentTime();
       
 23160   var priorityLevel = inferPriorityFromExpirationTime(currentTime, suspendedTime);
       
 23161   scheduleCallbackForRoot(root, priorityLevel, suspendedTime);
       
 23162 }
       
 23163 
       
 23164 function retryTimedOutBoundary(boundaryFiber) {
       
 23165   // The boundary fiber (a Suspense component or SuspenseList component)
       
 23166   // previously was rendered in its fallback state. One of the promises that
       
 23167   // suspended it has resolved, which means at least part of the tree was
       
 23168   // likely unblocked. Try rendering again, at a new expiration time.
       
 23169   var currentTime = requestCurrentTime();
       
 23170   var suspenseConfig = null; // Retries don't carry over the already committed update.
       
 23171   var retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
       
 23172   // TODO: Special case idle priority?
       
 23173   var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime);
       
 23174   var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime);
       
 23175   if (root !== null) {
       
 23176     scheduleCallbackForRoot(root, priorityLevel, retryTime);
       
 23177   }
       
 23178 }
       
 23179 
       
 23180 function resolveRetryThenable(boundaryFiber, thenable) {
       
 23181   var retryCache = void 0;
       
 23182   if (enableSuspenseServerRenderer) {
       
 23183     switch (boundaryFiber.tag) {
       
 23184       case SuspenseComponent:
       
 23185         retryCache = boundaryFiber.stateNode;
       
 23186         break;
       
 23187       case DehydratedSuspenseComponent:
       
 23188         retryCache = boundaryFiber.memoizedState;
       
 23189         break;
       
 23190       default:
       
 23191         (function () {
       
 23192           {
       
 23193             {
       
 23194               throw ReactError(Error('Pinged unknown suspense boundary type. This is probably a bug in React.'));
       
 23195             }
       
 23196           }
       
 23197         })();
       
 23198     }
       
 23199   } else {
       
 23200     retryCache = boundaryFiber.stateNode;
       
 23201   }
       
 23202 
       
 23203   if (retryCache !== null) {
       
 23204     // The thenable resolved, so we no longer need to memoize, because it will
       
 23205     // never be thrown again.
       
 23206     retryCache.delete(thenable);
       
 23207   }
       
 23208 
       
 23209   retryTimedOutBoundary(boundaryFiber);
       
 23210 }
       
 23211 
       
 23212 // Computes the next Just Noticeable Difference (JND) boundary.
       
 23213 // The theory is that a person can't tell the difference between small differences in time.
       
 23214 // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable
       
 23215 // difference in the experience. However, waiting for longer might mean that we can avoid
       
 23216 // showing an intermediate loading state. The longer we have already waited, the harder it
       
 23217 // is to tell small differences in time. Therefore, the longer we've already waited,
       
 23218 // the longer we can wait additionally. At some point we have to give up though.
       
 23219 // We pick a train model where the next boundary commits at a consistent schedule.
       
 23220 // These particular numbers are vague estimates. We expect to adjust them based on research.
       
 23221 function jnd(timeElapsed) {
       
 23222   return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
       
 23223 }
       
 23224 
       
 23225 function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) {
       
 23226   var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0;
       
 23227   if (busyMinDurationMs <= 0) {
       
 23228     return 0;
       
 23229   }
       
 23230   var busyDelayMs = suspenseConfig.busyDelayMs | 0;
       
 23231 
       
 23232   // Compute the time until this render pass would expire.
       
 23233   var currentTimeMs = now();
       
 23234   var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig);
       
 23235   var timeElapsed = currentTimeMs - eventTimeMs;
       
 23236   if (timeElapsed <= busyDelayMs) {
       
 23237     // If we haven't yet waited longer than the initial delay, we don't
       
 23238     // have to wait any additional time.
       
 23239     return 0;
       
 23240   }
       
 23241   var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed;
       
 23242   // This is the value that is passed to `setTimeout`.
       
 23243   return msUntilTimeout;
       
 23244 }
       
 23245 
       
 23246 function checkForNestedUpdates() {
       
 23247   if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
       
 23248     nestedUpdateCount = 0;
       
 23249     rootWithNestedUpdates = null;
       
 23250     (function () {
       
 23251       {
       
 23252         {
       
 23253           throw ReactError(Error('Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.'));
       
 23254         }
       
 23255       }
       
 23256     })();
       
 23257   }
       
 23258 
       
 23259   {
       
 23260     if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
       
 23261       nestedPassiveUpdateCount = 0;
       
 23262       warning$1(false, 'Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.');
       
 23263     }
       
 23264   }
       
 23265 }
       
 23266 
       
 23267 function flushRenderPhaseStrictModeWarningsInDEV() {
       
 23268   {
       
 23269     ReactStrictModeWarnings.flushLegacyContextWarning();
       
 23270 
       
 23271     if (warnAboutDeprecatedLifecycles) {
       
 23272       ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
       
 23273     }
       
 23274   }
       
 23275 }
       
 23276 
       
 23277 function stopFinishedWorkLoopTimer() {
       
 23278   var didCompleteRoot = true;
       
 23279   stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 23280   interruptedBy = null;
       
 23281 }
       
 23282 
       
 23283 function stopInterruptedWorkLoopTimer() {
       
 23284   // TODO: Track which fiber caused the interruption.
       
 23285   var didCompleteRoot = false;
       
 23286   stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 23287   interruptedBy = null;
       
 23288 }
       
 23289 
       
 23290 function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) {
       
 23291   if (enableUserTimingAPI && workInProgressRoot !== null && updateExpirationTime > renderExpirationTime) {
       
 23292     interruptedBy = fiberThatReceivedUpdate;
       
 23293   }
       
 23294 }
       
 23295 
       
 23296 var didWarnStateUpdateForUnmountedComponent = null;
       
 23297 function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
       
 23298   {
       
 23299     var tag = fiber.tag;
       
 23300     if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
       
 23301       // Only warn for user-defined components, not internal ones like Suspense.
       
 23302       return;
       
 23303     }
       
 23304     // We show the whole stack but dedupe on the top component's name because
       
 23305     // the problematic code almost always lies inside that component.
       
 23306     var componentName = getComponentName(fiber.type) || 'ReactComponent';
       
 23307     if (didWarnStateUpdateForUnmountedComponent !== null) {
       
 23308       if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
       
 23309         return;
       
 23310       }
       
 23311       didWarnStateUpdateForUnmountedComponent.add(componentName);
       
 23312     } else {
       
 23313       didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
       
 23314     }
       
 23315     warningWithoutStack$1(false, "Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
       
 23316   }
       
 23317 }
       
 23318 
       
 23319 var beginWork$$1 = void 0;
       
 23320 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 23321   var dummyFiber = null;
       
 23322   beginWork$$1 = function (current$$1, unitOfWork, expirationTime) {
       
 23323     // If a component throws an error, we replay it again in a synchronously
       
 23324     // dispatched event, so that the debugger will treat it as an uncaught
       
 23325     // error See ReactErrorUtils for more information.
       
 23326 
       
 23327     // Before entering the begin phase, copy the work-in-progress onto a dummy
       
 23328     // fiber. If beginWork throws, we'll use this to reset the state.
       
 23329     var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
 20542     try {
 23330     try {
 20543       return fn(a);
 23331       return beginWork$1(current$$1, unitOfWork, expirationTime);
 20544     } finally {
 23332     } catch (originalError) {
 20545       isUnbatchingUpdates = false;
 23333       if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
 20546     }
 23334         // Don't replay promises. Treat everything else like an error.
 20547   }
 23335         throw originalError;
 20548   return fn(a);
 23336       }
 20549 }
 23337 
 20550 
 23338       // Keep this code in sync with renderRoot; any changes here must have
 20551 // TODO: Batching should be implemented at the renderer level, not within
 23339       // corresponding changes there.
 20552 // the reconciler.
 23340       resetContextDependencies();
 20553 function flushSync(fn, a) {
 23341       resetHooks();
 20554   !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0;
 23342 
 20555   var previousIsBatchingUpdates = isBatchingUpdates;
 23343       // Unwind the failed stack frame
 20556   isBatchingUpdates = true;
 23344       unwindInterruptedWork(unitOfWork);
       
 23345 
       
 23346       // Restore the original properties of the fiber.
       
 23347       assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
       
 23348 
       
 23349       if (enableProfilerTimer && unitOfWork.mode & ProfileMode) {
       
 23350         // Reset the profiler timer.
       
 23351         startProfilerTimer(unitOfWork);
       
 23352       }
       
 23353 
       
 23354       // Run beginWork again.
       
 23355       invokeGuardedCallback(null, beginWork$1, null, current$$1, unitOfWork, expirationTime);
       
 23356 
       
 23357       if (hasCaughtError()) {
       
 23358         var replayError = clearCaughtError();
       
 23359         // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`.
       
 23360         // Rethrow this error instead of the original one.
       
 23361         throw replayError;
       
 23362       } else {
       
 23363         // This branch is reachable if the render phase is impure.
       
 23364         throw originalError;
       
 23365       }
       
 23366     }
       
 23367   };
       
 23368 } else {
       
 23369   beginWork$$1 = beginWork$1;
       
 23370 }
       
 23371 
       
 23372 var didWarnAboutUpdateInRender = false;
       
 23373 var didWarnAboutUpdateInGetChildContext = false;
       
 23374 function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) {
       
 23375   {
       
 23376     if (fiber.tag === ClassComponent) {
       
 23377       switch (phase) {
       
 23378         case 'getChildContext':
       
 23379           if (didWarnAboutUpdateInGetChildContext) {
       
 23380             return;
       
 23381           }
       
 23382           warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
       
 23383           didWarnAboutUpdateInGetChildContext = true;
       
 23384           break;
       
 23385         case 'render':
       
 23386           if (didWarnAboutUpdateInRender) {
       
 23387             return;
       
 23388           }
       
 23389           warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure function of ' + 'props and state.');
       
 23390           didWarnAboutUpdateInRender = true;
       
 23391           break;
       
 23392       }
       
 23393     }
       
 23394   }
       
 23395 }
       
 23396 
       
 23397 // a 'shared' variable that changes when act() opens/closes in tests.
       
 23398 var IsThisRendererActing = { current: false };
       
 23399 
       
 23400 function warnIfNotScopedWithMatchingAct(fiber) {
       
 23401   {
       
 23402     if (warnsIfNotActing === true && IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
       
 23403       warningWithoutStack$1(false, "It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '//...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '//...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber));
       
 23404     }
       
 23405   }
       
 23406 }
       
 23407 
       
 23408 function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
       
 23409   {
       
 23410     if (warnsIfNotActing === true && (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
       
 23411       warningWithoutStack$1(false, 'An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
       
 23412     }
       
 23413   }
       
 23414 }
       
 23415 
       
 23416 function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
       
 23417   {
       
 23418     if (warnsIfNotActing === true && executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
       
 23419       warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
       
 23420     }
       
 23421   }
       
 23422 }
       
 23423 
       
 23424 var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV;
       
 23425 
       
 23426 // In tests, we want to enforce a mocked scheduler.
       
 23427 var didWarnAboutUnmockedScheduler = false;
       
 23428 // TODO Before we release concurrent mode, revisit this and decide whether a mocked
       
 23429 // scheduler is the actual recommendation. The alternative could be a testing build,
       
 23430 // a new lib, or whatever; we dunno just yet. This message is for early adopters
       
 23431 // to get their tests right.
       
 23432 
       
 23433 function warnIfUnmockedScheduler(fiber) {
       
 23434   {
       
 23435     if (didWarnAboutUnmockedScheduler === false && unstable_flushAllWithoutAsserting === undefined) {
       
 23436       if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {
       
 23437         didWarnAboutUnmockedScheduler = true;
       
 23438         warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
       
 23439       } else if (warnAboutUnmockedScheduler === true) {
       
 23440         didWarnAboutUnmockedScheduler = true;
       
 23441         warningWithoutStack$1(false, 'Starting from React v17, the "scheduler" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
       
 23442       }
       
 23443     }
       
 23444   }
       
 23445 }
       
 23446 
       
 23447 var componentsThatTriggeredHighPriSuspend = null;
       
 23448 function checkForWrongSuspensePriorityInDEV(sourceFiber) {
       
 23449   {
       
 23450     var currentPriorityLevel = getCurrentPriorityLevel();
       
 23451     if ((sourceFiber.mode & ConcurrentMode) !== NoEffect && (currentPriorityLevel === UserBlockingPriority$2 || currentPriorityLevel === ImmediatePriority)) {
       
 23452       var workInProgressNode = sourceFiber;
       
 23453       while (workInProgressNode !== null) {
       
 23454         // Add the component that triggered the suspense
       
 23455         var current$$1 = workInProgressNode.alternate;
       
 23456         if (current$$1 !== null) {
       
 23457           // TODO: warn component that triggers the high priority
       
 23458           // suspend is the HostRoot
       
 23459           switch (workInProgressNode.tag) {
       
 23460             case ClassComponent:
       
 23461               // Loop through the component's update queue and see whether the component
       
 23462               // has triggered any high priority updates
       
 23463               var updateQueue = current$$1.updateQueue;
       
 23464               if (updateQueue !== null) {
       
 23465                 var update = updateQueue.firstUpdate;
       
 23466                 while (update !== null) {
       
 23467                   var priorityLevel = update.priority;
       
 23468                   if (priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority) {
       
 23469                     if (componentsThatTriggeredHighPriSuspend === null) {
       
 23470                       componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
       
 23471                     } else {
       
 23472                       componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
       
 23473                     }
       
 23474                     break;
       
 23475                   }
       
 23476                   update = update.next;
       
 23477                 }
       
 23478               }
       
 23479               break;
       
 23480             case FunctionComponent:
       
 23481             case ForwardRef:
       
 23482             case SimpleMemoComponent:
       
 23483               if (workInProgressNode.memoizedState !== null && workInProgressNode.memoizedState.baseUpdate !== null) {
       
 23484                 var _update = workInProgressNode.memoizedState.baseUpdate;
       
 23485                 // Loop through the functional component's memoized state to see whether
       
 23486                 // the component has triggered any high pri updates
       
 23487                 while (_update !== null) {
       
 23488                   var priority = _update.priority;
       
 23489                   if (priority === UserBlockingPriority$2 || priority === ImmediatePriority) {
       
 23490                     if (componentsThatTriggeredHighPriSuspend === null) {
       
 23491                       componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
       
 23492                     } else {
       
 23493                       componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
       
 23494                     }
       
 23495                     break;
       
 23496                   }
       
 23497                   if (_update.next === workInProgressNode.memoizedState.baseUpdate) {
       
 23498                     break;
       
 23499                   }
       
 23500                   _update = _update.next;
       
 23501                 }
       
 23502               }
       
 23503               break;
       
 23504             default:
       
 23505               break;
       
 23506           }
       
 23507         }
       
 23508         workInProgressNode = workInProgressNode.return;
       
 23509       }
       
 23510     }
       
 23511   }
       
 23512 }
       
 23513 
       
 23514 function flushSuspensePriorityWarningInDEV() {
       
 23515   {
       
 23516     if (componentsThatTriggeredHighPriSuspend !== null) {
       
 23517       var componentNames = [];
       
 23518       componentsThatTriggeredHighPriSuspend.forEach(function (name) {
       
 23519         return componentNames.push(name);
       
 23520       });
       
 23521       componentsThatTriggeredHighPriSuspend = null;
       
 23522 
       
 23523       if (componentNames.length > 0) {
       
 23524         warningWithoutStack$1(false, '%s triggered a user-blocking update that suspended.' + '\n\n' + 'The fix is to split the update into multiple parts: a user-blocking ' + 'update to provide immediate feedback, and another update that ' + 'triggers the bulk of the changes.' + '\n\n' + 'Refer to the documentation for useSuspenseTransition to learn how ' + 'to implement this pattern.',
       
 23525         // TODO: Add link to React docs with more information, once it exists
       
 23526         componentNames.sort().join(', '));
       
 23527       }
       
 23528     }
       
 23529   }
       
 23530 }
       
 23531 
       
 23532 function computeThreadID(root, expirationTime) {
       
 23533   // Interaction threads are unique per root and expiration time.
       
 23534   return expirationTime * 1000 + root.interactionThreadID;
       
 23535 }
       
 23536 
       
 23537 function markSpawnedWork(expirationTime) {
       
 23538   if (!enableSchedulerTracing) {
       
 23539     return;
       
 23540   }
       
 23541   if (spawnedWorkDuringRender === null) {
       
 23542     spawnedWorkDuringRender = [expirationTime];
       
 23543   } else {
       
 23544     spawnedWorkDuringRender.push(expirationTime);
       
 23545   }
       
 23546 }
       
 23547 
       
 23548 function scheduleInteractions(root, expirationTime, interactions) {
       
 23549   if (!enableSchedulerTracing) {
       
 23550     return;
       
 23551   }
       
 23552 
       
 23553   if (interactions.size > 0) {
       
 23554     var pendingInteractionMap = root.pendingInteractionMap;
       
 23555     var pendingInteractions = pendingInteractionMap.get(expirationTime);
       
 23556     if (pendingInteractions != null) {
       
 23557       interactions.forEach(function (interaction) {
       
 23558         if (!pendingInteractions.has(interaction)) {
       
 23559           // Update the pending async work count for previously unscheduled interaction.
       
 23560           interaction.__count++;
       
 23561         }
       
 23562 
       
 23563         pendingInteractions.add(interaction);
       
 23564       });
       
 23565     } else {
       
 23566       pendingInteractionMap.set(expirationTime, new Set(interactions));
       
 23567 
       
 23568       // Update the pending async work count for the current interactions.
       
 23569       interactions.forEach(function (interaction) {
       
 23570         interaction.__count++;
       
 23571       });
       
 23572     }
       
 23573 
       
 23574     var subscriber = __subscriberRef.current;
       
 23575     if (subscriber !== null) {
       
 23576       var threadID = computeThreadID(root, expirationTime);
       
 23577       subscriber.onWorkScheduled(interactions, threadID);
       
 23578     }
       
 23579   }
       
 23580 }
       
 23581 
       
 23582 function schedulePendingInteractions(root, expirationTime) {
       
 23583   // This is called when work is scheduled on a root.
       
 23584   // It associates the current interactions with the newly-scheduled expiration.
       
 23585   // They will be restored when that expiration is later committed.
       
 23586   if (!enableSchedulerTracing) {
       
 23587     return;
       
 23588   }
       
 23589 
       
 23590   scheduleInteractions(root, expirationTime, __interactionsRef.current);
       
 23591 }
       
 23592 
       
 23593 function startWorkOnPendingInteractions(root, expirationTime) {
       
 23594   // This is called when new work is started on a root.
       
 23595   if (!enableSchedulerTracing) {
       
 23596     return;
       
 23597   }
       
 23598 
       
 23599   // Determine which interactions this batch of work currently includes, So that
       
 23600   // we can accurately attribute time spent working on it, And so that cascading
       
 23601   // work triggered during the render phase will be associated with it.
       
 23602   var interactions = new Set();
       
 23603   root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 23604     if (scheduledExpirationTime >= expirationTime) {
       
 23605       scheduledInteractions.forEach(function (interaction) {
       
 23606         return interactions.add(interaction);
       
 23607       });
       
 23608     }
       
 23609   });
       
 23610 
       
 23611   // Store the current set of interactions on the FiberRoot for a few reasons:
       
 23612   // We can re-use it in hot functions like renderRoot() without having to
       
 23613   // recalculate it. We will also use it in commitWork() to pass to any Profiler
       
 23614   // onRender() hooks. This also provides DevTools with a way to access it when
       
 23615   // the onCommitRoot() hook is called.
       
 23616   root.memoizedInteractions = interactions;
       
 23617 
       
 23618   if (interactions.size > 0) {
       
 23619     var subscriber = __subscriberRef.current;
       
 23620     if (subscriber !== null) {
       
 23621       var threadID = computeThreadID(root, expirationTime);
       
 23622       try {
       
 23623         subscriber.onWorkStarted(interactions, threadID);
       
 23624       } catch (error) {
       
 23625         // If the subscriber throws, rethrow it in a separate task
       
 23626         scheduleCallback(ImmediatePriority, function () {
       
 23627           throw error;
       
 23628         });
       
 23629       }
       
 23630     }
       
 23631   }
       
 23632 }
       
 23633 
       
 23634 function finishPendingInteractions(root, committedExpirationTime) {
       
 23635   if (!enableSchedulerTracing) {
       
 23636     return;
       
 23637   }
       
 23638 
       
 23639   var earliestRemainingTimeAfterCommit = root.firstPendingTime;
       
 23640 
       
 23641   var subscriber = void 0;
       
 23642 
 20557   try {
 23643   try {
 20558     return syncUpdates(fn, a);
 23644     subscriber = __subscriberRef.current;
 20559   } finally {
 23645     if (subscriber !== null && root.memoizedInteractions.size > 0) {
 20560     isBatchingUpdates = previousIsBatchingUpdates;
 23646       var threadID = computeThreadID(root, committedExpirationTime);
 20561     performSyncWork();
 23647       subscriber.onWorkStopped(root.memoizedInteractions, threadID);
 20562   }
 23648     }
 20563 }
 23649   } catch (error) {
 20564 
 23650     // If the subscriber throws, rethrow it in a separate task
 20565 function interactiveUpdates$1(fn, a, b) {
 23651     scheduleCallback(ImmediatePriority, function () {
 20566   // If there are any pending interactive updates, synchronously flush them.
 23652       throw error;
 20567   // This needs to happen before we read any handlers, because the effect of
       
 20568   // the previous event may influence which handlers are called during
       
 20569   // this event.
       
 20570   if (!isBatchingUpdates && !isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
       
 20571     // Synchronously flush pending interactive updates.
       
 20572     performWork(lowestPriorityPendingInteractiveExpirationTime, false);
       
 20573     lowestPriorityPendingInteractiveExpirationTime = NoWork;
       
 20574   }
       
 20575   var previousIsBatchingUpdates = isBatchingUpdates;
       
 20576   isBatchingUpdates = true;
       
 20577   try {
       
 20578     return unstable_runWithPriority(unstable_UserBlockingPriority, function () {
       
 20579       return fn(a, b);
       
 20580     });
 23653     });
 20581   } finally {
 23654   } finally {
 20582     isBatchingUpdates = previousIsBatchingUpdates;
 23655     // Clear completed interactions from the pending Map.
 20583     if (!isBatchingUpdates && !isRendering) {
 23656     // Unless the render was suspended or cascading work was scheduled,
 20584       performSyncWork();
 23657     // In which case– leave pending interactions until the subsequent render.
 20585     }
 23658     var pendingInteractionMap = root.pendingInteractionMap;
 20586   }
 23659     pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
 20587 }
 23660       // Only decrement the pending interaction count if we're done.
 20588 
 23661       // If there's still work at the current priority,
 20589 function flushInteractiveUpdates$1() {
 23662       // That indicates that we are waiting for suspense data.
 20590   if (!isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
 23663       if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
 20591     // Synchronously flush pending interactive updates.
 23664         pendingInteractionMap.delete(scheduledExpirationTime);
 20592     performWork(lowestPriorityPendingInteractiveExpirationTime, false);
 23665 
 20593     lowestPriorityPendingInteractiveExpirationTime = NoWork;
 23666         scheduledInteractions.forEach(function (interaction) {
 20594   }
 23667           interaction.__count--;
 20595 }
 23668 
 20596 
 23669           if (subscriber !== null && interaction.__count === 0) {
 20597 function flushControlled(fn) {
 23670             try {
 20598   var previousIsBatchingUpdates = isBatchingUpdates;
 23671               subscriber.onInteractionScheduledWorkCompleted(interaction);
 20599   isBatchingUpdates = true;
 23672             } catch (error) {
       
 23673               // If the subscriber throws, rethrow it in a separate task
       
 23674               scheduleCallback(ImmediatePriority, function () {
       
 23675                 throw error;
       
 23676               });
       
 23677             }
       
 23678           }
       
 23679         });
       
 23680       }
       
 23681     });
       
 23682   }
       
 23683 }
       
 23684 
       
 23685 var onCommitFiberRoot = null;
       
 23686 var onCommitFiberUnmount = null;
       
 23687 var hasLoggedError = false;
       
 23688 
       
 23689 var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
       
 23690 
       
 23691 function injectInternals(internals) {
       
 23692   if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
       
 23693     // No DevTools
       
 23694     return false;
       
 23695   }
       
 23696   var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
       
 23697   if (hook.isDisabled) {
       
 23698     // This isn't a real property on the hook, but it can be set to opt out
       
 23699     // of DevTools integration and associated warnings and logs.
       
 23700     // https://github.com/facebook/react/issues/3877
       
 23701     return true;
       
 23702   }
       
 23703   if (!hook.supportsFiber) {
       
 23704     {
       
 23705       warningWithoutStack$1(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
       
 23706     }
       
 23707     // DevTools exists, even though it doesn't support Fiber.
       
 23708     return true;
       
 23709   }
 20600   try {
 23710   try {
 20601     syncUpdates(fn);
 23711     var rendererID = hook.inject(internals);
 20602   } finally {
 23712     // We have successfully injected, so now it is safe to set up hooks.
 20603     isBatchingUpdates = previousIsBatchingUpdates;
 23713     onCommitFiberRoot = function (root, expirationTime) {
 20604     if (!isBatchingUpdates && !isRendering) {
 23714       try {
 20605       performSyncWork();
 23715         var didError = (root.current.effectTag & DidCapture) === DidCapture;
 20606     }
 23716         if (enableProfilerTimer) {
 20607   }
 23717           var currentTime = requestCurrentTime();
 20608 }
 23718           var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
       
 23719           hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
       
 23720         } else {
       
 23721           hook.onCommitFiberRoot(rendererID, root, undefined, didError);
       
 23722         }
       
 23723       } catch (err) {
       
 23724         if (true && !hasLoggedError) {
       
 23725           hasLoggedError = true;
       
 23726           warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
       
 23727         }
       
 23728       }
       
 23729     };
       
 23730     onCommitFiberUnmount = function (fiber) {
       
 23731       try {
       
 23732         hook.onCommitFiberUnmount(rendererID, fiber);
       
 23733       } catch (err) {
       
 23734         if (true && !hasLoggedError) {
       
 23735           hasLoggedError = true;
       
 23736           warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
       
 23737         }
       
 23738       }
       
 23739     };
       
 23740   } catch (err) {
       
 23741     // Catch all errors because it is unsafe to throw during initialization.
       
 23742     {
       
 23743       warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
       
 23744     }
       
 23745   }
       
 23746   // DevTools exists
       
 23747   return true;
       
 23748 }
       
 23749 
       
 23750 function onCommitRoot(root, expirationTime) {
       
 23751   if (typeof onCommitFiberRoot === 'function') {
       
 23752     onCommitFiberRoot(root, expirationTime);
       
 23753   }
       
 23754 }
       
 23755 
       
 23756 function onCommitUnmount(fiber) {
       
 23757   if (typeof onCommitFiberUnmount === 'function') {
       
 23758     onCommitFiberUnmount(fiber);
       
 23759   }
       
 23760 }
       
 23761 
       
 23762 var hasBadMapPolyfill = void 0;
       
 23763 
       
 23764 {
       
 23765   hasBadMapPolyfill = false;
       
 23766   try {
       
 23767     var nonExtensibleObject = Object.preventExtensions({});
       
 23768     var testMap = new Map([[nonExtensibleObject, null]]);
       
 23769     var testSet = new Set([nonExtensibleObject]);
       
 23770     // This is necessary for Rollup to not consider these unused.
       
 23771     // https://github.com/rollup/rollup/issues/1771
       
 23772     // TODO: we can remove these if Rollup fixes the bug.
       
 23773     testMap.set(0, 0);
       
 23774     testSet.add(0);
       
 23775   } catch (e) {
       
 23776     // TODO: Consider warning about bad polyfills
       
 23777     hasBadMapPolyfill = true;
       
 23778   }
       
 23779 }
       
 23780 
       
 23781 // A Fiber is work on a Component that needs to be done or was done. There can
       
 23782 // be more than one per component.
       
 23783 
       
 23784 
       
 23785 var debugCounter = void 0;
       
 23786 
       
 23787 {
       
 23788   debugCounter = 1;
       
 23789 }
       
 23790 
       
 23791 function FiberNode(tag, pendingProps, key, mode) {
       
 23792   // Instance
       
 23793   this.tag = tag;
       
 23794   this.key = key;
       
 23795   this.elementType = null;
       
 23796   this.type = null;
       
 23797   this.stateNode = null;
       
 23798 
       
 23799   // Fiber
       
 23800   this.return = null;
       
 23801   this.child = null;
       
 23802   this.sibling = null;
       
 23803   this.index = 0;
       
 23804 
       
 23805   this.ref = null;
       
 23806 
       
 23807   this.pendingProps = pendingProps;
       
 23808   this.memoizedProps = null;
       
 23809   this.updateQueue = null;
       
 23810   this.memoizedState = null;
       
 23811   this.dependencies = null;
       
 23812 
       
 23813   this.mode = mode;
       
 23814 
       
 23815   // Effects
       
 23816   this.effectTag = NoEffect;
       
 23817   this.nextEffect = null;
       
 23818 
       
 23819   this.firstEffect = null;
       
 23820   this.lastEffect = null;
       
 23821 
       
 23822   this.expirationTime = NoWork;
       
 23823   this.childExpirationTime = NoWork;
       
 23824 
       
 23825   this.alternate = null;
       
 23826 
       
 23827   if (enableProfilerTimer) {
       
 23828     // Note: The following is done to avoid a v8 performance cliff.
       
 23829     //
       
 23830     // Initializing the fields below to smis and later updating them with
       
 23831     // double values will cause Fibers to end up having separate shapes.
       
 23832     // This behavior/bug has something to do with Object.preventExtension().
       
 23833     // Fortunately this only impacts DEV builds.
       
 23834     // Unfortunately it makes React unusably slow for some applications.
       
 23835     // To work around this, initialize the fields below with doubles.
       
 23836     //
       
 23837     // Learn more about this here:
       
 23838     // https://github.com/facebook/react/issues/14365
       
 23839     // https://bugs.chromium.org/p/v8/issues/detail?id=8538
       
 23840     this.actualDuration = Number.NaN;
       
 23841     this.actualStartTime = Number.NaN;
       
 23842     this.selfBaseDuration = Number.NaN;
       
 23843     this.treeBaseDuration = Number.NaN;
       
 23844 
       
 23845     // It's okay to replace the initial doubles with smis after initialization.
       
 23846     // This won't trigger the performance cliff mentioned above,
       
 23847     // and it simplifies other profiler code (including DevTools).
       
 23848     this.actualDuration = 0;
       
 23849     this.actualStartTime = -1;
       
 23850     this.selfBaseDuration = 0;
       
 23851     this.treeBaseDuration = 0;
       
 23852   }
       
 23853 
       
 23854   {
       
 23855     this._debugID = debugCounter++;
       
 23856     this._debugSource = null;
       
 23857     this._debugOwner = null;
       
 23858     this._debugIsCurrentlyTiming = false;
       
 23859     this._debugNeedsRemount = false;
       
 23860     this._debugHookTypes = null;
       
 23861     if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
       
 23862       Object.preventExtensions(this);
       
 23863     }
       
 23864   }
       
 23865 }
       
 23866 
       
 23867 // This is a constructor function, rather than a POJO constructor, still
       
 23868 // please ensure we do the following:
       
 23869 // 1) Nobody should add any instance methods on this. Instance methods can be
       
 23870 //    more difficult to predict when they get optimized and they are almost
       
 23871 //    never inlined properly in static compilers.
       
 23872 // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
       
 23873 //    always know when it is a fiber.
       
 23874 // 3) We might want to experiment with using numeric keys since they are easier
       
 23875 //    to optimize in a non-JIT environment.
       
 23876 // 4) We can easily go from a constructor to a createFiber object literal if that
       
 23877 //    is faster.
       
 23878 // 5) It should be easy to port this to a C struct and keep a C implementation
       
 23879 //    compatible.
       
 23880 var createFiber = function (tag, pendingProps, key, mode) {
       
 23881   // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
       
 23882   return new FiberNode(tag, pendingProps, key, mode);
       
 23883 };
       
 23884 
       
 23885 function shouldConstruct(Component) {
       
 23886   var prototype = Component.prototype;
       
 23887   return !!(prototype && prototype.isReactComponent);
       
 23888 }
       
 23889 
       
 23890 function isSimpleFunctionComponent(type) {
       
 23891   return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
       
 23892 }
       
 23893 
       
 23894 function resolveLazyComponentTag(Component) {
       
 23895   if (typeof Component === 'function') {
       
 23896     return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
       
 23897   } else if (Component !== undefined && Component !== null) {
       
 23898     var $$typeof = Component.$$typeof;
       
 23899     if ($$typeof === REACT_FORWARD_REF_TYPE) {
       
 23900       return ForwardRef;
       
 23901     }
       
 23902     if ($$typeof === REACT_MEMO_TYPE) {
       
 23903       return MemoComponent;
       
 23904     }
       
 23905   }
       
 23906   return IndeterminateComponent;
       
 23907 }
       
 23908 
       
 23909 // This is used to create an alternate fiber to do work on.
       
 23910 function createWorkInProgress(current, pendingProps, expirationTime) {
       
 23911   var workInProgress = current.alternate;
       
 23912   if (workInProgress === null) {
       
 23913     // We use a double buffering pooling technique because we know that we'll
       
 23914     // only ever need at most two versions of a tree. We pool the "other" unused
       
 23915     // node that we're free to reuse. This is lazily created to avoid allocating
       
 23916     // extra objects for things that are never updated. It also allow us to
       
 23917     // reclaim the extra memory if needed.
       
 23918     workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
       
 23919     workInProgress.elementType = current.elementType;
       
 23920     workInProgress.type = current.type;
       
 23921     workInProgress.stateNode = current.stateNode;
       
 23922 
       
 23923     {
       
 23924       // DEV-only fields
       
 23925       workInProgress._debugID = current._debugID;
       
 23926       workInProgress._debugSource = current._debugSource;
       
 23927       workInProgress._debugOwner = current._debugOwner;
       
 23928       workInProgress._debugHookTypes = current._debugHookTypes;
       
 23929     }
       
 23930 
       
 23931     workInProgress.alternate = current;
       
 23932     current.alternate = workInProgress;
       
 23933   } else {
       
 23934     workInProgress.pendingProps = pendingProps;
       
 23935 
       
 23936     // We already have an alternate.
       
 23937     // Reset the effect tag.
       
 23938     workInProgress.effectTag = NoEffect;
       
 23939 
       
 23940     // The effect list is no longer valid.
       
 23941     workInProgress.nextEffect = null;
       
 23942     workInProgress.firstEffect = null;
       
 23943     workInProgress.lastEffect = null;
       
 23944 
       
 23945     if (enableProfilerTimer) {
       
 23946       // We intentionally reset, rather than copy, actualDuration & actualStartTime.
       
 23947       // This prevents time from endlessly accumulating in new commits.
       
 23948       // This has the downside of resetting values for different priority renders,
       
 23949       // But works for yielding (the common case) and should support resuming.
       
 23950       workInProgress.actualDuration = 0;
       
 23951       workInProgress.actualStartTime = -1;
       
 23952     }
       
 23953   }
       
 23954 
       
 23955   workInProgress.childExpirationTime = current.childExpirationTime;
       
 23956   workInProgress.expirationTime = current.expirationTime;
       
 23957 
       
 23958   workInProgress.child = current.child;
       
 23959   workInProgress.memoizedProps = current.memoizedProps;
       
 23960   workInProgress.memoizedState = current.memoizedState;
       
 23961   workInProgress.updateQueue = current.updateQueue;
       
 23962 
       
 23963   // Clone the dependencies object. This is mutated during the render phase, so
       
 23964   // it cannot be shared with the current fiber.
       
 23965   var currentDependencies = current.dependencies;
       
 23966   workInProgress.dependencies = currentDependencies === null ? null : {
       
 23967     expirationTime: currentDependencies.expirationTime,
       
 23968     firstContext: currentDependencies.firstContext,
       
 23969     responders: currentDependencies.responders
       
 23970   };
       
 23971 
       
 23972   // These will be overridden during the parent's reconciliation
       
 23973   workInProgress.sibling = current.sibling;
       
 23974   workInProgress.index = current.index;
       
 23975   workInProgress.ref = current.ref;
       
 23976 
       
 23977   if (enableProfilerTimer) {
       
 23978     workInProgress.selfBaseDuration = current.selfBaseDuration;
       
 23979     workInProgress.treeBaseDuration = current.treeBaseDuration;
       
 23980   }
       
 23981 
       
 23982   {
       
 23983     workInProgress._debugNeedsRemount = current._debugNeedsRemount;
       
 23984     switch (workInProgress.tag) {
       
 23985       case IndeterminateComponent:
       
 23986       case FunctionComponent:
       
 23987       case SimpleMemoComponent:
       
 23988         workInProgress.type = resolveFunctionForHotReloading(current.type);
       
 23989         break;
       
 23990       case ClassComponent:
       
 23991         workInProgress.type = resolveClassForHotReloading(current.type);
       
 23992         break;
       
 23993       case ForwardRef:
       
 23994         workInProgress.type = resolveForwardRefForHotReloading(current.type);
       
 23995         break;
       
 23996       default:
       
 23997         break;
       
 23998     }
       
 23999   }
       
 24000 
       
 24001   return workInProgress;
       
 24002 }
       
 24003 
       
 24004 // Used to reuse a Fiber for a second pass.
       
 24005 function resetWorkInProgress(workInProgress, renderExpirationTime) {
       
 24006   // This resets the Fiber to what createFiber or createWorkInProgress would
       
 24007   // have set the values to before during the first pass. Ideally this wouldn't
       
 24008   // be necessary but unfortunately many code paths reads from the workInProgress
       
 24009   // when they should be reading from current and writing to workInProgress.
       
 24010 
       
 24011   // We assume pendingProps, index, key, ref, return are still untouched to
       
 24012   // avoid doing another reconciliation.
       
 24013 
       
 24014   // Reset the effect tag but keep any Placement tags, since that's something
       
 24015   // that child fiber is setting, not the reconciliation.
       
 24016   workInProgress.effectTag &= Placement;
       
 24017 
       
 24018   // The effect list is no longer valid.
       
 24019   workInProgress.nextEffect = null;
       
 24020   workInProgress.firstEffect = null;
       
 24021   workInProgress.lastEffect = null;
       
 24022 
       
 24023   var current = workInProgress.alternate;
       
 24024   if (current === null) {
       
 24025     // Reset to createFiber's initial values.
       
 24026     workInProgress.childExpirationTime = NoWork;
       
 24027     workInProgress.expirationTime = renderExpirationTime;
       
 24028 
       
 24029     workInProgress.child = null;
       
 24030     workInProgress.memoizedProps = null;
       
 24031     workInProgress.memoizedState = null;
       
 24032     workInProgress.updateQueue = null;
       
 24033 
       
 24034     workInProgress.dependencies = null;
       
 24035 
       
 24036     if (enableProfilerTimer) {
       
 24037       // Note: We don't reset the actualTime counts. It's useful to accumulate
       
 24038       // actual time across multiple render passes.
       
 24039       workInProgress.selfBaseDuration = 0;
       
 24040       workInProgress.treeBaseDuration = 0;
       
 24041     }
       
 24042   } else {
       
 24043     // Reset to the cloned values that createWorkInProgress would've.
       
 24044     workInProgress.childExpirationTime = current.childExpirationTime;
       
 24045     workInProgress.expirationTime = current.expirationTime;
       
 24046 
       
 24047     workInProgress.child = current.child;
       
 24048     workInProgress.memoizedProps = current.memoizedProps;
       
 24049     workInProgress.memoizedState = current.memoizedState;
       
 24050     workInProgress.updateQueue = current.updateQueue;
       
 24051 
       
 24052     // Clone the dependencies object. This is mutated during the render phase, so
       
 24053     // it cannot be shared with the current fiber.
       
 24054     var currentDependencies = current.dependencies;
       
 24055     workInProgress.dependencies = currentDependencies === null ? null : {
       
 24056       expirationTime: currentDependencies.expirationTime,
       
 24057       firstContext: currentDependencies.firstContext,
       
 24058       responders: currentDependencies.responders
       
 24059     };
       
 24060 
       
 24061     if (enableProfilerTimer) {
       
 24062       // Note: We don't reset the actualTime counts. It's useful to accumulate
       
 24063       // actual time across multiple render passes.
       
 24064       workInProgress.selfBaseDuration = current.selfBaseDuration;
       
 24065       workInProgress.treeBaseDuration = current.treeBaseDuration;
       
 24066     }
       
 24067   }
       
 24068 
       
 24069   return workInProgress;
       
 24070 }
       
 24071 
       
 24072 function createHostRootFiber(tag) {
       
 24073   var mode = void 0;
       
 24074   if (tag === ConcurrentRoot) {
       
 24075     mode = ConcurrentMode | BatchedMode | StrictMode;
       
 24076   } else if (tag === BatchedRoot) {
       
 24077     mode = BatchedMode | StrictMode;
       
 24078   } else {
       
 24079     mode = NoMode;
       
 24080   }
       
 24081 
       
 24082   if (enableProfilerTimer && isDevToolsPresent) {
       
 24083     // Always collect profile timings when DevTools are present.
       
 24084     // This enables DevTools to start capturing timing at any point–
       
 24085     // Without some nodes in the tree having empty base times.
       
 24086     mode |= ProfileMode;
       
 24087   }
       
 24088 
       
 24089   return createFiber(HostRoot, null, null, mode);
       
 24090 }
       
 24091 
       
 24092 function createFiberFromTypeAndProps(type, // React$ElementType
       
 24093 key, pendingProps, owner, mode, expirationTime) {
       
 24094   var fiber = void 0;
       
 24095 
       
 24096   var fiberTag = IndeterminateComponent;
       
 24097   // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
       
 24098   var resolvedType = type;
       
 24099   if (typeof type === 'function') {
       
 24100     if (shouldConstruct(type)) {
       
 24101       fiberTag = ClassComponent;
       
 24102       {
       
 24103         resolvedType = resolveClassForHotReloading(resolvedType);
       
 24104       }
       
 24105     } else {
       
 24106       {
       
 24107         resolvedType = resolveFunctionForHotReloading(resolvedType);
       
 24108       }
       
 24109     }
       
 24110   } else if (typeof type === 'string') {
       
 24111     fiberTag = HostComponent;
       
 24112   } else {
       
 24113     getTag: switch (type) {
       
 24114       case REACT_FRAGMENT_TYPE:
       
 24115         return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
       
 24116       case REACT_CONCURRENT_MODE_TYPE:
       
 24117         fiberTag = Mode;
       
 24118         mode |= ConcurrentMode | BatchedMode | StrictMode;
       
 24119         break;
       
 24120       case REACT_STRICT_MODE_TYPE:
       
 24121         fiberTag = Mode;
       
 24122         mode |= StrictMode;
       
 24123         break;
       
 24124       case REACT_PROFILER_TYPE:
       
 24125         return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
       
 24126       case REACT_SUSPENSE_TYPE:
       
 24127         return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
       
 24128       case REACT_SUSPENSE_LIST_TYPE:
       
 24129         return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key);
       
 24130       default:
       
 24131         {
       
 24132           if (typeof type === 'object' && type !== null) {
       
 24133             switch (type.$$typeof) {
       
 24134               case REACT_PROVIDER_TYPE:
       
 24135                 fiberTag = ContextProvider;
       
 24136                 break getTag;
       
 24137               case REACT_CONTEXT_TYPE:
       
 24138                 // This is a consumer
       
 24139                 fiberTag = ContextConsumer;
       
 24140                 break getTag;
       
 24141               case REACT_FORWARD_REF_TYPE:
       
 24142                 fiberTag = ForwardRef;
       
 24143                 {
       
 24144                   resolvedType = resolveForwardRefForHotReloading(resolvedType);
       
 24145                 }
       
 24146                 break getTag;
       
 24147               case REACT_MEMO_TYPE:
       
 24148                 fiberTag = MemoComponent;
       
 24149                 break getTag;
       
 24150               case REACT_LAZY_TYPE:
       
 24151                 fiberTag = LazyComponent;
       
 24152                 resolvedType = null;
       
 24153                 break getTag;
       
 24154               case REACT_FUNDAMENTAL_TYPE:
       
 24155                 if (enableFundamentalAPI) {
       
 24156                   return createFiberFromFundamental(type, pendingProps, mode, expirationTime, key);
       
 24157                 }
       
 24158                 break;
       
 24159             }
       
 24160           }
       
 24161           var info = '';
       
 24162           {
       
 24163             if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
       
 24164               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.';
       
 24165             }
       
 24166             var ownerName = owner ? getComponentName(owner.type) : null;
       
 24167             if (ownerName) {
       
 24168               info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 24169             }
       
 24170           }
       
 24171           (function () {
       
 24172             {
       
 24173               {
       
 24174                 throw ReactError(Error('Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ' + (type == null ? type : typeof type) + '.' + info));
       
 24175               }
       
 24176             }
       
 24177           })();
       
 24178         }
       
 24179     }
       
 24180   }
       
 24181 
       
 24182   fiber = createFiber(fiberTag, pendingProps, key, mode);
       
 24183   fiber.elementType = type;
       
 24184   fiber.type = resolvedType;
       
 24185   fiber.expirationTime = expirationTime;
       
 24186 
       
 24187   return fiber;
       
 24188 }
       
 24189 
       
 24190 function createFiberFromElement(element, mode, expirationTime) {
       
 24191   var owner = null;
       
 24192   {
       
 24193     owner = element._owner;
       
 24194   }
       
 24195   var type = element.type;
       
 24196   var key = element.key;
       
 24197   var pendingProps = element.props;
       
 24198   var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
       
 24199   {
       
 24200     fiber._debugSource = element._source;
       
 24201     fiber._debugOwner = element._owner;
       
 24202   }
       
 24203   return fiber;
       
 24204 }
       
 24205 
       
 24206 function createFiberFromFragment(elements, mode, expirationTime, key) {
       
 24207   var fiber = createFiber(Fragment, elements, key, mode);
       
 24208   fiber.expirationTime = expirationTime;
       
 24209   return fiber;
       
 24210 }
       
 24211 
       
 24212 function createFiberFromFundamental(fundamentalComponent, pendingProps, mode, expirationTime, key) {
       
 24213   var fiber = createFiber(FundamentalComponent, pendingProps, key, mode);
       
 24214   fiber.elementType = fundamentalComponent;
       
 24215   fiber.type = fundamentalComponent;
       
 24216   fiber.expirationTime = expirationTime;
       
 24217   return fiber;
       
 24218 }
       
 24219 
       
 24220 function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
       
 24221   {
       
 24222     if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
       
 24223       warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
       
 24224     }
       
 24225   }
       
 24226 
       
 24227   var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
       
 24228   // TODO: The Profiler fiber shouldn't have a type. It has a tag.
       
 24229   fiber.elementType = REACT_PROFILER_TYPE;
       
 24230   fiber.type = REACT_PROFILER_TYPE;
       
 24231   fiber.expirationTime = expirationTime;
       
 24232 
       
 24233   return fiber;
       
 24234 }
       
 24235 
       
 24236 function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
       
 24237   var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
       
 24238 
       
 24239   // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
       
 24240   // This needs to be fixed in getComponentName so that it relies on the tag
       
 24241   // instead.
       
 24242   fiber.type = REACT_SUSPENSE_TYPE;
       
 24243   fiber.elementType = REACT_SUSPENSE_TYPE;
       
 24244 
       
 24245   fiber.expirationTime = expirationTime;
       
 24246   return fiber;
       
 24247 }
       
 24248 
       
 24249 function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) {
       
 24250   var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
       
 24251   {
       
 24252     // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag.
       
 24253     // This needs to be fixed in getComponentName so that it relies on the tag
       
 24254     // instead.
       
 24255     fiber.type = REACT_SUSPENSE_LIST_TYPE;
       
 24256   }
       
 24257   fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
       
 24258   fiber.expirationTime = expirationTime;
       
 24259   return fiber;
       
 24260 }
       
 24261 
       
 24262 function createFiberFromText(content, mode, expirationTime) {
       
 24263   var fiber = createFiber(HostText, content, null, mode);
       
 24264   fiber.expirationTime = expirationTime;
       
 24265   return fiber;
       
 24266 }
       
 24267 
       
 24268 function createFiberFromHostInstanceForDeletion() {
       
 24269   var fiber = createFiber(HostComponent, null, null, NoMode);
       
 24270   // TODO: These should not need a type.
       
 24271   fiber.elementType = 'DELETED';
       
 24272   fiber.type = 'DELETED';
       
 24273   return fiber;
       
 24274 }
       
 24275 
       
 24276 function createFiberFromPortal(portal, mode, expirationTime) {
       
 24277   var pendingProps = portal.children !== null ? portal.children : [];
       
 24278   var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
       
 24279   fiber.expirationTime = expirationTime;
       
 24280   fiber.stateNode = {
       
 24281     containerInfo: portal.containerInfo,
       
 24282     pendingChildren: null, // Used by persistent updates
       
 24283     implementation: portal.implementation
       
 24284   };
       
 24285   return fiber;
       
 24286 }
       
 24287 
       
 24288 // Used for stashing WIP properties to replay failed work in DEV.
       
 24289 function assignFiberPropertiesInDEV(target, source) {
       
 24290   if (target === null) {
       
 24291     // This Fiber's initial properties will always be overwritten.
       
 24292     // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
       
 24293     target = createFiber(IndeterminateComponent, null, null, NoMode);
       
 24294   }
       
 24295 
       
 24296   // This is intentionally written as a list of all properties.
       
 24297   // We tried to use Object.assign() instead but this is called in
       
 24298   // the hottest path, and Object.assign() was too slow:
       
 24299   // https://github.com/facebook/react/issues/12502
       
 24300   // This code is DEV-only so size is not a concern.
       
 24301 
       
 24302   target.tag = source.tag;
       
 24303   target.key = source.key;
       
 24304   target.elementType = source.elementType;
       
 24305   target.type = source.type;
       
 24306   target.stateNode = source.stateNode;
       
 24307   target.return = source.return;
       
 24308   target.child = source.child;
       
 24309   target.sibling = source.sibling;
       
 24310   target.index = source.index;
       
 24311   target.ref = source.ref;
       
 24312   target.pendingProps = source.pendingProps;
       
 24313   target.memoizedProps = source.memoizedProps;
       
 24314   target.updateQueue = source.updateQueue;
       
 24315   target.memoizedState = source.memoizedState;
       
 24316   target.dependencies = source.dependencies;
       
 24317   target.mode = source.mode;
       
 24318   target.effectTag = source.effectTag;
       
 24319   target.nextEffect = source.nextEffect;
       
 24320   target.firstEffect = source.firstEffect;
       
 24321   target.lastEffect = source.lastEffect;
       
 24322   target.expirationTime = source.expirationTime;
       
 24323   target.childExpirationTime = source.childExpirationTime;
       
 24324   target.alternate = source.alternate;
       
 24325   if (enableProfilerTimer) {
       
 24326     target.actualDuration = source.actualDuration;
       
 24327     target.actualStartTime = source.actualStartTime;
       
 24328     target.selfBaseDuration = source.selfBaseDuration;
       
 24329     target.treeBaseDuration = source.treeBaseDuration;
       
 24330   }
       
 24331   target._debugID = source._debugID;
       
 24332   target._debugSource = source._debugSource;
       
 24333   target._debugOwner = source._debugOwner;
       
 24334   target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
       
 24335   target._debugNeedsRemount = source._debugNeedsRemount;
       
 24336   target._debugHookTypes = source._debugHookTypes;
       
 24337   return target;
       
 24338 }
       
 24339 
       
 24340 // TODO: This should be lifted into the renderer.
       
 24341 
       
 24342 
       
 24343 // The following attributes are only used by interaction tracing builds.
       
 24344 // They enable interactions to be associated with their async work,
       
 24345 // And expose interaction metadata to the React DevTools Profiler plugin.
       
 24346 // Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
       
 24347 
       
 24348 
       
 24349 // Exported FiberRoot type includes all properties,
       
 24350 // To avoid requiring potentially error-prone :any casts throughout the project.
       
 24351 // Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
       
 24352 // The types are defined separately within this file to ensure they stay in sync.
       
 24353 // (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
       
 24354 
       
 24355 
       
 24356 function FiberRootNode(containerInfo, tag, hydrate) {
       
 24357   this.tag = tag;
       
 24358   this.current = null;
       
 24359   this.containerInfo = containerInfo;
       
 24360   this.pendingChildren = null;
       
 24361   this.pingCache = null;
       
 24362   this.finishedExpirationTime = NoWork;
       
 24363   this.finishedWork = null;
       
 24364   this.timeoutHandle = noTimeout;
       
 24365   this.context = null;
       
 24366   this.pendingContext = null;
       
 24367   this.hydrate = hydrate;
       
 24368   this.firstBatch = null;
       
 24369   this.callbackNode = null;
       
 24370   this.callbackExpirationTime = NoWork;
       
 24371   this.firstPendingTime = NoWork;
       
 24372   this.lastPendingTime = NoWork;
       
 24373   this.pingTime = NoWork;
       
 24374 
       
 24375   if (enableSchedulerTracing) {
       
 24376     this.interactionThreadID = unstable_getThreadID();
       
 24377     this.memoizedInteractions = new Set();
       
 24378     this.pendingInteractionMap = new Map();
       
 24379   }
       
 24380 }
       
 24381 
       
 24382 function createFiberRoot(containerInfo, tag, hydrate) {
       
 24383   var root = new FiberRootNode(containerInfo, tag, hydrate);
       
 24384 
       
 24385   // Cyclic construction. This cheats the type system right now because
       
 24386   // stateNode is any.
       
 24387   var uninitializedFiber = createHostRootFiber(tag);
       
 24388   root.current = uninitializedFiber;
       
 24389   uninitializedFiber.stateNode = root;
       
 24390 
       
 24391   return root;
       
 24392 }
       
 24393 
       
 24394 // This lets us hook into Fiber to debug what it's doing.
       
 24395 // See https://github.com/facebook/react/pull/8033.
       
 24396 // This is not part of the public API, not even for React DevTools.
       
 24397 // You may only inject a debugTool if you work on React Fiber itself.
       
 24398 var ReactFiberInstrumentation = {
       
 24399   debugTool: null
       
 24400 };
       
 24401 
       
 24402 var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
 20609 
 24403 
 20610 // 0 is PROD, 1 is DEV.
 24404 // 0 is PROD, 1 is DEV.
 20611 // Might add PROFILE later.
 24405 // Might add PROFILE later.
 20612 
 24406 
 20613 
 24407 
 20635   }
 24429   }
 20636 
 24430 
 20637   return parentContext;
 24431   return parentContext;
 20638 }
 24432 }
 20639 
 24433 
 20640 function scheduleRootUpdate(current$$1, element, expirationTime, callback) {
 24434 function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
 20641   {
 24435   {
 20642     if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
 24436     if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
 20643       didWarnAboutNestedUpdates = true;
 24437       didWarnAboutNestedUpdates = true;
 20644       warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
 24438       warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
 20645     }
 24439     }
 20646   }
 24440   }
 20647 
 24441 
 20648   var update = createUpdate(expirationTime);
 24442   var update = createUpdate(expirationTime, suspenseConfig);
 20649   // Caution: React DevTools currently depends on this property
 24443   // Caution: React DevTools currently depends on this property
 20650   // being called "element".
 24444   // being called "element".
 20651   update.payload = { element: element };
 24445   update.payload = { element: element };
 20652 
 24446 
 20653   callback = callback === undefined ? null : callback;
 24447   callback = callback === undefined ? null : callback;
 20654   if (callback !== null) {
 24448   if (callback !== null) {
 20655     !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
 24449     !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
 20656     update.callback = callback;
 24450     update.callback = callback;
 20657   }
 24451   }
 20658 
 24452 
 20659   flushPassiveEffects();
 24453   if (revertPassiveEffectsChange) {
       
 24454     flushPassiveEffects();
       
 24455   }
 20660   enqueueUpdate(current$$1, update);
 24456   enqueueUpdate(current$$1, update);
 20661   scheduleWork(current$$1, expirationTime);
 24457   scheduleWork(current$$1, expirationTime);
 20662 
 24458 
 20663   return expirationTime;
 24459   return expirationTime;
 20664 }
 24460 }
 20665 
 24461 
 20666 function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback) {
 24462 function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
 20667   // TODO: If this is a nested container, this won't be the root.
 24463   // TODO: If this is a nested container, this won't be the root.
 20668   var current$$1 = container.current;
 24464   var current$$1 = container.current;
 20669 
 24465 
 20670   {
 24466   {
 20671     if (ReactFiberInstrumentation_1.debugTool) {
 24467     if (ReactFiberInstrumentation_1.debugTool) {
 20684     container.context = context;
 24480     container.context = context;
 20685   } else {
 24481   } else {
 20686     container.pendingContext = context;
 24482     container.pendingContext = context;
 20687   }
 24483   }
 20688 
 24484 
 20689   return scheduleRootUpdate(current$$1, element, expirationTime, callback);
 24485   return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
 20690 }
 24486 }
 20691 
 24487 
 20692 function findHostInstance(component) {
 24488 function findHostInstance(component) {
 20693   var fiber = get(component);
 24489   var fiber = get(component);
 20694   if (fiber === undefined) {
 24490   if (fiber === undefined) {
 20695     if (typeof component.render === 'function') {
 24491     if (typeof component.render === 'function') {
 20696       invariant(false, 'Unable to find node on an unmounted component.');
 24492       (function () {
       
 24493         {
       
 24494           {
       
 24495             throw ReactError(Error('Unable to find node on an unmounted component.'));
       
 24496           }
       
 24497         }
       
 24498       })();
 20697     } else {
 24499     } else {
 20698       invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
 24500       (function () {
       
 24501         {
       
 24502           {
       
 24503             throw ReactError(Error('Argument appears to not be a ReactComponent. Keys: ' + Object.keys(component)));
       
 24504           }
       
 24505         }
       
 24506       })();
 20699     }
 24507     }
 20700   }
 24508   }
 20701   var hostFiber = findCurrentHostFiber(fiber);
 24509   var hostFiber = findCurrentHostFiber(fiber);
 20702   if (hostFiber === null) {
 24510   if (hostFiber === null) {
 20703     return null;
 24511     return null;
 20708 function findHostInstanceWithWarning(component, methodName) {
 24516 function findHostInstanceWithWarning(component, methodName) {
 20709   {
 24517   {
 20710     var fiber = get(component);
 24518     var fiber = get(component);
 20711     if (fiber === undefined) {
 24519     if (fiber === undefined) {
 20712       if (typeof component.render === 'function') {
 24520       if (typeof component.render === 'function') {
 20713         invariant(false, 'Unable to find node on an unmounted component.');
 24521         (function () {
       
 24522           {
       
 24523             {
       
 24524               throw ReactError(Error('Unable to find node on an unmounted component.'));
       
 24525             }
       
 24526           }
       
 24527         })();
 20714       } else {
 24528       } else {
 20715         invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
 24529         (function () {
       
 24530           {
       
 24531             {
       
 24532               throw ReactError(Error('Argument appears to not be a ReactComponent. Keys: ' + Object.keys(component)));
       
 24533             }
       
 24534           }
       
 24535         })();
 20716       }
 24536       }
 20717     }
 24537     }
 20718     var hostFiber = findCurrentHostFiber(fiber);
 24538     var hostFiber = findCurrentHostFiber(fiber);
 20719     if (hostFiber === null) {
 24539     if (hostFiber === null) {
 20720       return null;
 24540       return null;
 20733     return hostFiber.stateNode;
 24553     return hostFiber.stateNode;
 20734   }
 24554   }
 20735   return findHostInstance(component);
 24555   return findHostInstance(component);
 20736 }
 24556 }
 20737 
 24557 
 20738 function createContainer(containerInfo, isConcurrent, hydrate) {
 24558 function createContainer(containerInfo, tag, hydrate) {
 20739   return createFiberRoot(containerInfo, isConcurrent, hydrate);
 24559   return createFiberRoot(containerInfo, tag, hydrate);
 20740 }
 24560 }
 20741 
 24561 
 20742 function updateContainer(element, container, parentComponent, callback) {
 24562 function updateContainer(element, container, parentComponent, callback) {
 20743   var current$$1 = container.current;
 24563   var current$$1 = container.current;
 20744   var currentTime = requestCurrentTime();
 24564   var currentTime = requestCurrentTime();
 20745   var expirationTime = computeExpirationForFiber(currentTime, current$$1);
 24565   {
 20746   return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback);
 24566     // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 24567     if ('undefined' !== typeof jest) {
       
 24568       warnIfUnmockedScheduler(current$$1);
       
 24569       warnIfNotScopedWithMatchingAct(current$$1);
       
 24570     }
       
 24571   }
       
 24572   var suspenseConfig = requestCurrentSuspenseConfig();
       
 24573   var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
       
 24574   return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback);
 20747 }
 24575 }
 20748 
 24576 
 20749 function getPublicRootInstance(container) {
 24577 function getPublicRootInstance(container) {
 20750   var containerFiber = container.current;
 24578   var containerFiber = container.current;
 20751   if (!containerFiber.child) {
 24579   if (!containerFiber.child) {
 20762 function findHostInstanceWithNoPortals(fiber) {
 24590 function findHostInstanceWithNoPortals(fiber) {
 20763   var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
 24591   var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
 20764   if (hostFiber === null) {
 24592   if (hostFiber === null) {
 20765     return null;
 24593     return null;
 20766   }
 24594   }
       
 24595   if (hostFiber.tag === FundamentalComponent) {
       
 24596     return hostFiber.stateNode.instance;
       
 24597   }
 20767   return hostFiber.stateNode;
 24598   return hostFiber.stateNode;
 20768 }
 24599 }
 20769 
 24600 
       
 24601 var shouldSuspendImpl = function (fiber) {
       
 24602   return false;
       
 24603 };
       
 24604 
       
 24605 function shouldSuspend(fiber) {
       
 24606   return shouldSuspendImpl(fiber);
       
 24607 }
       
 24608 
       
 24609 var overrideHookState = null;
 20770 var overrideProps = null;
 24610 var overrideProps = null;
       
 24611 var scheduleUpdate = null;
       
 24612 var setSuspenseHandler = null;
 20771 
 24613 
 20772 {
 24614 {
 20773   var copyWithSetImpl = function (obj, path, idx, value) {
 24615   var copyWithSetImpl = function (obj, path, idx, value) {
 20774     if (idx >= path.length) {
 24616     if (idx >= path.length) {
 20775       return value;
 24617       return value;
 20783 
 24625 
 20784   var copyWithSet = function (obj, path, value) {
 24626   var copyWithSet = function (obj, path, value) {
 20785     return copyWithSetImpl(obj, path, 0, value);
 24627     return copyWithSetImpl(obj, path, 0, value);
 20786   };
 24628   };
 20787 
 24629 
       
 24630   // Support DevTools editable values for useState and useReducer.
       
 24631   overrideHookState = function (fiber, id, path, value) {
       
 24632     // For now, the "id" of stateful hooks is just the stateful hook index.
       
 24633     // This may change in the future with e.g. nested hooks.
       
 24634     var currentHook = fiber.memoizedState;
       
 24635     while (currentHook !== null && id > 0) {
       
 24636       currentHook = currentHook.next;
       
 24637       id--;
       
 24638     }
       
 24639     if (currentHook !== null) {
       
 24640       if (revertPassiveEffectsChange) {
       
 24641         flushPassiveEffects();
       
 24642       }
       
 24643 
       
 24644       var newState = copyWithSet(currentHook.memoizedState, path, value);
       
 24645       currentHook.memoizedState = newState;
       
 24646       currentHook.baseState = newState;
       
 24647 
       
 24648       // We aren't actually adding an update to the queue,
       
 24649       // because there is no update we can add for useReducer hooks that won't trigger an error.
       
 24650       // (There's no appropriate action type for DevTools overrides.)
       
 24651       // As a result though, React will see the scheduled update as a noop and bailout.
       
 24652       // Shallow cloning props works as a workaround for now to bypass the bailout check.
       
 24653       fiber.memoizedProps = _assign({}, fiber.memoizedProps);
       
 24654 
       
 24655       scheduleWork(fiber, Sync);
       
 24656     }
       
 24657   };
       
 24658 
 20788   // Support DevTools props for function components, forwardRef, memo, host components, etc.
 24659   // Support DevTools props for function components, forwardRef, memo, host components, etc.
 20789   overrideProps = function (fiber, path, value) {
 24660   overrideProps = function (fiber, path, value) {
 20790     flushPassiveEffects();
 24661     if (revertPassiveEffectsChange) {
       
 24662       flushPassiveEffects();
       
 24663     }
 20791     fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
 24664     fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
 20792     if (fiber.alternate) {
 24665     if (fiber.alternate) {
 20793       fiber.alternate.pendingProps = fiber.pendingProps;
 24666       fiber.alternate.pendingProps = fiber.pendingProps;
 20794     }
 24667     }
 20795     scheduleWork(fiber, Sync);
 24668     scheduleWork(fiber, Sync);
 20796   };
 24669   };
       
 24670 
       
 24671   scheduleUpdate = function (fiber) {
       
 24672     if (revertPassiveEffectsChange) {
       
 24673       flushPassiveEffects();
       
 24674     }
       
 24675     scheduleWork(fiber, Sync);
       
 24676   };
       
 24677 
       
 24678   setSuspenseHandler = function (newShouldSuspendImpl) {
       
 24679     shouldSuspendImpl = newShouldSuspendImpl;
       
 24680   };
 20797 }
 24681 }
 20798 
 24682 
 20799 function injectIntoDevTools(devToolsConfig) {
 24683 function injectIntoDevTools(devToolsConfig) {
 20800   var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
 24684   var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
 20801   var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
 24685   var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
 20802 
 24686 
 20803 
 24687 
 20804   return injectInternals(_assign({}, devToolsConfig, {
 24688   return injectInternals(_assign({}, devToolsConfig, {
       
 24689     overrideHookState: overrideHookState,
 20805     overrideProps: overrideProps,
 24690     overrideProps: overrideProps,
       
 24691     setSuspenseHandler: setSuspenseHandler,
       
 24692     scheduleUpdate: scheduleUpdate,
 20806     currentDispatcherRef: ReactCurrentDispatcher,
 24693     currentDispatcherRef: ReactCurrentDispatcher,
 20807     findHostInstanceByFiber: function (fiber) {
 24694     findHostInstanceByFiber: function (fiber) {
 20808       var hostFiber = findCurrentHostFiber(fiber);
 24695       var hostFiber = findCurrentHostFiber(fiber);
 20809       if (hostFiber === null) {
 24696       if (hostFiber === null) {
 20810         return null;
 24697         return null;
 20815       if (!findFiberByHostInstance) {
 24702       if (!findFiberByHostInstance) {
 20816         // Might not be implemented by the renderer.
 24703         // Might not be implemented by the renderer.
 20817         return null;
 24704         return null;
 20818       }
 24705       }
 20819       return findFiberByHostInstance(instance);
 24706       return findFiberByHostInstance(instance);
       
 24707     },
       
 24708 
       
 24709     // React Refresh
       
 24710     findHostInstancesForRefresh: findHostInstancesForRefresh,
       
 24711     scheduleRefresh: scheduleRefresh,
       
 24712     scheduleRoot: scheduleRoot,
       
 24713     setRefreshHandler: setRefreshHandler,
       
 24714     // Enables DevTools to append owner stacks to error messages in DEV mode.
       
 24715     getCurrentFiber: function () {
       
 24716       return current;
 20820     }
 24717     }
 20821   }));
 24718   }));
 20822 }
 24719 }
 20823 
 24720 
 20824 // This file intentionally does *not* have the Flow annotation.
 24721 // This file intentionally does *not* have the Flow annotation.
 20839   };
 24736   };
 20840 }
 24737 }
 20841 
 24738 
 20842 // TODO: this is special because it gets imported during build.
 24739 // TODO: this is special because it gets imported during build.
 20843 
 24740 
 20844 var ReactVersion = '16.8.4';
 24741 var ReactVersion = '16.9.0';
 20845 
 24742 
 20846 // TODO: This type is shared between the reconciler and ReactDOM, but will
 24743 // TODO: This type is shared between the reconciler and ReactDOM, but will
 20847 // eventually be lifted out to the renderer.
 24744 // eventually be lifted out to the renderer.
 20848 
 24745 
 20849 var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
 24746 var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
 20895   this._hasChildren = false;
 24792   this._hasChildren = false;
 20896   this._children = null;
 24793   this._children = null;
 20897   this._defer = true;
 24794   this._defer = true;
 20898 }
 24795 }
 20899 ReactBatch.prototype.render = function (children) {
 24796 ReactBatch.prototype.render = function (children) {
 20900   !this._defer ? invariant(false, 'batch.render: Cannot render a batch that already committed.') : void 0;
 24797   var _this = this;
       
 24798 
       
 24799   (function () {
       
 24800     if (!_this._defer) {
       
 24801       {
       
 24802         throw ReactError(Error('batch.render: Cannot render a batch that already committed.'));
       
 24803       }
       
 24804     }
       
 24805   })();
 20901   this._hasChildren = true;
 24806   this._hasChildren = true;
 20902   this._children = children;
 24807   this._children = children;
 20903   var internalRoot = this._root._internalRoot;
 24808   var internalRoot = this._root._internalRoot;
 20904   var expirationTime = this._expirationTime;
 24809   var expirationTime = this._expirationTime;
 20905   var work = new ReactWork();
 24810   var work = new ReactWork();
 20906   updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, work._onCommit);
 24811   updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, null, work._onCommit);
 20907   return work;
 24812   return work;
 20908 };
 24813 };
 20909 ReactBatch.prototype.then = function (onComplete) {
 24814 ReactBatch.prototype.then = function (onComplete) {
 20910   if (this._didComplete) {
 24815   if (this._didComplete) {
 20911     onComplete();
 24816     onComplete();
 20916     callbacks = this._callbacks = [];
 24821     callbacks = this._callbacks = [];
 20917   }
 24822   }
 20918   callbacks.push(onComplete);
 24823   callbacks.push(onComplete);
 20919 };
 24824 };
 20920 ReactBatch.prototype.commit = function () {
 24825 ReactBatch.prototype.commit = function () {
       
 24826   var _this2 = this;
       
 24827 
 20921   var internalRoot = this._root._internalRoot;
 24828   var internalRoot = this._root._internalRoot;
 20922   var firstBatch = internalRoot.firstBatch;
 24829   var firstBatch = internalRoot.firstBatch;
 20923   !(this._defer && firstBatch !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
 24830   (function () {
       
 24831     if (!(_this2._defer && firstBatch !== null)) {
       
 24832       {
       
 24833         throw ReactError(Error('batch.commit: Cannot commit a batch multiple times.'));
       
 24834       }
       
 24835     }
       
 24836   })();
 20924 
 24837 
 20925   if (!this._hasChildren) {
 24838   if (!this._hasChildren) {
 20926     // This batch is empty. Return.
 24839     // This batch is empty. Return.
 20927     this._next = null;
 24840     this._next = null;
 20928     this._defer = false;
 24841     this._defer = false;
 20950     var batch = firstBatch;
 24863     var batch = firstBatch;
 20951     while (batch !== this) {
 24864     while (batch !== this) {
 20952       previous = batch;
 24865       previous = batch;
 20953       batch = batch._next;
 24866       batch = batch._next;
 20954     }
 24867     }
 20955     !(previous !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
 24868     (function () {
       
 24869       if (!(previous !== null)) {
       
 24870         {
       
 24871           throw ReactError(Error('batch.commit: Cannot commit a batch multiple times.'));
       
 24872         }
       
 24873       }
       
 24874     })();
 20956     previous._next = batch._next;
 24875     previous._next = batch._next;
 20957 
 24876 
 20958     // Add it to the front.
 24877     // Add it to the front.
 20959     this._next = firstBatch;
 24878     this._next = firstBatch;
 20960     firstBatch = internalRoot.firstBatch = this;
 24879     firstBatch = internalRoot.firstBatch = this;
 21018     return;
 24937     return;
 21019   }
 24938   }
 21020   // TODO: Error handling.
 24939   // TODO: Error handling.
 21021   for (var i = 0; i < callbacks.length; i++) {
 24940   for (var i = 0; i < callbacks.length; i++) {
 21022     var _callback2 = callbacks[i];
 24941     var _callback2 = callbacks[i];
 21023     !(typeof _callback2 === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback2) : void 0;
 24942     (function () {
       
 24943       if (!(typeof _callback2 === 'function')) {
       
 24944         {
       
 24945           throw ReactError(Error('Invalid argument passed as callback. Expected a function. Instead received: ' + _callback2));
       
 24946         }
       
 24947       }
       
 24948     })();
 21024     _callback2();
 24949     _callback2();
 21025   }
 24950   }
 21026 };
 24951 };
 21027 
 24952 
 21028 function ReactRoot(container, isConcurrent, hydrate) {
 24953 function ReactSyncRoot(container, tag, hydrate) {
 21029   var root = createContainer(container, isConcurrent, hydrate);
 24954   // Tag is either LegacyRoot or Concurrent Root
       
 24955   var root = createContainer(container, tag, hydrate);
 21030   this._internalRoot = root;
 24956   this._internalRoot = root;
 21031 }
 24957 }
 21032 ReactRoot.prototype.render = function (children, callback) {
 24958 
       
 24959 function ReactRoot(container, hydrate) {
       
 24960   var root = createContainer(container, ConcurrentRoot, hydrate);
       
 24961   this._internalRoot = root;
       
 24962 }
       
 24963 
       
 24964 ReactRoot.prototype.render = ReactSyncRoot.prototype.render = function (children, callback) {
 21033   var root = this._internalRoot;
 24965   var root = this._internalRoot;
 21034   var work = new ReactWork();
 24966   var work = new ReactWork();
 21035   callback = callback === undefined ? null : callback;
 24967   callback = callback === undefined ? null : callback;
 21036   {
 24968   {
 21037     warnOnInvalidCallback(callback, 'render');
 24969     warnOnInvalidCallback(callback, 'render');
 21040     work.then(callback);
 24972     work.then(callback);
 21041   }
 24973   }
 21042   updateContainer(children, root, null, work._onCommit);
 24974   updateContainer(children, root, null, work._onCommit);
 21043   return work;
 24975   return work;
 21044 };
 24976 };
 21045 ReactRoot.prototype.unmount = function (callback) {
 24977 
       
 24978 ReactRoot.prototype.unmount = ReactSyncRoot.prototype.unmount = function (callback) {
 21046   var root = this._internalRoot;
 24979   var root = this._internalRoot;
 21047   var work = new ReactWork();
 24980   var work = new ReactWork();
 21048   callback = callback === undefined ? null : callback;
 24981   callback = callback === undefined ? null : callback;
 21049   {
 24982   {
 21050     warnOnInvalidCallback(callback, 'render');
 24983     warnOnInvalidCallback(callback, 'render');
 21053     work.then(callback);
 24986     work.then(callback);
 21054   }
 24987   }
 21055   updateContainer(null, root, null, work._onCommit);
 24988   updateContainer(null, root, null, work._onCommit);
 21056   return work;
 24989   return work;
 21057 };
 24990 };
 21058 ReactRoot.prototype.legacy_renderSubtreeIntoContainer = function (parentComponent, children, callback) {
 24991 
 21059   var root = this._internalRoot;
 24992 // Sync roots cannot create batches. Only concurrent ones.
 21060   var work = new ReactWork();
       
 21061   callback = callback === undefined ? null : callback;
       
 21062   {
       
 21063     warnOnInvalidCallback(callback, 'render');
       
 21064   }
       
 21065   if (callback !== null) {
       
 21066     work.then(callback);
       
 21067   }
       
 21068   updateContainer(children, root, parentComponent, work._onCommit);
       
 21069   return work;
       
 21070 };
       
 21071 ReactRoot.prototype.createBatch = function () {
 24993 ReactRoot.prototype.createBatch = function () {
 21072   var batch = new ReactBatch(this);
 24994   var batch = new ReactBatch(this);
 21073   var expirationTime = batch._expirationTime;
 24995   var expirationTime = batch._expirationTime;
 21074 
 24996 
 21075   var internalRoot = this._internalRoot;
 24997   var internalRoot = this._internalRoot;
 21120 function shouldHydrateDueToLegacyHeuristic(container) {
 25042 function shouldHydrateDueToLegacyHeuristic(container) {
 21121   var rootElement = getReactRootElementInContainer(container);
 25043   var rootElement = getReactRootElementInContainer(container);
 21122   return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
 25044   return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
 21123 }
 25045 }
 21124 
 25046 
 21125 setBatchingImplementation(batchedUpdates$1, interactiveUpdates$1, flushInteractiveUpdates$1);
 25047 setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
 21126 
 25048 
 21127 var warnedAboutHydrateAPI = false;
 25049 var warnedAboutHydrateAPI = false;
 21128 
 25050 
 21129 function legacyCreateRootFromDOMContainer(container, forceHydrate) {
 25051 function legacyCreateRootFromDOMContainer(container, forceHydrate) {
 21130   var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
 25052   var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
 21146     if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
 25068     if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
 21147       warnedAboutHydrateAPI = true;
 25069       warnedAboutHydrateAPI = true;
 21148       lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
 25070       lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
 21149     }
 25071     }
 21150   }
 25072   }
 21151   // Legacy roots are not async by default.
 25073 
 21152   var isConcurrent = false;
 25074   // Legacy roots are not batched.
 21153   return new ReactRoot(container, isConcurrent, shouldHydrate);
 25075   return new ReactSyncRoot(container, LegacyRoot, shouldHydrate);
 21154 }
 25076 }
 21155 
 25077 
 21156 function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
 25078 function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
 21157   {
 25079   {
 21158     topLevelUpdateWarnings(container);
 25080     topLevelUpdateWarnings(container);
       
 25081     warnOnInvalidCallback(callback === undefined ? null : callback, 'render');
 21159   }
 25082   }
 21160 
 25083 
 21161   // TODO: Without `any` type, Flow says "Property cannot be accessed on any
 25084   // TODO: Without `any` type, Flow says "Property cannot be accessed on any
 21162   // member of intersection type." Whyyyyyy.
 25085   // member of intersection type." Whyyyyyy.
 21163   var root = container._reactRootContainer;
 25086   var root = container._reactRootContainer;
       
 25087   var fiberRoot = void 0;
 21164   if (!root) {
 25088   if (!root) {
 21165     // Initial mount
 25089     // Initial mount
 21166     root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
 25090     root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
       
 25091     fiberRoot = root._internalRoot;
 21167     if (typeof callback === 'function') {
 25092     if (typeof callback === 'function') {
 21168       var originalCallback = callback;
 25093       var originalCallback = callback;
 21169       callback = function () {
 25094       callback = function () {
 21170         var instance = getPublicRootInstance(root._internalRoot);
 25095         var instance = getPublicRootInstance(fiberRoot);
 21171         originalCallback.call(instance);
 25096         originalCallback.call(instance);
 21172       };
 25097       };
 21173     }
 25098     }
 21174     // Initial mount should not be batched.
 25099     // Initial mount should not be batched.
 21175     unbatchedUpdates(function () {
 25100     unbatchedUpdates(function () {
 21176       if (parentComponent != null) {
 25101       updateContainer(children, fiberRoot, parentComponent, callback);
 21177         root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
       
 21178       } else {
       
 21179         root.render(children, callback);
       
 21180       }
       
 21181     });
 25102     });
 21182   } else {
 25103   } else {
       
 25104     fiberRoot = root._internalRoot;
 21183     if (typeof callback === 'function') {
 25105     if (typeof callback === 'function') {
 21184       var _originalCallback = callback;
 25106       var _originalCallback = callback;
 21185       callback = function () {
 25107       callback = function () {
 21186         var instance = getPublicRootInstance(root._internalRoot);
 25108         var instance = getPublicRootInstance(fiberRoot);
 21187         _originalCallback.call(instance);
 25109         _originalCallback.call(instance);
 21188       };
 25110       };
 21189     }
 25111     }
 21190     // Update
 25112     // Update
 21191     if (parentComponent != null) {
 25113     updateContainer(children, fiberRoot, parentComponent, callback);
 21192       root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
 25114   }
 21193     } else {
 25115   return getPublicRootInstance(fiberRoot);
 21194       root.render(children, callback);
       
 21195     }
       
 21196   }
       
 21197   return getPublicRootInstance(root._internalRoot);
       
 21198 }
 25116 }
 21199 
 25117 
 21200 function createPortal$$1(children, container) {
 25118 function createPortal$$1(children, container) {
 21201   var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
 25119   var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
 21202 
 25120 
 21203   !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
 25121   (function () {
       
 25122     if (!isValidContainer(container)) {
       
 25123       {
       
 25124         throw ReactError(Error('Target container is not a DOM element.'));
       
 25125       }
       
 25126     }
       
 25127   })();
 21204   // TODO: pass ReactDOM portal implementation as third argument
 25128   // TODO: pass ReactDOM portal implementation as third argument
 21205   return createPortal$1(children, container, null, key);
 25129   return createPortal$1(children, container, null, key);
 21206 }
 25130 }
 21207 
 25131 
 21208 var ReactDOM = {
 25132 var ReactDOM = {
 21227       return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
 25151       return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
 21228     }
 25152     }
 21229     return findHostInstance(componentOrElement);
 25153     return findHostInstance(componentOrElement);
 21230   },
 25154   },
 21231   hydrate: function (element, container, callback) {
 25155   hydrate: function (element, container, callback) {
 21232     !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
 25156     (function () {
       
 25157       if (!isValidContainer(container)) {
       
 25158         {
       
 25159           throw ReactError(Error('Target container is not a DOM element.'));
       
 25160         }
       
 25161       }
       
 25162     })();
 21233     {
 25163     {
 21234       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 25164       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 21235     }
 25165     }
 21236     // TODO: throw or warn if we couldn't hydrate?
 25166     // TODO: throw or warn if we couldn't hydrate?
 21237     return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
 25167     return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
 21238   },
 25168   },
 21239   render: function (element, container, callback) {
 25169   render: function (element, container, callback) {
 21240     !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
 25170     (function () {
       
 25171       if (!isValidContainer(container)) {
       
 25172         {
       
 25173           throw ReactError(Error('Target container is not a DOM element.'));
       
 25174         }
       
 25175       }
       
 25176     })();
 21241     {
 25177     {
 21242       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call root.render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 25178       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call root.render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 21243     }
 25179     }
 21244     return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
 25180     return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
 21245   },
 25181   },
 21246   unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
 25182   unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
 21247     !isValidContainer(containerNode) ? invariant(false, 'Target container is not a DOM element.') : void 0;
 25183     (function () {
 21248     !(parentComponent != null && has(parentComponent)) ? invariant(false, 'parentComponent must be a valid React Component') : void 0;
 25184       if (!isValidContainer(containerNode)) {
       
 25185         {
       
 25186           throw ReactError(Error('Target container is not a DOM element.'));
       
 25187         }
       
 25188       }
       
 25189     })();
       
 25190     (function () {
       
 25191       if (!(parentComponent != null && has(parentComponent))) {
       
 25192         {
       
 25193           throw ReactError(Error('parentComponent must be a valid React Component'));
       
 25194         }
       
 25195       }
       
 25196     })();
 21249     return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
 25197     return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
 21250   },
 25198   },
 21251   unmountComponentAtNode: function (container) {
 25199   unmountComponentAtNode: function (container) {
 21252     !isValidContainer(container) ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : void 0;
 25200     (function () {
       
 25201       if (!isValidContainer(container)) {
       
 25202         {
       
 25203           throw ReactError(Error('unmountComponentAtNode(...): Target container is not a DOM element.'));
       
 25204         }
       
 25205       }
       
 25206     })();
 21253 
 25207 
 21254     {
 25208     {
 21255       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. Did you mean to call root.unmount()?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 25209       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. Did you mean to call root.unmount()?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 21256     }
 25210     }
 21257 
 25211 
 21298   },
 25252   },
 21299 
 25253 
 21300 
 25254 
 21301   unstable_batchedUpdates: batchedUpdates$1,
 25255   unstable_batchedUpdates: batchedUpdates$1,
 21302 
 25256 
 21303   unstable_interactiveUpdates: interactiveUpdates$1,
 25257   // TODO remove this legacy method, unstable_discreteUpdates replaces it
       
 25258   unstable_interactiveUpdates: function (fn, a, b, c) {
       
 25259     flushDiscreteUpdates();
       
 25260     return discreteUpdates$1(fn, a, b, c);
       
 25261   },
       
 25262 
       
 25263   unstable_discreteUpdates: discreteUpdates$1,
       
 25264   unstable_flushDiscreteUpdates: flushDiscreteUpdates,
 21304 
 25265 
 21305   flushSync: flushSync,
 25266   flushSync: flushSync,
 21306 
 25267 
 21307   unstable_createRoot: createRoot,
 25268   unstable_createRoot: createRoot,
       
 25269   unstable_createSyncRoot: createSyncRoot,
 21308   unstable_flushControlled: flushControlled,
 25270   unstable_flushControlled: flushControlled,
 21309 
 25271 
 21310   __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
 25272   __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
 21311     // Keep in sync with ReactDOMUnstableNativeDependencies.js
 25273     // Keep in sync with ReactDOMUnstableNativeDependencies.js
 21312     // and ReactTestUtils.js. This is an array for better minification.
 25274     // ReactTestUtils.js, and ReactTestUtilsAct.js. This is an array for better minification.
 21313     Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch]
 25275     Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch, flushPassiveEffects, IsThisRendererActing]
 21314   }
 25276   }
 21315 };
 25277 };
 21316 
 25278 
 21317 function createRoot(container, options) {
 25279 function createRoot(container, options) {
 21318   var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
 25280   var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
 21319   !isValidContainer(container) ? invariant(false, '%s(...): Target container is not a DOM element.', functionName) : void 0;
 25281   (function () {
       
 25282     if (!isValidContainer(container)) {
       
 25283       {
       
 25284         throw ReactError(Error(functionName + '(...): Target container is not a DOM element.'));
       
 25285       }
       
 25286     }
       
 25287   })();
       
 25288   warnIfReactDOMContainerInDEV(container);
       
 25289   var hydrate = options != null && options.hydrate === true;
       
 25290   return new ReactRoot(container, hydrate);
       
 25291 }
       
 25292 
       
 25293 function createSyncRoot(container, options) {
       
 25294   var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
       
 25295   (function () {
       
 25296     if (!isValidContainer(container)) {
       
 25297       {
       
 25298         throw ReactError(Error(functionName + '(...): Target container is not a DOM element.'));
       
 25299       }
       
 25300     }
       
 25301   })();
       
 25302   warnIfReactDOMContainerInDEV(container);
       
 25303   var hydrate = options != null && options.hydrate === true;
       
 25304   return new ReactSyncRoot(container, BatchedRoot, hydrate);
       
 25305 }
       
 25306 
       
 25307 function warnIfReactDOMContainerInDEV(container) {
 21320   {
 25308   {
 21321     !!container._reactRootContainer ? warningWithoutStack$1(false, 'You are calling ReactDOM.%s() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 25309     !!container._reactRootContainer ? warningWithoutStack$1(false, 'You are calling ReactDOM.%s() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 21322     container._reactHasBeenPassedToCreateRootDEV = true;
 25310     container._reactHasBeenPassedToCreateRootDEV = true;
 21323   }
 25311   }
 21324   var hydrate = options != null && options.hydrate === true;
       
 21325   return new ReactRoot(container, true, hydrate);
       
 21326 }
 25312 }
 21327 
 25313 
 21328 if (enableStableConcurrentModeAPIs) {
 25314 if (enableStableConcurrentModeAPIs) {
 21329   ReactDOM.createRoot = createRoot;
 25315   ReactDOM.createRoot = createRoot;
 21330   ReactDOM.unstable_createRoot = undefined;
 25316   ReactDOM.createSyncRoot = createSyncRoot;
 21331 }
 25317 }
 21332 
 25318 
 21333 var foundDevTools = injectIntoDevTools({
 25319 var foundDevTools = injectIntoDevTools({
 21334   findFiberByHostInstance: getClosestInstanceFromNode,
 25320   findFiberByHostInstance: getClosestInstanceFromNode,
 21335   bundleType: 1,
 25321   bundleType: 1,