[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/js/dist/vendor/ -> react-dom.js (source)

   1  /** @license React v16.9.0
   2   * react-dom.development.js
   3   *
   4   * Copyright (c) Facebook, Inc. and its affiliates.
   5   *
   6   * This source code is licensed under the MIT license found in the
   7   * LICENSE file in the root directory of this source tree.
   8   */
   9  
  10  'use strict';
  11  
  12  (function (global, factory) {
  13      typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
  14      typeof define === 'function' && define.amd ? define(['react'], factory) :
  15      (global.ReactDOM = factory(global.React));
  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  }
  30  
  31  /**
  32   * Use invariant() to assert state which your program assumes to be true.
  33   *
  34   * Provide sprintf-style format (only %s is supported) and arguments
  35   * to provide information about what broke and what you were
  36   * expecting.
  37   *
  38   * The invariant message will be stripped in production, but the invariant
  39   * will remain to ensure logic does not differ in production.
  40   */
  41  
  42  (function () {
  43    if (!React) {
  44      {
  45        throw ReactError(Error('ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.'));
  46      }
  47    }
  48  })();
  49  
  50  /**
  51   * Injectable ordering of event plugins.
  52   */
  53  var eventPluginOrder = null;
  54  
  55  /**
  56   * Injectable mapping from names to event plugin modules.
  57   */
  58  var namesToPlugins = {};
  59  
  60  /**
  61   * Recomputes the plugin list using the injected plugins and plugin ordering.
  62   *
  63   * @private
  64   */
  65  function recomputePluginOrdering() {
  66    if (!eventPluginOrder) {
  67      // Wait until an `eventPluginOrder` is injected.
  68      return;
  69    }
  70    for (var pluginName in namesToPlugins) {
  71      var pluginModule = namesToPlugins[pluginName];
  72      var pluginIndex = eventPluginOrder.indexOf(pluginName);
  73      (function () {
  74        if (!(pluginIndex > -1)) {
  75          {
  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  }
 256  
 257  var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
 258    var funcArgs = Array.prototype.slice.call(arguments, 3);
 259    try {
 260      func.apply(context, funcArgs);
 261    } catch (error) {
 262      this.onError(error);
 263    }
 264  };
 265  
 266  {
 267    // In DEV mode, we swap out invokeGuardedCallback for a special version
 268    // that plays more nicely with the browser's DevTools. The idea is to preserve
 269    // "Pause on exceptions" behavior. Because React wraps all user-provided
 270    // functions in invokeGuardedCallback, and the production version of
 271    // invokeGuardedCallback uses a try-catch, all user exceptions are treated
 272    // like caught exceptions, and the DevTools won't pause unless the developer
 273    // takes the extra step of enabling pause on caught exceptions. This is
 274    // unintuitive, though, because even though React has caught the error, from
 275    // the developer's perspective, the error is uncaught.
 276    //
 277    // To preserve the expected "Pause on exceptions" behavior, we don't use a
 278    // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
 279    // DOM node, and call the user-provided callback from inside an event handler
 280    // for that fake event. If the callback throws, the error is "captured" using
 281    // a global event handler. But because the error happens in a different
 282    // event loop context, it does not interrupt the normal program flow.
 283    // Effectively, this gives us try-catch behavior without actually using
 284    // try-catch. Neat!
 285  
 286    // Check that the browser supports the APIs we need to implement our special
 287    // DEV version of invokeGuardedCallback
 288    if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
 289      var fakeNode = document.createElement('react');
 290  
 291      var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
 292        // If document doesn't exist we know for sure we will crash in this method
 293        // when we call document.createEvent(). However this can cause confusing
 294        // errors: https://github.com/facebookincubator/create-react-app/issues/3482
 295        // So we preemptively throw with a better message instead.
 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        })();
 303        var evt = document.createEvent('Event');
 304  
 305        // Keeps track of whether the user-provided callback threw an error. We
 306        // set this to true at the beginning, then set it to false right after
 307        // calling the function. If the function errors, `didError` will never be
 308        // set to false. This strategy works even if the browser is flaky and
 309        // fails to call our global error handler, because it doesn't rely on
 310        // the error event at all.
 311        var didError = true;
 312  
 313        // Keeps track of the value of window.event so that we can reset it
 314        // during the callback to let user code access window.event in the
 315        // browsers that support it.
 316        var windowEvent = window.event;
 317  
 318        // Keeps track of the descriptor of window.event to restore it after event
 319        // dispatching: https://github.com/facebook/react/issues/13688
 320        var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
 321  
 322        // Create an event handler for our fake event. We will synchronously
 323        // dispatch our fake event using `dispatchEvent`. Inside the handler, we
 324        // call the user-provided callback.
 325        var funcArgs = Array.prototype.slice.call(arguments, 3);
 326        function callCallback() {
 327          // We immediately remove the callback from event listeners so that
 328          // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
 329          // nested call would trigger the fake event handlers of any call higher
 330          // in the stack.
 331          fakeNode.removeEventListener(evtType, callCallback, false);
 332  
 333          // We check for window.hasOwnProperty('event') to prevent the
 334          // window.event assignment in both IE <= 10 as they throw an error
 335          // "Member not found" in strict mode, and in Firefox which does not
 336          // support window.event.
 337          if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
 338            window.event = windowEvent;
 339          }
 340  
 341          func.apply(context, funcArgs);
 342          didError = false;
 343        }
 344  
 345        // Create a global error event handler. We use this to capture the value
 346        // that was thrown. It's possible that this error handler will fire more
 347        // than once; for example, if non-React code also calls `dispatchEvent`
 348        // and a handler for that event throws. We should be resilient to most of
 349        // those cases. Even if our error event handler fires more than once, the
 350        // last error event is always used. If the callback actually does error,
 351        // we know that the last error event is the correct one, because it's not
 352        // possible for anything else to have happened in between our callback
 353        // erroring and the code that follows the `dispatchEvent` call below. If
 354        // the callback doesn't error, but the error event was fired, we know to
 355        // ignore it because `didError` will be false, as described above.
 356        var error = void 0;
 357        // Use this to track whether the error event is ever called.
 358        var didSetError = false;
 359        var isCrossOriginError = false;
 360  
 361        function handleWindowError(event) {
 362          error = event.error;
 363          didSetError = true;
 364          if (error === null && event.colno === 0 && event.lineno === 0) {
 365            isCrossOriginError = true;
 366          }
 367          if (event.defaultPrevented) {
 368            // Some other error handler has prevented default.
 369            // Browsers silence the error report if this happens.
 370            // We'll remember this to later decide whether to log it or not.
 371            if (error != null && typeof error === 'object') {
 372              try {
 373                error._suppressLogging = true;
 374              } catch (inner) {
 375                // Ignore.
 376              }
 377            }
 378          }
 379        }
 380  
 381        // Create a fake event type.
 382        var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
 383  
 384        // Attach our event handlers
 385        window.addEventListener('error', handleWindowError);
 386        fakeNode.addEventListener(evtType, callCallback, false);
 387  
 388        // Synchronously dispatch our fake event. If the user-provided function
 389        // errors, it will trigger our global error handler.
 390        evt.initEvent(evtType, false, false);
 391        fakeNode.dispatchEvent(evt);
 392  
 393        if (windowEventDescriptor) {
 394          Object.defineProperty(window, 'event', windowEventDescriptor);
 395        }
 396  
 397        if (didError) {
 398          if (!didSetError) {
 399            // The callback errored, but the error event never fired.
 400            error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
 401          } else if (isCrossOriginError) {
 402            error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
 403          }
 404          this.onError(error);
 405        }
 406  
 407        // Remove our event listeners
 408        window.removeEventListener('error', handleWindowError);
 409      };
 410  
 411      invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
 412    }
 413  }
 414  
 415  var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
 416  
 417  // Used by Fiber to simulate a try-catch.
 418  var hasError = false;
 419  var caughtError = null;
 420  
 421  // Used by event system to capture/rethrow the first error.
 422  var hasRethrowError = false;
 423  var rethrowError = null;
 424  
 425  var reporter = {
 426    onError: function (error) {
 427      hasError = true;
 428      caughtError = error;
 429    }
 430  };
 431  
 432  /**
 433   * Call a function while guarding against errors that happens within it.
 434   * Returns an error if it throws, otherwise null.
 435   *
 436   * In production, this is implemented using a try-catch. The reason we don't
 437   * use a try-catch directly is so that we can swap out a different
 438   * implementation in DEV mode.
 439   *
 440   * @param {String} name of the guard to use for logging or debugging
 441   * @param {Function} func The function to invoke
 442   * @param {*} context The context to use when calling the function
 443   * @param {...*} args Arguments for function
 444   */
 445  function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
 446    hasError = false;
 447    caughtError = null;
 448    invokeGuardedCallbackImpl$1.apply(reporter, arguments);
 449  }
 450  
 451  /**
 452   * Same as invokeGuardedCallback, but instead of returning an error, it stores
 453   * it in a global so it can be rethrown by `rethrowCaughtError` later.
 454   * TODO: See if caughtError and rethrowError can be unified.
 455   *
 456   * @param {String} name of the guard to use for logging or debugging
 457   * @param {Function} func The function to invoke
 458   * @param {*} context The context to use when calling the function
 459   * @param {...*} args Arguments for function
 460   */
 461  function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
 462    invokeGuardedCallback.apply(this, arguments);
 463    if (hasError) {
 464      var error = clearCaughtError();
 465      if (!hasRethrowError) {
 466        hasRethrowError = true;
 467        rethrowError = error;
 468      }
 469    }
 470  }
 471  
 472  /**
 473   * During execution of guarded functions we will capture the first error which
 474   * we will rethrow to be handled by the top level error handler.
 475   */
 476  function rethrowCaughtError() {
 477    if (hasRethrowError) {
 478      var error = rethrowError;
 479      hasRethrowError = false;
 480      rethrowError = null;
 481      throw error;
 482    }
 483  }
 484  
 485  function hasCaughtError() {
 486    return hasError;
 487  }
 488  
 489  function clearCaughtError() {
 490    if (hasError) {
 491      var error = caughtError;
 492      hasError = false;
 493      caughtError = null;
 494      return error;
 495    } else {
 496      (function () {
 497        {
 498          {
 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.'));
 500          }
 501        }
 502      })();
 503    }
 504  }
 505  
 506  /**
 507   * Similar to invariant but only logs a warning if the condition is not met.
 508   * This can be used to log issues in development environments in critical
 509   * paths. Removing the logging code for production environments will keep the
 510   * same logic and follow the same code paths.
 511   */
 512  
 513  var warningWithoutStack = function () {};
 514  
 515  {
 516    warningWithoutStack = function (condition, format) {
 517      for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
 518        args[_key - 2] = arguments[_key];
 519      }
 520  
 521      if (format === undefined) {
 522        throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
 523      }
 524      if (args.length > 8) {
 525        // Check before the condition to catch violations early.
 526        throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
 527      }
 528      if (condition) {
 529        return;
 530      }
 531      if (typeof console !== 'undefined') {
 532        var argsWithFormat = args.map(function (item) {
 533          return '' + item;
 534        });
 535        argsWithFormat.unshift('Warning: ' + format);
 536  
 537        // We intentionally don't use spread (or .apply) directly because it
 538        // breaks IE9: https://github.com/facebook/react/issues/13610
 539        Function.prototype.apply.call(console.error, console, argsWithFormat);
 540      }
 541      try {
 542        // --- Welcome to debugging React ---
 543        // This error was thrown as a convenience so that you can use this stack
 544        // to find the callsite that caused this warning to fire.
 545        var argIndex = 0;
 546        var message = 'Warning: ' + format.replace(/%s/g, function () {
 547          return args[argIndex++];
 548        });
 549        throw new Error(message);
 550      } catch (x) {}
 551    };
 552  }
 553  
 554  var warningWithoutStack$1 = warningWithoutStack;
 555  
 556  var getFiberCurrentPropsFromNode = null;
 557  var getInstanceFromNode = null;
 558  var getNodeFromInstance = null;
 559  
 560  function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
 561    getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
 562    getInstanceFromNode = getInstanceFromNodeImpl;
 563    getNodeFromInstance = getNodeFromInstanceImpl;
 564    {
 565      !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
 566    }
 567  }
 568  
 569  var validateEventDispatches = void 0;
 570  {
 571    validateEventDispatches = function (event) {
 572      var dispatchListeners = event._dispatchListeners;
 573      var dispatchInstances = event._dispatchInstances;
 574  
 575      var listenersIsArr = Array.isArray(dispatchListeners);
 576      var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
 577  
 578      var instancesIsArr = Array.isArray(dispatchInstances);
 579      var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
 580  
 581      !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
 582    };
 583  }
 584  
 585  /**
 586   * Dispatch the event to the listener.
 587   * @param {SyntheticEvent} event SyntheticEvent to handle
 588   * @param {function} listener Application-level callback
 589   * @param {*} inst Internal component instance
 590   */
 591  function executeDispatch(event, listener, inst) {
 592    var type = event.type || 'unknown-event';
 593    event.currentTarget = getNodeFromInstance(inst);
 594    invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
 595    event.currentTarget = null;
 596  }
 597  
 598  /**
 599   * Standard/simple iteration through an event's collected dispatches.
 600   */
 601  function executeDispatchesInOrder(event) {
 602    var dispatchListeners = event._dispatchListeners;
 603    var dispatchInstances = event._dispatchInstances;
 604    {
 605      validateEventDispatches(event);
 606    }
 607    if (Array.isArray(dispatchListeners)) {
 608      for (var i = 0; i < dispatchListeners.length; i++) {
 609        if (event.isPropagationStopped()) {
 610          break;
 611        }
 612        // Listeners and Instances are two parallel arrays that are always in sync.
 613        executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
 614      }
 615    } else if (dispatchListeners) {
 616      executeDispatch(event, dispatchListeners, dispatchInstances);
 617    }
 618    event._dispatchListeners = null;
 619    event._dispatchInstances = null;
 620  }
 621  
 622  /**
 623   * @see executeDispatchesInOrderStopAtTrueImpl
 624   */
 625  
 626  
 627  /**
 628   * Execution of a "direct" dispatch - there must be at most one dispatch
 629   * accumulated on the event or it is considered an error. It doesn't really make
 630   * sense for an event with multiple dispatches (bubbled) to keep track of the
 631   * return values at each dispatch execution, but it does tend to make sense when
 632   * dealing with "direct" dispatches.
 633   *
 634   * @return {*} The return value of executing the single dispatch.
 635   */
 636  
 637  
 638  /**
 639   * @param {SyntheticEvent} event
 640   * @return {boolean} True iff number of dispatches accumulated is greater than 0.
 641   */
 642  
 643  /**
 644   * Accumulates items that must not be null or undefined into the first one. This
 645   * is used to conserve memory by avoiding array allocations, and thus sacrifices
 646   * API cleanness. Since `current` can be null before being passed in and not
 647   * null after this function, make sure to assign it back to `current`:
 648   *
 649   * `a = accumulateInto(a, b);`
 650   *
 651   * This API should be sparingly used. Try `accumulate` for something cleaner.
 652   *
 653   * @return {*|array<*>} An accumulation of items.
 654   */
 655  
 656  function accumulateInto(current, next) {
 657    (function () {
 658      if (!(next != null)) {
 659        {
 660          throw ReactError(Error('accumulateInto(...): Accumulated items must not be null or undefined.'));
 661        }
 662      }
 663    })();
 664  
 665    if (current == null) {
 666      return next;
 667    }
 668  
 669    // Both are not empty. Warning: Never call x.concat(y) when you are not
 670    // certain that x is an Array (x could be a string with concat method).
 671    if (Array.isArray(current)) {
 672      if (Array.isArray(next)) {
 673        current.push.apply(current, next);
 674        return current;
 675      }
 676      current.push(next);
 677      return current;
 678    }
 679  
 680    if (Array.isArray(next)) {
 681      // A bit too dangerous to mutate `next`.
 682      return [current].concat(next);
 683    }
 684  
 685    return [current, next];
 686  }
 687  
 688  /**
 689   * @param {array} arr an "accumulation" of items which is either an Array or
 690   * a single item. Useful when paired with the `accumulate` module. This is a
 691   * simple utility that allows us to reason about a collection of items, but
 692   * handling the case when there is exactly one item (and we do not need to
 693   * allocate an array).
 694   * @param {function} cb Callback invoked with each element or a collection.
 695   * @param {?} [scope] Scope used as `this` in a callback.
 696   */
 697  function forEachAccumulated(arr, cb, scope) {
 698    if (Array.isArray(arr)) {
 699      arr.forEach(cb, scope);
 700    } else if (arr) {
 701      cb.call(scope, arr);
 702    }
 703  }
 704  
 705  /**
 706   * Internal queue of events that have accumulated their dispatches and are
 707   * waiting to have their dispatches executed.
 708   */
 709  var eventQueue = null;
 710  
 711  /**
 712   * Dispatches an event and releases it back into the pool, unless persistent.
 713   *
 714   * @param {?object} event Synthetic event to be dispatched.
 715   * @private
 716   */
 717  var executeDispatchesAndRelease = function (event) {
 718    if (event) {
 719      executeDispatchesInOrder(event);
 720  
 721      if (!event.isPersistent()) {
 722        event.constructor.release(event);
 723      }
 724    }
 725  };
 726  var executeDispatchesAndReleaseTopLevel = function (e) {
 727    return executeDispatchesAndRelease(e);
 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  }
 755  
 756  function isInteractive(tag) {
 757    return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
 758  }
 759  
 760  function shouldPreventMouseEvent(name, type, props) {
 761    switch (name) {
 762      case 'onClick':
 763      case 'onClickCapture':
 764      case 'onDoubleClick':
 765      case 'onDoubleClickCapture':
 766      case 'onMouseDown':
 767      case 'onMouseDownCapture':
 768      case 'onMouseMove':
 769      case 'onMouseMoveCapture':
 770      case 'onMouseUp':
 771      case 'onMouseUpCapture':
 772        return !!(props.disabled && isInteractive(type));
 773      default:
 774        return false;
 775    }
 776  }
 777  
 778  /**
 779   * This is a unified interface for event plugins to be installed and configured.
 780   *
 781   * Event plugins can implement the following properties:
 782   *
 783   *   `extractEvents` {function(string, DOMEventTarget, string, object): *}
 784   *     Required. When a top-level event is fired, this method is expected to
 785   *     extract synthetic events that will in turn be queued and dispatched.
 786   *
 787   *   `eventTypes` {object}
 788   *     Optional, plugins that fire events must publish a mapping of registration
 789   *     names that are used to register listeners. Values of this mapping must
 790   *     be objects that contain `registrationName` or `phasedRegistrationNames`.
 791   *
 792   *   `executeDispatch` {function(object, function, string)}
 793   *     Optional, allows plugins to override how an event gets dispatched. By
 794   *     default, the listener is simply invoked.
 795   *
 796   * Each plugin that is injected into `EventsPluginHub` is immediately operable.
 797   *
 798   * @public
 799   */
 800  
 801  /**
 802   * Methods for injecting dependencies.
 803   */
 804  var injection = {
 805    /**
 806     * @param {array} InjectedEventPluginOrder
 807     * @public
 808     */
 809    injectEventPluginOrder: injectEventPluginOrder,
 810  
 811    /**
 812     * @param {object} injectedNamesToPlugins Map from names to plugin modules.
 813     */
 814    injectEventPluginsByName: injectEventPluginsByName
 815  };
 816  
 817  /**
 818   * @param {object} inst The instance, which is the source of events.
 819   * @param {string} registrationName Name of listener (e.g. `onClick`).
 820   * @return {?function} The stored callback.
 821   */
 822  function getListener(inst, registrationName) {
 823    var listener = void 0;
 824  
 825    // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
 826    // live here; needs to be moved to a better place soon
 827    var stateNode = inst.stateNode;
 828    if (!stateNode) {
 829      // Work in progress (ex: onload events in incremental mode).
 830      return null;
 831    }
 832    var props = getFiberCurrentPropsFromNode(stateNode);
 833    if (!props) {
 834      // Work in progress.
 835      return null;
 836    }
 837    listener = props[registrationName];
 838    if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
 839      return null;
 840    }
 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    })();
 848    return listener;
 849  }
 850  
 851  /**
 852   * Allows registered plugins an opportunity to extract events from top-level
 853   * native browser events.
 854   *
 855   * @return {*} An accumulation of synthetic events.
 856   * @internal
 857   */
 858  function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
 859    var events = null;
 860    for (var i = 0; i < plugins.length; i++) {
 861      // Not every plugin in the ordering may be loaded at runtime.
 862      var possiblePlugin = plugins[i];
 863      if (possiblePlugin) {
 864        var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
 865        if (extractedEvents) {
 866          events = accumulateInto(events, extractedEvents);
 867        }
 868      }
 869    }
 870    return events;
 871  }
 872  
 873  function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
 874    var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
 875    runEventsInBatch(events);
 876  }
 877  
 878  var FunctionComponent = 0;
 879  var ClassComponent = 1;
 880  var IndeterminateComponent = 2; // Before we know whether it is function or class
 881  var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
 882  var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
 883  var HostComponent = 5;
 884  var HostText = 6;
 885  var Fragment = 7;
 886  var Mode = 8;
 887  var ContextConsumer = 9;
 888  var ContextProvider = 10;
 889  var ForwardRef = 11;
 890  var Profiler = 12;
 891  var SuspenseComponent = 13;
 892  var MemoComponent = 14;
 893  var SimpleMemoComponent = 15;
 894  var LazyComponent = 16;
 895  var IncompleteClassComponent = 17;
 896  var DehydratedSuspenseComponent = 18;
 897  var SuspenseListComponent = 19;
 898  var FundamentalComponent = 20;
 899  
 900  var randomKey = Math.random().toString(36).slice(2);
 901  var internalInstanceKey = '__reactInternalInstance$' + randomKey;
 902  var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
 903  
 904  function precacheFiberNode(hostInst, node) {
 905    node[internalInstanceKey] = hostInst;
 906  }
 907  
 908  /**
 909   * Given a DOM node, return the closest ReactDOMComponent or
 910   * ReactDOMTextComponent instance ancestor.
 911   */
 912  function getClosestInstanceFromNode(node) {
 913    if (node[internalInstanceKey]) {
 914      return node[internalInstanceKey];
 915    }
 916  
 917    while (!node[internalInstanceKey]) {
 918      if (node.parentNode) {
 919        node = node.parentNode;
 920      } else {
 921        // Top of the tree. This node must not be part of a React tree (or is
 922        // unmounted, potentially).
 923        return null;
 924      }
 925    }
 926  
 927    var inst = node[internalInstanceKey];
 928    if (inst.tag === HostComponent || inst.tag === HostText) {
 929      // In Fiber, this will always be the deepest root.
 930      return inst;
 931    }
 932  
 933    return null;
 934  }
 935  
 936  /**
 937   * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
 938   * instance, or null if the node was not rendered by this React.
 939   */
 940  function getInstanceFromNode$1(node) {
 941    var inst = node[internalInstanceKey];
 942    if (inst) {
 943      if (inst.tag === HostComponent || inst.tag === HostText) {
 944        return inst;
 945      } else {
 946        return null;
 947      }
 948    }
 949    return null;
 950  }
 951  
 952  /**
 953   * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
 954   * DOM node.
 955   */
 956  function getNodeFromInstance$1(inst) {
 957    if (inst.tag === HostComponent || inst.tag === HostText) {
 958      // In Fiber this, is just the state node right now. We assume it will be
 959      // a host component or host text.
 960      return inst.stateNode;
 961    }
 962  
 963    // Without this first invariant, passing a non-DOM-component triggers the next
 964    // invariant for a missing parent, which is super confusing.
 965    (function () {
 966      {
 967        {
 968          throw ReactError(Error('getNodeFromInstance: Invalid argument.'));
 969        }
 970      }
 971    })();
 972  }
 973  
 974  function getFiberCurrentPropsFromNode$1(node) {
 975    return node[internalEventHandlersKey] || null;
 976  }
 977  
 978  function updateFiberProps(node, props) {
 979    node[internalEventHandlersKey] = props;
 980  }
 981  
 982  function getParent(inst) {
 983    do {
 984      inst = inst.return;
 985      // TODO: If this is a HostRoot we might want to bail out.
 986      // That is depending on if we want nested subtrees (layers) to bubble
 987      // events to their parent. We could also go through parentNode on the
 988      // host node but that wouldn't work for React Native and doesn't let us
 989      // do the portal feature.
 990    } while (inst && inst.tag !== HostComponent);
 991    if (inst) {
 992      return inst;
 993    }
 994    return null;
 995  }
 996  
 997  /**
 998   * Return the lowest common ancestor of A and B, or null if they are in
 999   * different trees.
1000   */
1001  function getLowestCommonAncestor(instA, instB) {
1002    var depthA = 0;
1003    for (var tempA = instA; tempA; tempA = getParent(tempA)) {
1004      depthA++;
1005    }
1006    var depthB = 0;
1007    for (var tempB = instB; tempB; tempB = getParent(tempB)) {
1008      depthB++;
1009    }
1010  
1011    // If A is deeper, crawl up.
1012    while (depthA - depthB > 0) {
1013      instA = getParent(instA);
1014      depthA--;
1015    }
1016  
1017    // If B is deeper, crawl up.
1018    while (depthB - depthA > 0) {
1019      instB = getParent(instB);
1020      depthB--;
1021    }
1022  
1023    // Walk in lockstep until we find a match.
1024    var depth = depthA;
1025    while (depth--) {
1026      if (instA === instB || instA === instB.alternate) {
1027        return instA;
1028      }
1029      instA = getParent(instA);
1030      instB = getParent(instB);
1031    }
1032    return null;
1033  }
1034  
1035  /**
1036   * Return if A is an ancestor of B.
1037   */
1038  
1039  
1040  /**
1041   * Return the parent instance of the passed-in instance.
1042   */
1043  
1044  
1045  /**
1046   * Simulates the traversal of a two-phase, capture/bubble event dispatch.
1047   */
1048  function traverseTwoPhase(inst, fn, arg) {
1049    var path = [];
1050    while (inst) {
1051      path.push(inst);
1052      inst = getParent(inst);
1053    }
1054    var i = void 0;
1055    for (i = path.length; i-- > 0;) {
1056      fn(path[i], 'captured', arg);
1057    }
1058    for (i = 0; i < path.length; i++) {
1059      fn(path[i], 'bubbled', arg);
1060    }
1061  }
1062  
1063  /**
1064   * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
1065   * should would receive a `mouseEnter` or `mouseLeave` event.
1066   *
1067   * Does not invoke the callback on the nearest common ancestor because nothing
1068   * "entered" or "left" that element.
1069   */
1070  function traverseEnterLeave(from, to, fn, argFrom, argTo) {
1071    var common = from && to ? getLowestCommonAncestor(from, to) : null;
1072    var pathFrom = [];
1073    while (true) {
1074      if (!from) {
1075        break;
1076      }
1077      if (from === common) {
1078        break;
1079      }
1080      var alternate = from.alternate;
1081      if (alternate !== null && alternate === common) {
1082        break;
1083      }
1084      pathFrom.push(from);
1085      from = getParent(from);
1086    }
1087    var pathTo = [];
1088    while (true) {
1089      if (!to) {
1090        break;
1091      }
1092      if (to === common) {
1093        break;
1094      }
1095      var _alternate = to.alternate;
1096      if (_alternate !== null && _alternate === common) {
1097        break;
1098      }
1099      pathTo.push(to);
1100      to = getParent(to);
1101    }
1102    for (var i = 0; i < pathFrom.length; i++) {
1103      fn(pathFrom[i], 'bubbled', argFrom);
1104    }
1105    for (var _i = pathTo.length; _i-- > 0;) {
1106      fn(pathTo[_i], 'captured', argTo);
1107    }
1108  }
1109  
1110  /**
1111   * Some event types have a notion of different registration names for different
1112   * "phases" of propagation. This finds listeners by a given phase.
1113   */
1114  function listenerAtPhase(inst, event, propagationPhase) {
1115    var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
1116    return getListener(inst, registrationName);
1117  }
1118  
1119  /**
1120   * A small set of propagation patterns, each of which will accept a small amount
1121   * of information, and generate a set of "dispatch ready event objects" - which
1122   * are sets of events that have already been annotated with a set of dispatched
1123   * listener functions/ids. The API is designed this way to discourage these
1124   * propagation strategies from actually executing the dispatches, since we
1125   * always want to collect the entire set of dispatches before executing even a
1126   * single one.
1127   */
1128  
1129  /**
1130   * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
1131   * here, allows us to not have to bind or create functions for each event.
1132   * Mutating the event's members allows us to not have to create a wrapping
1133   * "dispatch" object that pairs the event with the listener.
1134   */
1135  function accumulateDirectionalDispatches(inst, phase, event) {
1136    {
1137      !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
1138    }
1139    var listener = listenerAtPhase(inst, event, phase);
1140    if (listener) {
1141      event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
1142      event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
1143    }
1144  }
1145  
1146  /**
1147   * Collect dispatches (must be entirely collected before dispatching - see unit
1148   * tests). Lazily allocate the array to conserve memory.  We must loop through
1149   * each event and perform the traversal for each one. We cannot perform a
1150   * single traversal for the entire collection of events because each event may
1151   * have a different target.
1152   */
1153  function accumulateTwoPhaseDispatchesSingle(event) {
1154    if (event && event.dispatchConfig.phasedRegistrationNames) {
1155      traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
1156    }
1157  }
1158  
1159  /**
1160   * Accumulates without regard to direction, does not look for phased
1161   * registration names. Same as `accumulateDirectDispatchesSingle` but without
1162   * requiring that the `dispatchMarker` be the same as the dispatched ID.
1163   */
1164  function accumulateDispatches(inst, ignoredDirection, event) {
1165    if (inst && event && event.dispatchConfig.registrationName) {
1166      var registrationName = event.dispatchConfig.registrationName;
1167      var listener = getListener(inst, registrationName);
1168      if (listener) {
1169        event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
1170        event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
1171      }
1172    }
1173  }
1174  
1175  /**
1176   * Accumulates dispatches on an `SyntheticEvent`, but only for the
1177   * `dispatchMarker`.
1178   * @param {SyntheticEvent} event
1179   */
1180  function accumulateDirectDispatchesSingle(event) {
1181    if (event && event.dispatchConfig.registrationName) {
1182      accumulateDispatches(event._targetInst, null, event);
1183    }
1184  }
1185  
1186  function accumulateTwoPhaseDispatches(events) {
1187    forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
1188  }
1189  
1190  
1191  
1192  function accumulateEnterLeaveDispatches(leave, enter, from, to) {
1193    traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
1194  }
1195  
1196  function accumulateDirectDispatches(events) {
1197    forEachAccumulated(events, accumulateDirectDispatchesSingle);
1198  }
1199  
1200  var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
1201  
1202  // Do not use the below two methods directly!
1203  // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
1204  // (It is the only module that is allowed to access these methods.)
1205  
1206  function unsafeCastStringToDOMTopLevelType(topLevelType) {
1207    return topLevelType;
1208  }
1209  
1210  function unsafeCastDOMTopLevelTypeToString(topLevelType) {
1211    return topLevelType;
1212  }
1213  
1214  /**
1215   * Generate a mapping of standard vendor prefixes using the defined style property and event name.
1216   *
1217   * @param {string} styleProp
1218   * @param {string} eventName
1219   * @returns {object}
1220   */
1221  function makePrefixMap(styleProp, eventName) {
1222    var prefixes = {};
1223  
1224    prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
1225    prefixes['Webkit' + styleProp] = 'webkit' + eventName;
1226    prefixes['Moz' + styleProp] = 'moz' + eventName;
1227  
1228    return prefixes;
1229  }
1230  
1231  /**
1232   * A list of event names to a configurable list of vendor prefixes.
1233   */
1234  var vendorPrefixes = {
1235    animationend: makePrefixMap('Animation', 'AnimationEnd'),
1236    animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
1237    animationstart: makePrefixMap('Animation', 'AnimationStart'),
1238    transitionend: makePrefixMap('Transition', 'TransitionEnd')
1239  };
1240  
1241  /**
1242   * Event names that have already been detected and prefixed (if applicable).
1243   */
1244  var prefixedEventNames = {};
1245  
1246  /**
1247   * Element to check for prefixes on.
1248   */
1249  var style = {};
1250  
1251  /**
1252   * Bootstrap if a DOM exists.
1253   */
1254  if (canUseDOM) {
1255    style = document.createElement('div').style;
1256  
1257    // On some platforms, in particular some releases of Android 4.x,
1258    // the un-prefixed "animation" and "transition" properties are defined on the
1259    // style object but the events that fire will still be prefixed, so we need
1260    // to check if the un-prefixed events are usable, and if not remove them from the map.
1261    if (!('AnimationEvent' in window)) {
1262      delete vendorPrefixes.animationend.animation;
1263      delete vendorPrefixes.animationiteration.animation;
1264      delete vendorPrefixes.animationstart.animation;
1265    }
1266  
1267    // Same as above
1268    if (!('TransitionEvent' in window)) {
1269      delete vendorPrefixes.transitionend.transition;
1270    }
1271  }
1272  
1273  /**
1274   * Attempts to determine the correct vendor prefixed event name.
1275   *
1276   * @param {string} eventName
1277   * @returns {string}
1278   */
1279  function getVendorPrefixedEventName(eventName) {
1280    if (prefixedEventNames[eventName]) {
1281      return prefixedEventNames[eventName];
1282    } else if (!vendorPrefixes[eventName]) {
1283      return eventName;
1284    }
1285  
1286    var prefixMap = vendorPrefixes[eventName];
1287  
1288    for (var styleProp in prefixMap) {
1289      if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
1290        return prefixedEventNames[eventName] = prefixMap[styleProp];
1291      }
1292    }
1293  
1294    return eventName;
1295  }
1296  
1297  /**
1298   * To identify top level events in ReactDOM, we use constants defined by this
1299   * module. This is the only module that uses the unsafe* methods to express
1300   * that the constants actually correspond to the browser event names. This lets
1301   * us save some bundle size by avoiding a top level type -> event name map.
1302   * The rest of ReactDOM code should import top level types from this file.
1303   */
1304  var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
1305  var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
1306  var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
1307  var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
1308  var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
1309  var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
1310  var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
1311  var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
1312  var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
1313  var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
1314  var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
1315  var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
1316  var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
1317  var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
1318  var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
1319  var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
1320  var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
1321  var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
1322  var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
1323  var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
1324  var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
1325  var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
1326  var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
1327  var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
1328  var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
1329  var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
1330  var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
1331  var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
1332  var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
1333  var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
1334  var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
1335  var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
1336  var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
1337  var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
1338  var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
1339  var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
1340  var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
1341  var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
1342  var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
1343  var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
1344  var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
1345  var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
1346  var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
1347  var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
1348  var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
1349  var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
1350  var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
1351  var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
1352  var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
1353  var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
1354  var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
1355  var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
1356  var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
1357  var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
1358  var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
1359  
1360  
1361  var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
1362  var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
1363  var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
1364  var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
1365  var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
1366  var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
1367  var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
1368  var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
1369  var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
1370  var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
1371  var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
1372  var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
1373  var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
1374  var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
1375  var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
1376  var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
1377  var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
1378  var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
1379  var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
1380  var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
1381  var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
1382  var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
1383  var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
1384  var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
1385  var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
1386  
1387  // List of events that need to be individually attached to media elements.
1388  // Note that events in this list will *not* be listened to at the top level
1389  // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
1390  var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
1391  
1392  function getRawEventName(topLevelType) {
1393    return unsafeCastDOMTopLevelTypeToString(topLevelType);
1394  }
1395  
1396  /**
1397   * These variables store information about text content of a target node,
1398   * allowing comparison of content before and after a given event.
1399   *
1400   * Identify the node where selection currently begins, then observe
1401   * both its text content and its current position in the DOM. Since the
1402   * browser may natively replace the target node during composition, we can
1403   * use its position to find its replacement.
1404   *
1405   *
1406   */
1407  
1408  var root = null;
1409  var startText = null;
1410  var fallbackText = null;
1411  
1412  function initialize(nativeEventTarget) {
1413    root = nativeEventTarget;
1414    startText = getText();
1415    return true;
1416  }
1417  
1418  function reset() {
1419    root = null;
1420    startText = null;
1421    fallbackText = null;
1422  }
1423  
1424  function getData() {
1425    if (fallbackText) {
1426      return fallbackText;
1427    }
1428  
1429    var start = void 0;
1430    var startValue = startText;
1431    var startLength = startValue.length;
1432    var end = void 0;
1433    var endValue = getText();
1434    var endLength = endValue.length;
1435  
1436    for (start = 0; start < startLength; start++) {
1437      if (startValue[start] !== endValue[start]) {
1438        break;
1439      }
1440    }
1441  
1442    var minEnd = startLength - start;
1443    for (end = 1; end <= minEnd; end++) {
1444      if (startValue[startLength - end] !== endValue[endLength - end]) {
1445        break;
1446      }
1447    }
1448  
1449    var sliceTail = end > 1 ? 1 - end : undefined;
1450    fallbackText = endValue.slice(start, sliceTail);
1451    return fallbackText;
1452  }
1453  
1454  function getText() {
1455    if ('value' in root) {
1456      return root.value;
1457    }
1458    return root.textContent;
1459  }
1460  
1461  var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1462  
1463  var _assign = ReactInternals.assign;
1464  
1465  /* eslint valid-typeof: 0 */
1466  
1467  var EVENT_POOL_SIZE = 10;
1468  
1469  /**
1470   * @interface Event
1471   * @see http://www.w3.org/TR/DOM-Level-3-Events/
1472   */
1473  var EventInterface = {
1474    type: null,
1475    target: null,
1476    // currentTarget is set when dispatching; no use in copying it here
1477    currentTarget: function () {
1478      return null;
1479    },
1480    eventPhase: null,
1481    bubbles: null,
1482    cancelable: null,
1483    timeStamp: function (event) {
1484      return event.timeStamp || Date.now();
1485    },
1486    defaultPrevented: null,
1487    isTrusted: null
1488  };
1489  
1490  function functionThatReturnsTrue() {
1491    return true;
1492  }
1493  
1494  function functionThatReturnsFalse() {
1495    return false;
1496  }
1497  
1498  /**
1499   * Synthetic events are dispatched by event plugins, typically in response to a
1500   * top-level event delegation handler.
1501   *
1502   * These systems should generally use pooling to reduce the frequency of garbage
1503   * collection. The system should check `isPersistent` to determine whether the
1504   * event should be released into the pool after being dispatched. Users that
1505   * need a persisted event should invoke `persist`.
1506   *
1507   * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
1508   * normalizing browser quirks. Subclasses do not necessarily have to implement a
1509   * DOM interface; custom application-specific events can also subclass this.
1510   *
1511   * @param {object} dispatchConfig Configuration used to dispatch this event.
1512   * @param {*} targetInst Marker identifying the event target.
1513   * @param {object} nativeEvent Native browser event.
1514   * @param {DOMEventTarget} nativeEventTarget Target node.
1515   */
1516  function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
1517    {
1518      // these have a getter/setter for warnings
1519      delete this.nativeEvent;
1520      delete this.preventDefault;
1521      delete this.stopPropagation;
1522      delete this.isDefaultPrevented;
1523      delete this.isPropagationStopped;
1524    }
1525  
1526    this.dispatchConfig = dispatchConfig;
1527    this._targetInst = targetInst;
1528    this.nativeEvent = nativeEvent;
1529  
1530    var Interface = this.constructor.Interface;
1531    for (var propName in Interface) {
1532      if (!Interface.hasOwnProperty(propName)) {
1533        continue;
1534      }
1535      {
1536        delete this[propName]; // this has a getter/setter for warnings
1537      }
1538      var normalize = Interface[propName];
1539      if (normalize) {
1540        this[propName] = normalize(nativeEvent);
1541      } else {
1542        if (propName === 'target') {
1543          this.target = nativeEventTarget;
1544        } else {
1545          this[propName] = nativeEvent[propName];
1546        }
1547      }
1548    }
1549  
1550    var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
1551    if (defaultPrevented) {
1552      this.isDefaultPrevented = functionThatReturnsTrue;
1553    } else {
1554      this.isDefaultPrevented = functionThatReturnsFalse;
1555    }
1556    this.isPropagationStopped = functionThatReturnsFalse;
1557    return this;
1558  }
1559  
1560  _assign(SyntheticEvent.prototype, {
1561    preventDefault: function () {
1562      this.defaultPrevented = true;
1563      var event = this.nativeEvent;
1564      if (!event) {
1565        return;
1566      }
1567  
1568      if (event.preventDefault) {
1569        event.preventDefault();
1570      } else if (typeof event.returnValue !== 'unknown') {
1571        event.returnValue = false;
1572      }
1573      this.isDefaultPrevented = functionThatReturnsTrue;
1574    },
1575  
1576    stopPropagation: function () {
1577      var event = this.nativeEvent;
1578      if (!event) {
1579        return;
1580      }
1581  
1582      if (event.stopPropagation) {
1583        event.stopPropagation();
1584      } else if (typeof event.cancelBubble !== 'unknown') {
1585        // The ChangeEventPlugin registers a "propertychange" event for
1586        // IE. This event does not support bubbling or cancelling, and
1587        // any references to cancelBubble throw "Member not found".  A
1588        // typeof check of "unknown" circumvents this issue (and is also
1589        // IE specific).
1590        event.cancelBubble = true;
1591      }
1592  
1593      this.isPropagationStopped = functionThatReturnsTrue;
1594    },
1595  
1596    /**
1597     * We release all dispatched `SyntheticEvent`s after each event loop, adding
1598     * them back into the pool. This allows a way to hold onto a reference that
1599     * won't be added back into the pool.
1600     */
1601    persist: function () {
1602      this.isPersistent = functionThatReturnsTrue;
1603    },
1604  
1605    /**
1606     * Checks if this event should be released back into the pool.
1607     *
1608     * @return {boolean} True if this should not be released, false otherwise.
1609     */
1610    isPersistent: functionThatReturnsFalse,
1611  
1612    /**
1613     * `PooledClass` looks for `destructor` on each instance it releases.
1614     */
1615    destructor: function () {
1616      var Interface = this.constructor.Interface;
1617      for (var propName in Interface) {
1618        {
1619          Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
1620        }
1621      }
1622      this.dispatchConfig = null;
1623      this._targetInst = null;
1624      this.nativeEvent = null;
1625      this.isDefaultPrevented = functionThatReturnsFalse;
1626      this.isPropagationStopped = functionThatReturnsFalse;
1627      this._dispatchListeners = null;
1628      this._dispatchInstances = null;
1629      {
1630        Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
1631        Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
1632        Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
1633        Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
1634        Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
1635      }
1636    }
1637  });
1638  
1639  SyntheticEvent.Interface = EventInterface;
1640  
1641  /**
1642   * Helper to reduce boilerplate when creating subclasses.
1643   */
1644  SyntheticEvent.extend = function (Interface) {
1645    var Super = this;
1646  
1647    var E = function () {};
1648    E.prototype = Super.prototype;
1649    var prototype = new E();
1650  
1651    function Class() {
1652      return Super.apply(this, arguments);
1653    }
1654    _assign(prototype, Class.prototype);
1655    Class.prototype = prototype;
1656    Class.prototype.constructor = Class;
1657  
1658    Class.Interface = _assign({}, Super.Interface, Interface);
1659    Class.extend = Super.extend;
1660    addEventPoolingTo(Class);
1661  
1662    return Class;
1663  };
1664  
1665  addEventPoolingTo(SyntheticEvent);
1666  
1667  /**
1668   * Helper to nullify syntheticEvent instance properties when destructing
1669   *
1670   * @param {String} propName
1671   * @param {?object} getVal
1672   * @return {object} defineProperty object
1673   */
1674  function getPooledWarningPropertyDefinition(propName, getVal) {
1675    var isFunction = typeof getVal === 'function';
1676    return {
1677      configurable: true,
1678      set: set,
1679      get: get
1680    };
1681  
1682    function set(val) {
1683      var action = isFunction ? 'setting the method' : 'setting the property';
1684      warn(action, 'This is effectively a no-op');
1685      return val;
1686    }
1687  
1688    function get() {
1689      var action = isFunction ? 'accessing the method' : 'accessing the property';
1690      var result = isFunction ? 'This is a no-op function' : 'This is set to null';
1691      warn(action, result);
1692      return getVal;
1693    }
1694  
1695    function warn(action, result) {
1696      var warningCondition = false;
1697      !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
1698    }
1699  }
1700  
1701  function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
1702    var EventConstructor = this;
1703    if (EventConstructor.eventPool.length) {
1704      var instance = EventConstructor.eventPool.pop();
1705      EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
1706      return instance;
1707    }
1708    return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
1709  }
1710  
1711  function releasePooledEvent(event) {
1712    var EventConstructor = this;
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    })();
1720    event.destructor();
1721    if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
1722      EventConstructor.eventPool.push(event);
1723    }
1724  }
1725  
1726  function addEventPoolingTo(EventConstructor) {
1727    EventConstructor.eventPool = [];
1728    EventConstructor.getPooled = getPooledEvent;
1729    EventConstructor.release = releasePooledEvent;
1730  }
1731  
1732  /**
1733   * @interface Event
1734   * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
1735   */
1736  var SyntheticCompositionEvent = SyntheticEvent.extend({
1737    data: null
1738  });
1739  
1740  /**
1741   * @interface Event
1742   * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
1743   *      /#events-inputevents
1744   */
1745  var SyntheticInputEvent = SyntheticEvent.extend({
1746    data: null
1747  });
1748  
1749  var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
1750  var START_KEYCODE = 229;
1751  
1752  var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
1753  
1754  var documentMode = null;
1755  if (canUseDOM && 'documentMode' in document) {
1756    documentMode = document.documentMode;
1757  }
1758  
1759  // Webkit offers a very useful `textInput` event that can be used to
1760  // directly represent `beforeInput`. The IE `textinput` event is not as
1761  // useful, so we don't use it.
1762  var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
1763  
1764  // In IE9+, we have access to composition events, but the data supplied
1765  // by the native compositionend event may be incorrect. Japanese ideographic
1766  // spaces, for instance (\u3000) are not recorded correctly.
1767  var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
1768  
1769  var SPACEBAR_CODE = 32;
1770  var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
1771  
1772  // Events and their corresponding property names.
1773  var eventTypes = {
1774    beforeInput: {
1775      phasedRegistrationNames: {
1776        bubbled: 'onBeforeInput',
1777        captured: 'onBeforeInputCapture'
1778      },
1779      dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
1780    },
1781    compositionEnd: {
1782      phasedRegistrationNames: {
1783        bubbled: 'onCompositionEnd',
1784        captured: 'onCompositionEndCapture'
1785      },
1786      dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
1787    },
1788    compositionStart: {
1789      phasedRegistrationNames: {
1790        bubbled: 'onCompositionStart',
1791        captured: 'onCompositionStartCapture'
1792      },
1793      dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
1794    },
1795    compositionUpdate: {
1796      phasedRegistrationNames: {
1797        bubbled: 'onCompositionUpdate',
1798        captured: 'onCompositionUpdateCapture'
1799      },
1800      dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
1801    }
1802  };
1803  
1804  // Track whether we've ever handled a keypress on the space key.
1805  var hasSpaceKeypress = false;
1806  
1807  /**
1808   * Return whether a native keypress event is assumed to be a command.
1809   * This is required because Firefox fires `keypress` events for key commands
1810   * (cut, copy, select-all, etc.) even though no character is inserted.
1811   */
1812  function isKeypressCommand(nativeEvent) {
1813    return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
1814    // ctrlKey && altKey is equivalent to AltGr, and is not a command.
1815    !(nativeEvent.ctrlKey && nativeEvent.altKey);
1816  }
1817  
1818  /**
1819   * Translate native top level events into event types.
1820   *
1821   * @param {string} topLevelType
1822   * @return {object}
1823   */
1824  function getCompositionEventType(topLevelType) {
1825    switch (topLevelType) {
1826      case TOP_COMPOSITION_START:
1827        return eventTypes.compositionStart;
1828      case TOP_COMPOSITION_END:
1829        return eventTypes.compositionEnd;
1830      case TOP_COMPOSITION_UPDATE:
1831        return eventTypes.compositionUpdate;
1832    }
1833  }
1834  
1835  /**
1836   * Does our fallback best-guess model think this event signifies that
1837   * composition has begun?
1838   *
1839   * @param {string} topLevelType
1840   * @param {object} nativeEvent
1841   * @return {boolean}
1842   */
1843  function isFallbackCompositionStart(topLevelType, nativeEvent) {
1844    return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
1845  }
1846  
1847  /**
1848   * Does our fallback mode think that this event is the end of composition?
1849   *
1850   * @param {string} topLevelType
1851   * @param {object} nativeEvent
1852   * @return {boolean}
1853   */
1854  function isFallbackCompositionEnd(topLevelType, nativeEvent) {
1855    switch (topLevelType) {
1856      case TOP_KEY_UP:
1857        // Command keys insert or clear IME input.
1858        return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
1859      case TOP_KEY_DOWN:
1860        // Expect IME keyCode on each keydown. If we get any other
1861        // code we must have exited earlier.
1862        return nativeEvent.keyCode !== START_KEYCODE;
1863      case TOP_KEY_PRESS:
1864      case TOP_MOUSE_DOWN:
1865      case TOP_BLUR:
1866        // Events are not possible without cancelling IME.
1867        return true;
1868      default:
1869        return false;
1870    }
1871  }
1872  
1873  /**
1874   * Google Input Tools provides composition data via a CustomEvent,
1875   * with the `data` property populated in the `detail` object. If this
1876   * is available on the event object, use it. If not, this is a plain
1877   * composition event and we have nothing special to extract.
1878   *
1879   * @param {object} nativeEvent
1880   * @return {?string}
1881   */
1882  function getDataFromCustomEvent(nativeEvent) {
1883    var detail = nativeEvent.detail;
1884    if (typeof detail === 'object' && 'data' in detail) {
1885      return detail.data;
1886    }
1887    return null;
1888  }
1889  
1890  /**
1891   * Check if a composition event was triggered by Korean IME.
1892   * Our fallback mode does not work well with IE's Korean IME,
1893   * so just use native composition events when Korean IME is used.
1894   * Although CompositionEvent.locale property is deprecated,
1895   * it is available in IE, where our fallback mode is enabled.
1896   *
1897   * @param {object} nativeEvent
1898   * @return {boolean}
1899   */
1900  function isUsingKoreanIME(nativeEvent) {
1901    return nativeEvent.locale === 'ko';
1902  }
1903  
1904  // Track the current IME composition status, if any.
1905  var isComposing = false;
1906  
1907  /**
1908   * @return {?object} A SyntheticCompositionEvent.
1909   */
1910  function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
1911    var eventType = void 0;
1912    var fallbackData = void 0;
1913  
1914    if (canUseCompositionEvent) {
1915      eventType = getCompositionEventType(topLevelType);
1916    } else if (!isComposing) {
1917      if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
1918        eventType = eventTypes.compositionStart;
1919      }
1920    } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
1921      eventType = eventTypes.compositionEnd;
1922    }
1923  
1924    if (!eventType) {
1925      return null;
1926    }
1927  
1928    if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
1929      // The current composition is stored statically and must not be
1930      // overwritten while composition continues.
1931      if (!isComposing && eventType === eventTypes.compositionStart) {
1932        isComposing = initialize(nativeEventTarget);
1933      } else if (eventType === eventTypes.compositionEnd) {
1934        if (isComposing) {
1935          fallbackData = getData();
1936        }
1937      }
1938    }
1939  
1940    var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
1941  
1942    if (fallbackData) {
1943      // Inject data generated from fallback path into the synthetic event.
1944      // This matches the property of native CompositionEventInterface.
1945      event.data = fallbackData;
1946    } else {
1947      var customData = getDataFromCustomEvent(nativeEvent);
1948      if (customData !== null) {
1949        event.data = customData;
1950      }
1951    }
1952  
1953    accumulateTwoPhaseDispatches(event);
1954    return event;
1955  }
1956  
1957  /**
1958   * @param {TopLevelType} topLevelType Number from `TopLevelType`.
1959   * @param {object} nativeEvent Native browser event.
1960   * @return {?string} The string corresponding to this `beforeInput` event.
1961   */
1962  function getNativeBeforeInputChars(topLevelType, nativeEvent) {
1963    switch (topLevelType) {
1964      case TOP_COMPOSITION_END:
1965        return getDataFromCustomEvent(nativeEvent);
1966      case TOP_KEY_PRESS:
1967        /**
1968         * If native `textInput` events are available, our goal is to make
1969         * use of them. However, there is a special case: the spacebar key.
1970         * In Webkit, preventing default on a spacebar `textInput` event
1971         * cancels character insertion, but it *also* causes the browser
1972         * to fall back to its default spacebar behavior of scrolling the
1973         * page.
1974         *
1975         * Tracking at:
1976         * https://code.google.com/p/chromium/issues/detail?id=355103
1977         *
1978         * To avoid this issue, use the keypress event as if no `textInput`
1979         * event is available.
1980         */
1981        var which = nativeEvent.which;
1982        if (which !== SPACEBAR_CODE) {
1983          return null;
1984        }
1985  
1986        hasSpaceKeypress = true;
1987        return SPACEBAR_CHAR;
1988  
1989      case TOP_TEXT_INPUT:
1990        // Record the characters to be added to the DOM.
1991        var chars = nativeEvent.data;
1992  
1993        // If it's a spacebar character, assume that we have already handled
1994        // it at the keypress level and bail immediately. Android Chrome
1995        // doesn't give us keycodes, so we need to ignore it.
1996        if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
1997          return null;
1998        }
1999  
2000        return chars;
2001  
2002      default:
2003        // For other native event types, do nothing.
2004        return null;
2005    }
2006  }
2007  
2008  /**
2009   * For browsers that do not provide the `textInput` event, extract the
2010   * appropriate string to use for SyntheticInputEvent.
2011   *
2012   * @param {number} topLevelType Number from `TopLevelEventTypes`.
2013   * @param {object} nativeEvent Native browser event.
2014   * @return {?string} The fallback string for this `beforeInput` event.
2015   */
2016  function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
2017    // If we are currently composing (IME) and using a fallback to do so,
2018    // try to extract the composed characters from the fallback object.
2019    // If composition event is available, we extract a string only at
2020    // compositionevent, otherwise extract it at fallback events.
2021    if (isComposing) {
2022      if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
2023        var chars = getData();
2024        reset();
2025        isComposing = false;
2026        return chars;
2027      }
2028      return null;
2029    }
2030  
2031    switch (topLevelType) {
2032      case TOP_PASTE:
2033        // If a paste event occurs after a keypress, throw out the input
2034        // chars. Paste events should not lead to BeforeInput events.
2035        return null;
2036      case TOP_KEY_PRESS:
2037        /**
2038         * As of v27, Firefox may fire keypress events even when no character
2039         * will be inserted. A few possibilities:
2040         *
2041         * - `which` is `0`. Arrow keys, Esc key, etc.
2042         *
2043         * - `which` is the pressed key code, but no char is available.
2044         *   Ex: 'AltGr + d` in Polish. There is no modified character for
2045         *   this key combination and no character is inserted into the
2046         *   document, but FF fires the keypress for char code `100` anyway.
2047         *   No `input` event will occur.
2048         *
2049         * - `which` is the pressed key code, but a command combination is
2050         *   being used. Ex: `Cmd+C`. No character is inserted, and no
2051         *   `input` event will occur.
2052         */
2053        if (!isKeypressCommand(nativeEvent)) {
2054          // IE fires the `keypress` event when a user types an emoji via
2055          // Touch keyboard of Windows.  In such a case, the `char` property
2056          // holds an emoji character like `\uD83D\uDE0A`.  Because its length
2057          // is 2, the property `which` does not represent an emoji correctly.
2058          // In such a case, we directly return the `char` property instead of
2059          // using `which`.
2060          if (nativeEvent.char && nativeEvent.char.length > 1) {
2061            return nativeEvent.char;
2062          } else if (nativeEvent.which) {
2063            return String.fromCharCode(nativeEvent.which);
2064          }
2065        }
2066        return null;
2067      case TOP_COMPOSITION_END:
2068        return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
2069      default:
2070        return null;
2071    }
2072  }
2073  
2074  /**
2075   * Extract a SyntheticInputEvent for `beforeInput`, based on either native
2076   * `textInput` or fallback behavior.
2077   *
2078   * @return {?object} A SyntheticInputEvent.
2079   */
2080  function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
2081    var chars = void 0;
2082  
2083    if (canUseTextInputEvent) {
2084      chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
2085    } else {
2086      chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
2087    }
2088  
2089    // If no characters are being inserted, no BeforeInput event should
2090    // be fired.
2091    if (!chars) {
2092      return null;
2093    }
2094  
2095    var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
2096  
2097    event.data = chars;
2098    accumulateTwoPhaseDispatches(event);
2099    return event;
2100  }
2101  
2102  /**
2103   * Create an `onBeforeInput` event to match
2104   * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
2105   *
2106   * This event plugin is based on the native `textInput` event
2107   * available in Chrome, Safari, Opera, and IE. This event fires after
2108   * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
2109   *
2110   * `beforeInput` is spec'd but not implemented in any browsers, and
2111   * the `input` event does not provide any useful information about what has
2112   * actually been added, contrary to the spec. Thus, `textInput` is the best
2113   * available event to identify the characters that have actually been inserted
2114   * into the target node.
2115   *
2116   * This plugin is also responsible for emitting `composition` events, thus
2117   * allowing us to share composition fallback code for both `beforeInput` and
2118   * `composition` event types.
2119   */
2120  var BeforeInputEventPlugin = {
2121    eventTypes: eventTypes,
2122  
2123    extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
2124      var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
2125  
2126      var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
2127  
2128      if (composition === null) {
2129        return beforeInput;
2130      }
2131  
2132      if (beforeInput === null) {
2133        return composition;
2134      }
2135  
2136      return [composition, beforeInput];
2137    }
2138  };
2139  
2140  // Use to restore controlled state after a change event has fired.
2141  
2142  var restoreImpl = null;
2143  var restoreTarget = null;
2144  var restoreQueue = null;
2145  
2146  function restoreStateOfTarget(target) {
2147    // We perform this translation at the end of the event loop so that we
2148    // always receive the correct fiber here
2149    var internalInstance = getInstanceFromNode(target);
2150    if (!internalInstance) {
2151      // Unmounted
2152      return;
2153    }
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    })();
2161    var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
2162    restoreImpl(internalInstance.stateNode, internalInstance.type, props);
2163  }
2164  
2165  function setRestoreImplementation(impl) {
2166    restoreImpl = impl;
2167  }
2168  
2169  function enqueueStateRestore(target) {
2170    if (restoreTarget) {
2171      if (restoreQueue) {
2172        restoreQueue.push(target);
2173      } else {
2174        restoreQueue = [target];
2175      }
2176    } else {
2177      restoreTarget = target;
2178    }
2179  }
2180  
2181  function needsStateRestore() {
2182    return restoreTarget !== null || restoreQueue !== null;
2183  }
2184  
2185  function restoreStateIfNeeded() {
2186    if (!restoreTarget) {
2187      return;
2188    }
2189    var target = restoreTarget;
2190    var queuedTargets = restoreQueue;
2191    restoreTarget = null;
2192    restoreQueue = null;
2193  
2194    restoreStateOfTarget(target);
2195    if (queuedTargets) {
2196      for (var i = 0; i < queuedTargets.length; i++) {
2197        restoreStateOfTarget(queuedTargets[i]);
2198      }
2199    }
2200  }
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  
2290  // Used as a way to call batchedUpdates when we don't have a reference to
2291  // the renderer. Such as when we're dispatching events or if third party
2292  // libraries need to call batchedUpdates. Eventually, this API will go away when
2293  // everything is batched by default. We'll then have a similar API to opt-out of
2294  // scheduled work and instead do synchronous work.
2295  
2296  // Defaults
2297  var batchedUpdatesImpl = function (fn, bookkeeping) {
2298    return fn(bookkeeping);
2299  };
2300  var discreteUpdatesImpl = function (fn, a, b, c) {
2301    return fn(a, b, c);
2302  };
2303  var flushDiscreteUpdatesImpl = function () {};
2304  var batchedEventUpdatesImpl = batchedUpdatesImpl;
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  
2323  function batchedUpdates(fn, bookkeeping) {
2324    if (isInsideEventHandler) {
2325      // If we are currently inside another batch, we need to wait until it
2326      // fully completes before restoring state.
2327      return fn(bookkeeping);
2328    }
2329    isInsideEventHandler = true;
2330    try {
2331      return batchedUpdatesImpl(fn, bookkeeping);
2332    } finally {
2333      isInsideEventHandler = false;
2334      finishEventHandler();
2335    }
2336  }
2337  
2338  function batchedEventUpdates(fn, a, b) {
2339    if (isInsideEventHandler) {
2340      // If we are currently inside another batch, we need to wait until it
2341      // fully completes before restoring state.
2342      return fn(a, b);
2343    }
2344    isInsideEventHandler = true;
2345    try {
2346      return batchedEventUpdatesImpl(fn, a, b);
2347    } finally {
2348      isInsideEventHandler = false;
2349      finishEventHandler();
2350    }
2351  }
2352  
2353  function discreteUpdates(fn, a, b, c) {
2354    var prevIsInsideEventHandler = isInsideEventHandler;
2355    isInsideEventHandler = true;
2356    try {
2357      return discreteUpdatesImpl(fn, a, b, c);
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;
2391  }
2392  
2393  /**
2394   * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
2395   */
2396  var supportedInputTypes = {
2397    color: true,
2398    date: true,
2399    datetime: true,
2400    'datetime-local': true,
2401    email: true,
2402    month: true,
2403    number: true,
2404    password: true,
2405    range: true,
2406    search: true,
2407    tel: true,
2408    text: true,
2409    time: true,
2410    url: true,
2411    week: true
2412  };
2413  
2414  function isTextInputElement(elem) {
2415    var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
2416  
2417    if (nodeName === 'input') {
2418      return !!supportedInputTypes[elem.type];
2419    }
2420  
2421    if (nodeName === 'textarea') {
2422      return true;
2423    }
2424  
2425    return false;
2426  }
2427  
2428  /**
2429   * HTML nodeType values that represent the type of the node
2430   */
2431  
2432  var ELEMENT_NODE = 1;
2433  var TEXT_NODE = 3;
2434  var COMMENT_NODE = 8;
2435  var DOCUMENT_NODE = 9;
2436  var DOCUMENT_FRAGMENT_NODE = 11;
2437  
2438  /**
2439   * Gets the target node from a native browser event by accounting for
2440   * inconsistencies in browser DOM APIs.
2441   *
2442   * @param {object} nativeEvent Native browser event.
2443   * @return {DOMEventTarget} Target node.
2444   */
2445  function getEventTarget(nativeEvent) {
2446    // Fallback to nativeEvent.srcElement for IE9
2447    // https://github.com/facebook/react/issues/12506
2448    var target = nativeEvent.target || nativeEvent.srcElement || window;
2449  
2450    // Normalize SVG <use> element events #4963
2451    if (target.correspondingUseElement) {
2452      target = target.correspondingUseElement;
2453    }
2454  
2455    // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
2456    // @see http://www.quirksmode.org/js/events_properties.html
2457    return target.nodeType === TEXT_NODE ? target.parentNode : target;
2458  }
2459  
2460  /**
2461   * Checks if an event is supported in the current execution environment.
2462   *
2463   * NOTE: This will not work correctly for non-generic events such as `change`,
2464   * `reset`, `load`, `error`, and `select`.
2465   *
2466   * Borrows from Modernizr.
2467   *
2468   * @param {string} eventNameSuffix Event name, e.g. "click".
2469   * @return {boolean} True if the event is supported.
2470   * @internal
2471   * @license Modernizr 3.0.0pre (Custom Build) | MIT
2472   */
2473  function isEventSupported(eventNameSuffix) {
2474    if (!canUseDOM) {
2475      return false;
2476    }
2477  
2478    var eventName = 'on' + eventNameSuffix;
2479    var isSupported = eventName in document;
2480  
2481    if (!isSupported) {
2482      var element = document.createElement('div');
2483      element.setAttribute(eventName, 'return;');
2484      isSupported = typeof element[eventName] === 'function';
2485    }
2486  
2487    return isSupported;
2488  }
2489  
2490  function isCheckable(elem) {
2491    var type = elem.type;
2492    var nodeName = elem.nodeName;
2493    return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
2494  }
2495  
2496  function getTracker(node) {
2497    return node._valueTracker;
2498  }
2499  
2500  function detachTracker(node) {
2501    node._valueTracker = null;
2502  }
2503  
2504  function getValueFromNode(node) {
2505    var value = '';
2506    if (!node) {
2507      return value;
2508    }
2509  
2510    if (isCheckable(node)) {
2511      value = node.checked ? 'true' : 'false';
2512    } else {
2513      value = node.value;
2514    }
2515  
2516    return value;
2517  }
2518  
2519  function trackValueOnNode(node) {
2520    var valueField = isCheckable(node) ? 'checked' : 'value';
2521    var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
2522  
2523    var currentValue = '' + node[valueField];
2524  
2525    // if someone has already defined a value or Safari, then bail
2526    // and don't track value will cause over reporting of changes,
2527    // but it's better then a hard failure
2528    // (needed for certain tests that spyOn input values and Safari)
2529    if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
2530      return;
2531    }
2532    var get = descriptor.get,
2533        set = descriptor.set;
2534  
2535    Object.defineProperty(node, valueField, {
2536      configurable: true,
2537      get: function () {
2538        return get.call(this);
2539      },
2540      set: function (value) {
2541        currentValue = '' + value;
2542        set.call(this, value);
2543      }
2544    });
2545    // We could've passed this the first time
2546    // but it triggers a bug in IE11 and Edge 14/15.
2547    // Calling defineProperty() again should be equivalent.
2548    // https://github.com/facebook/react/issues/11768
2549    Object.defineProperty(node, valueField, {
2550      enumerable: descriptor.enumerable
2551    });
2552  
2553    var tracker = {
2554      getValue: function () {
2555        return currentValue;
2556      },
2557      setValue: function (value) {
2558        currentValue = '' + value;
2559      },
2560      stopTracking: function () {
2561        detachTracker(node);
2562        delete node[valueField];
2563      }
2564    };
2565    return tracker;
2566  }
2567  
2568  function track(node) {
2569    if (getTracker(node)) {
2570      return;
2571    }
2572  
2573    // TODO: Once it's just Fiber we can move this to node._wrapperState
2574    node._valueTracker = trackValueOnNode(node);
2575  }
2576  
2577  function updateValueIfChanged(node) {
2578    if (!node) {
2579      return false;
2580    }
2581  
2582    var tracker = getTracker(node);
2583    // if there is no tracker at this point it's unlikely
2584    // that trying again will succeed
2585    if (!tracker) {
2586      return true;
2587    }
2588  
2589    var lastValue = tracker.getValue();
2590    var nextValue = getValueFromNode(node);
2591    if (nextValue !== lastValue) {
2592      tracker.setValue(nextValue);
2593      return true;
2594    }
2595    return false;
2596  }
2597  
2598  var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2599  
2600  // Prevent newer renderers from RTE when used with older react package versions.
2601  // Current owner and dispatcher used to share the same ref,
2602  // but PR #14548 split them out to better support the react-debug-tools package.
2603  if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
2604    ReactSharedInternals.ReactCurrentDispatcher = {
2605      current: null
2606    };
2607  }
2608  if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
2609    ReactSharedInternals.ReactCurrentBatchConfig = {
2610      suspense: null
2611    };
2612  }
2613  
2614  var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
2615  
2616  var describeComponentFrame = function (name, source, ownerName) {
2617    var sourceInfo = '';
2618    if (source) {
2619      var path = source.fileName;
2620      var fileName = path.replace(BEFORE_SLASH_RE, '');
2621      {
2622        // In DEV, include code for a common special case:
2623        // prefer "folder/index.js" instead of just "index.js".
2624        if (/^index\./.test(fileName)) {
2625          var match = path.match(BEFORE_SLASH_RE);
2626          if (match) {
2627            var pathBeforeSlash = match[1];
2628            if (pathBeforeSlash) {
2629              var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
2630              fileName = folderName + '/' + fileName;
2631            }
2632          }
2633        }
2634      }
2635      sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
2636    } else if (ownerName) {
2637      sourceInfo = ' (created by ' + ownerName + ')';
2638    }
2639    return '\n    in ' + (name || 'Unknown') + sourceInfo;
2640  };
2641  
2642  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2643  // nor polyfill, then a plain number is used for performance.
2644  var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2645  
2646  var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2647  var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2648  var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2649  var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2650  var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2651  var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
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?
2655  
2656  var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2657  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2658  var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2659  var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
2660  var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
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;
2664  
2665  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2666  var FAUX_ITERATOR_SYMBOL = '@@iterator';
2667  
2668  function getIteratorFn(maybeIterable) {
2669    if (maybeIterable === null || typeof maybeIterable !== 'object') {
2670      return null;
2671    }
2672    var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
2673    if (typeof maybeIterator === 'function') {
2674      return maybeIterator;
2675    }
2676    return null;
2677  }
2678  
2679  var Pending = 0;
2680  var Resolved = 1;
2681  var Rejected = 2;
2682  
2683  function refineResolvedLazyComponent(lazyComponent) {
2684    return lazyComponent._status === Resolved ? lazyComponent._result : null;
2685  }
2686  
2687  function getWrappedName(outerType, innerType, wrapperName) {
2688    var functionName = innerType.displayName || innerType.name || '';
2689    return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
2690  }
2691  
2692  function getComponentName(type) {
2693    if (type == null) {
2694      // Host root, text node or just invalid type.
2695      return null;
2696    }
2697    {
2698      if (typeof type.tag === 'number') {
2699        warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
2700      }
2701    }
2702    if (typeof type === 'function') {
2703      return type.displayName || type.name || null;
2704    }
2705    if (typeof type === 'string') {
2706      return type;
2707    }
2708    switch (type) {
2709      case REACT_FRAGMENT_TYPE:
2710        return 'Fragment';
2711      case REACT_PORTAL_TYPE:
2712        return 'Portal';
2713      case REACT_PROFILER_TYPE:
2714        return 'Profiler';
2715      case REACT_STRICT_MODE_TYPE:
2716        return 'StrictMode';
2717      case REACT_SUSPENSE_TYPE:
2718        return 'Suspense';
2719      case REACT_SUSPENSE_LIST_TYPE:
2720        return 'SuspenseList';
2721    }
2722    if (typeof type === 'object') {
2723      switch (type.$$typeof) {
2724        case REACT_CONTEXT_TYPE:
2725          return 'Context.Consumer';
2726        case REACT_PROVIDER_TYPE:
2727          return 'Context.Provider';
2728        case REACT_FORWARD_REF_TYPE:
2729          return getWrappedName(type, type.render, 'ForwardRef');
2730        case REACT_MEMO_TYPE:
2731          return getComponentName(type.type);
2732        case REACT_LAZY_TYPE:
2733          {
2734            var thenable = type;
2735            var resolvedThenable = refineResolvedLazyComponent(thenable);
2736            if (resolvedThenable) {
2737              return getComponentName(resolvedThenable);
2738            }
2739            break;
2740          }
2741      }
2742    }
2743    return null;
2744  }
2745  
2746  var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2747  
2748  function describeFiber(fiber) {
2749    switch (fiber.tag) {
2750      case HostRoot:
2751      case HostPortal:
2752      case HostText:
2753      case Fragment:
2754      case ContextProvider:
2755      case ContextConsumer:
2756        return '';
2757      default:
2758        var owner = fiber._debugOwner;
2759        var source = fiber._debugSource;
2760        var name = getComponentName(fiber.type);
2761        var ownerName = null;
2762        if (owner) {
2763          ownerName = getComponentName(owner.type);
2764        }
2765        return describeComponentFrame(name, source, ownerName);
2766    }
2767  }
2768  
2769  function getStackByFiberInDevAndProd(workInProgress) {
2770    var info = '';
2771    var node = workInProgress;
2772    do {
2773      info += describeFiber(node);
2774      node = node.return;
2775    } while (node);
2776    return info;
2777  }
2778  
2779  var current = null;
2780  var phase = null;
2781  
2782  function getCurrentFiberOwnerNameInDevOrNull() {
2783    {
2784      if (current === null) {
2785        return null;
2786      }
2787      var owner = current._debugOwner;
2788      if (owner !== null && typeof owner !== 'undefined') {
2789        return getComponentName(owner.type);
2790      }
2791    }
2792    return null;
2793  }
2794  
2795  function getCurrentFiberStackInDev() {
2796    {
2797      if (current === null) {
2798        return '';
2799      }
2800      // Safe because if current fiber exists, we are reconciling,
2801      // and it is guaranteed to be the work-in-progress version.
2802      return getStackByFiberInDevAndProd(current);
2803    }
2804    return '';
2805  }
2806  
2807  function resetCurrentFiber() {
2808    {
2809      ReactDebugCurrentFrame.getCurrentStack = null;
2810      current = null;
2811      phase = null;
2812    }
2813  }
2814  
2815  function setCurrentFiber(fiber) {
2816    {
2817      ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
2818      current = fiber;
2819      phase = null;
2820    }
2821  }
2822  
2823  function setCurrentPhase(lifeCyclePhase) {
2824    {
2825      phase = lifeCyclePhase;
2826    }
2827  }
2828  
2829  /**
2830   * Similar to invariant but only logs a warning if the condition is not met.
2831   * This can be used to log issues in development environments in critical
2832   * paths. Removing the logging code for production environments will keep the
2833   * same logic and follow the same code paths.
2834   */
2835  
2836  var warning = warningWithoutStack$1;
2837  
2838  {
2839    warning = function (condition, format) {
2840      if (condition) {
2841        return;
2842      }
2843      var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2844      var stack = ReactDebugCurrentFrame.getStackAddendum();
2845      // eslint-disable-next-line react-internal/warning-and-invariant-args
2846  
2847      for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2848        args[_key - 2] = arguments[_key];
2849      }
2850  
2851      warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
2852    };
2853  }
2854  
2855  var warning$1 = warning;
2856  
2857  // A reserved attribute.
2858  // It is handled by React separately and shouldn't be written to the DOM.
2859  var RESERVED = 0;
2860  
2861  // A simple string attribute.
2862  // Attributes that aren't in the whitelist are presumed to have this type.
2863  var STRING = 1;
2864  
2865  // A string attribute that accepts booleans in React. In HTML, these are called
2866  // "enumerated" attributes with "true" and "false" as possible values.
2867  // When true, it should be set to a "true" string.
2868  // When false, it should be set to a "false" string.
2869  var BOOLEANISH_STRING = 2;
2870  
2871  // A real boolean attribute.
2872  // When true, it should be present (set either to an empty string or its name).
2873  // When false, it should be omitted.
2874  var BOOLEAN = 3;
2875  
2876  // An attribute that can be used as a flag as well as with a value.
2877  // When true, it should be present (set either to an empty string or its name).
2878  // When false, it should be omitted.
2879  // For any other value, should be present with that value.
2880  var OVERLOADED_BOOLEAN = 4;
2881  
2882  // An attribute that must be numeric or parse as a numeric.
2883  // When falsy, it should be removed.
2884  var NUMERIC = 5;
2885  
2886  // An attribute that must be positive numeric or parse as a positive numeric.
2887  // When falsy, it should be removed.
2888  var POSITIVE_NUMERIC = 6;
2889  
2890  /* eslint-disable max-len */
2891  var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
2892  /* eslint-enable max-len */
2893  var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
2894  
2895  
2896  var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
2897  var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
2898  
2899  var hasOwnProperty = Object.prototype.hasOwnProperty;
2900  var illegalAttributeNameCache = {};
2901  var validatedAttributeNameCache = {};
2902  
2903  function isAttributeNameSafe(attributeName) {
2904    if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
2905      return true;
2906    }
2907    if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
2908      return false;
2909    }
2910    if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
2911      validatedAttributeNameCache[attributeName] = true;
2912      return true;
2913    }
2914    illegalAttributeNameCache[attributeName] = true;
2915    {
2916      warning$1(false, 'Invalid attribute name: `%s`', attributeName);
2917    }
2918    return false;
2919  }
2920  
2921  function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
2922    if (propertyInfo !== null) {
2923      return propertyInfo.type === RESERVED;
2924    }
2925    if (isCustomComponentTag) {
2926      return false;
2927    }
2928    if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
2929      return true;
2930    }
2931    return false;
2932  }
2933  
2934  function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
2935    if (propertyInfo !== null && propertyInfo.type === RESERVED) {
2936      return false;
2937    }
2938    switch (typeof value) {
2939      case 'function':
2940      // $FlowIssue symbol is perfectly valid here
2941      case 'symbol':
2942        // eslint-disable-line
2943        return true;
2944      case 'boolean':
2945        {
2946          if (isCustomComponentTag) {
2947            return false;
2948          }
2949          if (propertyInfo !== null) {
2950            return !propertyInfo.acceptsBooleans;
2951          } else {
2952            var prefix = name.toLowerCase().slice(0, 5);
2953            return prefix !== 'data-' && prefix !== 'aria-';
2954          }
2955        }
2956      default:
2957        return false;
2958    }
2959  }
2960  
2961  function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
2962    if (value === null || typeof value === 'undefined') {
2963      return true;
2964    }
2965    if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
2966      return true;
2967    }
2968    if (isCustomComponentTag) {
2969      return false;
2970    }
2971    if (propertyInfo !== null) {
2972      switch (propertyInfo.type) {
2973        case BOOLEAN:
2974          return !value;
2975        case OVERLOADED_BOOLEAN:
2976          return value === false;
2977        case NUMERIC:
2978          return isNaN(value);
2979        case POSITIVE_NUMERIC:
2980          return isNaN(value) || value < 1;
2981      }
2982    }
2983    return false;
2984  }
2985  
2986  function getPropertyInfo(name) {
2987    return properties.hasOwnProperty(name) ? properties[name] : null;
2988  }
2989  
2990  function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
2991    this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
2992    this.attributeName = attributeName;
2993    this.attributeNamespace = attributeNamespace;
2994    this.mustUseProperty = mustUseProperty;
2995    this.propertyName = name;
2996    this.type = type;
2997    this.sanitizeURL = sanitizeURL;
2998  }
2999  
3000  // When adding attributes to this list, be sure to also add them to
3001  // the `possibleStandardNames` module to ensure casing and incorrect
3002  // name warnings.
3003  var properties = {};
3004  
3005  // These props are reserved by React. They shouldn't be written to the DOM.
3006  ['children', 'dangerouslySetInnerHTML',
3007  // TODO: This prevents the assignment of defaultValue to regular
3008  // elements (not just inputs). Now that ReactDOMInput assigns to the
3009  // defaultValue property -- do we need this?
3010  'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
3011    properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
3012    name, // attributeName
3013    null, // attributeNamespace
3014    false);
3015  } // sanitizeURL
3016  );
3017  
3018  // A few React string attributes have a different name.
3019  // This is a mapping from React prop names to the attribute names.
3020  [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
3021    var name = _ref[0],
3022        attributeName = _ref[1];
3023  
3024    properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
3025    attributeName, // attributeName
3026    null, // attributeNamespace
3027    false);
3028  } // sanitizeURL
3029  );
3030  
3031  // These are "enumerated" HTML attributes that accept "true" and "false".
3032  // In React, we let users pass `true` and `false` even though technically
3033  // these aren't boolean attributes (they are coerced to strings).
3034  ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
3035    properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
3036    name.toLowerCase(), // attributeName
3037    null, // attributeNamespace
3038    false);
3039  } // sanitizeURL
3040  );
3041  
3042  // These are "enumerated" SVG attributes that accept "true" and "false".
3043  // In React, we let users pass `true` and `false` even though technically
3044  // these aren't boolean attributes (they are coerced to strings).
3045  // Since these are SVG attributes, their attribute names are case-sensitive.
3046  ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
3047    properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
3048    name, // attributeName
3049    null, // attributeNamespace
3050    false);
3051  } // sanitizeURL
3052  );
3053  
3054  // These are HTML boolean attributes.
3055  ['allowFullScreen', 'async',
3056  // Note: there is a special case that prevents it from being written to the DOM
3057  // on the client side because the browsers are inconsistent. Instead we call focus().
3058  'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
3059  // Microdata
3060  'itemScope'].forEach(function (name) {
3061    properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
3062    name.toLowerCase(), // attributeName
3063    null, // attributeNamespace
3064    false);
3065  } // sanitizeURL
3066  );
3067  
3068  // These are the few React props that we set as DOM properties
3069  // rather than attributes. These are all booleans.
3070  ['checked',
3071  // Note: `option.selected` is not updated if `select.multiple` is
3072  // disabled with `removeAttribute`. We have special logic for handling this.
3073  'multiple', 'muted', 'selected'].forEach(function (name) {
3074    properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
3075    name, // attributeName
3076    null, // attributeNamespace
3077    false);
3078  } // sanitizeURL
3079  );
3080  
3081  // These are HTML attributes that are "overloaded booleans": they behave like
3082  // booleans, but can also accept a string value.
3083  ['capture', 'download'].forEach(function (name) {
3084    properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
3085    name, // attributeName
3086    null, // attributeNamespace
3087    false);
3088  } // sanitizeURL
3089  );
3090  
3091  // These are HTML attributes that must be positive numbers.
3092  ['cols', 'rows', 'size', 'span'].forEach(function (name) {
3093    properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
3094    name, // attributeName
3095    null, // attributeNamespace
3096    false);
3097  } // sanitizeURL
3098  );
3099  
3100  // These are HTML attributes that must be numbers.
3101  ['rowSpan', 'start'].forEach(function (name) {
3102    properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
3103    name.toLowerCase(), // attributeName
3104    null, // attributeNamespace
3105    false);
3106  } // sanitizeURL
3107  );
3108  
3109  var CAMELIZE = /[\-\:]([a-z])/g;
3110  var capitalize = function (token) {
3111    return token[1].toUpperCase();
3112  };
3113  
3114  // This is a list of all SVG attributes that need special casing, namespacing,
3115  // or boolean value assignment. Regular attributes that just accept strings
3116  // and have the same names are omitted, just like in the HTML whitelist.
3117  // Some of these attributes can be hard to find. This list was created by
3118  // scrapping the MDN documentation.
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) {
3120    var name = attributeName.replace(CAMELIZE, capitalize);
3121    properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
3122    attributeName, null, // attributeNamespace
3123    false);
3124  } // sanitizeURL
3125  );
3126  
3127  // String SVG attributes with the xlink namespace.
3128  ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
3129    var name = attributeName.replace(CAMELIZE, capitalize);
3130    properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
3131    attributeName, 'http://www.w3.org/1999/xlink', false);
3132  } // sanitizeURL
3133  );
3134  
3135  // String SVG attributes with the xml namespace.
3136  ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
3137    var name = attributeName.replace(CAMELIZE, capitalize);
3138    properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
3139    attributeName, 'http://www.w3.org/XML/1998/namespace', false);
3140  } // sanitizeURL
3141  );
3142  
3143  // These attribute exists both in HTML and SVG.
3144  // The attribute name is case-sensitive in SVG so we can't just use
3145  // the React name like we do for attributes that exist only in HTML.
3146  ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
3147    properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
3148    attributeName.toLowerCase(), // attributeName
3149    null, // attributeNamespace
3150    false);
3151  } // sanitizeURL
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  }
3201  
3202  /**
3203   * Get the value for a property on a node. Only used in DEV for SSR validation.
3204   * The "expected" argument is used as a hint of what the expected value is.
3205   * Some properties have multiple equivalent values.
3206   */
3207  function getValueForProperty(node, name, expected, propertyInfo) {
3208    {
3209      if (propertyInfo.mustUseProperty) {
3210        var propertyName = propertyInfo.propertyName;
3211  
3212        return node[propertyName];
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  
3221        var attributeName = propertyInfo.attributeName;
3222  
3223        var stringValue = null;
3224  
3225        if (propertyInfo.type === OVERLOADED_BOOLEAN) {
3226          if (node.hasAttribute(attributeName)) {
3227            var value = node.getAttribute(attributeName);
3228            if (value === '') {
3229              return true;
3230            }
3231            if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
3232              return value;
3233            }
3234            if (value === '' + expected) {
3235              return expected;
3236            }
3237            return value;
3238          }
3239        } else if (node.hasAttribute(attributeName)) {
3240          if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
3241            // We had an attribute but shouldn't have had one, so read it
3242            // for the error message.
3243            return node.getAttribute(attributeName);
3244          }
3245          if (propertyInfo.type === BOOLEAN) {
3246            // If this was a boolean, it doesn't matter what the value is
3247            // the fact that we have it is the same as the expected.
3248            return expected;
3249          }
3250          // Even if this property uses a namespace we use getAttribute
3251          // because we assume its namespaced name is the same as our config.
3252          // To use getAttributeNS we need the local name which we don't have
3253          // in our config atm.
3254          stringValue = node.getAttribute(attributeName);
3255        }
3256  
3257        if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
3258          return stringValue === null ? expected : stringValue;
3259        } else if (stringValue === '' + expected) {
3260          return expected;
3261        } else {
3262          return stringValue;
3263        }
3264      }
3265    }
3266  }
3267  
3268  /**
3269   * Get the value for a attribute on a node. Only used in DEV for SSR validation.
3270   * The third argument is used as a hint of what the expected value is. Some
3271   * attributes have multiple equivalent values.
3272   */
3273  function getValueForAttribute(node, name, expected) {
3274    {
3275      if (!isAttributeNameSafe(name)) {
3276        return;
3277      }
3278      if (!node.hasAttribute(name)) {
3279        return expected === undefined ? undefined : null;
3280      }
3281      var value = node.getAttribute(name);
3282      if (value === '' + expected) {
3283        return expected;
3284      }
3285      return value;
3286    }
3287  }
3288  
3289  /**
3290   * Sets the value for a property on a node.
3291   *
3292   * @param {DOMElement} node
3293   * @param {string} name
3294   * @param {*} value
3295   */
3296  function setValueForProperty(node, name, value, isCustomComponentTag) {
3297    var propertyInfo = getPropertyInfo(name);
3298    if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
3299      return;
3300    }
3301    if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
3302      value = null;
3303    }
3304    // If the prop isn't in the special list, treat it as a simple attribute.
3305    if (isCustomComponentTag || propertyInfo === null) {
3306      if (isAttributeNameSafe(name)) {
3307        var _attributeName = name;
3308        if (value === null) {
3309          node.removeAttribute(_attributeName);
3310        } else {
3311          node.setAttribute(_attributeName, '' + value);
3312        }
3313      }
3314      return;
3315    }
3316    var mustUseProperty = propertyInfo.mustUseProperty;
3317  
3318    if (mustUseProperty) {
3319      var propertyName = propertyInfo.propertyName;
3320  
3321      if (value === null) {
3322        var type = propertyInfo.type;
3323  
3324        node[propertyName] = type === BOOLEAN ? false : '';
3325      } else {
3326        // Contrary to `setAttribute`, object properties are properly
3327        // `toString`ed by IE8/9.
3328        node[propertyName] = value;
3329      }
3330      return;
3331    }
3332    // The rest are treated as attributes with special cases.
3333    var attributeName = propertyInfo.attributeName,
3334        attributeNamespace = propertyInfo.attributeNamespace;
3335  
3336    if (value === null) {
3337      node.removeAttribute(attributeName);
3338    } else {
3339      var _type = propertyInfo.type;
3340  
3341      var attributeValue = void 0;
3342      if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
3343        attributeValue = '';
3344      } else {
3345        // `setAttribute` with objects becomes only `[object]` in IE8/9,
3346        // ('' + value) makes it output the correct toString()-value.
3347        attributeValue = '' + value;
3348        if (propertyInfo.sanitizeURL) {
3349          sanitizeURL(attributeValue);
3350        }
3351      }
3352      if (attributeNamespace) {
3353        node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
3354      } else {
3355        node.setAttribute(attributeName, attributeValue);
3356      }
3357    }
3358  }
3359  
3360  // Flow does not allow string concatenation of most non-string types. To work
3361  // around this limitation, we use an opaque type that can only be obtained by
3362  // passing the value through getToStringValue first.
3363  function toString(value) {
3364    return '' + value;
3365  }
3366  
3367  function getToStringValue(value) {
3368    switch (typeof value) {
3369      case 'boolean':
3370      case 'number':
3371      case 'object':
3372      case 'string':
3373      case 'undefined':
3374        return value;
3375      default:
3376        // function, symbol are assigned as empty strings
3377        return '';
3378    }
3379  }
3380  
3381  /**
3382   * Copyright (c) 2013-present, Facebook, Inc.
3383   *
3384   * This source code is licensed under the MIT license found in the
3385   * LICENSE file in the root directory of this source tree.
3386   */
3387  
3388  
3389  
3390  var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
3391  
3392  var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
3393  
3394  /**
3395   * Copyright (c) 2013-present, Facebook, Inc.
3396   *
3397   * This source code is licensed under the MIT license found in the
3398   * LICENSE file in the root directory of this source tree.
3399   */
3400  
3401  
3402  
3403  var printWarning = function() {};
3404  
3405  {
3406    var ReactPropTypesSecret = ReactPropTypesSecret_1;
3407    var loggedTypeFailures = {};
3408  
3409    printWarning = function(text) {
3410      var message = 'Warning: ' + text;
3411      if (typeof console !== 'undefined') {
3412        console.error(message);
3413      }
3414      try {
3415        // --- Welcome to debugging React ---
3416        // This error was thrown as a convenience so that you can use this stack
3417        // to find the callsite that caused this warning to fire.
3418        throw new Error(message);
3419      } catch (x) {}
3420    };
3421  }
3422  
3423  /**
3424   * Assert that the values match with the type specs.
3425   * Error messages are memorized and will only be shown once.
3426   *
3427   * @param {object} typeSpecs Map of name to a ReactPropType
3428   * @param {object} values Runtime values that need to be type-checked
3429   * @param {string} location e.g. "prop", "context", "child context"
3430   * @param {string} componentName Name of the component for error messages.
3431   * @param {?Function} getStack Returns the component stack.
3432   * @private
3433   */
3434  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
3435    {
3436      for (var typeSpecName in typeSpecs) {
3437        if (typeSpecs.hasOwnProperty(typeSpecName)) {
3438          var error;
3439          // Prop type validation may throw. In case they do, we don't want to
3440          // fail the render phase where it didn't fail before. So we log it.
3441          // After these have been cleaned up, we'll let them throw.
3442          try {
3443            // This is intentionally an invariant that gets caught. It's the same
3444            // behavior as without this statement except with a better message.
3445            if (typeof typeSpecs[typeSpecName] !== 'function') {
3446              var err = Error(
3447                (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
3448                'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
3449              );
3450              err.name = 'Invariant Violation';
3451              throw err;
3452            }
3453            error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
3454          } catch (ex) {
3455            error = ex;
3456          }
3457          if (error && !(error instanceof Error)) {
3458            printWarning(
3459              (componentName || 'React class') + ': type specification of ' +
3460              location + ' `' + typeSpecName + '` is invalid; the type checker ' +
3461              'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
3462              'You may have forgotten to pass an argument to the type checker ' +
3463              'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
3464              'shape all require an argument).'
3465            );
3466  
3467          }
3468          if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3469            // Only monitor this failure once because there tends to be a lot of the
3470            // same error.
3471            loggedTypeFailures[error.message] = true;
3472  
3473            var stack = getStack ? getStack() : '';
3474  
3475            printWarning(
3476              'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
3477            );
3478          }
3479        }
3480      }
3481    }
3482  }
3483  
3484  var checkPropTypes_1 = checkPropTypes;
3485  
3486  var ReactDebugCurrentFrame$2 = null;
3487  
3488  var ReactControlledValuePropTypes = {
3489    checkPropTypes: null
3490  };
3491  
3492  {
3493    ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
3494  
3495    var hasReadOnlyValue = {
3496      button: true,
3497      checkbox: true,
3498      image: true,
3499      hidden: true,
3500      radio: true,
3501      reset: true,
3502      submit: true
3503    };
3504  
3505    var propTypes = {
3506      value: function (props, propName, componentName) {
3507        if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
3508          return null;
3509        }
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`.');
3511      },
3512      checked: function (props, propName, componentName) {
3513        if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
3514          return null;
3515        }
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`.');
3517      }
3518    };
3519  
3520    /**
3521     * Provide a linked `value` attribute for controlled forms. You should not use
3522     * this outside of the ReactDOM controlled form components.
3523     */
3524    ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
3525      checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
3526    };
3527  }
3528  
3529  // TODO: direct imports like some-package/src/* are bad. Fix me.
3530  var didWarnValueDefaultValue = false;
3531  var didWarnCheckedDefaultChecked = false;
3532  var didWarnControlledToUncontrolled = false;
3533  var didWarnUncontrolledToControlled = false;
3534  
3535  function isControlled(props) {
3536    var usesChecked = props.type === 'checkbox' || props.type === 'radio';
3537    return usesChecked ? props.checked != null : props.value != null;
3538  }
3539  
3540  /**
3541   * Implements an <input> host component that allows setting these optional
3542   * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
3543   *
3544   * If `checked` or `value` are not supplied (or null/undefined), user actions
3545   * that affect the checked state or value will trigger updates to the element.
3546   *
3547   * If they are supplied (and not null/undefined), the rendered element will not
3548   * trigger updates to the element. Instead, the props must change in order for
3549   * the rendered element to be updated.
3550   *
3551   * The rendered element will be initialized as unchecked (or `defaultChecked`)
3552   * with an empty value (or `defaultValue`).
3553   *
3554   * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
3555   */
3556  
3557  function getHostProps(element, props) {
3558    var node = element;
3559    var checked = props.checked;
3560  
3561    var hostProps = _assign({}, props, {
3562      defaultChecked: undefined,
3563      defaultValue: undefined,
3564      value: undefined,
3565      checked: checked != null ? checked : node._wrapperState.initialChecked
3566    });
3567  
3568    return hostProps;
3569  }
3570  
3571  function initWrapperState(element, props) {
3572    {
3573      ReactControlledValuePropTypes.checkPropTypes('input', props);
3574  
3575      if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
3576        warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
3577        didWarnCheckedDefaultChecked = true;
3578      }
3579      if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
3580        warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
3581        didWarnValueDefaultValue = true;
3582      }
3583    }
3584  
3585    var node = element;
3586    var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
3587  
3588    node._wrapperState = {
3589      initialChecked: props.checked != null ? props.checked : props.defaultChecked,
3590      initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
3591      controlled: isControlled(props)
3592    };
3593  }
3594  
3595  function updateChecked(element, props) {
3596    var node = element;
3597    var checked = props.checked;
3598    if (checked != null) {
3599      setValueForProperty(node, 'checked', checked, false);
3600    }
3601  }
3602  
3603  function updateWrapper(element, props) {
3604    var node = element;
3605    {
3606      var _controlled = isControlled(props);
3607  
3608      if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) {
3609        warning$1(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
3610        didWarnUncontrolledToControlled = true;
3611      }
3612      if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) {
3613        warning$1(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
3614        didWarnControlledToUncontrolled = true;
3615      }
3616    }
3617  
3618    updateChecked(element, props);
3619  
3620    var value = getToStringValue(props.value);
3621    var type = props.type;
3622  
3623    if (value != null) {
3624      if (type === 'number') {
3625        if (value === 0 && node.value === '' ||
3626        // We explicitly want to coerce to number here if possible.
3627        // eslint-disable-next-line
3628        node.value != value) {
3629          node.value = toString(value);
3630        }
3631      } else if (node.value !== toString(value)) {
3632        node.value = toString(value);
3633      }
3634    } else if (type === 'submit' || type === 'reset') {
3635      // Submit/reset inputs need the attribute removed completely to avoid
3636      // blank-text buttons.
3637      node.removeAttribute('value');
3638      return;
3639    }
3640  
3641    if (disableInputAttributeSyncing) {
3642      // When not syncing the value attribute, React only assigns a new value
3643      // whenever the defaultValue React prop has changed. When not present,
3644      // React does nothing
3645      if (props.hasOwnProperty('defaultValue')) {
3646        setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
3647      }
3648    } else {
3649      // When syncing the value attribute, the value comes from a cascade of
3650      // properties:
3651      //  1. The value React property
3652      //  2. The defaultValue React property
3653      //  3. Otherwise there should be no change
3654      if (props.hasOwnProperty('value')) {
3655        setDefaultValue(node, props.type, value);
3656      } else if (props.hasOwnProperty('defaultValue')) {
3657        setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
3658      }
3659    }
3660  
3661    if (disableInputAttributeSyncing) {
3662      // When not syncing the checked attribute, the attribute is directly
3663      // controllable from the defaultValue React property. It needs to be
3664      // updated as new props come in.
3665      if (props.defaultChecked == null) {
3666        node.removeAttribute('checked');
3667      } else {
3668        node.defaultChecked = !!props.defaultChecked;
3669      }
3670    } else {
3671      // When syncing the checked attribute, it only changes when it needs
3672      // to be removed, such as transitioning from a checkbox into a text input
3673      if (props.checked == null && props.defaultChecked != null) {
3674        node.defaultChecked = !!props.defaultChecked;
3675      }
3676    }
3677  }
3678  
3679  function postMountWrapper(element, props, isHydrating) {
3680    var node = element;
3681  
3682    // Do not assign value if it is already set. This prevents user text input
3683    // from being lost during SSR hydration.
3684    if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
3685      var type = props.type;
3686      var isButton = type === 'submit' || type === 'reset';
3687  
3688      // Avoid setting value attribute on submit/reset inputs as it overrides the
3689      // default value provided by the browser. See: #12872
3690      if (isButton && (props.value === undefined || props.value === null)) {
3691        return;
3692      }
3693  
3694      var _initialValue = toString(node._wrapperState.initialValue);
3695  
3696      // Do not assign value if it is already set. This prevents user text input
3697      // from being lost during SSR hydration.
3698      if (!isHydrating) {
3699        if (disableInputAttributeSyncing) {
3700          var value = getToStringValue(props.value);
3701  
3702          // When not syncing the value attribute, the value property points
3703          // directly to the React prop. Only assign it if it exists.
3704          if (value != null) {
3705            // Always assign on buttons so that it is possible to assign an
3706            // empty string to clear button text.
3707            //
3708            // Otherwise, do not re-assign the value property if is empty. This
3709            // potentially avoids a DOM write and prevents Firefox (~60.0.1) from
3710            // prematurely marking required inputs as invalid. Equality is compared
3711            // to the current value in case the browser provided value is not an
3712            // empty string.
3713            if (isButton || value !== node.value) {
3714              node.value = toString(value);
3715            }
3716          }
3717        } else {
3718          // When syncing the value attribute, the value property should use
3719          // the wrapperState._initialValue property. This uses:
3720          //
3721          //   1. The value React property when present
3722          //   2. The defaultValue React property when present
3723          //   3. An empty string
3724          if (_initialValue !== node.value) {
3725            node.value = _initialValue;
3726          }
3727        }
3728      }
3729  
3730      if (disableInputAttributeSyncing) {
3731        // When not syncing the value attribute, assign the value attribute
3732        // directly from the defaultValue React property (when present)
3733        var defaultValue = getToStringValue(props.defaultValue);
3734        if (defaultValue != null) {
3735          node.defaultValue = toString(defaultValue);
3736        }
3737      } else {
3738        // Otherwise, the value attribute is synchronized to the property,
3739        // so we assign defaultValue to the same thing as the value property
3740        // assignment step above.
3741        node.defaultValue = _initialValue;
3742      }
3743    }
3744  
3745    // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
3746    // this is needed to work around a chrome bug where setting defaultChecked
3747    // will sometimes influence the value of checked (even after detachment).
3748    // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
3749    // We need to temporarily unset name to avoid disrupting radio button groups.
3750    var name = node.name;
3751    if (name !== '') {
3752      node.name = '';
3753    }
3754  
3755    if (disableInputAttributeSyncing) {
3756      // When not syncing the checked attribute, the checked property
3757      // never gets assigned. It must be manually set. We don't want
3758      // to do this when hydrating so that existing user input isn't
3759      // modified
3760      if (!isHydrating) {
3761        updateChecked(element, props);
3762      }
3763  
3764      // Only assign the checked attribute if it is defined. This saves
3765      // a DOM write when controlling the checked attribute isn't needed
3766      // (text inputs, submit/reset)
3767      if (props.hasOwnProperty('defaultChecked')) {
3768        node.defaultChecked = !node.defaultChecked;
3769        node.defaultChecked = !!props.defaultChecked;
3770      }
3771    } else {
3772      // When syncing the checked attribute, both the checked property and
3773      // attribute are assigned at the same time using defaultChecked. This uses:
3774      //
3775      //   1. The checked React property when present
3776      //   2. The defaultChecked React property when present
3777      //   3. Otherwise, false
3778      node.defaultChecked = !node.defaultChecked;
3779      node.defaultChecked = !!node._wrapperState.initialChecked;
3780    }
3781  
3782    if (name !== '') {
3783      node.name = name;
3784    }
3785  }
3786  
3787  function restoreControlledState(element, props) {
3788    var node = element;
3789    updateWrapper(node, props);
3790    updateNamedCousins(node, props);
3791  }
3792  
3793  function updateNamedCousins(rootNode, props) {
3794    var name = props.name;
3795    if (props.type === 'radio' && name != null) {
3796      var queryRoot = rootNode;
3797  
3798      while (queryRoot.parentNode) {
3799        queryRoot = queryRoot.parentNode;
3800      }
3801  
3802      // If `rootNode.form` was non-null, then we could try `form.elements`,
3803      // but that sometimes behaves strangely in IE8. We could also try using
3804      // `form.getElementsByName`, but that will only return direct children
3805      // and won't include inputs that use the HTML5 `form=` attribute. Since
3806      // the input might not even be in a form. It might not even be in the
3807      // document. Let's just use the local `querySelectorAll` to ensure we don't
3808      // miss anything.
3809      var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
3810  
3811      for (var i = 0; i < group.length; i++) {
3812        var otherNode = group[i];
3813        if (otherNode === rootNode || otherNode.form !== rootNode.form) {
3814          continue;
3815        }
3816        // This will throw if radio buttons rendered by different copies of React
3817        // and the same name are rendered into the same form (same as #1939).
3818        // That's probably okay; we don't support it just as we don't support
3819        // mixing React radio buttons with non-React ones.
3820        var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
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        })();
3828  
3829        // We need update the tracked value on the named cousin since the value
3830        // was changed but the input saw no event or value set
3831        updateValueIfChanged(otherNode);
3832  
3833        // If this is a controlled radio button group, forcing the input that
3834        // was previously checked to update will cause it to be come re-checked
3835        // as appropriate.
3836        updateWrapper(otherNode, otherProps);
3837      }
3838    }
3839  }
3840  
3841  // In Chrome, assigning defaultValue to certain input types triggers input validation.
3842  // For number inputs, the display value loses trailing decimal points. For email inputs,
3843  // Chrome raises "The specified value <x> is not a valid email address".
3844  //
3845  // Here we check to see if the defaultValue has actually changed, avoiding these problems
3846  // when the user is inputting text
3847  //
3848  // https://github.com/facebook/react/issues/7253
3849  function setDefaultValue(node, type, value) {
3850    if (
3851    // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
3852    type !== 'number' || node.ownerDocument.activeElement !== node) {
3853      if (value == null) {
3854        node.defaultValue = toString(node._wrapperState.initialValue);
3855      } else if (node.defaultValue !== toString(value)) {
3856        node.defaultValue = toString(value);
3857      }
3858    }
3859  }
3860  
3861  var eventTypes$1 = {
3862    change: {
3863      phasedRegistrationNames: {
3864        bubbled: 'onChange',
3865        captured: 'onChangeCapture'
3866      },
3867      dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
3868    }
3869  };
3870  
3871  function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
3872    var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
3873    event.type = 'change';
3874    // Flag this event loop as needing state restore.
3875    enqueueStateRestore(target);
3876    accumulateTwoPhaseDispatches(event);
3877    return event;
3878  }
3879  /**
3880   * For IE shims
3881   */
3882  var activeElement = null;
3883  var activeElementInst = null;
3884  
3885  /**
3886   * SECTION: handle `change` event
3887   */
3888  function shouldUseChangeEvent(elem) {
3889    var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
3890    return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
3891  }
3892  
3893  function manualDispatchChangeEvent(nativeEvent) {
3894    var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
3895  
3896    // If change and propertychange bubbled, we'd just bind to it like all the
3897    // other events and have it go through ReactBrowserEventEmitter. Since it
3898    // doesn't, we manually listen for the events and so we have to enqueue and
3899    // process the abstract event manually.
3900    //
3901    // Batching is necessary here in order to ensure that all event handlers run
3902    // before the next rerender (including event handlers attached to ancestor
3903    // elements instead of directly on the input). Without this, controlled
3904    // components don't work properly in conjunction with event bubbling because
3905    // the component is rerendered and the value reverted before all the event
3906    // handlers can run. See https://github.com/facebook/react/issues/708.
3907    batchedUpdates(runEventInBatch, event);
3908  }
3909  
3910  function runEventInBatch(event) {
3911    runEventsInBatch(event);
3912  }
3913  
3914  function getInstIfValueChanged(targetInst) {
3915    var targetNode = getNodeFromInstance$1(targetInst);
3916    if (updateValueIfChanged(targetNode)) {
3917      return targetInst;
3918    }
3919  }
3920  
3921  function getTargetInstForChangeEvent(topLevelType, targetInst) {
3922    if (topLevelType === TOP_CHANGE) {
3923      return targetInst;
3924    }
3925  }
3926  
3927  /**
3928   * SECTION: handle `input` event
3929   */
3930  var isInputEventSupported = false;
3931  if (canUseDOM) {
3932    // IE9 claims to support the input event but fails to trigger it when
3933    // deleting text, so we ignore its input events.
3934    isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
3935  }
3936  
3937  /**
3938   * (For IE <=9) Starts tracking propertychange events on the passed-in element
3939   * and override the value property so that we can distinguish user events from
3940   * value changes in JS.
3941   */
3942  function startWatchingForValueChange(target, targetInst) {
3943    activeElement = target;
3944    activeElementInst = targetInst;
3945    activeElement.attachEvent('onpropertychange', handlePropertyChange);
3946  }
3947  
3948  /**
3949   * (For IE <=9) Removes the event listeners from the currently-tracked element,
3950   * if any exists.
3951   */
3952  function stopWatchingForValueChange() {
3953    if (!activeElement) {
3954      return;
3955    }
3956    activeElement.detachEvent('onpropertychange', handlePropertyChange);
3957    activeElement = null;
3958    activeElementInst = null;
3959  }
3960  
3961  /**
3962   * (For IE <=9) Handles a propertychange event, sending a `change` event if
3963   * the value of the active element has changed.
3964   */
3965  function handlePropertyChange(nativeEvent) {
3966    if (nativeEvent.propertyName !== 'value') {
3967      return;
3968    }
3969    if (getInstIfValueChanged(activeElementInst)) {
3970      manualDispatchChangeEvent(nativeEvent);
3971    }
3972  }
3973  
3974  function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
3975    if (topLevelType === TOP_FOCUS) {
3976      // In IE9, propertychange fires for most input events but is buggy and
3977      // doesn't fire when text is deleted, but conveniently, selectionchange
3978      // appears to fire in all of the remaining cases so we catch those and
3979      // forward the event if the value has changed
3980      // In either case, we don't want to call the event handler if the value
3981      // is changed from JS so we redefine a setter for `.value` that updates
3982      // our activeElementValue variable, allowing us to ignore those changes
3983      //
3984      // stopWatching() should be a noop here but we call it just in case we
3985      // missed a blur event somehow.
3986      stopWatchingForValueChange();
3987      startWatchingForValueChange(target, targetInst);
3988    } else if (topLevelType === TOP_BLUR) {
3989      stopWatchingForValueChange();
3990    }
3991  }
3992  
3993  // For IE8 and IE9.
3994  function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
3995    if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
3996      // On the selectionchange event, the target is just document which isn't
3997      // helpful for us so just check activeElement instead.
3998      //
3999      // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
4000      // propertychange on the first input event after setting `value` from a
4001      // script and fires only keydown, keypress, keyup. Catching keyup usually
4002      // gets it and catching keydown lets us fire an event for the first
4003      // keystroke if user does a key repeat (it'll be a little delayed: right
4004      // before the second keystroke). Other input methods (e.g., paste) seem to
4005      // fire selectionchange normally.
4006      return getInstIfValueChanged(activeElementInst);
4007    }
4008  }
4009  
4010  /**
4011   * SECTION: handle `click` event
4012   */
4013  function shouldUseClickEvent(elem) {
4014    // Use the `click` event to detect changes to checkbox and radio inputs.
4015    // This approach works across all browsers, whereas `change` does not fire
4016    // until `blur` in IE8.
4017    var nodeName = elem.nodeName;
4018    return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
4019  }
4020  
4021  function getTargetInstForClickEvent(topLevelType, targetInst) {
4022    if (topLevelType === TOP_CLICK) {
4023      return getInstIfValueChanged(targetInst);
4024    }
4025  }
4026  
4027  function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
4028    if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
4029      return getInstIfValueChanged(targetInst);
4030    }
4031  }
4032  
4033  function handleControlledInputBlur(node) {
4034    var state = node._wrapperState;
4035  
4036    if (!state || !state.controlled || node.type !== 'number') {
4037      return;
4038    }
4039  
4040    if (!disableInputAttributeSyncing) {
4041      // If controlled, assign the value attribute to the current value on blur
4042      setDefaultValue(node, 'number', node.value);
4043    }
4044  }
4045  
4046  /**
4047   * This plugin creates an `onChange` event that normalizes change events
4048   * across form elements. This event fires at a time when it's possible to
4049   * change the element's value without seeing a flicker.
4050   *
4051   * Supported elements are:
4052   * - input (see `isTextInputElement`)
4053   * - textarea
4054   * - select
4055   */
4056  var ChangeEventPlugin = {
4057    eventTypes: eventTypes$1,
4058  
4059    _isInputEventSupported: isInputEventSupported,
4060  
4061    extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4062      var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
4063  
4064      var getTargetInstFunc = void 0,
4065          handleEventFunc = void 0;
4066      if (shouldUseChangeEvent(targetNode)) {
4067        getTargetInstFunc = getTargetInstForChangeEvent;
4068      } else if (isTextInputElement(targetNode)) {
4069        if (isInputEventSupported) {
4070          getTargetInstFunc = getTargetInstForInputOrChangeEvent;
4071        } else {
4072          getTargetInstFunc = getTargetInstForInputEventPolyfill;
4073          handleEventFunc = handleEventsForInputEventPolyfill;
4074        }
4075      } else if (shouldUseClickEvent(targetNode)) {
4076        getTargetInstFunc = getTargetInstForClickEvent;
4077      }
4078  
4079      if (getTargetInstFunc) {
4080        var inst = getTargetInstFunc(topLevelType, targetInst);
4081        if (inst) {
4082          var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
4083          return event;
4084        }
4085      }
4086  
4087      if (handleEventFunc) {
4088        handleEventFunc(topLevelType, targetNode, targetInst);
4089      }
4090  
4091      // When blurring, set the value attribute for number inputs
4092      if (topLevelType === TOP_BLUR) {
4093        handleControlledInputBlur(targetNode);
4094      }
4095    }
4096  };
4097  
4098  /**
4099   * Module that is injectable into `EventPluginHub`, that specifies a
4100   * deterministic ordering of `EventPlugin`s. A convenient way to reason about
4101   * plugins, without having to package every one of them. This is better than
4102   * having plugins be ordered in the same order that they are injected because
4103   * that ordering would be influenced by the packaging order.
4104   * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
4105   * preventing default on events is convenient in `SimpleEventPlugin` handlers.
4106   */
4107  var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
4108  
4109  var SyntheticUIEvent = SyntheticEvent.extend({
4110    view: null,
4111    detail: null
4112  });
4113  
4114  var modifierKeyToProp = {
4115    Alt: 'altKey',
4116    Control: 'ctrlKey',
4117    Meta: 'metaKey',
4118    Shift: 'shiftKey'
4119  };
4120  
4121  // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
4122  // getModifierState. If getModifierState is not supported, we map it to a set of
4123  // modifier keys exposed by the event. In this case, Lock-keys are not supported.
4124  /**
4125   * Translation from modifier key to the associated property in the event.
4126   * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
4127   */
4128  
4129  function modifierStateGetter(keyArg) {
4130    var syntheticEvent = this;
4131    var nativeEvent = syntheticEvent.nativeEvent;
4132    if (nativeEvent.getModifierState) {
4133      return nativeEvent.getModifierState(keyArg);
4134    }
4135    var keyProp = modifierKeyToProp[keyArg];
4136    return keyProp ? !!nativeEvent[keyProp] : false;
4137  }
4138  
4139  function getEventModifierState(nativeEvent) {
4140    return modifierStateGetter;
4141  }
4142  
4143  var previousScreenX = 0;
4144  var previousScreenY = 0;
4145  // Use flags to signal movementX/Y has already been set
4146  var isMovementXSet = false;
4147  var isMovementYSet = false;
4148  
4149  /**
4150   * @interface MouseEvent
4151   * @see http://www.w3.org/TR/DOM-Level-3-Events/
4152   */
4153  var SyntheticMouseEvent = SyntheticUIEvent.extend({
4154    screenX: null,
4155    screenY: null,
4156    clientX: null,
4157    clientY: null,
4158    pageX: null,
4159    pageY: null,
4160    ctrlKey: null,
4161    shiftKey: null,
4162    altKey: null,
4163    metaKey: null,
4164    getModifierState: getEventModifierState,
4165    button: null,
4166    buttons: null,
4167    relatedTarget: function (event) {
4168      return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
4169    },
4170    movementX: function (event) {
4171      if ('movementX' in event) {
4172        return event.movementX;
4173      }
4174  
4175      var screenX = previousScreenX;
4176      previousScreenX = event.screenX;
4177  
4178      if (!isMovementXSet) {
4179        isMovementXSet = true;
4180        return 0;
4181      }
4182  
4183      return event.type === 'mousemove' ? event.screenX - screenX : 0;
4184    },
4185    movementY: function (event) {
4186      if ('movementY' in event) {
4187        return event.movementY;
4188      }
4189  
4190      var screenY = previousScreenY;
4191      previousScreenY = event.screenY;
4192  
4193      if (!isMovementYSet) {
4194        isMovementYSet = true;
4195        return 0;
4196      }
4197  
4198      return event.type === 'mousemove' ? event.screenY - screenY : 0;
4199    }
4200  });
4201  
4202  /**
4203   * @interface PointerEvent
4204   * @see http://www.w3.org/TR/pointerevents/
4205   */
4206  var SyntheticPointerEvent = SyntheticMouseEvent.extend({
4207    pointerId: null,
4208    width: null,
4209    height: null,
4210    pressure: null,
4211    tangentialPressure: null,
4212    tiltX: null,
4213    tiltY: null,
4214    twist: null,
4215    pointerType: null,
4216    isPrimary: null
4217  });
4218  
4219  var eventTypes$2 = {
4220    mouseEnter: {
4221      registrationName: 'onMouseEnter',
4222      dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
4223    },
4224    mouseLeave: {
4225      registrationName: 'onMouseLeave',
4226      dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
4227    },
4228    pointerEnter: {
4229      registrationName: 'onPointerEnter',
4230      dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
4231    },
4232    pointerLeave: {
4233      registrationName: 'onPointerLeave',
4234      dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
4235    }
4236  };
4237  
4238  var EnterLeaveEventPlugin = {
4239    eventTypes: eventTypes$2,
4240  
4241    /**
4242     * For almost every interaction we care about, there will be both a top-level
4243     * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
4244     * we do not extract duplicate events. However, moving the mouse into the
4245     * browser from outside will not fire a `mouseout` event. In this case, we use
4246     * the `mouseover` top-level event.
4247     */
4248    extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4249      var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
4250      var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
4251  
4252      if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
4253        return null;
4254      }
4255  
4256      if (!isOutEvent && !isOverEvent) {
4257        // Must not be a mouse or pointer in or out - ignoring.
4258        return null;
4259      }
4260  
4261      var win = void 0;
4262      if (nativeEventTarget.window === nativeEventTarget) {
4263        // `nativeEventTarget` is probably a window object.
4264        win = nativeEventTarget;
4265      } else {
4266        // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
4267        var doc = nativeEventTarget.ownerDocument;
4268        if (doc) {
4269          win = doc.defaultView || doc.parentWindow;
4270        } else {
4271          win = window;
4272        }
4273      }
4274  
4275      var from = void 0;
4276      var to = void 0;
4277      if (isOutEvent) {
4278        from = targetInst;
4279        var related = nativeEvent.relatedTarget || nativeEvent.toElement;
4280        to = related ? getClosestInstanceFromNode(related) : null;
4281      } else {
4282        // Moving to a node from outside the window.
4283        from = null;
4284        to = targetInst;
4285      }
4286  
4287      if (from === to) {
4288        // Nothing pertains to our managed components.
4289        return null;
4290      }
4291  
4292      var eventInterface = void 0,
4293          leaveEventType = void 0,
4294          enterEventType = void 0,
4295          eventTypePrefix = void 0;
4296  
4297      if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
4298        eventInterface = SyntheticMouseEvent;
4299        leaveEventType = eventTypes$2.mouseLeave;
4300        enterEventType = eventTypes$2.mouseEnter;
4301        eventTypePrefix = 'mouse';
4302      } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
4303        eventInterface = SyntheticPointerEvent;
4304        leaveEventType = eventTypes$2.pointerLeave;
4305        enterEventType = eventTypes$2.pointerEnter;
4306        eventTypePrefix = 'pointer';
4307      }
4308  
4309      var fromNode = from == null ? win : getNodeFromInstance$1(from);
4310      var toNode = to == null ? win : getNodeFromInstance$1(to);
4311  
4312      var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
4313      leave.type = eventTypePrefix + 'leave';
4314      leave.target = fromNode;
4315      leave.relatedTarget = toNode;
4316  
4317      var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
4318      enter.type = eventTypePrefix + 'enter';
4319      enter.target = toNode;
4320      enter.relatedTarget = fromNode;
4321  
4322      accumulateEnterLeaveDispatches(leave, enter, from, to);
4323  
4324      return [leave, enter];
4325    }
4326  };
4327  
4328  /**
4329   * inlined Object.is polyfill to avoid requiring consumers ship their own
4330   * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
4331   */
4332  function is(x, y) {
4333    return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
4334    ;
4335  }
4336  
4337  var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
4338  
4339  /**
4340   * Performs equality by iterating through keys on an object and returning false
4341   * when any key has values which are not strictly equal between the arguments.
4342   * Returns true when the values of all keys are strictly equal.
4343   */
4344  function shallowEqual(objA, objB) {
4345    if (is(objA, objB)) {
4346      return true;
4347    }
4348  
4349    if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
4350      return false;
4351    }
4352  
4353    var keysA = Object.keys(objA);
4354    var keysB = Object.keys(objB);
4355  
4356    if (keysA.length !== keysB.length) {
4357      return false;
4358    }
4359  
4360    // Test for A's keys different from B.
4361    for (var i = 0; i < keysA.length; i++) {
4362      if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
4363        return false;
4364      }
4365    }
4366  
4367    return true;
4368  }
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  
5120  /**
5121   * `ReactInstanceMap` maintains a mapping from a public facing stateful
5122   * instance (key) and the internal representation (value). This allows public
5123   * methods to accept the user facing instance as an argument and map them back
5124   * to internal methods.
5125   *
5126   * Note that this module is currently shared and assumed to be stateless.
5127   * If this becomes an actual Map, that will break.
5128   */
5129  
5130  /**
5131   * This API should be called `delete` but we'd have to make sure to always
5132   * transform these to strings for IE support. When this transform is fully
5133   * supported we can rename it.
5134   */
5135  
5136  
5137  function get(key) {
5138    return key._reactInternalFiber;
5139  }
5140  
5141  function has(key) {
5142    return key._reactInternalFiber !== undefined;
5143  }
5144  
5145  function set(key, value) {
5146    key._reactInternalFiber = value;
5147  }
5148  
5149  // Don't change these two values. They're used by React Dev Tools.
5150  var NoEffect = /*              */0;
5151  var PerformedWork = /*         */1;
5152  
5153  // You can change the rest (and add more).
5154  var Placement = /*             */2;
5155  var Update = /*                */4;
5156  var PlacementAndUpdate = /*    */6;
5157  var Deletion = /*              */8;
5158  var ContentReset = /*          */16;
5159  var Callback = /*              */32;
5160  var DidCapture = /*            */64;
5161  var Ref = /*                   */128;
5162  var Snapshot = /*              */256;
5163  var Passive = /*               */512;
5164  
5165  // Passive & Update & Callback & Ref & Snapshot
5166  var LifecycleEffectMask = /*   */932;
5167  
5168  // Union of all host effects
5169  var HostEffectMask = /*        */1023;
5170  
5171  var Incomplete = /*            */1024;
5172  var ShouldCapture = /*         */2048;
5173  
5174  var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
5175  
5176  var MOUNTING = 1;
5177  var MOUNTED = 2;
5178  var UNMOUNTED = 3;
5179  
5180  function isFiberMountedImpl(fiber) {
5181    var node = fiber;
5182    if (!fiber.alternate) {
5183      // If there is no alternate, this might be a new tree that isn't inserted
5184      // yet. If it is, then it will have a pending insertion effect on it.
5185      if ((node.effectTag & Placement) !== NoEffect) {
5186        return MOUNTING;
5187      }
5188      while (node.return) {
5189        node = node.return;
5190        if ((node.effectTag & Placement) !== NoEffect) {
5191          return MOUNTING;
5192        }
5193      }
5194    } else {
5195      while (node.return) {
5196        node = node.return;
5197      }
5198    }
5199    if (node.tag === HostRoot) {
5200      // TODO: Check if this was a nested HostRoot when used with
5201      // renderContainerIntoSubtree.
5202      return MOUNTED;
5203    }
5204    // If we didn't hit the root, that means that we're in an disconnected tree
5205    // that has been unmounted.
5206    return UNMOUNTED;
5207  }
5208  
5209  function isFiberMounted(fiber) {
5210    return isFiberMountedImpl(fiber) === MOUNTED;
5211  }
5212  
5213  function isMounted(component) {
5214    {
5215      var owner = ReactCurrentOwner$1.current;
5216      if (owner !== null && owner.tag === ClassComponent) {
5217        var ownerFiber = owner;
5218        var instance = ownerFiber.stateNode;
5219        !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0;
5220        instance._warnedAboutRefsInRender = true;
5221      }
5222    }
5223  
5224    var fiber = get(component);
5225    if (!fiber) {
5226      return false;
5227    }
5228    return isFiberMountedImpl(fiber) === MOUNTED;
5229  }
5230  
5231  function assertIsMounted(fiber) {
5232    (function () {
5233      if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
5234        {
5235          throw ReactError(Error('Unable to find node on an unmounted component.'));
5236        }
5237      }
5238    })();
5239  }
5240  
5241  function findCurrentFiberUsingSlowPath(fiber) {
5242    var alternate = fiber.alternate;
5243    if (!alternate) {
5244      // If there is no alternate, then we only need to check if it is mounted.
5245      var state = isFiberMountedImpl(fiber);
5246      (function () {
5247        if (!(state !== UNMOUNTED)) {
5248          {
5249            throw ReactError(Error('Unable to find node on an unmounted component.'));
5250          }
5251        }
5252      })();
5253      if (state === MOUNTING) {
5254        return null;
5255      }
5256      return fiber;
5257    }
5258    // If we have two possible branches, we'll walk backwards up to the root
5259    // to see what path the root points to. On the way we may hit one of the
5260    // special cases and we'll deal with them.
5261    var a = fiber;
5262    var b = alternate;
5263    while (true) {
5264      var parentA = a.return;
5265      if (parentA === null) {
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.
5281        break;
5282      }
5283  
5284      // If both copies of the parent fiber point to the same child, we can
5285      // assume that the child is current. This happens when we bailout on low
5286      // priority: the bailed out fiber's child reuses the current child.
5287      if (parentA.child === parentB.child) {
5288        var child = parentA.child;
5289        while (child) {
5290          if (child === a) {
5291            // We've determined that A is the current branch.
5292            assertIsMounted(parentA);
5293            return fiber;
5294          }
5295          if (child === b) {
5296            // We've determined that B is the current branch.
5297            assertIsMounted(parentA);
5298            return alternate;
5299          }
5300          child = child.sibling;
5301        }
5302        // We should never have an alternate for any mounting node. So the only
5303        // way this could possibly happen is if this was unmounted, if at all.
5304        (function () {
5305          {
5306            {
5307              throw ReactError(Error('Unable to find node on an unmounted component.'));
5308            }
5309          }
5310        })();
5311      }
5312  
5313      if (a.return !== b.return) {
5314        // The return pointer of A and the return pointer of B point to different
5315        // fibers. We assume that return pointers never criss-cross, so A must
5316        // belong to the child set of A.return, and B must belong to the child
5317        // set of B.return.
5318        a = parentA;
5319        b = parentB;
5320      } else {
5321        // The return pointers point to the same fiber. We'll have to use the
5322        // default, slow path: scan the child sets of each parent alternate to see
5323        // which child belongs to which set.
5324        //
5325        // Search parent A's child set
5326        var didFindChild = false;
5327        var _child = parentA.child;
5328        while (_child) {
5329          if (_child === a) {
5330            didFindChild = true;
5331            a = parentA;
5332            b = parentB;
5333            break;
5334          }
5335          if (_child === b) {
5336            didFindChild = true;
5337            b = parentA;
5338            a = parentB;
5339            break;
5340          }
5341          _child = _child.sibling;
5342        }
5343        if (!didFindChild) {
5344          // Search parent B's child set
5345          _child = parentB.child;
5346          while (_child) {
5347            if (_child === a) {
5348              didFindChild = true;
5349              a = parentB;
5350              b = parentA;
5351              break;
5352            }
5353            if (_child === b) {
5354              didFindChild = true;
5355              b = parentB;
5356              a = parentA;
5357              break;
5358            }
5359            _child = _child.sibling;
5360          }
5361          (function () {
5362            if (!didFindChild) {
5363              {
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.'));
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      })();
5378    }
5379    // If the root is not a host container, we're in a disconnected tree. I.e.
5380    // unmounted.
5381    (function () {
5382      if (!(a.tag === HostRoot)) {
5383        {
5384          throw ReactError(Error('Unable to find node on an unmounted component.'));
5385        }
5386      }
5387    })();
5388    if (a.stateNode.current === a) {
5389      // We've determined that A is the current branch.
5390      return fiber;
5391    }
5392    // Otherwise B has to be current branch.
5393    return alternate;
5394  }
5395  
5396  function findCurrentHostFiber(parent) {
5397    var currentParent = findCurrentFiberUsingSlowPath(parent);
5398    if (!currentParent) {
5399      return null;
5400    }
5401  
5402    // Next we'll drill down this component to find the first HostComponent/Text.
5403    var node = currentParent;
5404    while (true) {
5405      if (node.tag === HostComponent || node.tag === HostText) {
5406        return node;
5407      } else if (node.child) {
5408        node.child.return = node;
5409        node = node.child;
5410        continue;
5411      }
5412      if (node === currentParent) {
5413        return null;
5414      }
5415      while (!node.sibling) {
5416        if (!node.return || node.return === currentParent) {
5417          return null;
5418        }
5419        node = node.return;
5420      }
5421      node.sibling.return = node.return;
5422      node = node.sibling;
5423    }
5424    // Flow needs the return null here, but ESLint complains about it.
5425    // eslint-disable-next-line no-unreachable
5426    return null;
5427  }
5428  
5429  function findCurrentHostFiberWithNoPortals(parent) {
5430    var currentParent = findCurrentFiberUsingSlowPath(parent);
5431    if (!currentParent) {
5432      return null;
5433    }
5434  
5435    // Next we'll drill down this component to find the first HostComponent/Text.
5436    var node = currentParent;
5437    while (true) {
5438      if (node.tag === HostComponent || node.tag === HostText || node.tag === FundamentalComponent) {
5439        return node;
5440      } else if (node.child && node.tag !== HostPortal) {
5441        node.child.return = node;
5442        node = node.child;
5443        continue;
5444      }
5445      if (node === currentParent) {
5446        return null;
5447      }
5448      while (!node.sibling) {
5449        if (!node.return || node.return === currentParent) {
5450          return null;
5451        }
5452        node = node.return;
5453      }
5454      node.sibling.return = node.return;
5455      node = node.sibling;
5456    }
5457    // Flow needs the return null here, but ESLint complains about it.
5458    // eslint-disable-next-line no-unreachable
5459    return null;
5460  }
5461  
5462  function addEventBubbleListener(element, eventType, listener) {
5463    element.addEventListener(eventType, listener, false);
5464  }
5465  
5466  function addEventCaptureListener(element, eventType, listener) {
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    });
5475  }
5476  
5477  /**
5478   * @interface Event
5479   * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
5480   * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
5481   */
5482  var SyntheticAnimationEvent = SyntheticEvent.extend({
5483    animationName: null,
5484    elapsedTime: null,
5485    pseudoElement: null
5486  });
5487  
5488  /**
5489   * @interface Event
5490   * @see http://www.w3.org/TR/clipboard-apis/
5491   */
5492  var SyntheticClipboardEvent = SyntheticEvent.extend({
5493    clipboardData: function (event) {
5494      return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
5495    }
5496  });
5497  
5498  /**
5499   * @interface FocusEvent
5500   * @see http://www.w3.org/TR/DOM-Level-3-Events/
5501   */
5502  var SyntheticFocusEvent = SyntheticUIEvent.extend({
5503    relatedTarget: null
5504  });
5505  
5506  /**
5507   * `charCode` represents the actual "character code" and is safe to use with
5508   * `String.fromCharCode`. As such, only keys that correspond to printable
5509   * characters produce a valid `charCode`, the only exception to this is Enter.
5510   * The Tab-key is considered non-printable and does not have a `charCode`,
5511   * presumably because it does not produce a tab-character in browsers.
5512   *
5513   * @param {object} nativeEvent Native browser event.
5514   * @return {number} Normalized `charCode` property.
5515   */
5516  function getEventCharCode(nativeEvent) {
5517    var charCode = void 0;
5518    var keyCode = nativeEvent.keyCode;
5519  
5520    if ('charCode' in nativeEvent) {
5521      charCode = nativeEvent.charCode;
5522  
5523      // FF does not set `charCode` for the Enter-key, check against `keyCode`.
5524      if (charCode === 0 && keyCode === 13) {
5525        charCode = 13;
5526      }
5527    } else {
5528      // IE8 does not implement `charCode`, but `keyCode` has the correct value.
5529      charCode = keyCode;
5530    }
5531  
5532    // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
5533    // report Enter as charCode 10 when ctrl is pressed.
5534    if (charCode === 10) {
5535      charCode = 13;
5536    }
5537  
5538    // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
5539    // Must not discard the (non-)printable Enter-key.
5540    if (charCode >= 32 || charCode === 13) {
5541      return charCode;
5542    }
5543  
5544    return 0;
5545  }
5546  
5547  /**
5548   * Normalization of deprecated HTML5 `key` values
5549   * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
5550   */
5551  var normalizeKey = {
5552    Esc: 'Escape',
5553    Spacebar: ' ',
5554    Left: 'ArrowLeft',
5555    Up: 'ArrowUp',
5556    Right: 'ArrowRight',
5557    Down: 'ArrowDown',
5558    Del: 'Delete',
5559    Win: 'OS',
5560    Menu: 'ContextMenu',
5561    Apps: 'ContextMenu',
5562    Scroll: 'ScrollLock',
5563    MozPrintableKey: 'Unidentified'
5564  };
5565  
5566  /**
5567   * Translation from legacy `keyCode` to HTML5 `key`
5568   * Only special keys supported, all others depend on keyboard layout or browser
5569   * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
5570   */
5571  var translateToKey = {
5572    '8': 'Backspace',
5573    '9': 'Tab',
5574    '12': 'Clear',
5575    '13': 'Enter',
5576    '16': 'Shift',
5577    '17': 'Control',
5578    '18': 'Alt',
5579    '19': 'Pause',
5580    '20': 'CapsLock',
5581    '27': 'Escape',
5582    '32': ' ',
5583    '33': 'PageUp',
5584    '34': 'PageDown',
5585    '35': 'End',
5586    '36': 'Home',
5587    '37': 'ArrowLeft',
5588    '38': 'ArrowUp',
5589    '39': 'ArrowRight',
5590    '40': 'ArrowDown',
5591    '45': 'Insert',
5592    '46': 'Delete',
5593    '112': 'F1',
5594    '113': 'F2',
5595    '114': 'F3',
5596    '115': 'F4',
5597    '116': 'F5',
5598    '117': 'F6',
5599    '118': 'F7',
5600    '119': 'F8',
5601    '120': 'F9',
5602    '121': 'F10',
5603    '122': 'F11',
5604    '123': 'F12',
5605    '144': 'NumLock',
5606    '145': 'ScrollLock',
5607    '224': 'Meta'
5608  };
5609  
5610  /**
5611   * @param {object} nativeEvent Native browser event.
5612   * @return {string} Normalized `key` property.
5613   */
5614  function getEventKey(nativeEvent) {
5615    if (nativeEvent.key) {
5616      // Normalize inconsistent values reported by browsers due to
5617      // implementations of a working draft specification.
5618  
5619      // FireFox implements `key` but returns `MozPrintableKey` for all
5620      // printable characters (normalized to `Unidentified`), ignore it.
5621      var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
5622      if (key !== 'Unidentified') {
5623        return key;
5624      }
5625    }
5626  
5627    // Browser does not implement `key`, polyfill as much of it as we can.
5628    if (nativeEvent.type === 'keypress') {
5629      var charCode = getEventCharCode(nativeEvent);
5630  
5631      // The enter-key is technically both printable and non-printable and can
5632      // thus be captured by `keypress`, no other non-printable key should.
5633      return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
5634    }
5635    if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
5636      // While user keyboard layout determines the actual meaning of each
5637      // `keyCode` value, almost all function keys have a universal value.
5638      return translateToKey[nativeEvent.keyCode] || 'Unidentified';
5639    }
5640    return '';
5641  }
5642  
5643  /**
5644   * @interface KeyboardEvent
5645   * @see http://www.w3.org/TR/DOM-Level-3-Events/
5646   */
5647  var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
5648    key: getEventKey,
5649    location: null,
5650    ctrlKey: null,
5651    shiftKey: null,
5652    altKey: null,
5653    metaKey: null,
5654    repeat: null,
5655    locale: null,
5656    getModifierState: getEventModifierState,
5657    // Legacy Interface
5658    charCode: function (event) {
5659      // `charCode` is the result of a KeyPress event and represents the value of
5660      // the actual printable character.
5661  
5662      // KeyPress is deprecated, but its replacement is not yet final and not
5663      // implemented in any major browser. Only KeyPress has charCode.
5664      if (event.type === 'keypress') {
5665        return getEventCharCode(event);
5666      }
5667      return 0;
5668    },
5669    keyCode: function (event) {
5670      // `keyCode` is the result of a KeyDown/Up event and represents the value of
5671      // physical keyboard key.
5672  
5673      // The actual meaning of the value depends on the users' keyboard layout
5674      // which cannot be detected. Assuming that it is a US keyboard layout
5675      // provides a surprisingly accurate mapping for US and European users.
5676      // Due to this, it is left to the user to implement at this time.
5677      if (event.type === 'keydown' || event.type === 'keyup') {
5678        return event.keyCode;
5679      }
5680      return 0;
5681    },
5682    which: function (event) {
5683      // `which` is an alias for either `keyCode` or `charCode` depending on the
5684      // type of the event.
5685      if (event.type === 'keypress') {
5686        return getEventCharCode(event);
5687      }
5688      if (event.type === 'keydown' || event.type === 'keyup') {
5689        return event.keyCode;
5690      }
5691      return 0;
5692    }
5693  });
5694  
5695  /**
5696   * @interface DragEvent
5697   * @see http://www.w3.org/TR/DOM-Level-3-Events/
5698   */
5699  var SyntheticDragEvent = SyntheticMouseEvent.extend({
5700    dataTransfer: null
5701  });
5702  
5703  /**
5704   * @interface TouchEvent
5705   * @see http://www.w3.org/TR/touch-events/
5706   */
5707  var SyntheticTouchEvent = SyntheticUIEvent.extend({
5708    touches: null,
5709    targetTouches: null,
5710    changedTouches: null,
5711    altKey: null,
5712    metaKey: null,
5713    ctrlKey: null,
5714    shiftKey: null,
5715    getModifierState: getEventModifierState
5716  });
5717  
5718  /**
5719   * @interface Event
5720   * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
5721   * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
5722   */
5723  var SyntheticTransitionEvent = SyntheticEvent.extend({
5724    propertyName: null,
5725    elapsedTime: null,
5726    pseudoElement: null
5727  });
5728  
5729  /**
5730   * @interface WheelEvent
5731   * @see http://www.w3.org/TR/DOM-Level-3-Events/
5732   */
5733  var SyntheticWheelEvent = SyntheticMouseEvent.extend({
5734    deltaX: function (event) {
5735      return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
5736      'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
5737    },
5738    deltaY: function (event) {
5739      return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
5740      'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
5741      'wheelDelta' in event ? -event.wheelDelta : 0;
5742    },
5743  
5744    deltaZ: null,
5745  
5746    // Browsers without "deltaMode" is reporting in raw wheel delta where one
5747    // notch on the scroll is always +/- 120, roughly equivalent to pixels.
5748    // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
5749    // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
5750    deltaMode: null
5751  });
5752  
5753  /**
5754   * Turns
5755   * ['abort', ...]
5756   * into
5757   * eventTypes = {
5758   *   'abort': {
5759   *     phasedRegistrationNames: {
5760   *       bubbled: 'onAbort',
5761   *       captured: 'onAbortCapture',
5762   *     },
5763   *     dependencies: [TOP_ABORT],
5764   *   },
5765   *   ...
5766   * };
5767   * topLevelEventsToDispatchConfig = new Map([
5768   *   [TOP_ABORT, { sameConfig }],
5769   * ]);
5770   */
5771  
5772  var eventTuples = [
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]];
5781  
5782  var eventTypes$4 = {};
5783  var topLevelEventsToDispatchConfig = {};
5784  
5785  for (var i = 0; i < eventTuples.length; i++) {
5786    var eventTuple = eventTuples[i];
5787    var topEvent = eventTuple[0];
5788    var event = eventTuple[1];
5789    var eventPriority = eventTuple[2];
5790  
5791    var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
5792    var onEvent = 'on' + capitalizedEvent;
5793  
5794    var config = {
5795      phasedRegistrationNames: {
5796        bubbled: onEvent,
5797        captured: onEvent + 'Capture'
5798      },
5799      dependencies: [topEvent],
5800      eventPriority: eventPriority
5801    };
5802    eventTypes$4[event] = config;
5803    topLevelEventsToDispatchConfig[topEvent] = config;
5804  }
5805  
5806  // Only used in DEV for exhaustiveness validation.
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];
5808  
5809  var SimpleEventPlugin = {
5810    eventTypes: eventTypes$4,
5811  
5812    getEventPriority: function (topLevelType) {
5813      var config = topLevelEventsToDispatchConfig[topLevelType];
5814      return config !== undefined ? config.eventPriority : ContinuousEvent;
5815    },
5816  
5817  
5818    extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
5819      var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
5820      if (!dispatchConfig) {
5821        return null;
5822      }
5823      var EventConstructor = void 0;
5824      switch (topLevelType) {
5825        case TOP_KEY_PRESS:
5826          // Firefox creates a keypress event for function keys too. This removes
5827          // the unwanted keypress events. Enter is however both printable and
5828          // non-printable. One would expect Tab to be as well (but it isn't).
5829          if (getEventCharCode(nativeEvent) === 0) {
5830            return null;
5831          }
5832        /* falls through */
5833        case TOP_KEY_DOWN:
5834        case TOP_KEY_UP:
5835          EventConstructor = SyntheticKeyboardEvent;
5836          break;
5837        case TOP_BLUR:
5838        case TOP_FOCUS:
5839          EventConstructor = SyntheticFocusEvent;
5840          break;
5841        case TOP_CLICK:
5842          // Firefox creates a click event on right mouse clicks. This removes the
5843          // unwanted click events.
5844          if (nativeEvent.button === 2) {
5845            return null;
5846          }
5847        /* falls through */
5848        case TOP_AUX_CLICK:
5849        case TOP_DOUBLE_CLICK:
5850        case TOP_MOUSE_DOWN:
5851        case TOP_MOUSE_MOVE:
5852        case TOP_MOUSE_UP:
5853        // TODO: Disabled elements should not respond to mouse events
5854        /* falls through */
5855        case TOP_MOUSE_OUT:
5856        case TOP_MOUSE_OVER:
5857        case TOP_CONTEXT_MENU:
5858          EventConstructor = SyntheticMouseEvent;
5859          break;
5860        case TOP_DRAG:
5861        case TOP_DRAG_END:
5862        case TOP_DRAG_ENTER:
5863        case TOP_DRAG_EXIT:
5864        case TOP_DRAG_LEAVE:
5865        case TOP_DRAG_OVER:
5866        case TOP_DRAG_START:
5867        case TOP_DROP:
5868          EventConstructor = SyntheticDragEvent;
5869          break;
5870        case TOP_TOUCH_CANCEL:
5871        case TOP_TOUCH_END:
5872        case TOP_TOUCH_MOVE:
5873        case TOP_TOUCH_START:
5874          EventConstructor = SyntheticTouchEvent;
5875          break;
5876        case TOP_ANIMATION_END:
5877        case TOP_ANIMATION_ITERATION:
5878        case TOP_ANIMATION_START:
5879          EventConstructor = SyntheticAnimationEvent;
5880          break;
5881        case TOP_TRANSITION_END:
5882          EventConstructor = SyntheticTransitionEvent;
5883          break;
5884        case TOP_SCROLL:
5885          EventConstructor = SyntheticUIEvent;
5886          break;
5887        case TOP_WHEEL:
5888          EventConstructor = SyntheticWheelEvent;
5889          break;
5890        case TOP_COPY:
5891        case TOP_CUT:
5892        case TOP_PASTE:
5893          EventConstructor = SyntheticClipboardEvent;
5894          break;
5895        case TOP_GOT_POINTER_CAPTURE:
5896        case TOP_LOST_POINTER_CAPTURE:
5897        case TOP_POINTER_CANCEL:
5898        case TOP_POINTER_DOWN:
5899        case TOP_POINTER_MOVE:
5900        case TOP_POINTER_OUT:
5901        case TOP_POINTER_OVER:
5902        case TOP_POINTER_UP:
5903          EventConstructor = SyntheticPointerEvent;
5904          break;
5905        default:
5906          {
5907            if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
5908              warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
5909            }
5910          }
5911          // HTML Events
5912          // @see http://www.w3.org/TR/html5/index.html#events-0
5913          EventConstructor = SyntheticEvent;
5914          break;
5915      }
5916      var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
5917      accumulateTwoPhaseDispatches(event);
5918      return event;
5919    }
5920  };
5921  
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;
5947  
5948  
5949  var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
5950  var callbackBookkeepingPool = [];
5951  
5952  /**
5953   * Find the deepest React component completely containing the root of the
5954   * passed-in instance (for use when entire React trees are nested within each
5955   * other). If React trees are not nested, returns null.
5956   */
5957  function findRootContainerNode(inst) {
5958    // TODO: It may be a good idea to cache this to prevent unnecessary DOM
5959    // traversal, but caching is difficult to do correctly without using a
5960    // mutation observer to listen for all DOM changes.
5961    while (inst.return) {
5962      inst = inst.return;
5963    }
5964    if (inst.tag !== HostRoot) {
5965      // This can happen if we're in a detached tree.
5966      return null;
5967    }
5968    return inst.stateNode.containerInfo;
5969  }
5970  
5971  // Used to store ancestor hierarchy in top level callback
5972  function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
5973    if (callbackBookkeepingPool.length) {
5974      var instance = callbackBookkeepingPool.pop();
5975      instance.topLevelType = topLevelType;
5976      instance.nativeEvent = nativeEvent;
5977      instance.targetInst = targetInst;
5978      return instance;
5979    }
5980    return {
5981      topLevelType: topLevelType,
5982      nativeEvent: nativeEvent,
5983      targetInst: targetInst,
5984      ancestors: []
5985    };
5986  }
5987  
5988  function releaseTopLevelCallbackBookKeeping(instance) {
5989    instance.topLevelType = null;
5990    instance.nativeEvent = null;
5991    instance.targetInst = null;
5992    instance.ancestors.length = 0;
5993    if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
5994      callbackBookkeepingPool.push(instance);
5995    }
5996  }
5997  
5998  function handleTopLevel(bookKeeping) {
5999    var targetInst = bookKeeping.targetInst;
6000  
6001    // Loop through the hierarchy, in case there's any nested components.
6002    // It's important that we build the array of ancestors before calling any
6003    // event handlers, because event handlers can modify the DOM, leading to
6004    // inconsistencies with ReactMount's node cache. See #1105.
6005    var ancestor = targetInst;
6006    do {
6007      if (!ancestor) {
6008        var _ancestors = bookKeeping.ancestors;
6009        _ancestors.push(ancestor);
6010        break;
6011      }
6012      var root = findRootContainerNode(ancestor);
6013      if (!root) {
6014        break;
6015      }
6016      bookKeeping.ancestors.push(ancestor);
6017      ancestor = getClosestInstanceFromNode(root);
6018    } while (ancestor);
6019  
6020    for (var i = 0; i < bookKeeping.ancestors.length; i++) {
6021      targetInst = bookKeeping.ancestors[i];
6022      var eventTarget = getEventTarget(bookKeeping.nativeEvent);
6023      var _topLevelType = bookKeeping.topLevelType;
6024      var _nativeEvent = bookKeeping.nativeEvent;
6025  
6026      runExtractedPluginEventsInBatch(_topLevelType, targetInst, _nativeEvent, eventTarget);
6027    }
6028  }
6029  
6030  // TODO: can we stop exporting these?
6031  var _enabled = true;
6032  
6033  function setEnabled(enabled) {
6034    _enabled = !!enabled;
6035  }
6036  
6037  function isEnabled() {
6038    return _enabled;
6039  }
6040  
6041  function trapBubbledEvent(topLevelType, element) {
6042    trapEventForPluginEventSystem(element, topLevelType, false);
6043  }
6044  
6045  function trapCapturedEvent(topLevelType, element) {
6046    trapEventForPluginEventSystem(element, topLevelType, true);
6047  }
6048  
6049  function trapEventForResponderEventSystem(element, topLevelType, passive) {
6050    if (enableFlareAPI) {
6051      var rawEventName = getRawEventName(topLevelType);
6052      var eventFlags = RESPONDER_EVENT_SYSTEM;
6053  
6054      // If passive option is not supported, then the event will be
6055      // active and not passive, but we flag it as using not being
6056      // supported too. This way the responder event plugins know,
6057      // and can provide polyfills if needed.
6058      if (passive) {
6059        if (passiveBrowserEventsSupported) {
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) {
6128    if (!_enabled) {
6129      return;
6130    }
6131    var nativeEventTarget = getEventTarget(nativeEvent);
6132    var targetInst = getClosestInstanceFromNode(nativeEventTarget);
6133  
6134    if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
6135      // If we get an event (ex: img onload) before committing that
6136      // component's mount, ignore it for now (that is, treat it as if it was an
6137      // event on a non-React tree). We might also consider queueing events and
6138      // dispatching them after the mount.
6139      targetInst = null;
6140    }
6141  
6142    if (enableFlareAPI) {
6143      if (eventSystemFlags === PLUGIN_EVENT_SYSTEM) {
6144        dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
6145      } else {
6146        // React Flare event system
6147        dispatchEventForResponderEventSystem(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
6148      }
6149    } else {
6150      dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
6151    }
6152  }
6153  
6154  /**
6155   * Summary of `ReactBrowserEventEmitter` event handling:
6156   *
6157   *  - Top-level delegation is used to trap most native browser events. This
6158   *    may only occur in the main thread and is the responsibility of
6159   *    ReactDOMEventListener, which is injected and can therefore support
6160   *    pluggable event sources. This is the only work that occurs in the main
6161   *    thread.
6162   *
6163   *  - We normalize and de-duplicate events to account for browser quirks. This
6164   *    may be done in the worker thread.
6165   *
6166   *  - Forward these native events (with the associated top-level type used to
6167   *    trap it) to `EventPluginHub`, which in turn will ask plugins if they want
6168   *    to extract any synthetic events.
6169   *
6170   *  - The `EventPluginHub` will then process each event by annotating them with
6171   *    "dispatches", a sequence of listeners and IDs that care about that event.
6172   *
6173   *  - The `EventPluginHub` then dispatches the events.
6174   *
6175   * Overview of React and the event system:
6176   *
6177   * +------------+    .
6178   * |    DOM     |    .
6179   * +------------+    .
6180   *       |           .
6181   *       v           .
6182   * +------------+    .
6183   * | ReactEvent |    .
6184   * |  Listener  |    .
6185   * +------------+    .                         +-----------+
6186   *       |           .               +--------+|SimpleEvent|
6187   *       |           .               |         |Plugin     |
6188   * +-----|------+    .               v         +-----------+
6189   * |     |      |    .    +--------------+                    +------------+
6190   * |     +-----------.--->|EventPluginHub|                    |    Event   |
6191   * |            |    .    |              |     +-----------+  | Propagators|
6192   * | ReactEvent |    .    |              |     |TapEvent   |  |------------|
6193   * |  Emitter   |    .    |              |<---+|Plugin     |  |other plugin|
6194   * |            |    .    |              |     +-----------+  |  utilities |
6195   * |     +-----------.--->|              |                    +------------+
6196   * |     |      |    .    +--------------+
6197   * +-----|------+    .                ^        +-----------+
6198   *       |           .                |        |Enter/Leave|
6199   *       +           .                +-------+|Plugin     |
6200   * +-------------+   .                         +-----------+
6201   * | application |   .
6202   * |-------------|   .
6203   * |             |   .
6204   * |             |   .
6205   * +-------------+   .
6206   *                   .
6207   *    React Core     .  General Purpose Event Plugin System
6208   */
6209  
6210  var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
6211  var elementListeningSets = new PossiblyWeakMap();
6212  
6213  function getListeningSetForElement(element) {
6214    var listeningSet = elementListeningSets.get(element);
6215    if (listeningSet === undefined) {
6216      listeningSet = new Set();
6217      elementListeningSets.set(element, listeningSet);
6218    }
6219    return listeningSet;
6220  }
6221  
6222  /**
6223   * We listen for bubbled touch events on the document object.
6224   *
6225   * Firefox v8.01 (and possibly others) exhibited strange behavior when
6226   * mounting `onmousemove` events at some node that was not the document
6227   * element. The symptoms were that if your mouse is not moving over something
6228   * contained within that mount point (for example on the background) the
6229   * top-level listeners for `onmousemove` won't be called. However, if you
6230   * register the `mousemove` on the document object, then it will of course
6231   * catch all `mousemove`s. This along with iOS quirks, justifies restricting
6232   * top-level listeners to the document object only, at least for these
6233   * movement types of events and possibly all events.
6234   *
6235   * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
6236   *
6237   * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
6238   * they bubble to document.
6239   *
6240   * @param {string} registrationName Name of listener (e.g. `onClick`).
6241   * @param {object} mountAt Container where to mount the listener
6242   */
6243  function listenTo(registrationName, mountAt) {
6244    var listeningSet = getListeningSetForElement(mountAt);
6245    var dependencies = registrationNameDependencies[registrationName];
6246  
6247    for (var i = 0; i < dependencies.length; i++) {
6248      var dependency = dependencies[i];
6249      if (!listeningSet.has(dependency)) {
6250        switch (dependency) {
6251          case TOP_SCROLL:
6252            trapCapturedEvent(TOP_SCROLL, mountAt);
6253            break;
6254          case TOP_FOCUS:
6255          case TOP_BLUR:
6256            trapCapturedEvent(TOP_FOCUS, mountAt);
6257            trapCapturedEvent(TOP_BLUR, mountAt);
6258            // We set the flag for a single dependency later in this function,
6259            // but this ensures we mark both as attached rather than just one.
6260            listeningSet.add(TOP_BLUR);
6261            listeningSet.add(TOP_FOCUS);
6262            break;
6263          case TOP_CANCEL:
6264          case TOP_CLOSE:
6265            if (isEventSupported(getRawEventName(dependency))) {
6266              trapCapturedEvent(dependency, mountAt);
6267            }
6268            break;
6269          case TOP_INVALID:
6270          case TOP_SUBMIT:
6271          case TOP_RESET:
6272            // We listen to them on the target DOM elements.
6273            // Some of them bubble so we don't want them to fire twice.
6274            break;
6275          default:
6276            // By default, listen on the top level to all non-media events.
6277            // Media events don't bubble so adding the listener wouldn't do anything.
6278            var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1;
6279            if (!isMediaEvent) {
6280              trapBubbledEvent(dependency, mountAt);
6281            }
6282            break;
6283        }
6284        listeningSet.add(dependency);
6285      }
6286    }
6287  }
6288  
6289  function isListeningToAllDependencies(registrationName, mountAt) {
6290    var listeningSet = getListeningSetForElement(mountAt);
6291    var dependencies = registrationNameDependencies[registrationName];
6292  
6293    for (var i = 0; i < dependencies.length; i++) {
6294      var dependency = dependencies[i];
6295      if (!listeningSet.has(dependency)) {
6296        return false;
6297      }
6298    }
6299    return true;
6300  }
6301  
6302  function getActiveElement(doc) {
6303    doc = doc || (typeof document !== 'undefined' ? document : undefined);
6304    if (typeof doc === 'undefined') {
6305      return null;
6306    }
6307    try {
6308      return doc.activeElement || doc.body;
6309    } catch (e) {
6310      return doc.body;
6311    }
6312  }
6313  
6314  /**
6315   * Given any node return the first leaf node without children.
6316   *
6317   * @param {DOMElement|DOMTextNode} node
6318   * @return {DOMElement|DOMTextNode}
6319   */
6320  function getLeafNode(node) {
6321    while (node && node.firstChild) {
6322      node = node.firstChild;
6323    }
6324    return node;
6325  }
6326  
6327  /**
6328   * Get the next sibling within a container. This will walk up the
6329   * DOM if a node's siblings have been exhausted.
6330   *
6331   * @param {DOMElement|DOMTextNode} node
6332   * @return {?DOMElement|DOMTextNode}
6333   */
6334  function getSiblingNode(node) {
6335    while (node) {
6336      if (node.nextSibling) {
6337        return node.nextSibling;
6338      }
6339      node = node.parentNode;
6340    }
6341  }
6342  
6343  /**
6344   * Get object describing the nodes which contain characters at offset.
6345   *
6346   * @param {DOMElement|DOMTextNode} root
6347   * @param {number} offset
6348   * @return {?object}
6349   */
6350  function getNodeForCharacterOffset(root, offset) {
6351    var node = getLeafNode(root);
6352    var nodeStart = 0;
6353    var nodeEnd = 0;
6354  
6355    while (node) {
6356      if (node.nodeType === TEXT_NODE) {
6357        nodeEnd = nodeStart + node.textContent.length;
6358  
6359        if (nodeStart <= offset && nodeEnd >= offset) {
6360          return {
6361            node: node,
6362            offset: offset - nodeStart
6363          };
6364        }
6365  
6366        nodeStart = nodeEnd;
6367      }
6368  
6369      node = getLeafNode(getSiblingNode(node));
6370    }
6371  }
6372  
6373  /**
6374   * @param {DOMElement} outerNode
6375   * @return {?object}
6376   */
6377  function getOffsets(outerNode) {
6378    var ownerDocument = outerNode.ownerDocument;
6379  
6380    var win = ownerDocument && ownerDocument.defaultView || window;
6381    var selection = win.getSelection && win.getSelection();
6382  
6383    if (!selection || selection.rangeCount === 0) {
6384      return null;
6385    }
6386  
6387    var anchorNode = selection.anchorNode,
6388        anchorOffset = selection.anchorOffset,
6389        focusNode = selection.focusNode,
6390        focusOffset = selection.focusOffset;
6391  
6392    // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
6393    // up/down buttons on an <input type="number">. Anonymous divs do not seem to
6394    // expose properties, triggering a "Permission denied error" if any of its
6395    // properties are accessed. The only seemingly possible way to avoid erroring
6396    // is to access a property that typically works for non-anonymous divs and
6397    // catch any error that may otherwise arise. See
6398    // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
6399  
6400    try {
6401      /* eslint-disable no-unused-expressions */
6402      anchorNode.nodeType;
6403      focusNode.nodeType;
6404      /* eslint-enable no-unused-expressions */
6405    } catch (e) {
6406      return null;
6407    }
6408  
6409    return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
6410  }
6411  
6412  /**
6413   * Returns {start, end} where `start` is the character/codepoint index of
6414   * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
6415   * `end` is the index of (focusNode, focusOffset).
6416   *
6417   * Returns null if you pass in garbage input but we should probably just crash.
6418   *
6419   * Exported only for testing.
6420   */
6421  function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
6422    var length = 0;
6423    var start = -1;
6424    var end = -1;
6425    var indexWithinAnchor = 0;
6426    var indexWithinFocus = 0;
6427    var node = outerNode;
6428    var parentNode = null;
6429  
6430    outer: while (true) {
6431      var next = null;
6432  
6433      while (true) {
6434        if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
6435          start = length + anchorOffset;
6436        }
6437        if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
6438          end = length + focusOffset;
6439        }
6440  
6441        if (node.nodeType === TEXT_NODE) {
6442          length += node.nodeValue.length;
6443        }
6444  
6445        if ((next = node.firstChild) === null) {
6446          break;
6447        }
6448        // Moving from `node` to its first child `next`.
6449        parentNode = node;
6450        node = next;
6451      }
6452  
6453      while (true) {
6454        if (node === outerNode) {
6455          // If `outerNode` has children, this is always the second time visiting
6456          // it. If it has no children, this is still the first loop, and the only
6457          // valid selection is anchorNode and focusNode both equal to this node
6458          // and both offsets 0, in which case we will have handled above.
6459          break outer;
6460        }
6461        if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
6462          start = length;
6463        }
6464        if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
6465          end = length;
6466        }
6467        if ((next = node.nextSibling) !== null) {
6468          break;
6469        }
6470        node = parentNode;
6471        parentNode = node.parentNode;
6472      }
6473  
6474      // Moving from `node` to its next sibling `next`.
6475      node = next;
6476    }
6477  
6478    if (start === -1 || end === -1) {
6479      // This should never happen. (Would happen if the anchor/focus nodes aren't
6480      // actually inside the passed-in node.)
6481      return null;
6482    }
6483  
6484    return {
6485      start: start,
6486      end: end
6487    };
6488  }
6489  
6490  /**
6491   * In modern non-IE browsers, we can support both forward and backward
6492   * selections.
6493   *
6494   * Note: IE10+ supports the Selection object, but it does not support
6495   * the `extend` method, which means that even in modern IE, it's not possible
6496   * to programmatically create a backward selection. Thus, for all IE
6497   * versions, we use the old IE API to create our selections.
6498   *
6499   * @param {DOMElement|DOMTextNode} node
6500   * @param {object} offsets
6501   */
6502  function setOffsets(node, offsets) {
6503    var doc = node.ownerDocument || document;
6504    var win = doc && doc.defaultView || window;
6505  
6506    // Edge fails with "Object expected" in some scenarios.
6507    // (For instance: TinyMCE editor used in a list component that supports pasting to add more,
6508    // fails when pasting 100+ items)
6509    if (!win.getSelection) {
6510      return;
6511    }
6512  
6513    var selection = win.getSelection();
6514    var length = node.textContent.length;
6515    var start = Math.min(offsets.start, length);
6516    var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
6517  
6518    // IE 11 uses modern selection, but doesn't support the extend method.
6519    // Flip backward selections, so we can set with a single range.
6520    if (!selection.extend && start > end) {
6521      var temp = end;
6522      end = start;
6523      start = temp;
6524    }
6525  
6526    var startMarker = getNodeForCharacterOffset(node, start);
6527    var endMarker = getNodeForCharacterOffset(node, end);
6528  
6529    if (startMarker && endMarker) {
6530      if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
6531        return;
6532      }
6533      var range = doc.createRange();
6534      range.setStart(startMarker.node, startMarker.offset);
6535      selection.removeAllRanges();
6536  
6537      if (start > end) {
6538        selection.addRange(range);
6539        selection.extend(endMarker.node, endMarker.offset);
6540      } else {
6541        range.setEnd(endMarker.node, endMarker.offset);
6542        selection.addRange(range);
6543      }
6544    }
6545  }
6546  
6547  function isTextNode(node) {
6548    return node && node.nodeType === TEXT_NODE;
6549  }
6550  
6551  function containsNode(outerNode, innerNode) {
6552    if (!outerNode || !innerNode) {
6553      return false;
6554    } else if (outerNode === innerNode) {
6555      return true;
6556    } else if (isTextNode(outerNode)) {
6557      return false;
6558    } else if (isTextNode(innerNode)) {
6559      return containsNode(outerNode, innerNode.parentNode);
6560    } else if ('contains' in outerNode) {
6561      return outerNode.contains(innerNode);
6562    } else if (outerNode.compareDocumentPosition) {
6563      return !!(outerNode.compareDocumentPosition(innerNode) & 16);
6564    } else {
6565      return false;
6566    }
6567  }
6568  
6569  function isInDocument(node) {
6570    return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
6571  }
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  
6589  function getActiveElementDeep() {
6590    var win = window;
6591    var element = getActiveElement();
6592    while (element instanceof win.HTMLIFrameElement) {
6593      if (isSameOriginFrame(element)) {
6594        win = element.contentWindow;
6595      } else {
6596        return element;
6597      }
6598      element = getActiveElement(win.document);
6599    }
6600    return element;
6601  }
6602  
6603  /**
6604   * @ReactInputSelection: React input selection module. Based on Selection.js,
6605   * but modified to be suitable for react and has a couple of bug fixes (doesn't
6606   * assume buttons have range selections allowed).
6607   * Input selection module for React.
6608   */
6609  
6610  /**
6611   * @hasSelectionCapabilities: we get the element types that support selection
6612   * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
6613   * and `selectionEnd` rows.
6614   */
6615  function hasSelectionCapabilities(elem) {
6616    var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
6617    return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
6618  }
6619  
6620  function getSelectionInformation() {
6621    var focusedElem = getActiveElementDeep();
6622    return {
6623      focusedElem: focusedElem,
6624      selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null
6625    };
6626  }
6627  
6628  /**
6629   * @restoreSelection: If any selection information was potentially lost,
6630   * restore it. This is useful when performing operations that could remove dom
6631   * nodes and place them back in, resulting in focus being lost.
6632   */
6633  function restoreSelection(priorSelectionInformation) {
6634    var curFocusedElem = getActiveElementDeep();
6635    var priorFocusedElem = priorSelectionInformation.focusedElem;
6636    var priorSelectionRange = priorSelectionInformation.selectionRange;
6637    if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
6638      if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
6639        setSelection(priorFocusedElem, priorSelectionRange);
6640      }
6641  
6642      // Focusing a node can change the scroll position, which is undesirable
6643      var ancestors = [];
6644      var ancestor = priorFocusedElem;
6645      while (ancestor = ancestor.parentNode) {
6646        if (ancestor.nodeType === ELEMENT_NODE) {
6647          ancestors.push({
6648            element: ancestor,
6649            left: ancestor.scrollLeft,
6650            top: ancestor.scrollTop
6651          });
6652        }
6653      }
6654  
6655      if (typeof priorFocusedElem.focus === 'function') {
6656        priorFocusedElem.focus();
6657      }
6658  
6659      for (var i = 0; i < ancestors.length; i++) {
6660        var info = ancestors[i];
6661        info.element.scrollLeft = info.left;
6662        info.element.scrollTop = info.top;
6663      }
6664    }
6665  }
6666  
6667  /**
6668   * @getSelection: Gets the selection bounds of a focused textarea, input or
6669   * contentEditable node.
6670   * -@input: Look up selection bounds of this input
6671   * -@return {start: selectionStart, end: selectionEnd}
6672   */
6673  function getSelection$1(input) {
6674    var selection = void 0;
6675  
6676    if ('selectionStart' in input) {
6677      // Modern browser with input or textarea.
6678      selection = {
6679        start: input.selectionStart,
6680        end: input.selectionEnd
6681      };
6682    } else {
6683      // Content editable or old IE textarea.
6684      selection = getOffsets(input);
6685    }
6686  
6687    return selection || { start: 0, end: 0 };
6688  }
6689  
6690  /**
6691   * @setSelection: Sets the selection bounds of a textarea or input and focuses
6692   * the input.
6693   * -@input     Set selection bounds of this input or textarea
6694   * -@offsets   Object of same form that is returned from get*
6695   */
6696  function setSelection(input, offsets) {
6697    var start = offsets.start,
6698        end = offsets.end;
6699  
6700    if (end === undefined) {
6701      end = start;
6702    }
6703  
6704    if ('selectionStart' in input) {
6705      input.selectionStart = start;
6706      input.selectionEnd = Math.min(end, input.value.length);
6707    } else {
6708      setOffsets(input, offsets);
6709    }
6710  }
6711  
6712  var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
6713  
6714  var eventTypes$3 = {
6715    select: {
6716      phasedRegistrationNames: {
6717        bubbled: 'onSelect',
6718        captured: 'onSelectCapture'
6719      },
6720      dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
6721    }
6722  };
6723  
6724  var activeElement$1 = null;
6725  var activeElementInst$1 = null;
6726  var lastSelection = null;
6727  var mouseDown = false;
6728  
6729  /**
6730   * Get an object which is a unique representation of the current selection.
6731   *
6732   * The return value will not be consistent across nodes or browsers, but
6733   * two identical selections on the same node will return identical objects.
6734   *
6735   * @param {DOMElement} node
6736   * @return {object}
6737   */
6738  function getSelection(node) {
6739    if ('selectionStart' in node && hasSelectionCapabilities(node)) {
6740      return {
6741        start: node.selectionStart,
6742        end: node.selectionEnd
6743      };
6744    } else {
6745      var win = node.ownerDocument && node.ownerDocument.defaultView || window;
6746      var selection = win.getSelection();
6747      return {
6748        anchorNode: selection.anchorNode,
6749        anchorOffset: selection.anchorOffset,
6750        focusNode: selection.focusNode,
6751        focusOffset: selection.focusOffset
6752      };
6753    }
6754  }
6755  
6756  /**
6757   * Get document associated with the event target.
6758   *
6759   * @param {object} nativeEventTarget
6760   * @return {Document}
6761   */
6762  function getEventTargetDocument(eventTarget) {
6763    return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
6764  }
6765  
6766  /**
6767   * Poll selection to see whether it's changed.
6768   *
6769   * @param {object} nativeEvent
6770   * @param {object} nativeEventTarget
6771   * @return {?SyntheticEvent}
6772   */
6773  function constructSelectEvent(nativeEvent, nativeEventTarget) {
6774    // Ensure we have the right element, and that the user is not dragging a
6775    // selection (this matches native `select` event behavior). In HTML5, select
6776    // fires only on input and textarea thus if there's no focused element we
6777    // won't dispatch.
6778    var doc = getEventTargetDocument(nativeEventTarget);
6779  
6780    if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
6781      return null;
6782    }
6783  
6784    // Only fire when selection has actually changed.
6785    var currentSelection = getSelection(activeElement$1);
6786    if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
6787      lastSelection = currentSelection;
6788  
6789      var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
6790  
6791      syntheticEvent.type = 'select';
6792      syntheticEvent.target = activeElement$1;
6793  
6794      accumulateTwoPhaseDispatches(syntheticEvent);
6795  
6796      return syntheticEvent;
6797    }
6798  
6799    return null;
6800  }
6801  
6802  /**
6803   * This plugin creates an `onSelect` event that normalizes select events
6804   * across form elements.
6805   *
6806   * Supported elements are:
6807   * - input (see `isTextInputElement`)
6808   * - textarea
6809   * - contentEditable
6810   *
6811   * This differs from native browser implementations in the following ways:
6812   * - Fires on contentEditable fields as well as inputs.
6813   * - Fires for collapsed selection.
6814   * - Fires after user input.
6815   */
6816  var SelectEventPlugin = {
6817    eventTypes: eventTypes$3,
6818  
6819    extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
6820      var doc = getEventTargetDocument(nativeEventTarget);
6821      // Track whether all listeners exists for this plugin. If none exist, we do
6822      // not extract events. See #3639.
6823      if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
6824        return null;
6825      }
6826  
6827      var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
6828  
6829      switch (topLevelType) {
6830        // Track the input node that has focus.
6831        case TOP_FOCUS:
6832          if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
6833            activeElement$1 = targetNode;
6834            activeElementInst$1 = targetInst;
6835            lastSelection = null;
6836          }
6837          break;
6838        case TOP_BLUR:
6839          activeElement$1 = null;
6840          activeElementInst$1 = null;
6841          lastSelection = null;
6842          break;
6843        // Don't fire the event while the user is dragging. This matches the
6844        // semantics of the native select event.
6845        case TOP_MOUSE_DOWN:
6846          mouseDown = true;
6847          break;
6848        case TOP_CONTEXT_MENU:
6849        case TOP_MOUSE_UP:
6850        case TOP_DRAG_END:
6851          mouseDown = false;
6852          return constructSelectEvent(nativeEvent, nativeEventTarget);
6853        // Chrome and IE fire non-standard event when selection is changed (and
6854        // sometimes when it hasn't). IE's event fires out of order with respect
6855        // to key and input events on deletion, so we discard it.
6856        //
6857        // Firefox doesn't support selectionchange, so check selection status
6858        // after each key entry. The selection changes after keydown and before
6859        // keyup, but we check on keydown as well in the case of holding down a
6860        // key, when multiple keydown events are fired but only one keyup is.
6861        // This is also our approach for IE handling, for the reason above.
6862        case TOP_SELECTION_CHANGE:
6863          if (skipSelectionChangeEvent) {
6864            break;
6865          }
6866        // falls through
6867        case TOP_KEY_DOWN:
6868        case TOP_KEY_UP:
6869          return constructSelectEvent(nativeEvent, nativeEventTarget);
6870      }
6871  
6872      return null;
6873    }
6874  };
6875  
6876  /**
6877   * Inject modules for resolving DOM hierarchy and plugin ordering.
6878   */
6879  injection.injectEventPluginOrder(DOMEventPluginOrder);
6880  setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
6881  
6882  /**
6883   * Some important event plugins included by default (without having to require
6884   * them).
6885   */
6886  injection.injectEventPluginsByName({
6887    SimpleEventPlugin: SimpleEventPlugin,
6888    EnterLeaveEventPlugin: EnterLeaveEventPlugin,
6889    ChangeEventPlugin: ChangeEventPlugin,
6890    SelectEventPlugin: SelectEventPlugin,
6891    BeforeInputEventPlugin: BeforeInputEventPlugin
6892  });
6893  
6894  function endsWith(subject, search) {
6895    var length = subject.length;
6896    return subject.substring(length - search.length, length) === search;
6897  }
6898  
6899  var didWarnSelectedSetOnOption = false;
6900  var didWarnInvalidChild = false;
6901  
6902  function flattenChildren(children) {
6903    var content = '';
6904  
6905    // Flatten children. We'll warn if they are invalid
6906    // during validateProps() which runs for hydration too.
6907    // Note that this would throw on non-element objects.
6908    // Elements are stringified (which is normally irrelevant
6909    // but matters for <fbt>).
6910    React.Children.forEach(children, function (child) {
6911      if (child == null) {
6912        return;
6913      }
6914      content += child;
6915      // Note: we don't warn about invalid children here.
6916      // Instead, this is done separately below so that
6917      // it happens during the hydration codepath too.
6918    });
6919  
6920    return content;
6921  }
6922  
6923  /**
6924   * Implements an <option> host component that warns when `selected` is set.
6925   */
6926  
6927  function validateProps(element, props) {
6928    {
6929      // This mirrors the codepath above, but runs for hydration too.
6930      // Warn about invalid children here so that client and hydration are consistent.
6931      // TODO: this seems like it could cause a DEV-only throw for hydration
6932      // if children contains a non-element object. We should try to avoid that.
6933      if (typeof props.children === 'object' && props.children !== null) {
6934        React.Children.forEach(props.children, function (child) {
6935          if (child == null) {
6936            return;
6937          }
6938          if (typeof child === 'string' || typeof child === 'number') {
6939            return;
6940          }
6941          if (typeof child.type !== 'string') {
6942            return;
6943          }
6944          if (!didWarnInvalidChild) {
6945            didWarnInvalidChild = true;
6946            warning$1(false, 'Only strings and numbers are supported as <option> children.');
6947          }
6948        });
6949      }
6950  
6951      // TODO: Remove support for `selected` in <option>.
6952      if (props.selected != null && !didWarnSelectedSetOnOption) {
6953        warning$1(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
6954        didWarnSelectedSetOnOption = true;
6955      }
6956    }
6957  }
6958  
6959  function postMountWrapper$1(element, props) {
6960    // value="" should make a value attribute (#6219)
6961    if (props.value != null) {
6962      element.setAttribute('value', toString(getToStringValue(props.value)));
6963    }
6964  }
6965  
6966  function getHostProps$1(element, props) {
6967    var hostProps = _assign({ children: undefined }, props);
6968    var content = flattenChildren(props.children);
6969  
6970    if (content) {
6971      hostProps.children = content;
6972    }
6973  
6974    return hostProps;
6975  }
6976  
6977  // TODO: direct imports like some-package/src/* are bad. Fix me.
6978  var didWarnValueDefaultValue$1 = void 0;
6979  
6980  {
6981    didWarnValueDefaultValue$1 = false;
6982  }
6983  
6984  function getDeclarationErrorAddendum() {
6985    var ownerName = getCurrentFiberOwnerNameInDevOrNull();
6986    if (ownerName) {
6987      return '\n\nCheck the render method of `' + ownerName + '`.';
6988    }
6989    return '';
6990  }
6991  
6992  var valuePropNames = ['value', 'defaultValue'];
6993  
6994  /**
6995   * Validation function for `value` and `defaultValue`.
6996   */
6997  function checkSelectPropTypes(props) {
6998    ReactControlledValuePropTypes.checkPropTypes('select', props);
6999  
7000    for (var i = 0; i < valuePropNames.length; i++) {
7001      var propName = valuePropNames[i];
7002      if (props[propName] == null) {
7003        continue;
7004      }
7005      var isArray = Array.isArray(props[propName]);
7006      if (props.multiple && !isArray) {
7007        warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
7008      } else if (!props.multiple && isArray) {
7009        warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
7010      }
7011    }
7012  }
7013  
7014  function updateOptions(node, multiple, propValue, setDefaultSelected) {
7015    var options = node.options;
7016  
7017    if (multiple) {
7018      var selectedValues = propValue;
7019      var selectedValue = {};
7020      for (var i = 0; i < selectedValues.length; i++) {
7021        // Prefix to avoid chaos with special keys.
7022        selectedValue['$' + selectedValues[i]] = true;
7023      }
7024      for (var _i = 0; _i < options.length; _i++) {
7025        var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
7026        if (options[_i].selected !== selected) {
7027          options[_i].selected = selected;
7028        }
7029        if (selected && setDefaultSelected) {
7030          options[_i].defaultSelected = true;
7031        }
7032      }
7033    } else {
7034      // Do not set `select.value` as exact behavior isn't consistent across all
7035      // browsers for all cases.
7036      var _selectedValue = toString(getToStringValue(propValue));
7037      var defaultSelected = null;
7038      for (var _i2 = 0; _i2 < options.length; _i2++) {
7039        if (options[_i2].value === _selectedValue) {
7040          options[_i2].selected = true;
7041          if (setDefaultSelected) {
7042            options[_i2].defaultSelected = true;
7043          }
7044          return;
7045        }
7046        if (defaultSelected === null && !options[_i2].disabled) {
7047          defaultSelected = options[_i2];
7048        }
7049      }
7050      if (defaultSelected !== null) {
7051        defaultSelected.selected = true;
7052      }
7053    }
7054  }
7055  
7056  /**
7057   * Implements a <select> host component that allows optionally setting the
7058   * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
7059   * stringable. If `multiple` is true, the prop must be an array of stringables.
7060   *
7061   * If `value` is not supplied (or null/undefined), user actions that change the
7062   * selected option will trigger updates to the rendered options.
7063   *
7064   * If it is supplied (and not null/undefined), the rendered options will not
7065   * update in response to user actions. Instead, the `value` prop must change in
7066   * order for the rendered options to update.
7067   *
7068   * If `defaultValue` is provided, any options with the supplied values will be
7069   * selected.
7070   */
7071  
7072  function getHostProps$2(element, props) {
7073    return _assign({}, props, {
7074      value: undefined
7075    });
7076  }
7077  
7078  function initWrapperState$1(element, props) {
7079    var node = element;
7080    {
7081      checkSelectPropTypes(props);
7082    }
7083  
7084    node._wrapperState = {
7085      wasMultiple: !!props.multiple
7086    };
7087  
7088    {
7089      if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
7090        warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
7091        didWarnValueDefaultValue$1 = true;
7092      }
7093    }
7094  }
7095  
7096  function postMountWrapper$2(element, props) {
7097    var node = element;
7098    node.multiple = !!props.multiple;
7099    var value = props.value;
7100    if (value != null) {
7101      updateOptions(node, !!props.multiple, value, false);
7102    } else if (props.defaultValue != null) {
7103      updateOptions(node, !!props.multiple, props.defaultValue, true);
7104    }
7105  }
7106  
7107  function postUpdateWrapper(element, props) {
7108    var node = element;
7109    var wasMultiple = node._wrapperState.wasMultiple;
7110    node._wrapperState.wasMultiple = !!props.multiple;
7111  
7112    var value = props.value;
7113    if (value != null) {
7114      updateOptions(node, !!props.multiple, value, false);
7115    } else if (wasMultiple !== !!props.multiple) {
7116      // For simplicity, reapply `defaultValue` if `multiple` is toggled.
7117      if (props.defaultValue != null) {
7118        updateOptions(node, !!props.multiple, props.defaultValue, true);
7119      } else {
7120        // Revert the select back to its default unselected state.
7121        updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
7122      }
7123    }
7124  }
7125  
7126  function restoreControlledState$2(element, props) {
7127    var node = element;
7128    var value = props.value;
7129  
7130    if (value != null) {
7131      updateOptions(node, !!props.multiple, value, false);
7132    }
7133  }
7134  
7135  var didWarnValDefaultVal = false;
7136  
7137  /**
7138   * Implements a <textarea> host component that allows setting `value`, and
7139   * `defaultValue`. This differs from the traditional DOM API because value is
7140   * usually set as PCDATA children.
7141   *
7142   * If `value` is not supplied (or null/undefined), user actions that affect the
7143   * value will trigger updates to the element.
7144   *
7145   * If `value` is supplied (and not null/undefined), the rendered element will
7146   * not trigger updates to the element. Instead, the `value` prop must change in
7147   * order for the rendered element to be updated.
7148   *
7149   * The rendered element will be initialized with an empty value, the prop
7150   * `defaultValue` if specified, or the children content (deprecated).
7151   */
7152  
7153  function getHostProps$3(element, props) {
7154    var node = element;
7155    (function () {
7156      if (!(props.dangerouslySetInnerHTML == null)) {
7157        {
7158          throw ReactError(Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.'));
7159        }
7160      }
7161    })();
7162  
7163    // Always set children to the same thing. In IE9, the selection range will
7164    // get reset if `textContent` is mutated.  We could add a check in setTextContent
7165    // to only set the value if/when the value differs from the node value (which would
7166    // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
7167    // solution. The value can be a boolean or object so that's why it's forced
7168    // to be a string.
7169    var hostProps = _assign({}, props, {
7170      value: undefined,
7171      defaultValue: undefined,
7172      children: toString(node._wrapperState.initialValue)
7173    });
7174  
7175    return hostProps;
7176  }
7177  
7178  function initWrapperState$2(element, props) {
7179    var node = element;
7180    {
7181      ReactControlledValuePropTypes.checkPropTypes('textarea', props);
7182      if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
7183        warning$1(false, '%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
7184        didWarnValDefaultVal = true;
7185      }
7186    }
7187  
7188    var initialValue = props.value;
7189  
7190    // Only bother fetching default value if we're going to use it
7191    if (initialValue == null) {
7192      var defaultValue = props.defaultValue;
7193      // TODO (yungsters): Remove support for children content in <textarea>.
7194      var children = props.children;
7195      if (children != null) {
7196        {
7197          warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
7198        }
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        })();
7206        if (Array.isArray(children)) {
7207          (function () {
7208            if (!(children.length <= 1)) {
7209              {
7210                throw ReactError(Error('<textarea> can only have at most one child.'));
7211              }
7212            }
7213          })();
7214          children = children[0];
7215        }
7216  
7217        defaultValue = children;
7218      }
7219      if (defaultValue == null) {
7220        defaultValue = '';
7221      }
7222      initialValue = defaultValue;
7223    }
7224  
7225    node._wrapperState = {
7226      initialValue: getToStringValue(initialValue)
7227    };
7228  }
7229  
7230  function updateWrapper$1(element, props) {
7231    var node = element;
7232    var value = getToStringValue(props.value);
7233    var defaultValue = getToStringValue(props.defaultValue);
7234    if (value != null) {
7235      // Cast `value` to a string to ensure the value is set correctly. While
7236      // browsers typically do this as necessary, jsdom doesn't.
7237      var newValue = toString(value);
7238      // To avoid side effects (such as losing text selection), only set value if changed
7239      if (newValue !== node.value) {
7240        node.value = newValue;
7241      }
7242      if (props.defaultValue == null && node.defaultValue !== newValue) {
7243        node.defaultValue = newValue;
7244      }
7245    }
7246    if (defaultValue != null) {
7247      node.defaultValue = toString(defaultValue);
7248    }
7249  }
7250  
7251  function postMountWrapper$3(element, props) {
7252    var node = element;
7253    // This is in postMount because we need access to the DOM node, which is not
7254    // available until after the component has mounted.
7255    var textContent = node.textContent;
7256  
7257    // Only set node.value if textContent is equal to the expected
7258    // initial value. In IE10/IE11 there is a bug where the placeholder attribute
7259    // will populate textContent as well.
7260    // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
7261    if (textContent === node._wrapperState.initialValue) {
7262      node.value = textContent;
7263    }
7264  }
7265  
7266  function restoreControlledState$3(element, props) {
7267    // DOM component is still mounted; update
7268    updateWrapper$1(element, props);
7269  }
7270  
7271  var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
7272  var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
7273  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
7274  
7275  var Namespaces = {
7276    html: HTML_NAMESPACE$1,
7277    mathml: MATH_NAMESPACE,
7278    svg: SVG_NAMESPACE
7279  };
7280  
7281  // Assumes there is no parent namespace.
7282  function getIntrinsicNamespace(type) {
7283    switch (type) {
7284      case 'svg':
7285        return SVG_NAMESPACE;
7286      case 'math':
7287        return MATH_NAMESPACE;
7288      default:
7289        return HTML_NAMESPACE$1;
7290    }
7291  }
7292  
7293  function getChildNamespace(parentNamespace, type) {
7294    if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
7295      // No (or default) parent namespace: potential entry point.
7296      return getIntrinsicNamespace(type);
7297    }
7298    if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
7299      // We're leaving SVG.
7300      return HTML_NAMESPACE$1;
7301    }
7302    // By default, pass namespace below.
7303    return parentNamespace;
7304  }
7305  
7306  /* globals MSApp */
7307  
7308  /**
7309   * Create a function which has 'unsafe' privileges (required by windows8 apps)
7310   */
7311  var createMicrosoftUnsafeLocalFunction = function (func) {
7312    if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
7313      return function (arg0, arg1, arg2, arg3) {
7314        MSApp.execUnsafeLocalFunction(function () {
7315          return func(arg0, arg1, arg2, arg3);
7316        });
7317      };
7318    } else {
7319      return func;
7320    }
7321  };
7322  
7323  // SVG temp container for IE lacking innerHTML
7324  var reusableSVGContainer = void 0;
7325  
7326  /**
7327   * Set the innerHTML property of a node
7328   *
7329   * @param {DOMElement} node
7330   * @param {string} html
7331   * @internal
7332   */
7333  var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
7334    // IE does not have innerHTML for SVG nodes, so instead we inject the
7335    // new markup in a temp node and then move the child nodes across into
7336    // the target node
7337  
7338    if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
7339      reusableSVGContainer = reusableSVGContainer || document.createElement('div');
7340      reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
7341      var svgNode = reusableSVGContainer.firstChild;
7342      while (node.firstChild) {
7343        node.removeChild(node.firstChild);
7344      }
7345      while (svgNode.firstChild) {
7346        node.appendChild(svgNode.firstChild);
7347      }
7348    } else {
7349      node.innerHTML = html;
7350    }
7351  });
7352  
7353  /**
7354   * Set the textContent property of a node. For text updates, it's faster
7355   * to set the `nodeValue` of the Text node directly instead of using
7356   * `.textContent` which will remove the existing node and create a new one.
7357   *
7358   * @param {DOMElement} node
7359   * @param {string} text
7360   * @internal
7361   */
7362  var setTextContent = function (node, text) {
7363    if (text) {
7364      var firstChild = node.firstChild;
7365  
7366      if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
7367        firstChild.nodeValue = text;
7368        return;
7369      }
7370    }
7371    node.textContent = text;
7372  };
7373  
7374  // List derived from Gecko source code:
7375  // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
7376  var shorthandToLonghand = {
7377    animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
7378    background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
7379    backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
7380    border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
7381    borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
7382    borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
7383    borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
7384    borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
7385    borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
7386    borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
7387    borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
7388    borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
7389    borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
7390    borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
7391    borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
7392    borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
7393    borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
7394    columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
7395    columns: ['columnCount', 'columnWidth'],
7396    flex: ['flexBasis', 'flexGrow', 'flexShrink'],
7397    flexFlow: ['flexDirection', 'flexWrap'],
7398    font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
7399    fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
7400    gap: ['columnGap', 'rowGap'],
7401    grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
7402    gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
7403    gridColumn: ['gridColumnEnd', 'gridColumnStart'],
7404    gridColumnGap: ['columnGap'],
7405    gridGap: ['columnGap', 'rowGap'],
7406    gridRow: ['gridRowEnd', 'gridRowStart'],
7407    gridRowGap: ['rowGap'],
7408    gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
7409    listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
7410    margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
7411    marker: ['markerEnd', 'markerMid', 'markerStart'],
7412    mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
7413    maskPosition: ['maskPositionX', 'maskPositionY'],
7414    outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
7415    overflow: ['overflowX', 'overflowY'],
7416    padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
7417    placeContent: ['alignContent', 'justifyContent'],
7418    placeItems: ['alignItems', 'justifyItems'],
7419    placeSelf: ['alignSelf', 'justifySelf'],
7420    textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
7421    textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
7422    transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
7423    wordWrap: ['overflowWrap']
7424  };
7425  
7426  /**
7427   * CSS properties which accept numbers but are not in units of "px".
7428   */
7429  var isUnitlessNumber = {
7430    animationIterationCount: true,
7431    borderImageOutset: true,
7432    borderImageSlice: true,
7433    borderImageWidth: true,
7434    boxFlex: true,
7435    boxFlexGroup: true,
7436    boxOrdinalGroup: true,
7437    columnCount: true,
7438    columns: true,
7439    flex: true,
7440    flexGrow: true,
7441    flexPositive: true,
7442    flexShrink: true,
7443    flexNegative: true,
7444    flexOrder: true,
7445    gridArea: true,
7446    gridRow: true,
7447    gridRowEnd: true,
7448    gridRowSpan: true,
7449    gridRowStart: true,
7450    gridColumn: true,
7451    gridColumnEnd: true,
7452    gridColumnSpan: true,
7453    gridColumnStart: true,
7454    fontWeight: true,
7455    lineClamp: true,
7456    lineHeight: true,
7457    opacity: true,
7458    order: true,
7459    orphans: true,
7460    tabSize: true,
7461    widows: true,
7462    zIndex: true,
7463    zoom: true,
7464  
7465    // SVG-related properties
7466    fillOpacity: true,
7467    floodOpacity: true,
7468    stopOpacity: true,
7469    strokeDasharray: true,
7470    strokeDashoffset: true,
7471    strokeMiterlimit: true,
7472    strokeOpacity: true,
7473    strokeWidth: true
7474  };
7475  
7476  /**
7477   * @param {string} prefix vendor-specific prefix, eg: Webkit
7478   * @param {string} key style name, eg: transitionDuration
7479   * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
7480   * WebkitTransitionDuration
7481   */
7482  function prefixKey(prefix, key) {
7483    return prefix + key.charAt(0).toUpperCase() + key.substring(1);
7484  }
7485  
7486  /**
7487   * Support style names that may come passed in prefixed by adding permutations
7488   * of vendor prefixes.
7489   */
7490  var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
7491  
7492  // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
7493  // infinite loop, because it iterates over the newly added props too.
7494  Object.keys(isUnitlessNumber).forEach(function (prop) {
7495    prefixes.forEach(function (prefix) {
7496      isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
7497    });
7498  });
7499  
7500  /**
7501   * Convert a value into the proper css writable value. The style name `name`
7502   * should be logical (no hyphens), as specified
7503   * in `CSSProperty.isUnitlessNumber`.
7504   *
7505   * @param {string} name CSS property name such as `topMargin`.
7506   * @param {*} value CSS property value such as `10px`.
7507   * @return {string} Normalized style value with dimensions applied.
7508   */
7509  function dangerousStyleValue(name, value, isCustomProperty) {
7510    // Note that we've removed escapeTextForBrowser() calls here since the
7511    // whole string will be escaped when the attribute is injected into
7512    // the markup. If you provide unsafe user data here they can inject
7513    // arbitrary CSS which may be problematic (I couldn't repro this):
7514    // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
7515    // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
7516    // This is not an XSS hole but instead a potential CSS injection issue
7517    // which has lead to a greater discussion about how we're going to
7518    // trust URLs moving forward. See #2115901
7519  
7520    var isEmpty = value == null || typeof value === 'boolean' || value === '';
7521    if (isEmpty) {
7522      return '';
7523    }
7524  
7525    if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
7526      return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
7527    }
7528  
7529    return ('' + value).trim();
7530  }
7531  
7532  var uppercasePattern = /([A-Z])/g;
7533  var msPattern = /^ms-/;
7534  
7535  /**
7536   * Hyphenates a camelcased CSS property name, for example:
7537   *
7538   *   > hyphenateStyleName('backgroundColor')
7539   *   < "background-color"
7540   *   > hyphenateStyleName('MozTransition')
7541   *   < "-moz-transition"
7542   *   > hyphenateStyleName('msTransition')
7543   *   < "-ms-transition"
7544   *
7545   * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
7546   * is converted to `-ms-`.
7547   */
7548  function hyphenateStyleName(name) {
7549    return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
7550  }
7551  
7552  var warnValidStyle = function () {};
7553  
7554  {
7555    // 'msTransform' is correct, but the other prefixes should be capitalized
7556    var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
7557    var msPattern$1 = /^-ms-/;
7558    var hyphenPattern = /-(.)/g;
7559  
7560    // style values shouldn't contain a semicolon
7561    var badStyleValueWithSemicolonPattern = /;\s*$/;
7562  
7563    var warnedStyleNames = {};
7564    var warnedStyleValues = {};
7565    var warnedForNaNValue = false;
7566    var warnedForInfinityValue = false;
7567  
7568    var camelize = function (string) {
7569      return string.replace(hyphenPattern, function (_, character) {
7570        return character.toUpperCase();
7571      });
7572    };
7573  
7574    var warnHyphenatedStyleName = function (name) {
7575      if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
7576        return;
7577      }
7578  
7579      warnedStyleNames[name] = true;
7580      warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
7581      // As Andi Smith suggests
7582      // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
7583      // is converted to lowercase `ms`.
7584      camelize(name.replace(msPattern$1, 'ms-')));
7585    };
7586  
7587    var warnBadVendoredStyleName = function (name) {
7588      if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
7589        return;
7590      }
7591  
7592      warnedStyleNames[name] = true;
7593      warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
7594    };
7595  
7596    var warnStyleValueWithSemicolon = function (name, value) {
7597      if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
7598        return;
7599      }
7600  
7601      warnedStyleValues[value] = true;
7602      warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
7603    };
7604  
7605    var warnStyleValueIsNaN = function (name, value) {
7606      if (warnedForNaNValue) {
7607        return;
7608      }
7609  
7610      warnedForNaNValue = true;
7611      warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
7612    };
7613  
7614    var warnStyleValueIsInfinity = function (name, value) {
7615      if (warnedForInfinityValue) {
7616        return;
7617      }
7618  
7619      warnedForInfinityValue = true;
7620      warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
7621    };
7622  
7623    warnValidStyle = function (name, value) {
7624      if (name.indexOf('-') > -1) {
7625        warnHyphenatedStyleName(name);
7626      } else if (badVendoredStyleNamePattern.test(name)) {
7627        warnBadVendoredStyleName(name);
7628      } else if (badStyleValueWithSemicolonPattern.test(value)) {
7629        warnStyleValueWithSemicolon(name, value);
7630      }
7631  
7632      if (typeof value === 'number') {
7633        if (isNaN(value)) {
7634          warnStyleValueIsNaN(name, value);
7635        } else if (!isFinite(value)) {
7636          warnStyleValueIsInfinity(name, value);
7637        }
7638      }
7639    };
7640  }
7641  
7642  var warnValidStyle$1 = warnValidStyle;
7643  
7644  /**
7645   * Operations for dealing with CSS properties.
7646   */
7647  
7648  /**
7649   * This creates a string that is expected to be equivalent to the style
7650   * attribute generated by server-side rendering. It by-passes warnings and
7651   * security checks so it's not safe to use this value for anything other than
7652   * comparison. It is only used in DEV for SSR validation.
7653   */
7654  function createDangerousStringForStyles(styles) {
7655    {
7656      var serialized = '';
7657      var delimiter = '';
7658      for (var styleName in styles) {
7659        if (!styles.hasOwnProperty(styleName)) {
7660          continue;
7661        }
7662        var styleValue = styles[styleName];
7663        if (styleValue != null) {
7664          var isCustomProperty = styleName.indexOf('--') === 0;
7665          serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':';
7666          serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
7667  
7668          delimiter = ';';
7669        }
7670      }
7671      return serialized || null;
7672    }
7673  }
7674  
7675  /**
7676   * Sets the value for multiple styles on a node.  If a value is specified as
7677   * '' (empty string), the corresponding style property will be unset.
7678   *
7679   * @param {DOMElement} node
7680   * @param {object} styles
7681   */
7682  function setValueForStyles(node, styles) {
7683    var style = node.style;
7684    for (var styleName in styles) {
7685      if (!styles.hasOwnProperty(styleName)) {
7686        continue;
7687      }
7688      var isCustomProperty = styleName.indexOf('--') === 0;
7689      {
7690        if (!isCustomProperty) {
7691          warnValidStyle$1(styleName, styles[styleName]);
7692        }
7693      }
7694      var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
7695      if (styleName === 'float') {
7696        styleName = 'cssFloat';
7697      }
7698      if (isCustomProperty) {
7699        style.setProperty(styleName, styleValue);
7700      } else {
7701        style[styleName] = styleValue;
7702      }
7703    }
7704  }
7705  
7706  function isValueEmpty(value) {
7707    return value == null || typeof value === 'boolean' || value === '';
7708  }
7709  
7710  /**
7711   * Given {color: 'red', overflow: 'hidden'} returns {
7712   *   color: 'color',
7713   *   overflowX: 'overflow',
7714   *   overflowY: 'overflow',
7715   * }. This can be read as "the overflowY property was set by the overflow
7716   * shorthand". That is, the values are the property that each was derived from.
7717   */
7718  function expandShorthandMap(styles) {
7719    var expanded = {};
7720    for (var key in styles) {
7721      var longhands = shorthandToLonghand[key] || [key];
7722      for (var i = 0; i < longhands.length; i++) {
7723        expanded[longhands[i]] = key;
7724      }
7725    }
7726    return expanded;
7727  }
7728  
7729  /**
7730   * When mixing shorthand and longhand property names, we warn during updates if
7731   * we expect an incorrect result to occur. In particular, we warn for:
7732   *
7733   * Updating a shorthand property (longhand gets overwritten):
7734   *   {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
7735   *   becomes .style.font = 'baz'
7736   * Removing a shorthand property (longhand gets lost too):
7737   *   {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
7738   *   becomes .style.font = ''
7739   * Removing a longhand property (should revert to shorthand; doesn't):
7740   *   {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
7741   *   becomes .style.fontVariant = ''
7742   */
7743  function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
7744    if (!warnAboutShorthandPropertyCollision) {
7745      return;
7746    }
7747  
7748    if (!nextStyles) {
7749      return;
7750    }
7751  
7752    var expandedUpdates = expandShorthandMap(styleUpdates);
7753    var expandedStyles = expandShorthandMap(nextStyles);
7754    var warnedAbout = {};
7755    for (var key in expandedUpdates) {
7756      var originalKey = expandedUpdates[key];
7757      var correctOriginalKey = expandedStyles[key];
7758      if (correctOriginalKey && originalKey !== correctOriginalKey) {
7759        var warningKey = originalKey + ',' + correctOriginalKey;
7760        if (warnedAbout[warningKey]) {
7761          continue;
7762        }
7763        warnedAbout[warningKey] = true;
7764        warning$1(false, '%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
7765      }
7766    }
7767  }
7768  
7769  // For HTML, certain tags should omit their close tag. We keep a whitelist for
7770  // those special-case tags.
7771  
7772  var omittedCloseTags = {
7773    area: true,
7774    base: true,
7775    br: true,
7776    col: true,
7777    embed: true,
7778    hr: true,
7779    img: true,
7780    input: true,
7781    keygen: true,
7782    link: true,
7783    meta: true,
7784    param: true,
7785    source: true,
7786    track: true,
7787    wbr: true
7788    // NOTE: menuitem's close tag should be omitted, but that causes problems.
7789  };
7790  
7791  // For HTML, certain tags cannot have children. This has the same purpose as
7792  // `omittedCloseTags` except that `menuitem` should still have its closing tag.
7793  
7794  var voidElementTags = _assign({
7795    menuitem: true
7796  }, omittedCloseTags);
7797  
7798  // TODO: We can remove this if we add invariantWithStack()
7799  // or add stack by default to invariants where possible.
7800  var HTML$1 = '__html';
7801  
7802  var ReactDebugCurrentFrame$3 = null;
7803  {
7804    ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
7805  }
7806  
7807  function assertValidProps(tag, props) {
7808    if (!props) {
7809      return;
7810    }
7811    // Note the use of `==` which checks for null or undefined.
7812    if (voidElementTags[tag]) {
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      })();
7820    }
7821    if (props.dangerouslySetInnerHTML != null) {
7822      (function () {
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      })();
7836    }
7837    {
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;
7839    }
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    })();
7847  }
7848  
7849  function isCustomComponent(tagName, props) {
7850    if (tagName.indexOf('-') === -1) {
7851      return typeof props.is === 'string';
7852    }
7853    switch (tagName) {
7854      // These are reserved SVG and MathML elements.
7855      // We don't mind this whitelist too much because we expect it to never grow.
7856      // The alternative is to track the namespace in a few places which is convoluted.
7857      // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
7858      case 'annotation-xml':
7859      case 'color-profile':
7860      case 'font-face':
7861      case 'font-face-src':
7862      case 'font-face-uri':
7863      case 'font-face-format':
7864      case 'font-face-name':
7865      case 'missing-glyph':
7866        return false;
7867      default:
7868        return true;
7869    }
7870  }
7871  
7872  // When adding attributes to the HTML or SVG whitelist, be sure to
7873  // also add them to this module to ensure casing and incorrect name
7874  // warnings.
7875  var possibleStandardNames = {
7876    // HTML
7877    accept: 'accept',
7878    acceptcharset: 'acceptCharset',
7879    'accept-charset': 'acceptCharset',
7880    accesskey: 'accessKey',
7881    action: 'action',
7882    allowfullscreen: 'allowFullScreen',
7883    alt: 'alt',
7884    as: 'as',
7885    async: 'async',
7886    autocapitalize: 'autoCapitalize',
7887    autocomplete: 'autoComplete',
7888    autocorrect: 'autoCorrect',
7889    autofocus: 'autoFocus',
7890    autoplay: 'autoPlay',
7891    autosave: 'autoSave',
7892    capture: 'capture',
7893    cellpadding: 'cellPadding',
7894    cellspacing: 'cellSpacing',
7895    challenge: 'challenge',
7896    charset: 'charSet',
7897    checked: 'checked',
7898    children: 'children',
7899    cite: 'cite',
7900    class: 'className',
7901    classid: 'classID',
7902    classname: 'className',
7903    cols: 'cols',
7904    colspan: 'colSpan',
7905    content: 'content',
7906    contenteditable: 'contentEditable',
7907    contextmenu: 'contextMenu',
7908    controls: 'controls',
7909    controlslist: 'controlsList',
7910    coords: 'coords',
7911    crossorigin: 'crossOrigin',
7912    dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
7913    data: 'data',
7914    datetime: 'dateTime',
7915    default: 'default',
7916    defaultchecked: 'defaultChecked',
7917    defaultvalue: 'defaultValue',
7918    defer: 'defer',
7919    dir: 'dir',
7920    disabled: 'disabled',
7921    disablepictureinpicture: 'disablePictureInPicture',
7922    download: 'download',
7923    draggable: 'draggable',
7924    enctype: 'encType',
7925    for: 'htmlFor',
7926    form: 'form',
7927    formmethod: 'formMethod',
7928    formaction: 'formAction',
7929    formenctype: 'formEncType',
7930    formnovalidate: 'formNoValidate',
7931    formtarget: 'formTarget',
7932    frameborder: 'frameBorder',
7933    headers: 'headers',
7934    height: 'height',
7935    hidden: 'hidden',
7936    high: 'high',
7937    href: 'href',
7938    hreflang: 'hrefLang',
7939    htmlfor: 'htmlFor',
7940    httpequiv: 'httpEquiv',
7941    'http-equiv': 'httpEquiv',
7942    icon: 'icon',
7943    id: 'id',
7944    innerhtml: 'innerHTML',
7945    inputmode: 'inputMode',
7946    integrity: 'integrity',
7947    is: 'is',
7948    itemid: 'itemID',
7949    itemprop: 'itemProp',
7950    itemref: 'itemRef',
7951    itemscope: 'itemScope',
7952    itemtype: 'itemType',
7953    keyparams: 'keyParams',
7954    keytype: 'keyType',
7955    kind: 'kind',
7956    label: 'label',
7957    lang: 'lang',
7958    list: 'list',
7959    loop: 'loop',
7960    low: 'low',
7961    manifest: 'manifest',
7962    marginwidth: 'marginWidth',
7963    marginheight: 'marginHeight',
7964    max: 'max',
7965    maxlength: 'maxLength',
7966    media: 'media',
7967    mediagroup: 'mediaGroup',
7968    method: 'method',
7969    min: 'min',
7970    minlength: 'minLength',
7971    multiple: 'multiple',
7972    muted: 'muted',
7973    name: 'name',
7974    nomodule: 'noModule',
7975    nonce: 'nonce',
7976    novalidate: 'noValidate',
7977    open: 'open',
7978    optimum: 'optimum',
7979    pattern: 'pattern',
7980    placeholder: 'placeholder',
7981    playsinline: 'playsInline',
7982    poster: 'poster',
7983    preload: 'preload',
7984    profile: 'profile',
7985    radiogroup: 'radioGroup',
7986    readonly: 'readOnly',
7987    referrerpolicy: 'referrerPolicy',
7988    rel: 'rel',
7989    required: 'required',
7990    reversed: 'reversed',
7991    role: 'role',
7992    rows: 'rows',
7993    rowspan: 'rowSpan',
7994    sandbox: 'sandbox',
7995    scope: 'scope',
7996    scoped: 'scoped',
7997    scrolling: 'scrolling',
7998    seamless: 'seamless',
7999    selected: 'selected',
8000    shape: 'shape',
8001    size: 'size',
8002    sizes: 'sizes',
8003    span: 'span',
8004    spellcheck: 'spellCheck',
8005    src: 'src',
8006    srcdoc: 'srcDoc',
8007    srclang: 'srcLang',
8008    srcset: 'srcSet',
8009    start: 'start',
8010    step: 'step',
8011    style: 'style',
8012    summary: 'summary',
8013    tabindex: 'tabIndex',
8014    target: 'target',
8015    title: 'title',
8016    type: 'type',
8017    usemap: 'useMap',
8018    value: 'value',
8019    width: 'width',
8020    wmode: 'wmode',
8021    wrap: 'wrap',
8022  
8023    // SVG
8024    about: 'about',
8025    accentheight: 'accentHeight',
8026    'accent-height': 'accentHeight',
8027    accumulate: 'accumulate',
8028    additive: 'additive',
8029    alignmentbaseline: 'alignmentBaseline',
8030    'alignment-baseline': 'alignmentBaseline',
8031    allowreorder: 'allowReorder',
8032    alphabetic: 'alphabetic',
8033    amplitude: 'amplitude',
8034    arabicform: 'arabicForm',
8035    'arabic-form': 'arabicForm',
8036    ascent: 'ascent',
8037    attributename: 'attributeName',
8038    attributetype: 'attributeType',
8039    autoreverse: 'autoReverse',
8040    azimuth: 'azimuth',
8041    basefrequency: 'baseFrequency',
8042    baselineshift: 'baselineShift',
8043    'baseline-shift': 'baselineShift',
8044    baseprofile: 'baseProfile',
8045    bbox: 'bbox',
8046    begin: 'begin',
8047    bias: 'bias',
8048    by: 'by',
8049    calcmode: 'calcMode',
8050    capheight: 'capHeight',
8051    'cap-height': 'capHeight',
8052    clip: 'clip',
8053    clippath: 'clipPath',
8054    'clip-path': 'clipPath',
8055    clippathunits: 'clipPathUnits',
8056    cliprule: 'clipRule',
8057    'clip-rule': 'clipRule',
8058    color: 'color',
8059    colorinterpolation: 'colorInterpolation',
8060    'color-interpolation': 'colorInterpolation',
8061    colorinterpolationfilters: 'colorInterpolationFilters',
8062    'color-interpolation-filters': 'colorInterpolationFilters',
8063    colorprofile: 'colorProfile',
8064    'color-profile': 'colorProfile',
8065    colorrendering: 'colorRendering',
8066    'color-rendering': 'colorRendering',
8067    contentscripttype: 'contentScriptType',
8068    contentstyletype: 'contentStyleType',
8069    cursor: 'cursor',
8070    cx: 'cx',
8071    cy: 'cy',
8072    d: 'd',
8073    datatype: 'datatype',
8074    decelerate: 'decelerate',
8075    descent: 'descent',
8076    diffuseconstant: 'diffuseConstant',
8077    direction: 'direction',
8078    display: 'display',
8079    divisor: 'divisor',
8080    dominantbaseline: 'dominantBaseline',
8081    'dominant-baseline': 'dominantBaseline',
8082    dur: 'dur',
8083    dx: 'dx',
8084    dy: 'dy',
8085    edgemode: 'edgeMode',
8086    elevation: 'elevation',
8087    enablebackground: 'enableBackground',
8088    'enable-background': 'enableBackground',
8089    end: 'end',
8090    exponent: 'exponent',
8091    externalresourcesrequired: 'externalResourcesRequired',
8092    fill: 'fill',
8093    fillopacity: 'fillOpacity',
8094    'fill-opacity': 'fillOpacity',
8095    fillrule: 'fillRule',
8096    'fill-rule': 'fillRule',
8097    filter: 'filter',
8098    filterres: 'filterRes',
8099    filterunits: 'filterUnits',
8100    floodopacity: 'floodOpacity',
8101    'flood-opacity': 'floodOpacity',
8102    floodcolor: 'floodColor',
8103    'flood-color': 'floodColor',
8104    focusable: 'focusable',
8105    fontfamily: 'fontFamily',
8106    'font-family': 'fontFamily',
8107    fontsize: 'fontSize',
8108    'font-size': 'fontSize',
8109    fontsizeadjust: 'fontSizeAdjust',
8110    'font-size-adjust': 'fontSizeAdjust',
8111    fontstretch: 'fontStretch',
8112    'font-stretch': 'fontStretch',
8113    fontstyle: 'fontStyle',
8114    'font-style': 'fontStyle',
8115    fontvariant: 'fontVariant',
8116    'font-variant': 'fontVariant',
8117    fontweight: 'fontWeight',
8118    'font-weight': 'fontWeight',
8119    format: 'format',
8120    from: 'from',
8121    fx: 'fx',
8122    fy: 'fy',
8123    g1: 'g1',
8124    g2: 'g2',
8125    glyphname: 'glyphName',
8126    'glyph-name': 'glyphName',
8127    glyphorientationhorizontal: 'glyphOrientationHorizontal',
8128    'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
8129    glyphorientationvertical: 'glyphOrientationVertical',
8130    'glyph-orientation-vertical': 'glyphOrientationVertical',
8131    glyphref: 'glyphRef',
8132    gradienttransform: 'gradientTransform',
8133    gradientunits: 'gradientUnits',
8134    hanging: 'hanging',
8135    horizadvx: 'horizAdvX',
8136    'horiz-adv-x': 'horizAdvX',
8137    horizoriginx: 'horizOriginX',
8138    'horiz-origin-x': 'horizOriginX',
8139    ideographic: 'ideographic',
8140    imagerendering: 'imageRendering',
8141    'image-rendering': 'imageRendering',
8142    in2: 'in2',
8143    in: 'in',
8144    inlist: 'inlist',
8145    intercept: 'intercept',
8146    k1: 'k1',
8147    k2: 'k2',
8148    k3: 'k3',
8149    k4: 'k4',
8150    k: 'k',
8151    kernelmatrix: 'kernelMatrix',
8152    kernelunitlength: 'kernelUnitLength',
8153    kerning: 'kerning',
8154    keypoints: 'keyPoints',
8155    keysplines: 'keySplines',
8156    keytimes: 'keyTimes',
8157    lengthadjust: 'lengthAdjust',
8158    letterspacing: 'letterSpacing',
8159    'letter-spacing': 'letterSpacing',
8160    lightingcolor: 'lightingColor',
8161    'lighting-color': 'lightingColor',
8162    limitingconeangle: 'limitingConeAngle',
8163    local: 'local',
8164    markerend: 'markerEnd',
8165    'marker-end': 'markerEnd',
8166    markerheight: 'markerHeight',
8167    markermid: 'markerMid',
8168    'marker-mid': 'markerMid',
8169    markerstart: 'markerStart',
8170    'marker-start': 'markerStart',
8171    markerunits: 'markerUnits',
8172    markerwidth: 'markerWidth',
8173    mask: 'mask',
8174    maskcontentunits: 'maskContentUnits',
8175    maskunits: 'maskUnits',
8176    mathematical: 'mathematical',
8177    mode: 'mode',
8178    numoctaves: 'numOctaves',
8179    offset: 'offset',
8180    opacity: 'opacity',
8181    operator: 'operator',
8182    order: 'order',
8183    orient: 'orient',
8184    orientation: 'orientation',
8185    origin: 'origin',
8186    overflow: 'overflow',
8187    overlineposition: 'overlinePosition',
8188    'overline-position': 'overlinePosition',
8189    overlinethickness: 'overlineThickness',
8190    'overline-thickness': 'overlineThickness',
8191    paintorder: 'paintOrder',
8192    'paint-order': 'paintOrder',
8193    panose1: 'panose1',
8194    'panose-1': 'panose1',
8195    pathlength: 'pathLength',
8196    patterncontentunits: 'patternContentUnits',
8197    patterntransform: 'patternTransform',
8198    patternunits: 'patternUnits',
8199    pointerevents: 'pointerEvents',
8200    'pointer-events': 'pointerEvents',
8201    points: 'points',
8202    pointsatx: 'pointsAtX',
8203    pointsaty: 'pointsAtY',
8204    pointsatz: 'pointsAtZ',
8205    prefix: 'prefix',
8206    preservealpha: 'preserveAlpha',
8207    preserveaspectratio: 'preserveAspectRatio',
8208    primitiveunits: 'primitiveUnits',
8209    property: 'property',
8210    r: 'r',
8211    radius: 'radius',
8212    refx: 'refX',
8213    refy: 'refY',
8214    renderingintent: 'renderingIntent',
8215    'rendering-intent': 'renderingIntent',
8216    repeatcount: 'repeatCount',
8217    repeatdur: 'repeatDur',
8218    requiredextensions: 'requiredExtensions',
8219    requiredfeatures: 'requiredFeatures',
8220    resource: 'resource',
8221    restart: 'restart',
8222    result: 'result',
8223    results: 'results',
8224    rotate: 'rotate',
8225    rx: 'rx',
8226    ry: 'ry',
8227    scale: 'scale',
8228    security: 'security',
8229    seed: 'seed',
8230    shaperendering: 'shapeRendering',
8231    'shape-rendering': 'shapeRendering',
8232    slope: 'slope',
8233    spacing: 'spacing',
8234    specularconstant: 'specularConstant',
8235    specularexponent: 'specularExponent',
8236    speed: 'speed',
8237    spreadmethod: 'spreadMethod',
8238    startoffset: 'startOffset',
8239    stddeviation: 'stdDeviation',
8240    stemh: 'stemh',
8241    stemv: 'stemv',
8242    stitchtiles: 'stitchTiles',
8243    stopcolor: 'stopColor',
8244    'stop-color': 'stopColor',
8245    stopopacity: 'stopOpacity',
8246    'stop-opacity': 'stopOpacity',
8247    strikethroughposition: 'strikethroughPosition',
8248    'strikethrough-position': 'strikethroughPosition',
8249    strikethroughthickness: 'strikethroughThickness',
8250    'strikethrough-thickness': 'strikethroughThickness',
8251    string: 'string',
8252    stroke: 'stroke',
8253    strokedasharray: 'strokeDasharray',
8254    'stroke-dasharray': 'strokeDasharray',
8255    strokedashoffset: 'strokeDashoffset',
8256    'stroke-dashoffset': 'strokeDashoffset',
8257    strokelinecap: 'strokeLinecap',
8258    'stroke-linecap': 'strokeLinecap',
8259    strokelinejoin: 'strokeLinejoin',
8260    'stroke-linejoin': 'strokeLinejoin',
8261    strokemiterlimit: 'strokeMiterlimit',
8262    'stroke-miterlimit': 'strokeMiterlimit',
8263    strokewidth: 'strokeWidth',
8264    'stroke-width': 'strokeWidth',
8265    strokeopacity: 'strokeOpacity',
8266    'stroke-opacity': 'strokeOpacity',
8267    suppresscontenteditablewarning: 'suppressContentEditableWarning',
8268    suppresshydrationwarning: 'suppressHydrationWarning',
8269    surfacescale: 'surfaceScale',
8270    systemlanguage: 'systemLanguage',
8271    tablevalues: 'tableValues',
8272    targetx: 'targetX',
8273    targety: 'targetY',
8274    textanchor: 'textAnchor',
8275    'text-anchor': 'textAnchor',
8276    textdecoration: 'textDecoration',
8277    'text-decoration': 'textDecoration',
8278    textlength: 'textLength',
8279    textrendering: 'textRendering',
8280    'text-rendering': 'textRendering',
8281    to: 'to',
8282    transform: 'transform',
8283    typeof: 'typeof',
8284    u1: 'u1',
8285    u2: 'u2',
8286    underlineposition: 'underlinePosition',
8287    'underline-position': 'underlinePosition',
8288    underlinethickness: 'underlineThickness',
8289    'underline-thickness': 'underlineThickness',
8290    unicode: 'unicode',
8291    unicodebidi: 'unicodeBidi',
8292    'unicode-bidi': 'unicodeBidi',
8293    unicoderange: 'unicodeRange',
8294    'unicode-range': 'unicodeRange',
8295    unitsperem: 'unitsPerEm',
8296    'units-per-em': 'unitsPerEm',
8297    unselectable: 'unselectable',
8298    valphabetic: 'vAlphabetic',
8299    'v-alphabetic': 'vAlphabetic',
8300    values: 'values',
8301    vectoreffect: 'vectorEffect',
8302    'vector-effect': 'vectorEffect',
8303    version: 'version',
8304    vertadvy: 'vertAdvY',
8305    'vert-adv-y': 'vertAdvY',
8306    vertoriginx: 'vertOriginX',
8307    'vert-origin-x': 'vertOriginX',
8308    vertoriginy: 'vertOriginY',
8309    'vert-origin-y': 'vertOriginY',
8310    vhanging: 'vHanging',
8311    'v-hanging': 'vHanging',
8312    videographic: 'vIdeographic',
8313    'v-ideographic': 'vIdeographic',
8314    viewbox: 'viewBox',
8315    viewtarget: 'viewTarget',
8316    visibility: 'visibility',
8317    vmathematical: 'vMathematical',
8318    'v-mathematical': 'vMathematical',
8319    vocab: 'vocab',
8320    widths: 'widths',
8321    wordspacing: 'wordSpacing',
8322    'word-spacing': 'wordSpacing',
8323    writingmode: 'writingMode',
8324    'writing-mode': 'writingMode',
8325    x1: 'x1',
8326    x2: 'x2',
8327    x: 'x',
8328    xchannelselector: 'xChannelSelector',
8329    xheight: 'xHeight',
8330    'x-height': 'xHeight',
8331    xlinkactuate: 'xlinkActuate',
8332    'xlink:actuate': 'xlinkActuate',
8333    xlinkarcrole: 'xlinkArcrole',
8334    'xlink:arcrole': 'xlinkArcrole',
8335    xlinkhref: 'xlinkHref',
8336    'xlink:href': 'xlinkHref',
8337    xlinkrole: 'xlinkRole',
8338    'xlink:role': 'xlinkRole',
8339    xlinkshow: 'xlinkShow',
8340    'xlink:show': 'xlinkShow',
8341    xlinktitle: 'xlinkTitle',
8342    'xlink:title': 'xlinkTitle',
8343    xlinktype: 'xlinkType',
8344    'xlink:type': 'xlinkType',
8345    xmlbase: 'xmlBase',
8346    'xml:base': 'xmlBase',
8347    xmllang: 'xmlLang',
8348    'xml:lang': 'xmlLang',
8349    xmlns: 'xmlns',
8350    'xml:space': 'xmlSpace',
8351    xmlnsxlink: 'xmlnsXlink',
8352    'xmlns:xlink': 'xmlnsXlink',
8353    xmlspace: 'xmlSpace',
8354    y1: 'y1',
8355    y2: 'y2',
8356    y: 'y',
8357    ychannelselector: 'yChannelSelector',
8358    z: 'z',
8359    zoomandpan: 'zoomAndPan'
8360  };
8361  
8362  var ariaProperties = {
8363    'aria-current': 0, // state
8364    'aria-details': 0,
8365    'aria-disabled': 0, // state
8366    'aria-hidden': 0, // state
8367    'aria-invalid': 0, // state
8368    'aria-keyshortcuts': 0,
8369    'aria-label': 0,
8370    'aria-roledescription': 0,
8371    // Widget Attributes
8372    'aria-autocomplete': 0,
8373    'aria-checked': 0,
8374    'aria-expanded': 0,
8375    'aria-haspopup': 0,
8376    'aria-level': 0,
8377    'aria-modal': 0,
8378    'aria-multiline': 0,
8379    'aria-multiselectable': 0,
8380    'aria-orientation': 0,
8381    'aria-placeholder': 0,
8382    'aria-pressed': 0,
8383    'aria-readonly': 0,
8384    'aria-required': 0,
8385    'aria-selected': 0,
8386    'aria-sort': 0,
8387    'aria-valuemax': 0,
8388    'aria-valuemin': 0,
8389    'aria-valuenow': 0,
8390    'aria-valuetext': 0,
8391    // Live Region Attributes
8392    'aria-atomic': 0,
8393    'aria-busy': 0,
8394    'aria-live': 0,
8395    'aria-relevant': 0,
8396    // Drag-and-Drop Attributes
8397    'aria-dropeffect': 0,
8398    'aria-grabbed': 0,
8399    // Relationship Attributes
8400    'aria-activedescendant': 0,
8401    'aria-colcount': 0,
8402    'aria-colindex': 0,
8403    'aria-colspan': 0,
8404    'aria-controls': 0,
8405    'aria-describedby': 0,
8406    'aria-errormessage': 0,
8407    'aria-flowto': 0,
8408    'aria-labelledby': 0,
8409    'aria-owns': 0,
8410    'aria-posinset': 0,
8411    'aria-rowcount': 0,
8412    'aria-rowindex': 0,
8413    'aria-rowspan': 0,
8414    'aria-setsize': 0
8415  };
8416  
8417  var warnedProperties = {};
8418  var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
8419  var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
8420  
8421  var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
8422  
8423  function validateProperty(tagName, name) {
8424    if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
8425      return true;
8426    }
8427  
8428    if (rARIACamel.test(name)) {
8429      var ariaName = 'aria-' + name.slice(4).toLowerCase();
8430      var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
8431  
8432      // If this is an aria-* attribute, but is not listed in the known DOM
8433      // DOM properties, then it is an invalid aria-* attribute.
8434      if (correctName == null) {
8435        warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
8436        warnedProperties[name] = true;
8437        return true;
8438      }
8439      // aria-* attributes should be lowercase; suggest the lowercase version.
8440      if (name !== correctName) {
8441        warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
8442        warnedProperties[name] = true;
8443        return true;
8444      }
8445    }
8446  
8447    if (rARIA.test(name)) {
8448      var lowerCasedName = name.toLowerCase();
8449      var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
8450  
8451      // If this is an aria-* attribute, but is not listed in the known DOM
8452      // DOM properties, then it is an invalid aria-* attribute.
8453      if (standardName == null) {
8454        warnedProperties[name] = true;
8455        return false;
8456      }
8457      // aria-* attributes should be lowercase; suggest the lowercase version.
8458      if (name !== standardName) {
8459        warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
8460        warnedProperties[name] = true;
8461        return true;
8462      }
8463    }
8464  
8465    return true;
8466  }
8467  
8468  function warnInvalidARIAProps(type, props) {
8469    var invalidProps = [];
8470  
8471    for (var key in props) {
8472      var isValid = validateProperty(type, key);
8473      if (!isValid) {
8474        invalidProps.push(key);
8475      }
8476    }
8477  
8478    var unknownPropString = invalidProps.map(function (prop) {
8479      return '`' + prop + '`';
8480    }).join(', ');
8481  
8482    if (invalidProps.length === 1) {
8483      warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
8484    } else if (invalidProps.length > 1) {
8485      warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
8486    }
8487  }
8488  
8489  function validateProperties(type, props) {
8490    if (isCustomComponent(type, props)) {
8491      return;
8492    }
8493    warnInvalidARIAProps(type, props);
8494  }
8495  
8496  var didWarnValueNull = false;
8497  
8498  function validateProperties$1(type, props) {
8499    if (type !== 'input' && type !== 'textarea' && type !== 'select') {
8500      return;
8501    }
8502  
8503    if (props != null && props.value === null && !didWarnValueNull) {
8504      didWarnValueNull = true;
8505      if (type === 'select' && props.multiple) {
8506        warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
8507      } else {
8508        warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
8509      }
8510    }
8511  }
8512  
8513  var validateProperty$1 = function () {};
8514  
8515  {
8516    var warnedProperties$1 = {};
8517    var _hasOwnProperty = Object.prototype.hasOwnProperty;
8518    var EVENT_NAME_REGEX = /^on./;
8519    var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
8520    var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
8521    var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
8522  
8523    validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
8524      if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
8525        return true;
8526      }
8527  
8528      var lowerCasedName = name.toLowerCase();
8529      if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
8530        warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
8531        warnedProperties$1[name] = true;
8532        return true;
8533      }
8534  
8535      // We can't rely on the event system being injected on the server.
8536      if (canUseEventSystem) {
8537        if (registrationNameModules.hasOwnProperty(name)) {
8538          return true;
8539        }
8540        var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
8541        if (registrationName != null) {
8542          warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
8543          warnedProperties$1[name] = true;
8544          return true;
8545        }
8546        if (EVENT_NAME_REGEX.test(name)) {
8547          warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
8548          warnedProperties$1[name] = true;
8549          return true;
8550        }
8551      } else if (EVENT_NAME_REGEX.test(name)) {
8552        // If no event plugins have been injected, we are in a server environment.
8553        // So we can't tell if the event name is correct for sure, but we can filter
8554        // out known bad ones like `onclick`. We can't suggest a specific replacement though.
8555        if (INVALID_EVENT_NAME_REGEX.test(name)) {
8556          warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
8557        }
8558        warnedProperties$1[name] = true;
8559        return true;
8560      }
8561  
8562      // Let the ARIA attribute hook validate ARIA attributes
8563      if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
8564        return true;
8565      }
8566  
8567      if (lowerCasedName === 'innerhtml') {
8568        warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
8569        warnedProperties$1[name] = true;
8570        return true;
8571      }
8572  
8573      if (lowerCasedName === 'aria') {
8574        warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
8575        warnedProperties$1[name] = true;
8576        return true;
8577      }
8578  
8579      if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
8580        warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
8581        warnedProperties$1[name] = true;
8582        return true;
8583      }
8584  
8585      if (typeof value === 'number' && isNaN(value)) {
8586        warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
8587        warnedProperties$1[name] = true;
8588        return true;
8589      }
8590  
8591      var propertyInfo = getPropertyInfo(name);
8592      var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
8593  
8594      // Known attributes should match the casing specified in the property config.
8595      if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
8596        var standardName = possibleStandardNames[lowerCasedName];
8597        if (standardName !== name) {
8598          warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
8599          warnedProperties$1[name] = true;
8600          return true;
8601        }
8602      } else if (!isReserved && name !== lowerCasedName) {
8603        // Unknown attributes should have lowercase casing since that's how they
8604        // will be cased anyway with server rendering.
8605        warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
8606        warnedProperties$1[name] = true;
8607        return true;
8608      }
8609  
8610      if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
8611        if (value) {
8612          warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
8613        } else {
8614          warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
8615        }
8616        warnedProperties$1[name] = true;
8617        return true;
8618      }
8619  
8620      // Now that we've validated casing, do not validate
8621      // data types for reserved props
8622      if (isReserved) {
8623        return true;
8624      }
8625  
8626      // Warn when a known attribute is a bad type
8627      if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
8628        warnedProperties$1[name] = true;
8629        return false;
8630      }
8631  
8632      // Warn when passing the strings 'false' or 'true' into a boolean prop
8633      if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
8634        warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
8635        warnedProperties$1[name] = true;
8636        return true;
8637      }
8638  
8639      return true;
8640    };
8641  }
8642  
8643  var warnUnknownProperties = function (type, props, canUseEventSystem) {
8644    var unknownProps = [];
8645    for (var key in props) {
8646      var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
8647      if (!isValid) {
8648        unknownProps.push(key);
8649      }
8650    }
8651  
8652    var unknownPropString = unknownProps.map(function (prop) {
8653      return '`' + prop + '`';
8654    }).join(', ');
8655    if (unknownProps.length === 1) {
8656      warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
8657    } else if (unknownProps.length > 1) {
8658      warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
8659    }
8660  };
8661  
8662  function validateProperties$2(type, props, canUseEventSystem) {
8663    if (isCustomComponent(type, props)) {
8664      return;
8665    }
8666    warnUnknownProperties(type, props, canUseEventSystem);
8667  }
8668  
8669  // TODO: direct imports like some-package/src/* are bad. Fix me.
8670  var didWarnInvalidHydration = false;
8671  var didWarnShadyDOM = false;
8672  
8673  var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
8674  var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
8675  var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
8676  var AUTOFOCUS = 'autoFocus';
8677  var CHILDREN = 'children';
8678  var STYLE$1 = 'style';
8679  var HTML = '__html';
8680  var LISTENERS = 'listeners';
8681  
8682  var HTML_NAMESPACE = Namespaces.html;
8683  
8684  
8685  var warnedUnknownTags = void 0;
8686  var suppressHydrationWarning = void 0;
8687  
8688  var validatePropertiesInDevelopment = void 0;
8689  var warnForTextDifference = void 0;
8690  var warnForPropDifference = void 0;
8691  var warnForExtraAttributes = void 0;
8692  var warnForInvalidEventListener = void 0;
8693  var canDiffStyleForHydrationWarning = void 0;
8694  
8695  var normalizeMarkupForTextOrAttribute = void 0;
8696  var normalizeHTML = void 0;
8697  
8698  {
8699    warnedUnknownTags = {
8700      // Chrome is the only major browser not shipping <time>. But as of July
8701      // 2017 it intends to ship it due to widespread usage. We intentionally
8702      // *don't* warn for <time> even if it's unrecognized by Chrome because
8703      // it soon will be, and many apps have been using it anyway.
8704      time: true,
8705      // There are working polyfills for <dialog>. Let people use it.
8706      dialog: true,
8707      // Electron ships a custom <webview> tag to display external web content in
8708      // an isolated frame and process.
8709      // This tag is not present in non Electron environments such as JSDom which
8710      // is often used for testing purposes.
8711      // @see https://electronjs.org/docs/api/webview-tag
8712      webview: true
8713    };
8714  
8715    validatePropertiesInDevelopment = function (type, props) {
8716      validateProperties(type, props);
8717      validateProperties$1(type, props);
8718      validateProperties$2(type, props, /* canUseEventSystem */true);
8719    };
8720  
8721    // IE 11 parses & normalizes the style attribute as opposed to other
8722    // browsers. It adds spaces and sorts the properties in some
8723    // non-alphabetical order. Handling that would require sorting CSS
8724    // properties in the client & server versions or applying
8725    // `expectedStyle` to a temporary DOM node to read its `style` attribute
8726    // normalized. Since it only affects IE, we're skipping style warnings
8727    // in that browser completely in favor of doing all that work.
8728    // See https://github.com/facebook/react/issues/11807
8729    canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode;
8730  
8731    // HTML parsing normalizes CR and CRLF to LF.
8732    // It also can turn \u0000 into \uFFFD inside attributes.
8733    // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
8734    // If we have a mismatch, it might be caused by that.
8735    // We will still patch up in this case but not fire the warning.
8736    var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
8737    var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
8738  
8739    normalizeMarkupForTextOrAttribute = function (markup) {
8740      var markupString = typeof markup === 'string' ? markup : '' + markup;
8741      return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
8742    };
8743  
8744    warnForTextDifference = function (serverText, clientText) {
8745      if (didWarnInvalidHydration) {
8746        return;
8747      }
8748      var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
8749      var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
8750      if (normalizedServerText === normalizedClientText) {
8751        return;
8752      }
8753      didWarnInvalidHydration = true;
8754      warningWithoutStack$1(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
8755    };
8756  
8757    warnForPr