You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2017/09/27 17:53:10 UTC
[7/8] allura git commit: [#8161] upgrade React from v0.14.3 to v16.0.0
http://git-wip-us.apache.org/repos/asf/allura/blob/0459800f/Allura/allura/public/nf/js/react-dom.development.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/react-dom.development.js b/Allura/allura/public/nf/js/react-dom.development.js
new file mode 100644
index 0000000..eea5c11
--- /dev/null
+++ b/Allura/allura/public/nf/js/react-dom.development.js
@@ -0,0 +1,18427 @@
+/** @license React v16.0.0
+ * react-dom.development.js
+ *
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
+ typeof define === 'function' && define.amd ? define(['react'], factory) :
+ (global.ReactDOM = factory(global.React));
+}(this, (function (require$$0) { 'use strict';
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule reactProdInvariant
+ *
+ */
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+var validateFormat = function validateFormat(format) {};
+
+{
+ validateFormat = function validateFormat(format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
+}
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+var invariant_1 = invariant;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule checkReact
+ *
+ */
+
+
+
+
+!require$$0 ? invariant_1(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule DOMNamespaces
+ */
+
+var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
+var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
+var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
+
+var Namespaces = {
+ html: HTML_NAMESPACE,
+ mathml: MATH_NAMESPACE,
+ svg: SVG_NAMESPACE
+};
+
+// Assumes there is no parent namespace.
+function getIntrinsicNamespace(type) {
+ switch (type) {
+ case 'svg':
+ return SVG_NAMESPACE;
+ case 'math':
+ return MATH_NAMESPACE;
+ default:
+ return HTML_NAMESPACE;
+ }
+}
+
+function getChildNamespace$1(parentNamespace, type) {
+ if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
+ // No (or default) parent namespace: potential entry point.
+ return getIntrinsicNamespace(type);
+ }
+ if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
+ // We're leaving SVG.
+ return HTML_NAMESPACE;
+ }
+ // By default, pass namespace below.
+ return parentNamespace;
+}
+
+var Namespaces_1 = Namespaces;
+var getIntrinsicNamespace_1 = getIntrinsicNamespace;
+var getChildNamespace_1 = getChildNamespace$1;
+
+var DOMNamespaces = {
+ Namespaces: Namespaces_1,
+ getIntrinsicNamespace: getIntrinsicNamespace_1,
+ getChildNamespace: getChildNamespace_1
+};
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+/**
+ * Simple, lightweight module assisting with the detection and context of
+ * Worker. Helps avoid circular dependencies and allows code to reason about
+ * whether or not they are in a Worker, even if they never include the main
+ * `ReactWorker` dependency.
+ */
+var ExecutionEnvironment = {
+
+ canUseDOM: canUseDOM,
+
+ canUseWorkers: typeof Worker !== 'undefined',
+
+ canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
+
+ canUseViewport: canUseDOM && !!window.screen,
+
+ isInWorker: !canUseDOM // For now, this is true - might change in the future.
+
+};
+
+var ExecutionEnvironment_1 = ExecutionEnvironment;
+
+var ReactInternals = require$$0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+var assign = ReactInternals.assign;
+
+/**
+ * Injectable ordering of event plugins.
+ */
+var eventPluginOrder = null;
+
+/**
+ * Injectable mapping from names to event plugin modules.
+ */
+var namesToPlugins = {};
+
+/**
+ * Recomputes the plugin list using the injected plugins and plugin ordering.
+ *
+ * @private
+ */
+function recomputePluginOrdering() {
+ if (!eventPluginOrder) {
+ // Wait until an `eventPluginOrder` is injected.
+ return;
+ }
+ for (var pluginName in namesToPlugins) {
+ var pluginModule = namesToPlugins[pluginName];
+ var pluginIndex = eventPluginOrder.indexOf(pluginName);
+ !(pluginIndex > -1) ? invariant_1(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
+ if (EventPluginRegistry.plugins[pluginIndex]) {
+ continue;
+ }
+ !pluginModule.extractEvents ? invariant_1(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
+ EventPluginRegistry.plugins[pluginIndex] = pluginModule;
+ var publishedEvents = pluginModule.eventTypes;
+ for (var eventName in publishedEvents) {
+ !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant_1(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
+ }
+ }
+}
+
+/**
+ * Publishes an event so that it can be dispatched by the supplied plugin.
+ *
+ * @param {object} dispatchConfig Dispatch configuration for the event.
+ * @param {object} PluginModule Plugin publishing the event.
+ * @return {boolean} True if the event was successfully published.
+ * @private
+ */
+function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant_1(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
+ EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
+
+ var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
+ if (phasedRegistrationNames) {
+ for (var phaseName in phasedRegistrationNames) {
+ if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
+ var phasedRegistrationName = phasedRegistrationNames[phaseName];
+ publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
+ }
+ }
+ return true;
+ } else if (dispatchConfig.registrationName) {
+ publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Publishes a registration name that is used to identify dispatched events.
+ *
+ * @param {string} registrationName Registration name to add.
+ * @param {object} PluginModule Plugin publishing the event.
+ * @private
+ */
+function publishRegistrationName(registrationName, pluginModule, eventName) {
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? invariant_1(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
+ EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
+ EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
+
+ {
+ var lowerCasedName = registrationName.toLowerCase();
+ EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
+
+ if (registrationName === 'onDoubleClick') {
+ EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
+ }
+ }
+}
+
+/**
+ * Registers plugins so that they can extract and dispatch events.
+ *
+ * @see {EventPluginHub}
+ */
+var EventPluginRegistry = {
+ /**
+ * Ordered list of injected plugins.
+ */
+ plugins: [],
+
+ /**
+ * Mapping from event name to dispatch config
+ */
+ eventNameDispatchConfigs: {},
+
+ /**
+ * Mapping from registration name to plugin module
+ */
+ registrationNameModules: {},
+
+ /**
+ * Mapping from registration name to event name
+ */
+ registrationNameDependencies: {},
+
+ /**
+ * Mapping from lowercase registration names to the properly cased version,
+ * used to warn in the case of missing event handlers. Available
+ * only in true.
+ * @type {Object}
+ */
+ possibleRegistrationNames: {},
+ // Trust the developer to only use possibleRegistrationNames in true
+
+ /**
+ * Injects an ordering of plugins (by plugin name). This allows the ordering
+ * to be decoupled from injection of the actual plugins so that ordering is
+ * always deterministic regardless of packaging, on-the-fly injection, etc.
+ *
+ * @param {array} InjectedEventPluginOrder
+ * @internal
+ * @see {EventPluginHub.injection.injectEventPluginOrder}
+ */
+ injectEventPluginOrder: function (injectedEventPluginOrder) {
+ !!eventPluginOrder ? invariant_1(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
+ // Clone the ordering so it cannot be dynamically mutated.
+ eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
+ recomputePluginOrdering();
+ },
+
+ /**
+ * Injects plugins to be used by `EventPluginHub`. The plugin names must be
+ * in the ordering injected by `injectEventPluginOrder`.
+ *
+ * Plugins can be injected as part of page initialization or on-the-fly.
+ *
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
+ * @internal
+ * @see {EventPluginHub.injection.injectEventPluginsByName}
+ */
+ injectEventPluginsByName: function (injectedNamesToPlugins) {
+ var isOrderingDirty = false;
+ for (var pluginName in injectedNamesToPlugins) {
+ if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
+ continue;
+ }
+ var pluginModule = injectedNamesToPlugins[pluginName];
+ if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
+ !!namesToPlugins[pluginName] ? invariant_1(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
+ namesToPlugins[pluginName] = pluginModule;
+ isOrderingDirty = true;
+ }
+ }
+ if (isOrderingDirty) {
+ recomputePluginOrdering();
+ }
+ }
+};
+
+var EventPluginRegistry_1 = EventPluginRegistry;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ *
+ */
+
+function makeEmptyFunction(arg) {
+ return function () {
+ return arg;
+ };
+}
+
+/**
+ * This function accepts and discards inputs; it has no side effects. This is
+ * primarily useful idiomatically for overridable function endpoints which
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
+ */
+var emptyFunction = function emptyFunction() {};
+
+emptyFunction.thatReturns = makeEmptyFunction;
+emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
+emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
+emptyFunction.thatReturnsNull = makeEmptyFunction(null);
+emptyFunction.thatReturnsThis = function () {
+ return this;
+};
+emptyFunction.thatReturnsArgument = function (arg) {
+ return arg;
+};
+
+var emptyFunction_1 = emptyFunction;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @typechecks
+ */
+
+
+
+/**
+ * Upstream version of event listener. Does not take into account specific
+ * nature of platform.
+ */
+var EventListener = {
+ /**
+ * Listen to DOM events during the bubble phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ listen: function listen(target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, false);
+ return {
+ remove: function remove() {
+ target.removeEventListener(eventType, callback, false);
+ }
+ };
+ } else if (target.attachEvent) {
+ target.attachEvent('on' + eventType, callback);
+ return {
+ remove: function remove() {
+ target.detachEvent('on' + eventType, callback);
+ }
+ };
+ }
+ },
+
+ /**
+ * Listen to DOM events during the capture phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ capture: function capture(target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, true);
+ return {
+ remove: function remove() {
+ target.removeEventListener(eventType, callback, true);
+ }
+ };
+ } else {
+ {
+ console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
+ }
+ return {
+ remove: emptyFunction_1
+ };
+ }
+ },
+
+ registerDefault: function registerDefault() {}
+};
+
+var EventListener_1 = EventListener;
+
+// These attributes should be all lowercase to allow for
+// case insensitive checks
+var RESERVED_PROPS = {
+ children: true,
+ dangerouslySetInnerHTML: true,
+ autoFocus: true,
+ defaultValue: true,
+ defaultChecked: true,
+ innerHTML: true,
+ suppressContentEditableWarning: true,
+ style: true
+};
+
+function checkMask(value, bitmask) {
+ return (value & bitmask) === bitmask;
+}
+
+var DOMPropertyInjection = {
+ /**
+ * Mapping from normalized, camelcased property names to a configuration that
+ * specifies how the associated DOM property should be accessed or rendered.
+ */
+ MUST_USE_PROPERTY: 0x1,
+ HAS_BOOLEAN_VALUE: 0x4,
+ HAS_NUMERIC_VALUE: 0x8,
+ HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
+ HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
+ HAS_STRING_BOOLEAN_VALUE: 0x40,
+
+ /**
+ * Inject some specialized knowledge about the DOM. This takes a config object
+ * with the following properties:
+ *
+ * Properties: object mapping DOM property name to one of the
+ * DOMPropertyInjection constants or null. If your attribute isn't in here,
+ * it won't get written to the DOM.
+ *
+ * DOMAttributeNames: object mapping React attribute name to the DOM
+ * attribute name. Attribute names not specified use the **lowercase**
+ * normalized name.
+ *
+ * DOMAttributeNamespaces: object mapping React attribute name to the DOM
+ * attribute namespace URL. (Attribute names not specified use no namespace.)
+ *
+ * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
+ * Property names not specified use the normalized name.
+ *
+ * DOMMutationMethods: Properties that require special mutation methods. If
+ * `value` is undefined, the mutation method should unset the property.
+ *
+ * @param {object} domPropertyConfig the config as described above.
+ */
+ injectDOMPropertyConfig: function (domPropertyConfig) {
+ var Injection = DOMPropertyInjection;
+ var Properties = domPropertyConfig.Properties || {};
+ var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
+ var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
+ var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
+
+ for (var propName in Properties) {
+ !!DOMProperty.properties.hasOwnProperty(propName) ? invariant_1(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : void 0;
+
+ var lowerCased = propName.toLowerCase();
+ var propConfig = Properties[propName];
+
+ var propertyInfo = {
+ attributeName: lowerCased,
+ attributeNamespace: null,
+ propertyName: propName,
+ mutationMethod: null,
+
+ mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
+ hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
+ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
+ hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
+ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE),
+ hasStringBooleanValue: checkMask(propConfig, Injection.HAS_STRING_BOOLEAN_VALUE)
+ };
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant_1(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : void 0;
+
+ if (DOMAttributeNames.hasOwnProperty(propName)) {
+ var attributeName = DOMAttributeNames[propName];
+
+ propertyInfo.attributeName = attributeName;
+ }
+
+ if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
+ propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+ }
+
+ if (DOMMutationMethods.hasOwnProperty(propName)) {
+ propertyInfo.mutationMethod = DOMMutationMethods[propName];
+ }
+
+ // Downcase references to whitelist properties to check for membership
+ // without case-sensitivity. This allows the whitelist to pick up
+ // `allowfullscreen`, which should be written using the property configuration
+ // for `allowFullscreen`
+ DOMProperty.properties[propName] = propertyInfo;
+ }
+ }
+};
+
+/* eslint-disable max-len */
+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';
+/* eslint-enable max-len */
+
+/**
+ * DOMProperty exports lookup objects that can be used like functions:
+ *
+ * > DOMProperty.isValid['id']
+ * true
+ * > DOMProperty.isValid['foobar']
+ * undefined
+ *
+ * Although this may be confusing, it performs better in general.
+ *
+ * @see http://jsperf.com/key-exists
+ * @see http://jsperf.com/key-missing
+ */
+var DOMProperty = {
+ ID_ATTRIBUTE_NAME: 'data-reactid',
+ ROOT_ATTRIBUTE_NAME: 'data-reactroot',
+
+ ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
+ ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
+
+ /**
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasBooleanValue:
+ * Whether the property should be removed when set to a falsey value.
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
+ * Whether the property must be positive numeric or parse as a positive
+ * numeric and should be removed when set to a falsey value.
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
+ */
+ properties: {},
+
+ /**
+ * Checks whether a property name is a writeable attribute.
+ * @method
+ */
+ shouldSetAttribute: function (name, value) {
+ if (DOMProperty.isReservedProp(name)) {
+ return false;
+ }
+ if ((name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
+ return false;
+ }
+ if (value === null) {
+ return true;
+ }
+ switch (typeof value) {
+ case 'boolean':
+ return DOMProperty.shouldAttributeAcceptBooleanValue(name);
+ case 'undefined':
+ case 'number':
+ case 'string':
+ case 'object':
+ return true;
+ default:
+ // function, symbol
+ return false;
+ }
+ },
+
+ getPropertyInfo: function (name) {
+ return DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ },
+ shouldAttributeAcceptBooleanValue: function (name) {
+ if (DOMProperty.isReservedProp(name)) {
+ return true;
+ }
+ var propertyInfo = DOMProperty.getPropertyInfo(name);
+ if (propertyInfo) {
+ return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue;
+ }
+ var prefix = name.toLowerCase().slice(0, 5);
+ return prefix === 'data-' || prefix === 'aria-';
+ },
+
+
+ /**
+ * Checks to see if a property name is within the list of properties
+ * reserved for internal React operations. These properties should
+ * not be set on an HTML element.
+ *
+ * @private
+ * @param {string} name
+ * @return {boolean} If the name is within reserved props
+ */
+ isReservedProp: function (name) {
+ return RESERVED_PROPS.hasOwnProperty(name);
+ },
+
+
+ injection: DOMPropertyInjection
+};
+
+var DOMProperty_1 = DOMProperty;
+
+/**
+ * Copyright (c) 2015-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule ReactDOMComponentFlags
+ */
+
+var ReactDOMComponentFlags = {
+ hasCachedChildNodes: 1 << 0
+};
+
+var ReactDOMComponentFlags_1 = ReactDOMComponentFlags;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule ReactTypeOfWork
+ *
+ */
+
+var ReactTypeOfWork = {
+ IndeterminateComponent: 0, // Before we know whether it is functional or class
+ FunctionalComponent: 1,
+ ClassComponent: 2,
+ HostRoot: 3, // Root of a host tree. Could be nested inside another node.
+ HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
+ HostComponent: 5,
+ HostText: 6,
+ CoroutineComponent: 7,
+ CoroutineHandlerPhase: 8,
+ YieldComponent: 9,
+ Fragment: 10
+};
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule HTMLNodeType
+ */
+
+/**
+ * HTML nodeType values that represent the type of the node
+ */
+
+var HTMLNodeType = {
+ ELEMENT_NODE: 1,
+ TEXT_NODE: 3,
+ COMMENT_NODE: 8,
+ DOCUMENT_NODE: 9,
+ DOCUMENT_FRAGMENT_NODE: 11
+};
+
+var HTMLNodeType_1 = HTMLNodeType;
+
+var HostComponent = ReactTypeOfWork.HostComponent;
+var HostText = ReactTypeOfWork.HostText;
+
+var ELEMENT_NODE$1 = HTMLNodeType_1.ELEMENT_NODE;
+var COMMENT_NODE$1 = HTMLNodeType_1.COMMENT_NODE;
+
+
+
+var ATTR_NAME = DOMProperty_1.ID_ATTRIBUTE_NAME;
+var Flags = ReactDOMComponentFlags_1;
+
+var randomKey = Math.random().toString(36).slice(2);
+
+var internalInstanceKey = '__reactInternalInstance$' + randomKey;
+
+var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
+
+/**
+ * Check if a given node should be cached.
+ */
+function shouldPrecacheNode(node, nodeID) {
+ return node.nodeType === ELEMENT_NODE$1 && node.getAttribute(ATTR_NAME) === '' + nodeID || node.nodeType === COMMENT_NODE$1 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === COMMENT_NODE$1 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
+}
+
+/**
+ * Drill down (through composites and empty components) until we get a host or
+ * host text component.
+ *
+ * This is pretty polymorphic but unavoidable with the current structure we have
+ * for `_renderedChildren`.
+ */
+function getRenderedHostOrTextFromComponent(component) {
+ var rendered;
+ while (rendered = component._renderedComponent) {
+ component = rendered;
+ }
+ return component;
+}
+
+/**
+ * Populate `_hostNode` on the rendered host/text component with the given
+ * DOM node. The passed `inst` can be a composite.
+ */
+function precacheNode(inst, node) {
+ var hostInst = getRenderedHostOrTextFromComponent(inst);
+ hostInst._hostNode = node;
+ node[internalInstanceKey] = hostInst;
+}
+
+function precacheFiberNode$1(hostInst, node) {
+ node[internalInstanceKey] = hostInst;
+}
+
+function uncacheNode(inst) {
+ var node = inst._hostNode;
+ if (node) {
+ delete node[internalInstanceKey];
+ inst._hostNode = null;
+ }
+}
+
+/**
+ * Populate `_hostNode` on each child of `inst`, assuming that the children
+ * match up with the DOM (element) children of `node`.
+ *
+ * We cache entire levels at once to avoid an n^2 problem where we access the
+ * children of a node sequentially and have to walk from the start to our target
+ * node every time.
+ *
+ * Since we update `_renderedChildren` and the actual DOM at (slightly)
+ * different times, we could race here and see a newer `_renderedChildren` than
+ * the DOM nodes we see. To avoid this, ReactMultiChild calls
+ * `prepareToManageChildren` before we change `_renderedChildren`, at which
+ * time the container's child nodes are always cached (until it unmounts).
+ */
+function precacheChildNodes(inst, node) {
+ if (inst._flags & Flags.hasCachedChildNodes) {
+ return;
+ }
+ var children = inst._renderedChildren;
+ var childNode = node.firstChild;
+ outer: for (var name in children) {
+ if (!children.hasOwnProperty(name)) {
+ continue;
+ }
+ var childInst = children[name];
+ var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
+ if (childID === 0) {
+ // We're currently unmounting this child in ReactMultiChild; skip it.
+ continue;
+ }
+ // We assume the child nodes are in the same order as the child instances.
+ for (; childNode !== null; childNode = childNode.nextSibling) {
+ if (shouldPrecacheNode(childNode, childID)) {
+ precacheNode(childInst, childNode);
+ continue outer;
+ }
+ }
+ // We reached the end of the DOM children without finding an ID match.
+ invariant_1(false, 'Unable to find element with ID %s.', childID);
+ }
+ inst._flags |= Flags.hasCachedChildNodes;
+}
+
+/**
+ * Given a DOM node, return the closest ReactDOMComponent or
+ * ReactDOMTextComponent instance ancestor.
+ */
+function getClosestInstanceFromNode(node) {
+ if (node[internalInstanceKey]) {
+ return node[internalInstanceKey];
+ }
+
+ // Walk up the tree until we find an ancestor whose instance we have cached.
+ var parents = [];
+ while (!node[internalInstanceKey]) {
+ parents.push(node);
+ if (node.parentNode) {
+ node = node.parentNode;
+ } else {
+ // Top of the tree. This node must not be part of a React tree (or is
+ // unmounted, potentially).
+ return null;
+ }
+ }
+
+ var closest;
+ var inst = node[internalInstanceKey];
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ // In Fiber, this will always be the deepest root.
+ return inst;
+ }
+ for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
+ closest = inst;
+ if (parents.length) {
+ precacheChildNodes(inst, node);
+ }
+ }
+
+ return closest;
+}
+
+/**
+ * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
+ * instance, or null if the node was not rendered by this React.
+ */
+function getInstanceFromNode(node) {
+ var inst = node[internalInstanceKey];
+ if (inst) {
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ return inst;
+ } else if (inst._hostNode === node) {
+ return inst;
+ } else {
+ return null;
+ }
+ }
+ inst = getClosestInstanceFromNode(node);
+ if (inst != null && inst._hostNode === node) {
+ return inst;
+ } else {
+ return null;
+ }
+}
+
+/**
+ * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
+ * DOM node.
+ */
+function getNodeFromInstance(inst) {
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ // In Fiber this, is just the state node right now. We assume it will be
+ // a host component or host text.
+ return inst.stateNode;
+ }
+
+ // Without this first invariant, passing a non-DOM-component triggers the next
+ // invariant for a missing parent, which is super confusing.
+ !(inst._hostNode !== undefined) ? invariant_1(false, 'getNodeFromInstance: Invalid argument.') : void 0;
+
+ if (inst._hostNode) {
+ return inst._hostNode;
+ }
+
+ // Walk up the tree until we find an ancestor whose DOM node we have cached.
+ var parents = [];
+ while (!inst._hostNode) {
+ parents.push(inst);
+ !inst._hostParent ? invariant_1(false, 'React DOM tree root should always have a node reference.') : void 0;
+ inst = inst._hostParent;
+ }
+
+ // Now parents contains each ancestor that does *not* have a cached native
+ // node, and `inst` is the deepest ancestor that does.
+ for (; parents.length; inst = parents.pop()) {
+ precacheChildNodes(inst, inst._hostNode);
+ }
+
+ return inst._hostNode;
+}
+
+function getFiberCurrentPropsFromNode(node) {
+ return node[internalEventHandlersKey] || null;
+}
+
+function updateFiberProps$1(node, props) {
+ node[internalEventHandlersKey] = props;
+}
+
+var ReactDOMComponentTree = {
+ getClosestInstanceFromNode: getClosestInstanceFromNode,
+ getInstanceFromNode: getInstanceFromNode,
+ getNodeFromInstance: getNodeFromInstance,
+ precacheChildNodes: precacheChildNodes,
+ precacheNode: precacheNode,
+ uncacheNode: uncacheNode,
+ precacheFiberNode: precacheFiberNode$1,
+ getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode,
+ updateFiberProps: updateFiberProps$1
+};
+
+var ReactDOMComponentTree_1 = ReactDOMComponentTree;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule ReactInstanceMap
+ */
+
+/**
+ * `ReactInstanceMap` maintains a mapping from a public facing stateful
+ * instance (key) and the internal representation (value). This allows public
+ * methods to accept the user facing instance as an argument and map them back
+ * to internal methods.
+ */
+
+// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
+
+var ReactInstanceMap = {
+ /**
+ * This API should be called `delete` but we'd have to make sure to always
+ * transform these to strings for IE support. When this transform is fully
+ * supported we can rename it.
+ */
+ remove: function (key) {
+ key._reactInternalFiber = undefined;
+ },
+
+ get: function (key) {
+ return key._reactInternalFiber;
+ },
+
+ has: function (key) {
+ return key._reactInternalFiber !== undefined;
+ },
+
+ set: function (key, value) {
+ key._reactInternalFiber = value;
+ }
+};
+
+var ReactInstanceMap_1 = ReactInstanceMap;
+
+var ReactInternals$1 = require$$0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+var ReactGlobalSharedState = {
+ ReactCurrentOwner: ReactInternals$1.ReactCurrentOwner
+};
+
+{
+ assign(ReactGlobalSharedState, {
+ ReactComponentTreeHook: ReactInternals$1.ReactComponentTreeHook,
+ ReactDebugCurrentFrame: ReactInternals$1.ReactDebugCurrentFrame
+ });
+}
+
+var ReactGlobalSharedState_1 = ReactGlobalSharedState;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule getComponentName
+ *
+ */
+
+function getComponentName(instanceOrFiber) {
+ if (typeof instanceOrFiber.getName === 'function') {
+ // Stack reconciler
+ var instance = instanceOrFiber;
+ return instance.getName();
+ }
+ if (typeof instanceOrFiber.tag === 'number') {
+ // Fiber reconciler
+ var fiber = instanceOrFiber;
+ var type = fiber.type;
+
+ if (typeof type === 'string') {
+ return type;
+ }
+ if (typeof type === 'function') {
+ return type.displayName || type.name;
+ }
+ }
+ return null;
+}
+
+var getComponentName_1 = getComponentName;
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warning$2 = emptyFunction_1;
+
+{
+ var printWarning = function printWarning(format) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var argIndex = 0;
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.error(message);
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ throw new Error(message);
+ } catch (x) {}
+ };
+
+ warning$2 = function warning(condition, format) {
+ if (format === undefined) {
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+
+ if (format.indexOf('Failed Composite propType: ') === 0) {
+ return; // Ignore CompositeComponent proptype check.
+ }
+
+ if (!condition) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
+ }
+
+ printWarning.apply(undefined, [format].concat(args));
+ }
+ };
+}
+
+var warning_1 = warning$2;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule ReactTypeOfSideEffect
+ *
+ */
+
+var ReactTypeOfSideEffect = {
+ // Don't change these two values:
+ NoEffect: 0, // 0b00000000
+ PerformedWork: 1, // 0b00000001
+ // You can change the rest (and add more).
+ Placement: 2, // 0b00000010
+ Update: 4, // 0b00000100
+ PlacementAndUpdate: 6, // 0b00000110
+ Deletion: 8, // 0b00001000
+ ContentReset: 16, // 0b00010000
+ Callback: 32, // 0b00100000
+ Err: 64, // 0b01000000
+ Ref: 128 };
+
+var ReactCurrentOwner = ReactGlobalSharedState_1.ReactCurrentOwner;
+
+
+
+
+{
+ var warning$1 = warning_1;
+}
+
+var ClassComponent = ReactTypeOfWork.ClassComponent;
+var HostComponent$1 = ReactTypeOfWork.HostComponent;
+var HostRoot$1 = ReactTypeOfWork.HostRoot;
+var HostPortal = ReactTypeOfWork.HostPortal;
+var HostText$1 = ReactTypeOfWork.HostText;
+
+var NoEffect = ReactTypeOfSideEffect.NoEffect;
+var Placement = ReactTypeOfSideEffect.Placement;
+
+var MOUNTING = 1;
+var MOUNTED = 2;
+var UNMOUNTED = 3;
+
+function isFiberMountedImpl(fiber) {
+ var node = fiber;
+ if (!fiber.alternate) {
+ // If there is no alternate, this might be a new tree that isn't inserted
+ // yet. If it is, then it will have a pending insertion effect on it.
+ if ((node.effectTag & Placement) !== NoEffect) {
+ return MOUNTING;
+ }
+ while (node['return']) {
+ node = node['return'];
+ if ((node.effectTag & Placement) !== NoEffect) {
+ return MOUNTING;
+ }
+ }
+ } else {
+ while (node['return']) {
+ node = node['return'];
+ }
+ }
+ if (node.tag === HostRoot$1) {
+ // TODO: Check if this was a nested HostRoot when used with
+ // renderContainerIntoSubtree.
+ return MOUNTED;
+ }
+ // If we didn't hit the root, that means that we're in an disconnected tree
+ // that has been unmounted.
+ return UNMOUNTED;
+}
+var isFiberMounted = function (fiber) {
+ return isFiberMountedImpl(fiber) === MOUNTED;
+};
+
+var isMounted = function (component) {
+ {
+ var owner = ReactCurrentOwner.current;
+ if (owner !== null && owner.tag === ClassComponent) {
+ var ownerFiber = owner;
+ var instance = ownerFiber.stateNode;
+ warning$1(instance._warnedAboutRefsInRender, '%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_1(ownerFiber) || 'A component');
+ instance._warnedAboutRefsInRender = true;
+ }
+ }
+
+ var fiber = ReactInstanceMap_1.get(component);
+ if (!fiber) {
+ return false;
+ }
+ return isFiberMountedImpl(fiber) === MOUNTED;
+};
+
+function assertIsMounted(fiber) {
+ !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant_1(false, 'Unable to find node on an unmounted component.') : void 0;
+}
+
+function findCurrentFiberUsingSlowPath(fiber) {
+ var alternate = fiber.alternate;
+ if (!alternate) {
+ // If there is no alternate, then we only need to check if it is mounted.
+ var state = isFiberMountedImpl(fiber);
+ !(state !== UNMOUNTED) ? invariant_1(false, 'Unable to find node on an unmounted component.') : void 0;
+ if (state === MOUNTING) {
+ return null;
+ }
+ return fiber;
+ }
+ // If we have two possible branches, we'll walk backwards up to the root
+ // to see what path the root points to. On the way we may hit one of the
+ // special cases and we'll deal with them.
+ var a = fiber;
+ var b = alternate;
+ while (true) {
+ var parentA = a['return'];
+ var parentB = parentA ? parentA.alternate : null;
+ if (!parentA || !parentB) {
+ // We're at the root.
+ break;
+ }
+
+ // If both copies of the parent fiber point to the same child, we can
+ // assume that the child is current. This happens when we bailout on low
+ // priority: the bailed out fiber's child reuses the current child.
+ if (parentA.child === parentB.child) {
+ var child = parentA.child;
+ while (child) {
+ if (child === a) {
+ // We've determined that A is the current branch.
+ assertIsMounted(parentA);
+ return fiber;
+ }
+ if (child === b) {
+ // We've determined that B is the current branch.
+ assertIsMounted(parentA);
+ return alternate;
+ }
+ child = child.sibling;
+ }
+ // We should never have an alternate for any mounting node. So the only
+ // way this could possibly happen is if this was unmounted, if at all.
+ invariant_1(false, 'Unable to find node on an unmounted component.');
+ }
+
+ if (a['return'] !== b['return']) {
+ // The return pointer of A and the return pointer of B point to different
+ // fibers. We assume that return pointers never criss-cross, so A must
+ // belong to the child set of A.return, and B must belong to the child
+ // set of B.return.
+ a = parentA;
+ b = parentB;
+ } else {
+ // The return pointers point to the same fiber. We'll have to use the
+ // default, slow path: scan the child sets of each parent alternate to see
+ // which child belongs to which set.
+ //
+ // Search parent A's child set
+ var didFindChild = false;
+ var _child = parentA.child;
+ while (_child) {
+ if (_child === a) {
+ didFindChild = true;
+ a = parentA;
+ b = parentB;
+ break;
+ }
+ if (_child === b) {
+ didFindChild = true;
+ b = parentA;
+ a = parentB;
+ break;
+ }
+ _child = _child.sibling;
+ }
+ if (!didFindChild) {
+ // Search parent B's child set
+ _child = parentB.child;
+ while (_child) {
+ if (_child === a) {
+ didFindChild = true;
+ a = parentB;
+ b = parentA;
+ break;
+ }
+ if (_child === b) {
+ didFindChild = true;
+ b = parentB;
+ a = parentA;
+ break;
+ }
+ _child = _child.sibling;
+ }
+ !didFindChild ? invariant_1(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0;
+ }
+ }
+
+ !(a.alternate === b) ? invariant_1(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ }
+ // If the root is not a host container, we're in a disconnected tree. I.e.
+ // unmounted.
+ !(a.tag === HostRoot$1) ? invariant_1(false, 'Unable to find node on an unmounted component.') : void 0;
+ if (a.stateNode.current === a) {
+ // We've determined that A is the current branch.
+ return fiber;
+ }
+ // Otherwise B has to be current branch.
+ return alternate;
+}
+var findCurrentFiberUsingSlowPath_1 = findCurrentFiberUsingSlowPath;
+
+var findCurrentHostFiber = function (parent) {
+ var currentParent = findCurrentFiberUsingSlowPath(parent);
+ if (!currentParent) {
+ return null;
+ }
+
+ // Next we'll drill down this component to find the first HostComponent/Text.
+ var node = currentParent;
+ while (true) {
+ if (node.tag === HostComponent$1 || node.tag === HostText$1) {
+ return node;
+ } else if (node.child) {
+ node.child['return'] = node;
+ node = node.child;
+ continue;
+ }
+ if (node === currentParent) {
+ return null;
+ }
+ while (!node.sibling) {
+ if (!node['return'] || node['return'] === currentParent) {
+ return null;
+ }
+ node = node['return'];
+ }
+ node.sibling['return'] = node['return'];
+ node = node.sibling;
+ }
+ // Flow needs the return null here, but ESLint complains about it.
+ // eslint-disable-next-line no-unreachable
+ return null;
+};
+
+var findCurrentHostFiberWithNoPortals = function (parent) {
+ var currentParent = findCurrentFiberUsingSlowPath(parent);
+ if (!currentParent) {
+ return null;
+ }
+
+ // Next we'll drill down this component to find the first HostComponent/Text.
+ var node = currentParent;
+ while (true) {
+ if (node.tag === HostComponent$1 || node.tag === HostText$1) {
+ return node;
+ } else if (node.child && node.tag !== HostPortal) {
+ node.child['return'] = node;
+ node = node.child;
+ continue;
+ }
+ if (node === currentParent) {
+ return null;
+ }
+ while (!node.sibling) {
+ if (!node['return'] || node['return'] === currentParent) {
+ return null;
+ }
+ node = node['return'];
+ }
+ node.sibling['return'] = node['return'];
+ node = node.sibling;
+ }
+ // Flow needs the return null here, but ESLint complains about it.
+ // eslint-disable-next-line no-unreachable
+ return null;
+};
+
+var ReactFiberTreeReflection = {
+ isFiberMounted: isFiberMounted,
+ isMounted: isMounted,
+ findCurrentFiberUsingSlowPath: findCurrentFiberUsingSlowPath_1,
+ findCurrentHostFiber: findCurrentHostFiber,
+ findCurrentHostFiberWithNoPortals: findCurrentHostFiberWithNoPortals
+};
+
+var ReactErrorUtils = {
+ // Used by Fiber to simulate a try-catch.
+ _caughtError: null,
+ _hasCaughtError: false,
+
+ // Used by event system to capture/rethrow the first error.
+ _rethrowError: null,
+ _hasRethrowError: false,
+
+ injection: {
+ injectErrorUtils: function (injectedErrorUtils) {
+ !(typeof injectedErrorUtils.invokeGuardedCallback === 'function') ? invariant_1(false, 'Injected invokeGuardedCallback() must be a function.') : void 0;
+ invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback;
+ }
+ },
+
+ /**
+ * Call a function while guarding against errors that happens within it.
+ * Returns an error if it throws, otherwise null.
+ *
+ * In production, this is implemented using a try-catch. The reason we don't
+ * use a try-catch directly is so that we can swap out a different
+ * implementation in DEV mode.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
+ invokeGuardedCallback: function (name, func, context, a, b, c, d, e, f) {
+ invokeGuardedCallback.apply(ReactErrorUtils, arguments);
+ },
+
+ /**
+ * Same as invokeGuardedCallback, but instead of returning an error, it stores
+ * it in a global so it can be rethrown by `rethrowCaughtError` later.
+ * TODO: See if _caughtError and _rethrowError can be unified.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
+ invokeGuardedCallbackAndCatchFirstError: function (name, func, context, a, b, c, d, e, f) {
+ ReactErrorUtils.invokeGuardedCallback.apply(this, arguments);
+ if (ReactErrorUtils.hasCaughtError()) {
+ var error = ReactErrorUtils.clearCaughtError();
+ if (!ReactErrorUtils._hasRethrowError) {
+ ReactErrorUtils._hasRethrowError = true;
+ ReactErrorUtils._rethrowError = error;
+ }
+ }
+ },
+
+ /**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+ rethrowCaughtError: function () {
+ return rethrowCaughtError.apply(ReactErrorUtils, arguments);
+ },
+
+ hasCaughtError: function () {
+ return ReactErrorUtils._hasCaughtError;
+ },
+
+ clearCaughtError: function () {
+ if (ReactErrorUtils._hasCaughtError) {
+ var error = ReactErrorUtils._caughtError;
+ ReactErrorUtils._caughtError = null;
+ ReactErrorUtils._hasCaughtError = false;
+ return error;
+ } else {
+ invariant_1(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
+ }
+ }
+};
+
+var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
+ ReactErrorUtils._hasCaughtError = false;
+ ReactErrorUtils._caughtError = null;
+ var funcArgs = Array.prototype.slice.call(arguments, 3);
+ try {
+ func.apply(context, funcArgs);
+ } catch (error) {
+ ReactErrorUtils._caughtError = error;
+ ReactErrorUtils._hasCaughtError = true;
+ }
+};
+
+{
+ // In DEV mode, we swap out invokeGuardedCallback for a special version
+ // that plays more nicely with the browser's DevTools. The idea is to preserve
+ // "Pause on exceptions" behavior. Because React wraps all user-provided
+ // functions in invokeGuardedCallback, and the production version of
+ // invokeGuardedCallback uses a try-catch, all user exceptions are treated
+ // like caught exceptions, and the DevTools won't pause unless the developer
+ // takes the extra step of enabling pause on caught exceptions. This is
+ // untintuitive, though, because even though React has caught the error, from
+ // the developer's perspective, the error is uncaught.
+ //
+ // To preserve the expected "Pause on exceptions" behavior, we don't use a
+ // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
+ // DOM node, and call the user-provided callback from inside an event handler
+ // for that fake event. If the callback throws, the error is "captured" using
+ // a global event handler. But because the error happens in a different
+ // event loop context, it does not interrupt the normal program flow.
+ // Effectively, this gives us try-catch behavior without actually using
+ // try-catch. Neat!
+
+ // Check that the browser supports the APIs we need to implement our special
+ // DEV version of invokeGuardedCallback
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
+ var fakeNode = document.createElement('react');
+
+ var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
+ // Keeps track of whether the user-provided callback threw an error. We
+ // set this to true at the beginning, then set it to false right after
+ // calling the function. If the function errors, `didError` will never be
+ // set to false. This strategy works even if the browser is flaky and
+ // fails to call our global error handler, because it doesn't rely on
+ // the error event at all.
+ var didError = true;
+
+ // Create an event handler for our fake event. We will synchronously
+ // dispatch our fake event using `dispatchEvent`. Inside the handler, we
+ // call the user-provided callback.
+ var funcArgs = Array.prototype.slice.call(arguments, 3);
+ function callCallback() {
+ // We immediately remove the callback from event listeners so that
+ // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
+ // nested call would trigger the fake event handlers of any call higher
+ // in the stack.
+ fakeNode.removeEventListener(evtType, callCallback, false);
+ func.apply(context, funcArgs);
+ didError = false;
+ }
+
+ // Create a global error event handler. We use this to capture the value
+ // that was thrown. It's possible that this error handler will fire more
+ // than once; for example, if non-React code also calls `dispatchEvent`
+ // and a handler for that event throws. We should be resilient to most of
+ // those cases. Even if our error event handler fires more than once, the
+ // last error event is always used. If the callback actually does error,
+ // we know that the last error event is the correct one, because it's not
+ // possible for anything else to have happened in between our callback
+ // erroring and the code that follows the `dispatchEvent` call below. If
+ // the callback doesn't error, but the error event was fired, we know to
+ // ignore it because `didError` will be false, as described above.
+ var error = void 0;
+ // Use this to track whether the error event is ever called.
+ var didSetError = false;
+ var isCrossOriginError = false;
+
+ function onError(event) {
+ error = event.error;
+ didSetError = true;
+ if (error === null && event.colno === 0 && event.lineno === 0) {
+ isCrossOriginError = true;
+ }
+ }
+
+ // Create a fake event type.
+ var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
+
+ // Attach our event handlers
+ window.addEventListener('error', onError);
+ fakeNode.addEventListener(evtType, callCallback, false);
+
+ // Synchronously dispatch our fake event. If the user-provided function
+ // errors, it will trigger our global error handler.
+ var evt = document.createEvent('Event');
+ evt.initEvent(evtType, false, false);
+ fakeNode.dispatchEvent(evt);
+
+ if (didError) {
+ if (!didSetError) {
+ // The callback errored, but the error event never fired.
+ 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.');
+ } else if (isCrossOriginError) {
+ 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.');
+ }
+ ReactErrorUtils._hasCaughtError = true;
+ ReactErrorUtils._caughtError = error;
+ } else {
+ ReactErrorUtils._hasCaughtError = false;
+ ReactErrorUtils._caughtError = null;
+ }
+
+ // Remove our event listeners
+ window.removeEventListener('error', onError);
+ };
+
+ invokeGuardedCallback = invokeGuardedCallbackDev;
+ }
+}
+
+var rethrowCaughtError = function () {
+ if (ReactErrorUtils._hasRethrowError) {
+ var error = ReactErrorUtils._rethrowError;
+ ReactErrorUtils._rethrowError = null;
+ ReactErrorUtils._hasRethrowError = false;
+ throw error;
+ }
+};
+
+var ReactErrorUtils_1 = ReactErrorUtils;
+
+{
+ var warning$3 = warning_1;
+}
+
+/**
+ * Injected dependencies:
+ */
+
+/**
+ * - `ComponentTree`: [required] Module that can convert between React instances
+ * and actual node references.
+ */
+var ComponentTree;
+var injection = {
+ injectComponentTree: function (Injected) {
+ ComponentTree = Injected;
+ {
+ warning$3(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
+ }
+ }
+};
+
+function isEndish(topLevelType) {
+ return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
+}
+
+function isMoveish(topLevelType) {
+ return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
+}
+function isStartish(topLevelType) {
+ return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
+}
+
+var validateEventDispatches;
+{
+ validateEventDispatches = function (event) {
+ var dispatchListeners = event._dispatchListeners;
+ var dispatchInstances = event._dispatchInstances;
+
+ var listenersIsArr = Array.isArray(dispatchListeners);
+ var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
+
+ var instancesIsArr = Array.isArray(dispatchInstances);
+ var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
+
+ warning$3(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.');
+ };
+}
+
+/**
+ * Dispatch the event to the listener.
+ * @param {SyntheticEvent} event SyntheticEvent to handle
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
+ * @param {function} listener Application-level callback
+ * @param {*} inst Internal component instance
+ */
+function executeDispatch(event, simulated, listener, inst) {
+ var type = event.type || 'unknown-event';
+ event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
+ ReactErrorUtils_1.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
+ event.currentTarget = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches.
+ */
+function executeDispatchesInOrder(event, simulated) {
+ var dispatchListeners = event._dispatchListeners;
+ var dispatchInstances = event._dispatchInstances;
+ {
+ validateEventDispatches(event);
+ }
+ if (Array.isArray(dispatchListeners)) {
+ for (var i = 0; i < dispatchListeners.length; i++) {
+ if (event.isPropagationStopped()) {
+ break;
+ }
+ // Listeners and Instances are two parallel arrays that are always in sync.
+ executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
+ }
+ } else if (dispatchListeners) {
+ executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
+ }
+ event._dispatchListeners = null;
+ event._dispatchInstances = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches, but stops
+ * at the first dispatch execution returning true, and returns that id.
+ *
+ * @return {?string} id of the first dispatch execution who's listener returns
+ * true, or null if no listener returned true.
+ */
+function executeDispatchesInOrderStopAtTrueImpl(event) {
+ var dispatchListeners = event._dispatchListeners;
+ var dispatchInstances = event._dispatchInstances;
+ {
+ validateEventDispatches(event);
+ }
+ if (Array.isArray(dispatchListeners)) {
+ for (var i = 0; i < dispatchListeners.length; i++) {
+ if (event.isPropagationStopped()) {
+ break;
+ }
+ // Listeners and Instances are two parallel arrays that are always in sync.
+ if (dispatchListeners[i](event, dispatchInstances[i])) {
+ return dispatchInstances[i];
+ }
+ }
+ } else if (dispatchListeners) {
+ if (dispatchListeners(event, dispatchInstances)) {
+ return dispatchInstances;
+ }
+ }
+ return null;
+}
+
+/**
+ * @see executeDispatchesInOrderStopAtTrueImpl
+ */
+function executeDispatchesInOrderStopAtTrue(event) {
+ var ret = executeDispatchesInOrderStopAtTrueImpl(event);
+ event._dispatchInstances = null;
+ event._dispatchListeners = null;
+ return ret;
+}
+
+/**
+ * Execution of a "direct" dispatch - there must be at most one dispatch
+ * accumulated on the event or it is considered an error. It doesn't really make
+ * sense for an event with multiple dispatches (bubbled) to keep track of the
+ * return values at each dispatch execution, but it does tend to make sense when
+ * dealing with "direct" dispatches.
+ *
+ * @return {*} The return value of executing the single dispatch.
+ */
+function executeDirectDispatch(event) {
+ {
+ validateEventDispatches(event);
+ }
+ var dispatchListener = event._dispatchListeners;
+ var dispatchInstance = event._dispatchInstances;
+ !!Array.isArray(dispatchListener) ? invariant_1(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0;
+ event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
+ var res = dispatchListener ? dispatchListener(event) : null;
+ event.currentTarget = null;
+ event._dispatchListeners = null;
+ event._dispatchInstances = null;
+ return res;
+}
+
+/**
+ * @param {SyntheticEvent} event
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
+ */
+function hasDispatches(event) {
+ return !!event._dispatchListeners;
+}
+
+/**
+ * General utilities that are useful in creating custom Event Plugins.
+ */
+var EventPluginUtils = {
+ isEndish: isEndish,
+ isMoveish: isMoveish,
+ isStartish: isStartish,
+
+ executeDirectDispatch: executeDirectDispatch,
+ executeDispatchesInOrder: executeDispatchesInOrder,
+ executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
+ hasDispatches: hasDispatches,
+
+ getFiberCurrentPropsFromNode: function (node) {
+ return ComponentTree.getFiberCurrentPropsFromNode(node);
+ },
+ getInstanceFromNode: function (node) {
+ return ComponentTree.getInstanceFromNode(node);
+ },
+ getNodeFromInstance: function (node) {
+ return ComponentTree.getNodeFromInstance(node);
+ },
+
+ injection: injection
+};
+
+var EventPluginUtils_1 = EventPluginUtils;
+
+// Use to restore controlled state after a change event has fired.
+
+var fiberHostComponent = null;
+
+var ReactControlledComponentInjection = {
+ injectFiberControlledHostComponent: function (hostComponentImpl) {
+ // The fiber implementation doesn't use dynamic dispatch so we need to
+ // inject the implementation.
+ fiberHostComponent = hostComponentImpl;
+ }
+};
+
+var restoreTarget = null;
+var restoreQueue = null;
+
+function restoreStateOfTarget(target) {
+ // We perform this translation at the end of the event loop so that we
+ // always receive the correct fiber here
+ var internalInstance = EventPluginUtils_1.getInstanceFromNode(target);
+ if (!internalInstance) {
+ // Unmounted
+ return;
+ }
+ if (typeof internalInstance.tag === 'number') {
+ !(fiberHostComponent && typeof fiberHostComponent.restoreControlledState === 'function') ? invariant_1(false, 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(internalInstance.stateNode);
+ fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props);
+ return;
+ }
+ !(typeof internalInstance.restoreControlledState === 'function') ? invariant_1(false, 'The internal instance must be a React host component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ // If it is not a Fiber, we can just use dynamic dispatch.
+ internalInstance.restoreControlledState();
+}
+
+var ReactControlledComponent = {
+ injection: ReactControlledComponentInjection,
+
+ enqueueStateRestore: function (target) {
+ if (restoreTarget) {
+ if (restoreQueue) {
+ restoreQueue.push(target);
+ } else {
+ restoreQueue = [target];
+ }
+ } else {
+ restoreTarget = target;
+ }
+ },
+ restoreStateIfNeeded: function () {
+ if (!restoreTarget) {
+ return;
+ }
+ var target = restoreTarget;
+ var queuedTargets = restoreQueue;
+ restoreTarget = null;
+ restoreQueue = null;
+
+ restoreStateOfTarget(target);
+ if (queuedTargets) {
+ for (var i = 0; i < queuedTargets.length; i++) {
+ restoreStateOfTarget(queuedTargets[i]);
+ }
+ }
+ }
+};
+
+var ReactControlledComponent_1 = ReactControlledComponent;
+
+// Used as a way to call batchedUpdates when we don't know if we're in a Fiber
+// or Stack context. Such as when we're dispatching events or if third party
+// libraries need to call batchedUpdates. Eventually, this API will go away when
+// everything is batched by default. We'll then have a similar API to opt-out of
+// scheduled work and instead do synchronous work.
+
+// Defaults
+var stackBatchedUpdates = function (fn, a, b, c, d, e) {
+ return fn(a, b, c, d, e);
+};
+var fiberBatchedUpdates = function (fn, bookkeeping) {
+ return fn(bookkeeping);
+};
+
+function performFiberBatchedUpdates(fn, bookkeeping) {
+ // If we have Fiber loaded, we need to wrap this in a batching call so that
+ // Fiber can apply its default priority for this call.
+ return fiberBatchedUpdates(fn, bookkeeping);
+}
+function batchedUpdates(fn, bookkeeping) {
+ // We first perform work with the stack batching strategy, by passing our
+ // indirection to it.
+ return stackBatchedUpdates(performFiberBatchedUpdates, fn, bookkeeping);
+}
+
+var isNestingBatched = false;
+function batchedUpdatesWithControlledComponents(fn, bookkeeping) {
+ if (isNestingBatched) {
+ // If we are currently inside another batch, we need to wait until it
+ // fully completes before restoring state. Therefore, we add the target to
+ // a queue of work.
+ return batchedUpdates(fn, bookkeeping);
+ }
+ isNestingBatched = true;
+ try {
+ return batchedUpdates(fn, bookkeeping);
+ } finally {
+ // Here we wait until all updates have propagated, which is important
+ // when using controlled components within layers:
+ // https://github.com/facebook/react/issues/1698
+ // Then we restore state of any controlled component.
+ isNestingBatched = false;
+ ReactControlledComponent_1.restoreStateIfNeeded();
+ }
+}
+
+var ReactGenericBatchingInjection = {
+ injectStackBatchedUpdates: function (_batchedUpdates) {
+ stackBatchedUpdates = _batchedUpdates;
+ },
+ injectFiberBatchedUpdates: function (_batchedUpdates) {
+ fiberBatchedUpdates = _batchedUpdates;
+ }
+};
+
+var ReactGenericBatching = {
+ batchedUpdates: batchedUpdatesWithControlledComponents,
+ injection: ReactGenericBatchingInjection
+};
+
+var ReactGenericBatching_1 = ReactGenericBatching;
+
+var TEXT_NODE$1 = HTMLNodeType_1.TEXT_NODE;
+
+/**
+ * Gets the target node from a native browser event by accounting for
+ * inconsistencies in browser DOM APIs.
+ *
+ * @param {object} nativeEvent Native browser event.
+ * @return {DOMEventTarget} Target node.
+ */
+
+
+function getEventTarget(nativeEvent) {
+ var target = nativeEvent.target || nativeEvent.srcElement || window;
+
+ // Normalize SVG <use> element events #4963
+ if (target.correspondingUseElement) {
+ target = target.correspondingUseElement;
+ }
+
+ // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
+ // @see http://www.quirksmode.org/js/events_properties.html
+ return target.nodeType === TEXT_NODE$1 ? target.parentNode : target;
+}
+
+var getEventTarget_1 = getEventTarget;
+
+var HostRoot = ReactTypeOfWork.HostRoot;
+
+
+var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
+var callbackBookkeepingPool = [];
+
+/**
+ * Find the deepest React component completely containing the root of the
+ * passed-in instance (for use when entire React trees are nested within each
+ * other). If React trees are not nested, returns null.
+ */
+function findRootContainerNode(inst) {
+ // TODO: It may be a good idea to cache this to prevent unnecessary DOM
+ // traversal, but caching is difficult to do correctly without using a
+ // mutation observer to listen for all DOM changes.
+ if (typeof inst.tag === 'number') {
+ while (inst['return']) {
+ inst = inst['return'];
+ }
+ if (inst.tag !== HostRoot) {
+ // This can happen if we're in a detached tree.
+ return null;
+ }
+ return inst.stateNode.containerInfo;
+ } else {
+ while (inst._hostParent) {
+ inst = inst._hostParent;
+ }
+ var rootNode = ReactDOMComponentTree_1.getNodeFromInstance(inst);
+ return rootNode.parentNode;
+ }
+}
+
+// Used to store ancestor hierarchy in top level callback
+function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
+ if (callbackBookkeepingPool.length) {
+ var instance = callbackBookkeepingPool.pop();
+ instance.topLevelType = topLevelType;
+ instance.nativeEvent = nativeEvent;
+ instance.targetInst = targetInst;
+ return instance;
+ }
+ return {
+ topLevelType: topLevelType,
+ nativeEvent: nativeEvent,
+ targetInst: targetInst,
+ ancestors: []
+ };
+}
+
+function releaseTopLevelCallbackBookKeeping(instance) {
+ instance.topLevelType = null;
+ instance.nativeEvent = null;
+ instance.targetInst = null;
+ instance.ancestors.length = 0;
+ if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
+ callbackBookkeepingPool.push(instance);
+ }
+}
+
+function handleTopLevelImpl(bookKeeping) {
+ var targetInst = bookKeeping.targetInst;
+
+ // Loop through the hierarchy, in case there's any nested components.
+ // It's important that we build the array of ancestors before calling any
+ // event handlers, because event handlers can modify the DOM, leading to
+ // inconsistencies with ReactMount's node cache. See #1105.
+ var ancestor = targetInst;
+ do {
+ if (!ancestor) {
+ bookKeeping.ancestors.push(ancestor);
+ break;
+ }
+ var root = findRootContainerNode(ancestor);
+ if (!root) {
+ break;
+ }
+ bookKeeping.ancestors.push(ancestor);
+ ancestor = ReactDOMComponentTree_1.getClosestInstanceFromNode(root);
+ } while (ancestor);
+
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
+ targetInst = bookKeeping.ancestors[i];
+ ReactDOMEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget_1(bookKeeping.nativeEvent));
+ }
+}
+
+var ReactDOMEventListener = {
+ _enabled: true,
+ _handleTopLevel: null,
+
+ setHandleTopLevel: function (handleTopLevel) {
+ ReactDOMEventListener._handleTopLevel = handleTopLevel;
+ },
+
+ setEnabled: function (enabled) {
+ ReactDOMEventListener._enabled = !!enabled;
+ },
+
+ isEnabled: function () {
+ return ReactDOMEventListener._enabled;
+ },
+
+ /**
+ * Traps top-level events by using event bubbling.
+ *
+ * @param {string} topLevelType Record from `BrowserEventConstants`.
+ * @param {string} handlerBaseName Event name (e.g. "click").
+ * @param {object} element Element on which to attach listener.
+ * @return {?object} An object with a remove function which will forcefully
+ * remove the listener.
+ * @internal
+ */
+ trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
+ if (!element) {
+ return null;
+ }
+ return EventListener_1.listen(element, handlerBaseName, ReactDOMEventListener.dispatchEvent.bind(null, topLevelType));
+ },
+
+ /**
+ * Traps a top-level event by using event capturing.
+ *
+ * @param {string} topLevelType Record from `BrowserEventConstants`.
+ * @param {string} handlerBaseName Event name (e.g. "click").
+ * @param {object} element Element on which to attach listener.
+ * @return {?object} An object with a remove function which will forcefully
+ * remove the listener.
+ * @internal
+ */
+ trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
+ if (!element) {
+ return null;
+ }
+ return EventListener_1.capture(element, handlerBaseName, ReactDOMEventListener.dispatchEvent.bind(null, topLevelType));
+ },
+
+ dispatchEvent: function (topLevelType, nativeEvent) {
+ if (!ReactDOMEventListener._enabled) {
+ return;
+ }
+
+ var nativeEventTarget = getEventTarget_1(nativeEvent);
+ var targetInst = ReactDOMComponentTree_1.getClosestInstanceFromNode(nativeEventTarget);
+ if (targetInst !== null && typeof targetInst.tag === 'number' && !ReactFiberTreeReflection.isFiberMounted(targetInst)) {
+ // If we get an event (ex: img onload) before committing that
+ // component's mount, ignore it for now (that is, treat it as if it was an
+ // event on a non-React tree). We might also consider queueing events and
+ // dispatching them after the mount.
+ targetInst = null;
+ }
+
+ var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
+
+ try {
+ // Event queue being processed in the same cycle allows
+ // `preventDefault`.
+ ReactGenericBatching_1.batchedUpdates(handleTopLevelImpl, bookKeeping);
+ } finally {
+ releaseTopLevelCallbackBookKeeping(bookKeeping);
+ }
+ }
+};
+
+var ReactDOMEventListener_1 = ReactDOMEventListener;
+
+/**
+ * Accumulates items that must not be null or undefined into the first one. This
+ * is used to conserve memory by avoiding array allocations, and thus sacrifices
+ * API cleanness. Since `current` can be null before being passed in and not
+ * null after this function, make sure to assign it back to `current`:
+ *
+ * `a = accumulateInto(a, b);`
+ *
+ * This API should be sparingly used. Try `accumulate` for something cleaner.
+ *
+ * @return {*|array<*>} An accumulation of items.
+ */
+
+function accumulateInto(current, next) {
+ !(next != null) ? invariant_1(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
+
+ if (current == null) {
+ return next;
+ }
+
+ // Both are not empty. Warning: Never call x.concat(y) when you are not
+ // certain that x is an Array (x could be a string with concat method).
+ if (Array.isArray(current)) {
+ if (Array.isArray(next)) {
+ current.push.apply(current, next);
+ return current;
+ }
+ current.push(next);
+ return current;
+ }
+
+ if (Array.isArray(next)) {
+ // A bit too dangerous to mutate `next`.
+ return [current].concat(next);
+ }
+
+ return [current, next];
+}
+
+var accumulateInto_1 = accumulateInto;
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @providesModule forEachAccumulated
+ *
+ */
+
+/**
+ * @param {array} arr an "accumulation" of items which is either an Array or
+ * a single item. Useful when paired with the `accumulate` module. This is a
+ * simple utility that allows us to reason about a collection of items, but
+ * handling the case when there is exactly one item (and we do not need to
+ * allocate an array).
+ * @param {function} cb Callback invoked with each element or a collection.
+ * @param {?} [scope] Scope used as `this` in a callback.
+ */
+
+function forEachAccumulated(arr, cb, scope) {
+ if (Array.isArray(arr)) {
+ arr.forEach(cb, scope);
+ } else if (arr) {
+ cb.call(scope, arr);
+ }
+}
+
+var forEachAccumulated_1 = forEachAccumulated;
+
+/**
+ * Internal queue of events that have accumulated their dispatches and are
+ * waiting to have their dispatches executed.
+ */
+var eventQueue = null;
+
+/**
+ * Dispatches an event and releases it back into the pool, unless persistent.
+ *
+ * @param {?object} event Synthetic event to be dispatched.
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
+ * @private
+ */
+var executeDispatchesAndRelease = function (event, simulated) {
+ if (event) {
+ EventPluginUtils_1.executeDispatchesInOrder(event, simulated);
+
+ if (!event.isPersistent()) {
+ event.constructor.release(event);
+ }
+ }
+};
+var executeDispatchesAndReleaseSimulated = function (e) {
+ return executeDispatchesAndRelease(e, true);
+};
+var executeDispatchesAndReleaseTopLevel = function (e) {
+ return executeDispatchesAndRelease(e, false);
+};
+
+function isInteractive(tag) {
+ return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
+}
+
+function shouldPreventMouseEvent(name, type, props) {
+ switch (name) {
+ case 'onClick':
+ case 'onClickCapture':
+ case 'onDoubleClick':
+ case 'onDoubleClickCapture':
+ case 'onMouseDown':
+ case 'onMouseDownCapture':
+ case 'onMouseMove':
+ case 'onMouseMoveCapture':
+ case 'onMouseUp':
+ case 'onMouseUpCapture':
+ return !!(props.disabled && isInteractive(type));
+ default:
+ return false;
+ }
+}
+
+/**
+ * This is a unified interface for event plugins to be installed and configured.
+ *
+ * Event plugins can implement the following properties:
+ *
+ * `extractEvents` {function(string, DOMEventTarget, string, object): *}
+ * Required. When a top-level event is fired, this method is expected to
+ * extract synthetic events that will in turn be queued and dispatched.
+ *
+ * `eventTypes` {object}
+ * Optional, plugins that fire events must publish a mapping of registration
+ * names that are used to register listeners. Values of this mapping must
+ * be objects that contain `registrationName` or `phasedRegistrationNames`.
+ *
+ * `executeDispatch` {function(object, function, string)}
+ * Optional, allows plugins to override how an event gets dispatched. By
+ * default, the listener is simply invoked.
+ *
+ * Each plugin that is injected into `EventsPluginHub` is immediately operable.
+ *
+ * @public
+ */
+var EventPluginHub = {
+ /**
+ * Methods for injecting dependencies.
+ */
+ injection: {
+ /**
+ * @param {array} InjectedEventPluginOrder
+ * @public
+ */
+ injectEventPluginOrder: EventPluginRegistry_1.injectEventPluginOrder,
+
+ /**
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
+ */
+ injectEventPluginsByName: EventPluginRegistry_1.injectEventPluginsByName
+ },
+
+ /**
+ * @param {object} inst The instance, which is the source of events.
+ * @param {string} registrationName Name of listener (e.g. `onClick`).
+ * @return {?function} The stored callback.
+ */
+ getListener: function (inst, registrationName) {
+ var listener;
+
+ // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
+ // live here; needs to be moved to a better place soon
+ if (typeof inst.tag === 'number') {
+ var stateNode = inst.stateNode;
+ if (!stateNode) {
+ // Work in progress (ex: onload events in incremental mode).
+ return null;
+ }
+ var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode);
+ if (!props) {
+ // Work in progress.
+ return null;
+ }
+ listener = props[registrationName];
+ if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
+ return null;
+ }
+ } else {
+ var currentElement = inst._currentElement;
+ if (typeof currentElement === 'string' || typeof currentElement === 'number') {
+ // Text node, let it bubble through.
+ return null;
+ }
+ if (!inst._rootNodeID) {
+ // If the instance is already unmounted, we have no listeners.
+ return null;
+ }
+ var _props = currentElement.props;
+ listener = _props[registrationName];
+ if (shouldPreventMouseEvent(registrationName, currentElement.type, _props)) {
+ return null;
+ }
+ }
+
+ !(!listener || typeof listener === 'function') ? invariant_1(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
+ return listener;
+ },
+
+ /**
+ * Allows registered plugins an opportunity to extract events from top-level
+ * native browser events.
+ *
+ * @return {*} An accumulation of synthetic events.
+ * @internal
+ */
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events;
+ var plugins = EventPluginRegistry_1.plugins;
+ for (var i = 0; i < plugins.length; i++) {
+ // Not every plugin in the ordering may be loaded at runtime.
+ var possiblePlugin = plugins[i];
+ if (possiblePlugin) {
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+ if (extractedEvents) {
+ events = accumulateInto_1(events, extractedEvents);
+ }
+ }
+ }
+ return events;
+ },
+
+ /**
+ * Enqueues a synthetic event that should be dispatched when
+ * `processEventQueue` is invoked.
+ *
+ * @param {*} events An accumulation of synthetic events.
+ * @internal
+ */
+ enqueueEvents: function (events) {
+ if (events) {
+ eventQueue = accumulateInto_1(eventQueue, events);
+ }
+ },
+
+ /**
+ * Dispatches all synthetic events on the event queue.
+ *
+ * @internal
+ */
+ processEventQueue: function (simulated) {
+ // Set `eventQueue` to null before processing it so that we can tell if more
+ // events get enqueued while processing.
+ var processingEventQueue = eventQueue;
+ eventQueue = null;
+ if (simulated) {
+ forEachAccumulated_1(processingEventQueue, executeDispatchesAndReleaseSimulated);
+ } else {
+ forEachAccumulated_1(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ }
+ !!eventQueue ? invariant_1(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
+ // This would be a good time to rethrow if any of the event handlers threw.
+ ReactErrorUtils_1.rethrowCaughtError();
+ }
+};
+
+var EventPluginHub_1 = EventPluginHub;
+
+function runEventQueueInBatch(events) {
+ EventPluginHub_1.enqueueEvents(events);
+ EventPluginHub_1.processEventQueue(false);
+}
+
+var ReactEventEmitterMixin = {
+ /**
+ * Streams a fired top-level event to `EventPluginHub` where plugins have the
+ * opportunity to create `ReactEvent`s to be dispatched.
+ */
+ handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events = EventPluginHub_1.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+ runEventQueueInBatch(events);
+ }
+};
+
+var ReactEventEmitterMixin_1 = ReactEventEmitterMixin;
+
+var useHasFeature;
+if (ExecutionEnvironment_1.canUseDOM) {
+ useHasFeature = document.implementation && document.implementation.hasFeature &&
+ // always returns true in newer browsers as per the standard.
+ // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
+ document.implementation.hasFeature('', '') !== true;
+}
+
+/**
+ * Checks if an event is supported in the current execution environment.
+ *
+ * NOTE: This will not work correctly for non-generic events such as `change`,
+ * `reset`, `load`, `error`, and `select`.
+ *
+ * Borrows from Modernizr.
+ *
+ * @param {string} eventNameSuffix Event name, e.g. "click".
+ * @param {?boolean} capture Check if the capture phase is supported.
+ * @return {boolean} True if the event is supported.
+ * @internal
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
+ */
+function isEventSupported(eventNameSuffix, capture) {
+ if (!ExecutionEnvironment_1.canUseDOM || capture && !('addEventListener' in document)) {
+ return false;
+ }
+
+ var eventName = 'on' + eventNameSuffix;
+ var isSupported = eventName in document;
+
+ if (!isSupported) {
+ var element = document.createElement('div');
+ element.setAttribute(eventName, 'return;');
+ isSupported = typeof element[eventName] === 'function';
+ }
+
+ if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
+ // This is the only way to test support for the `wheel` event in IE9+.
+ isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
+ }
+
+ return isSupported;
+}
+
+var isEventSupported_1 = isEventSupported;
+
+/**
+ * Generate a mapping of standard vendor prefixes using the defined style property and event name.
+ *
+ * @param {string} styleProp
+ * @param {string} eventName
+ * @returns {object}
+ */
+function makePrefixMap(styleProp, eventName) {
+ var prefixes = {};
+
+ prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
+ prefixes['Webkit' + styleProp] = 'webkit' + eventName;
+ prefixes['Moz' + styleProp] = 'moz' + eventName;
+ prefixes['ms' + styleProp] = 'MS' + eventName;
+ prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
+
+ return prefixes;
+}
+
+/**
+ * A list of event names to a configurable list of vendor prefixes.
+ */
+var vendorPrefixes = {
+ animationend: makePrefixMap('Animation', 'AnimationEnd'),
+ animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
+ animationstart: makePrefixMap('Animation', 'AnimationStart'),
+ transitionend: makePrefixMap('Transition', 'TransitionEnd')
+};
+
+/**
+ * Event names that have already been detected and prefixed (if applicable).
+ */
+var prefixedEventNames = {};
+
+/**
+ * Element to check for prefixes on.
+ */
+var style = {};
+
+/**
+ * Bootstrap if a DOM exists.
+ */
+if (ExecutionEnvironment_1.canUseDOM) {
+ style = document.createElement('div').style;
+
+ // On some platforms, in particular some releases of Android 4.x,
+ // the un-prefixed "animation" and "transition" properties are defined on the
+ // style object but the events that fire will still be prefixed, so we need
+ // to check if the un-prefixed events are usable, and if not remove them from the map.
+ if (!('AnimationEvent' in window)) {
+ delete vendorPrefixes.animationend.animation;
+ delete vendorPrefixes.animationiteration.animation;
+ delete vendorPrefixes.animationstart.animation;
+ }
+
+ // Same as above
+ if (!('TransitionEvent' in window)) {
+ delete vendorPrefixes.transitionend.transition;
+ }
+}
+
+/**
+ * Attempts to determine the correct vendor prefixed event name.
+ *
+ * @param {string} eventName
+ * @returns {string}
+ */
+function getVendorPrefixedEventName(eventName) {
+ if (prefixedEventNames[eventName]) {
+ return prefixedEventNames[eventName];
+ } else if (!vendorPrefixes[eventName]) {
+ return eventName;
+ }
+
+ var prefixMap = vendorPrefixes[eventName];
+
+ for (var styleProp in prefixMap) {
+ if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
+ return prefixedEventNames[eventName] = prefixMap[styleProp];
+ }
+ }
+
+ return '';
+}
+
+var getVendorPrefixedEventName_1 = getVendorPrefixedEventName;
+
+/**
+ * Types of raw signals from the browser caught at the top level.
+ *
+ * For events like 'submit' which don't consistently bubble (which we
+ * trap at a lower node than `document`), binding at `document` would
+ * cause duplicate events so we don't include them here.
+ */
+var topLevelTypes$1 = {
+ topAbort: 'abort',
+ topAnimationEnd: getVendorPrefixedEventName_1('animationend') || 'animationend',
+ topAnimationIteration: getVendorPrefixedEventName_1('animationiteration') || 'animationiteration',
+ topAnimationStart: getVendorPrefixedEventName_1('animationstart') || 'animationstart',
+ topBlur: 'blur',
+ topCancel: 'cancel',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
+ topChange: 'change',
+ topClick: 'click',
+ topClose: 'close',
+ topCompositionEnd: 'compositionend',
+ topCompositionStart: 'compositionstart',
+ topCompositionUpdate: 'compositionupdate',
+ topContextMenu: 'contextmenu',
+ topCopy: 'copy',
+ topCut: 'cut',
+ topDoubleClick: 'dblclick',
+ topDrag: 'drag',
+ topDragEnd: 'dragend',
+ topDragEnter: 'dragenter',
+ topDragExit: 'dragexit',
+ topDragLeave: 'dragleave',
+ topDragOver: 'dragover',
+ topDragStart: 'dragstart',
+ topDrop: 'drop',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
+ topFocus: 'focus',
+ topInput: 'input',
+ topKeyDown: 'keydown',
+ topKeyPress: 'keypress',
+ topKeyUp: 'keyup',
+ topLoadedData: 'loadeddata',
+ topLoad: 'load',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
+ topMouseDown: 'mousedown',
+ topMouseMove: 'mousemove',
+ topMouseOut: 'mouseout',
+ topMouseOver: 'mouseover',
+ topMouseUp: 'mouseup',
+ topPaste: 'paste',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
+ topScroll: 'scroll',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
+ topSelectionChange: 'selectionchange',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
+ topTextInput: 'textInput',
+ topTimeUpdate: 'timeupdate',
+ topToggle: 'toggle',
+ topTouchCancel: 'touchcancel',
+ topTouchEnd: 'touchend',
+ topTouchMove: 'touchmove',
+ topTouchStart: 'touchstart',
+ topTransitionEnd: getVendorPrefixedEventName_1('transitionend') || 'transitionend',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting',
+ topWheel: 'wheel'
+};
+
+var BrowserEventConstants = {
+ topLevelTypes: topLevelTypes$1
+};
+
+var BrowserEventCon
<TRUNCATED>