diff --git a/mopidy_iris/static/app.js b/mopidy_iris/static/app.js
index fa1365de..ccfe2579 100644
--- a/mopidy_iris/static/app.js
+++ b/mopidy_iris/static/app.js
@@ -181,23 +181,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
/***/ }),
-/***/ "./node_modules/@babel/runtime/helpers/inheritsLoose.js":
-/*!**************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/inheritsLoose.js ***!
- \**************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports) {
-
-function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
-}
-
-module.exports = _inheritsLoose;
-
-/***/ }),
-
/***/ "./node_modules/autobind-decorator/lib/index.js":
/*!******************************************************!*\
!*** ./node_modules/autobind-decorator/lib/index.js ***!
@@ -500,27 +483,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(( true && fun
});
-/***/ }),
-
-/***/ "./node_modules/gud/index.js":
-/*!***********************************!*\
- !*** ./node_modules/gud/index.js ***!
- \***********************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(global) {// @flow
-
-
-var key = '__global_unique_id__';
-
-module.exports = function() {
- return global[key] = (global[key] || 0) + 1;
-};
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
-
/***/ }),
/***/ "./node_modules/history/esm/history.js":
@@ -540,8 +502,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; });
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js");
-/* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! resolve-pathname */ "./node_modules/resolve-pathname/esm/resolve-pathname.js");
-/* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/esm/value-equal.js");
+/* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! resolve-pathname */ "./node_modules/resolve-pathname/index.js");
+/* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/index.js");
/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tiny-warning */ "./node_modules/tiny-warning/dist/tiny-warning.esm.js");
/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.esm.js");
@@ -557,7 +519,7 @@ function stripLeadingSlash(path) {
return path.charAt(0) === '/' ? path.substr(1) : path;
}
function hasBasename(path, prefix) {
- return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
+ return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path);
}
function stripBasename(path, prefix) {
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
@@ -767,7 +729,7 @@ function supportsGoWithoutReloadUsingHash() {
*/
function isExtraneousPopstateEvent(event) {
- return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
+ event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
}
var PopStateEvent = 'popstate';
@@ -909,7 +871,7 @@ function createBrowserHistory(props) {
window.location.href = href;
} else {
var prevIndex = allKeys.indexOf(history.location.key);
- var nextKeys = allKeys.slice(0, prevIndex + 1);
+ var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
nextKeys.push(location.key);
allKeys = nextKeys;
setState({
@@ -1052,11 +1014,6 @@ var HashPathCoders = {
}
};
-function stripHash(url) {
- var hashIndex = url.indexOf('#');
- return hashIndex === -1 ? url : url.slice(0, hashIndex);
-}
-
function getHashPath() {
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
@@ -1070,7 +1027,8 @@ function pushHashPath(path) {
}
function replaceHashPath(path) {
- window.location.replace(stripHash(window.location.href) + '#' + path);
+ var hashIndex = window.location.href.indexOf('#');
+ window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path);
}
function createHashHistory(props) {
@@ -1110,10 +1068,6 @@ function createHashHistory(props) {
var forceNextPop = false;
var ignorePath = null;
- function locationsAreEqual$$1(a, b) {
- return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
- }
-
function handleHashChange() {
var path = getHashPath();
var encodedPath = encodePath(path);
@@ -1124,7 +1078,7 @@ function createHashHistory(props) {
} else {
var location = getDOMLocation();
var prevLocation = history.location;
- if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
+ if (!forceNextPop && locationsAreEqual(prevLocation, location)) return; // A hashchange doesn't always == location change.
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
@@ -1177,14 +1131,7 @@ function createHashHistory(props) {
var allPaths = [createPath(initialLocation)]; // Public interface
function createHref(location) {
- var baseTag = document.querySelector('base');
- var href = '';
-
- if (baseTag && baseTag.getAttribute('href')) {
- href = stripHash(window.location.href);
- }
-
- return href + '#' + encodePath(basename + createPath(location));
+ return '#' + encodePath(basename + createPath(location));
}
function push(path, state) {
@@ -1204,7 +1151,7 @@ function createHashHistory(props) {
ignorePath = path;
pushHashPath(encodedPath);
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
- var nextPaths = allPaths.slice(0, prevIndex + 1);
+ var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
nextPaths.push(path);
allPaths = nextPaths;
setState({
@@ -1477,101 +1424,69 @@ function createMemoryHistory(props) {
"use strict";
-var reactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js");
-
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
- childContextTypes: true,
- contextType: true,
- contextTypes: true,
- defaultProps: true,
- displayName: true,
- getDefaultProps: true,
- getDerivedStateFromError: true,
- getDerivedStateFromProps: true,
- mixins: true,
- propTypes: true,
- type: true
+ childContextTypes: true,
+ contextTypes: true,
+ defaultProps: true,
+ displayName: true,
+ getDefaultProps: true,
+ getDerivedStateFromProps: true,
+ mixins: true,
+ propTypes: true,
+ type: true
};
+
var KNOWN_STATICS = {
- name: true,
- length: true,
- prototype: true,
- caller: true,
- callee: true,
- arguments: true,
- arity: true
+ name: true,
+ length: true,
+ prototype: true,
+ caller: true,
+ callee: true,
+ arguments: true,
+ arity: true
};
-var FORWARD_REF_STATICS = {
- '$$typeof': true,
- render: true,
- defaultProps: true,
- displayName: true,
- propTypes: true
-};
-var MEMO_STATICS = {
- '$$typeof': true,
- compare: true,
- defaultProps: true,
- displayName: true,
- propTypes: true,
- type: true
-};
-var TYPE_STATICS = {};
-TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
-
-function getStatics(component) {
- if (reactIs.isMemo(component)) {
- return MEMO_STATICS;
- }
-
- return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
-}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
-var objectPrototype = Object.prototype;
+var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
+
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
- if (typeof sourceComponent !== 'string') {
- // don't hoist over string (html) components
- if (objectPrototype) {
- var inheritedComponent = getPrototypeOf(sourceComponent);
+ if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
- if (inheritedComponent && inheritedComponent !== objectPrototype) {
- hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
- }
+ if (objectPrototype) {
+ var inheritedComponent = getPrototypeOf(sourceComponent);
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
+ hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
+ }
+ }
+
+ var keys = getOwnPropertyNames(sourceComponent);
+
+ if (getOwnPropertySymbols) {
+ keys = keys.concat(getOwnPropertySymbols(sourceComponent));
+ }
+
+ for (var i = 0; i < keys.length; ++i) {
+ var key = keys[i];
+ if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
+ var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
+ try { // Avoid failures from read-only properties
+ defineProperty(targetComponent, key, descriptor);
+ } catch (e) {}
+ }
+ }
+
+ return targetComponent;
}
- var keys = getOwnPropertyNames(sourceComponent);
-
- if (getOwnPropertySymbols) {
- keys = keys.concat(getOwnPropertySymbols(sourceComponent));
- }
-
- var targetStatics = getStatics(targetComponent);
- var sourceStatics = getStatics(sourceComponent);
-
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
-
- if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
- var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
-
- try {
- // Avoid failures from read-only properties
- defineProperty(targetComponent, key, descriptor);
- } catch (e) {}
- }
- }
- }
-
- return targetComponent;
+ return targetComponent;
}
module.exports = hoistNonReactStatics;
@@ -12793,203 +12708,6 @@ return jQuery;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
-/***/ }),
-
-/***/ "./node_modules/mini-create-react-context/dist/esm/index.js":
-/*!******************************************************************!*\
- !*** ./node_modules/mini-create-react-context/dist/esm/index.js ***!
- \******************************************************************/
-/*! exports provided: default */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
-/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ "./node_modules/@babel/runtime/helpers/inheritsLoose.js");
-/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
-/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var gud__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! gud */ "./node_modules/gud/index.js");
-/* harmony import */ var gud__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(gud__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tiny-warning */ "./node_modules/tiny-warning/dist/tiny-warning.esm.js");
-
-
-
-
-
-
-var MAX_SIGNED_31_BIT_INT = 1073741823;
-
-function objectIs(x, y) {
- if (x === y) {
- return x !== 0 || 1 / x === 1 / y;
- } else {
- return x !== x && y !== y;
- }
-}
-
-function createEventEmitter(value) {
- var handlers = [];
- return {
- on: function on(handler) {
- handlers.push(handler);
- },
- off: function off(handler) {
- handlers = handlers.filter(function (h) {
- return h !== handler;
- });
- },
- get: function get() {
- return value;
- },
- set: function set(newValue, changedBits) {
- value = newValue;
- handlers.forEach(function (handler) {
- return handler(value, changedBits);
- });
- }
- };
-}
-
-function onlyChild(children) {
- return Array.isArray(children) ? children[0] : children;
-}
-
-function createReactContext(defaultValue, calculateChangedBits) {
- var _Provider$childContex, _Consumer$contextType;
-
- var contextProp = '__create-react-context-' + gud__WEBPACK_IMPORTED_MODULE_3___default()() + '__';
-
- var Provider =
- /*#__PURE__*/
- function (_Component) {
- _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default()(Provider, _Component);
-
- function Provider() {
- var _this;
-
- _this = _Component.apply(this, arguments) || this;
- _this.emitter = createEventEmitter(_this.props.value);
- return _this;
- }
-
- var _proto = Provider.prototype;
-
- _proto.getChildContext = function getChildContext() {
- var _ref;
-
- return _ref = {}, _ref[contextProp] = this.emitter, _ref;
- };
-
- _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
- if (this.props.value !== nextProps.value) {
- var oldValue = this.props.value;
- var newValue = nextProps.value;
- var changedBits;
-
- if (objectIs(oldValue, newValue)) {
- changedBits = 0;
- } else {
- changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
-
- if (true) {
- Object(tiny_warning__WEBPACK_IMPORTED_MODULE_4__["default"])((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: ' + changedBits);
- }
-
- changedBits |= 0;
-
- if (changedBits !== 0) {
- this.emitter.set(nextProps.value, changedBits);
- }
- }
- }
- };
-
- _proto.render = function render() {
- return this.props.children;
- };
-
- return Provider;
- }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]);
-
- Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object.isRequired, _Provider$childContex);
-
- var Consumer =
- /*#__PURE__*/
- function (_Component2) {
- _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default()(Consumer, _Component2);
-
- function Consumer() {
- var _this2;
-
- _this2 = _Component2.apply(this, arguments) || this;
- _this2.state = {
- value: _this2.getValue()
- };
-
- _this2.onUpdate = function (newValue, changedBits) {
- var observedBits = _this2.observedBits | 0;
-
- if ((observedBits & changedBits) !== 0) {
- _this2.setState({
- value: _this2.getValue()
- });
- }
- };
-
- return _this2;
- }
-
- var _proto2 = Consumer.prototype;
-
- _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
- var observedBits = nextProps.observedBits;
- this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
- };
-
- _proto2.componentDidMount = function componentDidMount() {
- if (this.context[contextProp]) {
- this.context[contextProp].on(this.onUpdate);
- }
-
- var observedBits = this.props.observedBits;
- this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
- };
-
- _proto2.componentWillUnmount = function componentWillUnmount() {
- if (this.context[contextProp]) {
- this.context[contextProp].off(this.onUpdate);
- }
- };
-
- _proto2.getValue = function getValue() {
- if (this.context[contextProp]) {
- return this.context[contextProp].get();
- } else {
- return defaultValue;
- }
- };
-
- _proto2.render = function render() {
- return onlyChild(this.props.children)(this.state.value);
- };
-
- return Consumer;
- }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]);
-
- Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object, _Consumer$contextType);
- return {
- Provider: Provider,
- Consumer: Consumer
- };
-}
-
-var index = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext || createReactContext;
-
-/* harmony default export */ __webpack_exports__["default"] = (index);
-
-
/***/ }),
/***/ "./node_modules/mopidy/lib/websocket/browser.js":
@@ -13569,7 +13287,7 @@ function parse (str, options) {
* @return {!function(Object=, Object=)}
*/
function compile (str, options) {
- return tokensToFunction(parse(str, options), options)
+ return tokensToFunction(parse(str, options))
}
/**
@@ -13599,14 +13317,14 @@ function encodeAsterisk (str) {
/**
* Expose a method for transforming tokens into the path function.
*/
-function tokensToFunction (tokens, options) {
+function tokensToFunction (tokens) {
// Compile all the tokens into regexps.
var matches = new Array(tokens.length)
// Compile all the patterns before compilation.
for (var i = 0; i < tokens.length; i++) {
if (typeof tokens[i] === 'object') {
- matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))
+ matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')
}
}
@@ -13719,7 +13437,7 @@ function attachKeys (re, keys) {
* @return {string}
*/
function flags (options) {
- return options && options.sensitive ? '' : 'i'
+ return options.sensitive ? '' : 'i'
}
/**
@@ -14859,7 +14577,7 @@ module.exports = ReactPropTypesSecret;
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-/** @license React v16.12.0
+/** @license React v16.8.6
* react-dom.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@@ -14878,14 +14596,10 @@ if (true) {
var React = __webpack_require__(/*! react */ "./node_modules/react/index.js");
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
-var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js");
var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");
+var scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js");
var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js");
-// Do not require this module directly! Use normal `invariant` calls with
-// template literal strings. The messages will be replaced with error codes
-// during build.
-
/**
* Use invariant() to assert state which your program assumes to be true.
*
@@ -14897,227 +14611,44 @@ var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/sched
* will remain to ensure logic does not differ in production.
*/
-if (!React) {
- {
- throw Error("ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.");
+var validateFormat = function () {};
+
+{
+ validateFormat = function (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 = void 0;
+ 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;
}
}
-/**
- * Injectable ordering of event plugins.
- */
-var eventPluginOrder = null;
-/**
- * Injectable mapping from names to event plugin modules.
- */
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
-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);
-
- if (!(pluginIndex > -1)) {
- {
- throw Error("EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`.");
- }
- }
-
- if (plugins[pluginIndex]) {
- continue;
- }
-
- if (!pluginModule.extractEvents) {
- {
- throw Error("EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not.");
- }
- }
-
- plugins[pluginIndex] = pluginModule;
- var publishedEvents = pluginModule.eventTypes;
-
- for (var eventName in publishedEvents) {
- if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
- {
- throw Error("EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`.");
- }
- }
- }
- }
-}
-/**
- * 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) {
- if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
- {
- throw Error("EventPluginHub: More than one plugin attempted to publish the same event name, `" + eventName + "`.");
- }
- }
-
- 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) {
- if (!!registrationNameModules[registrationName]) {
- {
- throw Error("EventPluginHub: More than one plugin attempted to publish the same registration name, `" + registrationName + "`.");
- }
- }
-
- registrationNameModules[registrationName] = pluginModule;
- registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
-
- {
- var lowerCasedName = registrationName.toLowerCase();
- possibleRegistrationNames[lowerCasedName] = registrationName;
-
- if (registrationName === 'onDoubleClick') {
- possibleRegistrationNames.ondblclick = registrationName;
- }
- }
-}
-/**
- * Registers plugins so that they can extract and dispatch events.
- *
- * @see {EventPluginHub}
- */
-
-/**
- * Ordered list of injected plugins.
- */
-
-
-var plugins = [];
-/**
- * Mapping from event name to dispatch config
- */
-
-var eventNameDispatchConfigs = {};
-/**
- * Mapping from registration name to plugin module
- */
-
-var registrationNameModules = {};
-/**
- * Mapping from registration name to event name
- */
-
-var 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}
- */
-
-var 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}
- */
-
-function injectEventPluginOrder(injectedEventPluginOrder) {
- if (!!eventPluginOrder) {
- {
- throw Error("EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.");
- }
- } // 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}
- */
-
-function injectEventPluginsByName(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) {
- if (!!namesToPlugins[pluginName]) {
- {
- throw Error("EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`.");
- }
- }
-
- namesToPlugins[pluginName] = pluginModule;
- isOrderingDirty = true;
- }
- }
-
- if (isOrderingDirty) {
- recomputePluginOrdering();
- }
-}
+!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
var funcArgs = Array.prototype.slice.call(arguments, 3);
-
try {
func.apply(context, funcArgs);
} catch (error) {
@@ -15144,6 +14675,7 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
// 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') {
@@ -15154,49 +14686,50 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
// when we call document.createEvent(). However this can cause confusing
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
// So we preemptively throw with a better message instead.
- if (!(typeof document !== 'undefined')) {
- {
- throw 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.");
- }
- }
+ !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0;
+ var evt = document.createEvent('Event');
- var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
+ // 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;
- var didError = true; // Keeps track of the value of window.event so that we can reset it
+ // Keeps track of the value of window.event so that we can reset it
// during the callback to let user code access window.event in the
// browsers that support it.
+ var windowEvent = window.event;
- var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event
+ // Keeps track of the descriptor of window.event to restore it after event
// dispatching: https://github.com/facebook/react/issues/13688
+ var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
- var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously
+ // 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); // We check for window.hasOwnProperty('event') to prevent the
+ fakeNode.removeEventListener(evtType, callCallback, false);
+
+ // We check for window.hasOwnProperty('event') to prevent the
// window.event assignment in both IE <= 10 as they throw an error
// "Member not found" in strict mode, and in Firefox which does not
// support window.event.
-
if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
window.event = windowEvent;
}
func.apply(context, funcArgs);
didError = false;
- } // Create a global error event handler. We use this to capture the value
+ }
+
+ // 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
@@ -15207,21 +14740,17 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
// 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; // Use this to track whether the error event is ever called.
-
+ var error = void 0;
+ // Use this to track whether the error event is ever called.
var didSetError = false;
var isCrossOriginError = false;
function handleWindowError(event) {
error = event.error;
didSetError = true;
-
if (error === null && event.colno === 0 && event.lineno === 0) {
isCrossOriginError = true;
}
-
if (event.defaultPrevented) {
// Some other error handler has prevented default.
// Browsers silence the error report if this happens.
@@ -15229,19 +14758,22 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
if (error != null && typeof error === 'object') {
try {
error._suppressLogging = true;
- } catch (inner) {// Ignore.
+ } catch (inner) {
+ // Ignore.
}
}
}
- } // Create a fake event type.
+ }
+ // Create a fake event type.
+ var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
- var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers
-
+ // Attach our event handlers
window.addEventListener('error', handleWindowError);
- fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function
- // errors, it will trigger our global error handler.
+ fakeNode.addEventListener(evtType, callCallback, false);
+ // Synchronously dispatch our fake event. If the user-provided function
+ // errors, it will trigger our global error handler.
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
@@ -15256,11 +14788,10 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
} 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.');
}
-
this.onError(error);
- } // Remove our event listeners
-
+ }
+ // Remove our event listeners
window.removeEventListener('error', handleWindowError);
};
@@ -15270,17 +14801,21 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f)
var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
+// Used by Fiber to simulate a try-catch.
var hasError = false;
-var caughtError = null; // Used by event system to capture/rethrow the first error.
+var caughtError = null;
+// Used by event system to capture/rethrow the first error.
var hasRethrowError = false;
var rethrowError = null;
+
var reporter = {
onError: function (error) {
hasError = true;
caughtError = error;
}
};
+
/**
* Call a function while guarding against errors that happens within it.
* Returns an error if it throws, otherwise null.
@@ -15294,12 +14829,12 @@ var reporter = {
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
*/
-
function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
hasError = false;
caughtError = null;
invokeGuardedCallbackImpl$1.apply(reporter, arguments);
}
+
/**
* Same as invokeGuardedCallback, but instead of returning an error, it stores
* it in a global so it can be rethrown by `rethrowCaughtError` later.
@@ -15310,24 +14845,21 @@ function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
*/
-
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
invokeGuardedCallback.apply(this, arguments);
-
if (hasError) {
var error = clearCaughtError();
-
if (!hasRethrowError) {
hasRethrowError = true;
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.
*/
-
function rethrowCaughtError() {
if (hasRethrowError) {
var error = rethrowError;
@@ -15336,9 +14868,11 @@ function rethrowCaughtError() {
throw error;
}
}
+
function hasCaughtError() {
return hasError;
}
+
function clearCaughtError() {
if (hasError) {
var error = caughtError;
@@ -15346,11 +14880,172 @@ function clearCaughtError() {
caughtError = null;
return error;
} else {
- {
- {
- throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
+ invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
+ }
+}
+
+/**
+ * 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(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
+ if (plugins[pluginIndex]) {
+ continue;
+ }
+ !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
+ plugins[pluginIndex] = pluginModule;
+ var publishedEvents = pluginModule.eventTypes;
+ for (var eventName in publishedEvents) {
+ !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(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) {
+ !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
+ 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) {
+ !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
+ registrationNameModules[registrationName] = pluginModule;
+ registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
+
+ {
+ var lowerCasedName = registrationName.toLowerCase();
+ possibleRegistrationNames[lowerCasedName] = registrationName;
+
+ if (registrationName === 'onDoubleClick') {
+ possibleRegistrationNames.ondblclick = registrationName;
+ }
+ }
+}
+
+/**
+ * Registers plugins so that they can extract and dispatch events.
+ *
+ * @see {EventPluginHub}
+ */
+
+/**
+ * Ordered list of injected plugins.
+ */
+var plugins = [];
+
+/**
+ * Mapping from event name to dispatch config
+ */
+var eventNameDispatchConfigs = {};
+
+/**
+ * Mapping from registration name to plugin module
+ */
+var registrationNameModules = {};
+
+/**
+ * Mapping from registration name to event name
+ */
+var 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}
+ */
+var 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}
+ */
+function injectEventPluginOrder(injectedEventPluginOrder) {
+ !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
+ // 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}
+ */
+function injectEventPluginsByName(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(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
+ namesToPlugins[pluginName] = pluginModule;
+ isOrderingDirty = true;
+ }
+ }
+ if (isOrderingDirty) {
+ recomputePluginOrdering();
}
}
@@ -15360,37 +15055,35 @@ function clearCaughtError() {
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
+
var warningWithoutStack = function () {};
{
warningWithoutStack = function (condition, format) {
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (format === undefined) {
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
}
-
if (args.length > 8) {
// Check before the condition to catch violations early.
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
}
-
if (condition) {
return;
}
-
if (typeof console !== 'undefined') {
var argsWithFormat = args.map(function (item) {
return '' + item;
});
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
- // breaks IE9: https://github.com/facebook/react/issues/13610
+ argsWithFormat.unshift('Warning: ' + format);
+ // We intentionally don't use spread (or .apply) directly because it
+ // breaks IE9: https://github.com/facebook/react/issues/13610
Function.prototype.apply.call(console.error, console, argsWithFormat);
}
-
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
@@ -15409,76 +15102,74 @@ var warningWithoutStack$1 = warningWithoutStack;
var getFiberCurrentPropsFromNode = null;
var getInstanceFromNode = null;
var getNodeFromInstance = null;
+
function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
getInstanceFromNode = getInstanceFromNodeImpl;
getNodeFromInstance = getNodeFromInstanceImpl;
-
{
!(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
}
}
-var validateEventDispatches;
+var validateEventDispatches = void 0;
{
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;
+
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
+
/**
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {function} listener Application-level callback
* @param {*} inst Internal component instance
*/
-
-
function executeDispatch(event, listener, inst) {
var type = event.type || 'unknown-event';
event.currentTarget = getNodeFromInstance(inst);
invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
event.currentTarget = null;
}
+
/**
* Standard/simple iteration through an event's collected dispatches.
*/
-
function executeDispatchesInOrder(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.
-
-
+ }
+ // Listeners and Instances are two parallel arrays that are always in sync.
executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
}
} else if (dispatchListeners) {
executeDispatch(event, dispatchListeners, dispatchInstances);
}
-
event._dispatchListeners = null;
event._dispatchInstances = null;
}
+
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
-
/**
* 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
@@ -15509,24 +15200,19 @@ function executeDispatchesInOrder(event) {
*/
function accumulateInto(current, next) {
- if (!(next != null)) {
- {
- throw Error("accumulateInto(...): Accumulated items must not be null or undefined.");
- }
- }
+ !(next != null) ? invariant(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
+ }
+
+ // 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;
}
@@ -15560,15 +15246,14 @@ function forEachAccumulated(arr, cb, scope) {
* 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.
* @private
*/
-
var executeDispatchesAndRelease = function (event) {
if (event) {
executeDispatchesInOrder(event);
@@ -15578,37 +15263,10 @@ var executeDispatchesAndRelease = function (event) {
}
}
};
-
var executeDispatchesAndReleaseTopLevel = function (e) {
return executeDispatchesAndRelease(e);
};
-function runEventsInBatch(events) {
- if (events !== null) {
- eventQueue = accumulateInto(eventQueue, events);
- } // 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 (!processingEventQueue) {
- return;
- }
-
- forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
-
- if (!!eventQueue) {
- {
- throw Error("processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.");
- }
- } // This would be a good time to rethrow if any of the event handlers threw.
-
-
- rethrowCaughtError();
-}
-
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
@@ -15626,11 +15284,11 @@ function shouldPreventMouseEvent(name, type, props) {
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.
*
@@ -15657,8 +15315,6 @@ function shouldPreventMouseEvent(name, type, props) {
/**
* Methods for injecting dependencies.
*/
-
-
var injection = {
/**
* @param {array} InjectedEventPluginOrder
@@ -15671,44 +15327,35 @@ var injection = {
*/
injectEventPluginsByName: 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.
*/
-
function getListener(inst, registrationName) {
- var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
+ var listener = void 0;
+
+ // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
-
var stateNode = inst.stateNode;
-
if (!stateNode) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
-
var props = getFiberCurrentPropsFromNode(stateNode);
-
if (!props) {
// Work in progress.
return null;
}
-
listener = props[registrationName];
-
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
-
- if (!(!listener || typeof listener === 'function')) {
- {
- throw Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
- }
- }
-
+ !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
return listener;
}
+
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
@@ -15716,39 +15363,51 @@ function getListener(inst, registrationName) {
* @return {*} An accumulation of synthetic events.
* @internal
*/
-
-function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
+function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var events = null;
-
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, eventSystemFlags);
-
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
}
}
-
return events;
}
-function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
- var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
+function runEventsInBatch(events) {
+ if (events !== null) {
+ eventQueue = accumulateInto(eventQueue, events);
+ }
+
+ // 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 (!processingEventQueue) {
+ return;
+ }
+
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ !!eventQueue ? invariant(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.
+ rethrowCaughtError();
+}
+
+function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
runEventsInBatch(events);
}
var FunctionComponent = 0;
var ClassComponent = 1;
var IndeterminateComponent = 2; // Before we know whether it is function or class
-
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
-
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
-
var HostComponent = 5;
var HostText = 6;
var Fragment = 7;
@@ -15762,2597 +15421,312 @@ var MemoComponent = 14;
var SimpleMemoComponent = 15;
var LazyComponent = 16;
var IncompleteClassComponent = 17;
-var DehydratedFragment = 18;
-var SuspenseListComponent = 19;
-var FundamentalComponent = 20;
-var ScopeComponent = 21;
+var DehydratedSuspenseComponent = 18;
-var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
-// Current owner and dispatcher used to share the same ref,
-// but PR #14548 split them out to better support the react-debug-tools package.
+var randomKey = Math.random().toString(36).slice(2);
+var internalInstanceKey = '__reactInternalInstance$' + randomKey;
+var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
-if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
- ReactSharedInternals.ReactCurrentDispatcher = {
- current: null
- };
+function precacheFiberNode(hostInst, node) {
+ node[internalInstanceKey] = hostInst;
}
-if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
- ReactSharedInternals.ReactCurrentBatchConfig = {
- suspense: null
- };
-}
+/**
+ * Given a DOM node, return the closest ReactDOMComponent or
+ * ReactDOMTextComponent instance ancestor.
+ */
+function getClosestInstanceFromNode(node) {
+ if (node[internalInstanceKey]) {
+ return node[internalInstanceKey];
+ }
-var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
-var describeComponentFrame = function (name, source, ownerName) {
- var sourceInfo = '';
-
- if (source) {
- var path = source.fileName;
- var fileName = path.replace(BEFORE_SLASH_RE, '');
-
- {
- // In DEV, include code for a common special case:
- // prefer "folder/index.js" instead of just "index.js".
- if (/^index\./.test(fileName)) {
- var match = path.match(BEFORE_SLASH_RE);
-
- if (match) {
- var pathBeforeSlash = match[1];
-
- if (pathBeforeSlash) {
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
- fileName = folderName + '/' + fileName;
- }
- }
- }
+ while (!node[internalInstanceKey]) {
+ 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;
}
-
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
- } else if (ownerName) {
- sourceInfo = ' (created by ' + ownerName + ')';
}
- return '\n in ' + (name || 'Unknown') + sourceInfo;
-};
-
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol.for;
-var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
-var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
-var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
-var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
-var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
-var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
-var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
-// (unstable) APIs that have been removed. Can we remove the symbols?
-
-
-var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
-var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
-var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
-var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
-var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
-var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
-var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
-var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
-var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
-var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
-var FAUX_ITERATOR_SYMBOL = '@@iterator';
-function getIteratorFn(maybeIterable) {
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
- return null;
- }
-
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
-
- if (typeof maybeIterator === 'function') {
- return maybeIterator;
+ var inst = node[internalInstanceKey];
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ // In Fiber, this will always be the deepest root.
+ return inst;
}
return null;
}
/**
- * 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.
+ * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
+ * instance, or null if the node was not rendered by this React.
*/
-
-var warning = warningWithoutStack$1;
-
-{
- warning = function (condition, format) {
- if (condition) {
- return;
- }
-
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
- var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
-
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
- args[_key - 2] = arguments[_key];
- }
-
- warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
- };
-}
-
-var warning$1 = warning;
-
-var Uninitialized = -1;
-var Pending = 0;
-var Resolved = 1;
-var Rejected = 2;
-function refineResolvedLazyComponent(lazyComponent) {
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
-}
-function initializeLazyComponentType(lazyComponent) {
- if (lazyComponent._status === Uninitialized) {
- lazyComponent._status = Pending;
- var ctor = lazyComponent._ctor;
- var thenable = ctor();
- lazyComponent._result = thenable;
- thenable.then(function (moduleObject) {
- if (lazyComponent._status === Pending) {
- var defaultExport = moduleObject.default;
-
- {
- if (defaultExport === undefined) {
- warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
- }
- }
-
- lazyComponent._status = Resolved;
- lazyComponent._result = defaultExport;
- }
- }, function (error) {
- if (lazyComponent._status === Pending) {
- lazyComponent._status = Rejected;
- lazyComponent._result = error;
- }
- });
- }
-}
-
-function getWrappedName(outerType, innerType, wrapperName) {
- var functionName = innerType.displayName || innerType.name || '';
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
-}
-
-function getComponentName(type) {
- if (type == null) {
- // Host root, text node or just invalid type.
- return null;
- }
-
- {
- if (typeof type.tag === 'number') {
- warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
+function getInstanceFromNode$1(node) {
+ var inst = node[internalInstanceKey];
+ if (inst) {
+ if (inst.tag === HostComponent || inst.tag === HostText) {
+ return inst;
+ } else {
+ return null;
}
}
-
- if (typeof type === 'function') {
- return type.displayName || type.name || null;
- }
-
- if (typeof type === 'string') {
- return type;
- }
-
- switch (type) {
- case REACT_FRAGMENT_TYPE:
- return 'Fragment';
-
- case REACT_PORTAL_TYPE:
- return 'Portal';
-
- case REACT_PROFILER_TYPE:
- return "Profiler";
-
- case REACT_STRICT_MODE_TYPE:
- return 'StrictMode';
-
- case REACT_SUSPENSE_TYPE:
- return 'Suspense';
-
- case REACT_SUSPENSE_LIST_TYPE:
- return 'SuspenseList';
- }
-
- if (typeof type === 'object') {
- switch (type.$$typeof) {
- case REACT_CONTEXT_TYPE:
- return 'Context.Consumer';
-
- case REACT_PROVIDER_TYPE:
- return 'Context.Provider';
-
- case REACT_FORWARD_REF_TYPE:
- return getWrappedName(type, type.render, 'ForwardRef');
-
- case REACT_MEMO_TYPE:
- return getComponentName(type.type);
-
- case REACT_LAZY_TYPE:
- {
- var thenable = type;
- var resolvedThenable = refineResolvedLazyComponent(thenable);
-
- if (resolvedThenable) {
- return getComponentName(resolvedThenable);
- }
-
- break;
- }
- }
- }
-
return null;
}
-var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
-
-function describeFiber(fiber) {
- switch (fiber.tag) {
- case HostRoot:
- case HostPortal:
- case HostText:
- case Fragment:
- case ContextProvider:
- case ContextConsumer:
- return '';
-
- default:
- var owner = fiber._debugOwner;
- var source = fiber._debugSource;
- var name = getComponentName(fiber.type);
- var ownerName = null;
-
- if (owner) {
- ownerName = getComponentName(owner.type);
- }
-
- return describeComponentFrame(name, source, ownerName);
+/**
+ * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
+ * DOM node.
+ */
+function getNodeFromInstance$1(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.
+ invariant(false, 'getNodeFromInstance: Invalid argument.');
}
-function getStackByFiberInDevAndProd(workInProgress) {
- var info = '';
- var node = workInProgress;
+function getFiberCurrentPropsFromNode$1(node) {
+ return node[internalEventHandlersKey] || null;
+}
+function updateFiberProps(node, props) {
+ node[internalEventHandlersKey] = props;
+}
+
+function getParent(inst) {
do {
- info += describeFiber(node);
- node = node.return;
- } while (node);
-
- return info;
-}
-var current = null;
-var phase = null;
-function getCurrentFiberOwnerNameInDevOrNull() {
- {
- if (current === null) {
- return null;
- }
-
- var owner = current._debugOwner;
-
- if (owner !== null && typeof owner !== 'undefined') {
- return getComponentName(owner.type);
- }
+ inst = inst.return;
+ // TODO: If this is a HostRoot we might want to bail out.
+ // That is depending on if we want nested subtrees (layers) to bubble
+ // events to their parent. We could also go through parentNode on the
+ // host node but that wouldn't work for React Native and doesn't let us
+ // do the portal feature.
+ } while (inst && inst.tag !== HostComponent);
+ if (inst) {
+ return inst;
}
-
return null;
}
-function getCurrentFiberStackInDev() {
+
+/**
+ * Return the lowest common ancestor of A and B, or null if they are in
+ * different trees.
+ */
+function getLowestCommonAncestor(instA, instB) {
+ var depthA = 0;
+ for (var tempA = instA; tempA; tempA = getParent(tempA)) {
+ depthA++;
+ }
+ var depthB = 0;
+ for (var tempB = instB; tempB; tempB = getParent(tempB)) {
+ depthB++;
+ }
+
+ // If A is deeper, crawl up.
+ while (depthA - depthB > 0) {
+ instA = getParent(instA);
+ depthA--;
+ }
+
+ // If B is deeper, crawl up.
+ while (depthB - depthA > 0) {
+ instB = getParent(instB);
+ depthB--;
+ }
+
+ // Walk in lockstep until we find a match.
+ var depth = depthA;
+ while (depth--) {
+ if (instA === instB || instA === instB.alternate) {
+ return instA;
+ }
+ instA = getParent(instA);
+ instB = getParent(instB);
+ }
+ return null;
+}
+
+/**
+ * Return if A is an ancestor of B.
+ */
+
+
+/**
+ * Return the parent instance of the passed-in instance.
+ */
+
+
+/**
+ * Simulates the traversal of a two-phase, capture/bubble event dispatch.
+ */
+function traverseTwoPhase(inst, fn, arg) {
+ var path = [];
+ while (inst) {
+ path.push(inst);
+ inst = getParent(inst);
+ }
+ var i = void 0;
+ for (i = path.length; i-- > 0;) {
+ fn(path[i], 'captured', arg);
+ }
+ for (i = 0; i < path.length; i++) {
+ fn(path[i], 'bubbled', arg);
+ }
+}
+
+/**
+ * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
+ * should would receive a `mouseEnter` or `mouseLeave` event.
+ *
+ * Does not invoke the callback on the nearest common ancestor because nothing
+ * "entered" or "left" that element.
+ */
+function traverseEnterLeave(from, to, fn, argFrom, argTo) {
+ var common = from && to ? getLowestCommonAncestor(from, to) : null;
+ var pathFrom = [];
+ while (true) {
+ if (!from) {
+ break;
+ }
+ if (from === common) {
+ break;
+ }
+ var alternate = from.alternate;
+ if (alternate !== null && alternate === common) {
+ break;
+ }
+ pathFrom.push(from);
+ from = getParent(from);
+ }
+ var pathTo = [];
+ while (true) {
+ if (!to) {
+ break;
+ }
+ if (to === common) {
+ break;
+ }
+ var _alternate = to.alternate;
+ if (_alternate !== null && _alternate === common) {
+ break;
+ }
+ pathTo.push(to);
+ to = getParent(to);
+ }
+ for (var i = 0; i < pathFrom.length; i++) {
+ fn(pathFrom[i], 'bubbled', argFrom);
+ }
+ for (var _i = pathTo.length; _i-- > 0;) {
+ fn(pathTo[_i], 'captured', argTo);
+ }
+}
+
+/**
+ * Some event types have a notion of different registration names for different
+ * "phases" of propagation. This finds listeners by a given phase.
+ */
+function listenerAtPhase(inst, event, propagationPhase) {
+ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
+ return getListener(inst, registrationName);
+}
+
+/**
+ * A small set of propagation patterns, each of which will accept a small amount
+ * of information, and generate a set of "dispatch ready event objects" - which
+ * are sets of events that have already been annotated with a set of dispatched
+ * listener functions/ids. The API is designed this way to discourage these
+ * propagation strategies from actually executing the dispatches, since we
+ * always want to collect the entire set of dispatches before executing even a
+ * single one.
+ */
+
+/**
+ * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
+ * here, allows us to not have to bind or create functions for each event.
+ * Mutating the event's members allows us to not have to create a wrapping
+ * "dispatch" object that pairs the event with the listener.
+ */
+function accumulateDirectionalDispatches(inst, phase, event) {
{
- if (current === null) {
- return '';
- } // Safe because if current fiber exists, we are reconciling,
- // and it is guaranteed to be the work-in-progress version.
-
-
- return getStackByFiberInDevAndProd(current);
+ !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
}
-
- return '';
-}
-function resetCurrentFiber() {
- {
- ReactDebugCurrentFrame.getCurrentStack = null;
- current = null;
- phase = null;
+ var listener = listenerAtPhase(inst, event, phase);
+ if (listener) {
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
+ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
}
}
-function setCurrentFiber(fiber) {
- {
- ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
- current = fiber;
- phase = null;
- }
-}
-function setCurrentPhase(lifeCyclePhase) {
- {
- phase = lifeCyclePhase;
- }
-}
-
-var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
-
-function endsWith(subject, search) {
- var length = subject.length;
- return subject.substring(length - search.length, length) === search;
-}
-
-var PLUGIN_EVENT_SYSTEM = 1;
-var RESPONDER_EVENT_SYSTEM = 1 << 1;
-var IS_PASSIVE = 1 << 2;
-var IS_ACTIVE = 1 << 3;
-var PASSIVE_NOT_SUPPORTED = 1 << 4;
-var IS_REPLAYED = 1 << 5;
-
-var restoreImpl = null;
-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 = getInstanceFromNode(target);
-
- if (!internalInstance) {
- // Unmounted
- return;
- }
-
- if (!(typeof restoreImpl === 'function')) {
- {
- throw 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.");
- }
- }
-
- var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
- restoreImpl(internalInstance.stateNode, internalInstance.type, props);
-}
-
-function setRestoreImplementation(impl) {
- restoreImpl = impl;
-}
-function enqueueStateRestore(target) {
- if (restoreTarget) {
- if (restoreQueue) {
- restoreQueue.push(target);
- } else {
- restoreQueue = [target];
- }
- } else {
- restoreTarget = target;
- }
-}
-function needsStateRestore() {
- return restoreTarget !== null || restoreQueue !== null;
-}
-function restoreStateIfNeeded() {
- 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 enableUserTimingAPI = true; // Helps identify side effects in render-phase lifecycle hooks and setState
-// reducers by double invoking them in Strict Mode.
-
-var debugRenderPhaseSideEffectsForStrictMode = true; // To preserve the "Pause on caught exceptions" behavior of the debugger, we
-// replay the begin phase of a failed component inside invokeGuardedCallback.
-
-var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
-
-var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for Profiler subtrees.
-
-var enableProfilerTimer = true; // Trace which interactions trigger each commit.
-
-var enableSchedulerTracing = true; // SSR experiments
-
-var enableSuspenseServerRenderer = false;
-var enableSelectiveHydration = false; // Only used in www builds.
-
- // Only used in www builds.
-
- // Disable javascript: URL strings in href for XSS protection.
-
-var disableJavaScriptURLs = false; // React Fire: prevent the value and checked attributes from syncing
-// with their related DOM properties
-
-var disableInputAttributeSyncing = false; // These APIs will no longer be "unstable" in the upcoming 16.7 release,
-// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
-
-var exposeConcurrentModeAPIs = false;
-var warnAboutShorthandPropertyCollision = false; // Experimental React Flare event system and event components support.
-
-var enableFlareAPI = false; // Experimental Host Component support.
-
-var enableFundamentalAPI = false; // Experimental Scope support.
-
-var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
-
- // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
-// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
-
-var warnAboutUnmockedScheduler = false; // For tests, we flush suspense fallbacks in an act scope;
-// *except* in some of our own tests, where we test incremental loading states.
-
-var flushSuspenseFallbacksInTests = true; // Add a callback property to suspense to notify which promises are currently
-// in the update queue. This allows reporting and tracing of what is causing
-// the user to see a loading state.
-// Also allows hydration callbacks to fire when a dehydrated boundary gets
-// hydrated or deleted.
-
-var enableSuspenseCallback = false; // Part of the simplification of React.createElement so we can eventually move
-// from React.createElement to React.jsx
-// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
-
-var warnAboutDefaultPropsOnFunctionComponents = false;
-var warnAboutStringRefs = false;
-var disableLegacyContext = false;
-var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
-var enableTrustedTypesIntegration = false; // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
-
-// the renderer. 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 batchedUpdatesImpl = function (fn, bookkeeping) {
- return fn(bookkeeping);
-};
-
-var discreteUpdatesImpl = function (fn, a, b, c) {
- return fn(a, b, c);
-};
-
-var flushDiscreteUpdatesImpl = function () {};
-
-var batchedEventUpdatesImpl = batchedUpdatesImpl;
-var isInsideEventHandler = false;
-var isBatchingEventUpdates = false;
-
-function finishEventHandler() {
- // 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.
- var controlledComponentsHavePendingUpdates = needsStateRestore();
-
- if (controlledComponentsHavePendingUpdates) {
- // If a controlled event was fired, we may need to restore the state of
- // the DOM node back to the controlled value. This is necessary when React
- // bails out of the update without touching the DOM.
- flushDiscreteUpdatesImpl();
- restoreStateIfNeeded();
- }
-}
-
-function batchedUpdates(fn, bookkeeping) {
- if (isInsideEventHandler) {
- // If we are currently inside another batch, we need to wait until it
- // fully completes before restoring state.
- return fn(bookkeeping);
- }
-
- isInsideEventHandler = true;
-
- try {
- return batchedUpdatesImpl(fn, bookkeeping);
- } finally {
- isInsideEventHandler = false;
- finishEventHandler();
- }
-}
-function batchedEventUpdates(fn, a, b) {
- if (isBatchingEventUpdates) {
- // If we are currently inside another batch, we need to wait until it
- // fully completes before restoring state.
- return fn(a, b);
- }
-
- isBatchingEventUpdates = true;
-
- try {
- return batchedEventUpdatesImpl(fn, a, b);
- } finally {
- isBatchingEventUpdates = false;
- finishEventHandler();
- }
-} // This is for the React Flare event system
-
-function executeUserEventHandler(fn, value) {
- var previouslyInEventHandler = isInsideEventHandler;
-
- try {
- isInsideEventHandler = true;
- var type = typeof value === 'object' && value !== null ? value.type : '';
- invokeGuardedCallbackAndCatchFirstError(type, fn, undefined, value);
- } finally {
- isInsideEventHandler = previouslyInEventHandler;
- }
-}
-function discreteUpdates(fn, a, b, c) {
- var prevIsInsideEventHandler = isInsideEventHandler;
- isInsideEventHandler = true;
-
- try {
- return discreteUpdatesImpl(fn, a, b, c);
- } finally {
- isInsideEventHandler = prevIsInsideEventHandler;
-
- if (!isInsideEventHandler) {
- finishEventHandler();
- }
- }
-}
-var lastFlushedEventTimeStamp = 0;
-function flushDiscreteUpdatesIfNeeded(timeStamp) {
- // event.timeStamp isn't overly reliable due to inconsistencies in
- // how different browsers have historically provided the time stamp.
- // Some browsers provide high-resolution time stamps for all events,
- // some provide low-resolution time stamps for all events. FF < 52
- // even mixes both time stamps together. Some browsers even report
- // negative time stamps or time stamps that are 0 (iOS9) in some cases.
- // Given we are only comparing two time stamps with equality (!==),
- // we are safe from the resolution differences. If the time stamp is 0
- // we bail-out of preventing the flush, which can affect semantics,
- // such as if an earlier flush removes or adds event listeners that
- // are fired in the subsequent flush. However, this is the same
- // behaviour as we had before this change, so the risks are low.
- if (!isInsideEventHandler && (!enableFlareAPI || timeStamp === 0 || lastFlushedEventTimeStamp !== timeStamp)) {
- lastFlushedEventTimeStamp = timeStamp;
- flushDiscreteUpdatesImpl();
- }
-}
-function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
- batchedUpdatesImpl = _batchedUpdatesImpl;
- discreteUpdatesImpl = _discreteUpdatesImpl;
- flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
- batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
-}
-
-var DiscreteEvent = 0;
-var UserBlockingEvent = 1;
-var ContinuousEvent = 2;
-
-// CommonJS interop named imports.
-
-var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
-var runWithPriority = Scheduler.unstable_runWithPriority;
-var listenToResponderEventTypesImpl;
-function setListenToResponderEventTypes(_listenToResponderEventTypesImpl) {
- listenToResponderEventTypesImpl = _listenToResponderEventTypesImpl;
-}
-var rootEventTypesToEventResponderInstances = new Map();
-var DoNotPropagateToNextResponder = 0;
-var PropagateToNextResponder = 1;
-var currentTimeStamp = 0;
-var currentInstance = null;
-var currentDocument = null;
-var currentPropagationBehavior = DoNotPropagateToNextResponder;
-var eventResponderContext = {
- dispatchEvent: function (eventValue, eventListener, eventPriority) {
- validateResponderContext();
- validateEventValue(eventValue);
-
- switch (eventPriority) {
- case DiscreteEvent:
- {
- flushDiscreteUpdatesIfNeeded(currentTimeStamp);
- discreteUpdates(function () {
- return executeUserEventHandler(eventListener, eventValue);
- });
- break;
- }
-
- case UserBlockingEvent:
- {
- runWithPriority(UserBlockingPriority, function () {
- return executeUserEventHandler(eventListener, eventValue);
- });
- break;
- }
-
- case ContinuousEvent:
- {
- executeUserEventHandler(eventListener, eventValue);
- break;
- }
- }
- },
- isTargetWithinResponder: function (target) {
- validateResponderContext();
-
- if (target != null) {
- var fiber = getClosestInstanceFromNode(target);
- var responderFiber = currentInstance.fiber;
-
- while (fiber !== null) {
- if (fiber === responderFiber || fiber.alternate === responderFiber) {
- return true;
- }
-
- fiber = fiber.return;
- }
- }
-
- return false;
- },
- isTargetWithinResponderScope: function (target) {
- validateResponderContext();
- var componentInstance = currentInstance;
- var responder = componentInstance.responder;
-
- if (target != null) {
- var fiber = getClosestInstanceFromNode(target);
- var responderFiber = currentInstance.fiber;
-
- while (fiber !== null) {
- if (fiber === responderFiber || fiber.alternate === responderFiber) {
- return true;
- }
-
- if (doesFiberHaveResponder(fiber, responder)) {
- return false;
- }
-
- fiber = fiber.return;
- }
- }
-
- return false;
- },
- isTargetWithinNode: function (childTarget, parentTarget) {
- validateResponderContext();
- var childFiber = getClosestInstanceFromNode(childTarget);
- var parentFiber = getClosestInstanceFromNode(parentTarget);
-
- if (childFiber != null && parentFiber != null) {
- var parentAlternateFiber = parentFiber.alternate;
- var node = childFiber;
-
- while (node !== null) {
- if (node === parentFiber || node === parentAlternateFiber) {
- return true;
- }
-
- node = node.return;
- }
-
- return false;
- } // Fallback to DOM APIs
-
-
- return parentTarget.contains(childTarget);
- },
- addRootEventTypes: function (rootEventTypes) {
- validateResponderContext();
- listenToResponderEventTypesImpl(rootEventTypes, currentDocument);
-
- for (var i = 0; i < rootEventTypes.length; i++) {
- var rootEventType = rootEventTypes[i];
- var eventResponderInstance = currentInstance;
- registerRootEventType(rootEventType, eventResponderInstance);
- }
- },
- removeRootEventTypes: function (rootEventTypes) {
- validateResponderContext();
-
- for (var i = 0; i < rootEventTypes.length; i++) {
- var rootEventType = rootEventTypes[i];
- var rootEventResponders = rootEventTypesToEventResponderInstances.get(rootEventType);
- var rootEventTypesSet = currentInstance.rootEventTypes;
-
- if (rootEventTypesSet !== null) {
- rootEventTypesSet.delete(rootEventType);
- }
-
- if (rootEventResponders !== undefined) {
- rootEventResponders.delete(currentInstance);
- }
- }
- },
- getActiveDocument: getActiveDocument,
- objectAssign: _assign,
- getTimeStamp: function () {
- validateResponderContext();
- return currentTimeStamp;
- },
- isTargetWithinHostComponent: function (target, elementType) {
- validateResponderContext();
- var fiber = getClosestInstanceFromNode(target);
-
- while (fiber !== null) {
- if (fiber.tag === HostComponent && fiber.type === elementType) {
- return true;
- }
-
- fiber = fiber.return;
- }
-
- return false;
- },
- continuePropagation: function () {
- currentPropagationBehavior = PropagateToNextResponder;
- },
- enqueueStateRestore: enqueueStateRestore,
- getResponderNode: function () {
- validateResponderContext();
- var responderFiber = currentInstance.fiber;
-
- if (responderFiber.tag === ScopeComponent) {
- return null;
- }
-
- return responderFiber.stateNode;
- }
-};
-
-function validateEventValue(eventValue) {
- if (typeof eventValue === 'object' && eventValue !== null) {
- var target = eventValue.target,
- type = eventValue.type,
- timeStamp = eventValue.timeStamp;
-
- if (target == null || type == null || timeStamp == null) {
- throw new Error('context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.');
- }
-
- var showWarning = function (name) {
- {
- 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);
- }
- };
-
- eventValue.isDefaultPrevented = function () {
- {
- showWarning('isDefaultPrevented()');
- }
- };
-
- eventValue.isPropagationStopped = function () {
- {
- showWarning('isPropagationStopped()');
- }
- }; // $FlowFixMe: we don't need value, Flow thinks we do
-
-
- Object.defineProperty(eventValue, 'nativeEvent', {
- get: function () {
- {
- showWarning('nativeEvent');
- }
- }
- });
- }
-}
-
-function doesFiberHaveResponder(fiber, responder) {
- var tag = fiber.tag;
-
- if (tag === HostComponent || tag === ScopeComponent) {
- var dependencies = fiber.dependencies;
-
- if (dependencies !== null) {
- var respondersMap = dependencies.responders;
-
- if (respondersMap !== null && respondersMap.has(responder)) {
- return true;
- }
- }
- }
-
- return false;
-}
-
-function getActiveDocument() {
- return currentDocument;
-}
-
-function createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, passive, passiveSupported) {
- var _ref = nativeEvent,
- buttons = _ref.buttons,
- pointerType = _ref.pointerType;
- var eventPointerType = '';
-
- if (pointerType !== undefined) {
- eventPointerType = pointerType;
- } else if (nativeEvent.key !== undefined) {
- eventPointerType = 'keyboard';
- } else if (buttons !== undefined) {
- eventPointerType = 'mouse';
- } else if (nativeEvent.changedTouches !== undefined) {
- eventPointerType = 'touch';
- }
-
- return {
- nativeEvent: nativeEvent,
- passive: passive,
- passiveSupported: passiveSupported,
- pointerType: eventPointerType,
- target: nativeEventTarget,
- type: topLevelType
- };
-}
-
-function responderEventTypesContainType(eventTypes, type) {
- for (var i = 0, len = eventTypes.length; i < len; i++) {
- if (eventTypes[i] === type) {
- return true;
- }
- }
-
- return false;
-}
-
-function validateResponderTargetEventTypes(eventType, responder) {
- var targetEventTypes = responder.targetEventTypes; // Validate the target event type exists on the responder
-
- if (targetEventTypes !== null) {
- return responderEventTypesContainType(targetEventTypes, eventType);
- }
-
- return false;
-}
-
-function traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
- var isPassiveEvent = (eventSystemFlags & IS_PASSIVE) !== 0;
- var isPassiveSupported = (eventSystemFlags & PASSIVE_NOT_SUPPORTED) === 0;
- var isPassive = isPassiveEvent || !isPassiveSupported;
- var eventType = isPassive ? topLevelType : topLevelType + '_active'; // Trigger event responders in this order:
- // - Bubble target responder phase
- // - Root responder phase
-
- var visitedResponders = new Set();
- var responderEvent = createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, isPassiveEvent, isPassiveSupported);
- var node = targetFiber;
- var insidePortal = false;
-
- while (node !== null) {
- var _node = node,
- dependencies = _node.dependencies,
- tag = _node.tag;
-
- if (tag === HostPortal) {
- insidePortal = true;
- } else if ((tag === HostComponent || tag === ScopeComponent) && dependencies !== null) {
- var respondersMap = dependencies.responders;
-
- if (respondersMap !== null) {
- var responderInstances = Array.from(respondersMap.values());
-
- for (var i = 0, length = responderInstances.length; i < length; i++) {
- var responderInstance = responderInstances[i];
- var props = responderInstance.props,
- responder = responderInstance.responder,
- state = responderInstance.state;
-
- if (!visitedResponders.has(responder) && validateResponderTargetEventTypes(eventType, responder) && (!insidePortal || responder.targetPortalPropagation)) {
- visitedResponders.add(responder);
- var onEvent = responder.onEvent;
-
- if (onEvent !== null) {
- currentInstance = responderInstance;
- onEvent(responderEvent, eventResponderContext, props, state);
-
- if (currentPropagationBehavior === PropagateToNextResponder) {
- visitedResponders.delete(responder);
- currentPropagationBehavior = DoNotPropagateToNextResponder;
- }
- }
- }
- }
- }
- }
-
- node = node.return;
- } // Root phase
-
-
- var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(eventType);
-
- if (rootEventResponderInstances !== undefined) {
- var _responderInstances = Array.from(rootEventResponderInstances);
-
- for (var _i = 0; _i < _responderInstances.length; _i++) {
- var _responderInstance = _responderInstances[_i];
- var props = _responderInstance.props,
- responder = _responderInstance.responder,
- state = _responderInstance.state;
- var onRootEvent = responder.onRootEvent;
-
- if (onRootEvent !== null) {
- currentInstance = _responderInstance;
- onRootEvent(responderEvent, eventResponderContext, props, state);
- }
- }
- }
-}
-
-function mountEventResponder(responder, responderInstance, props, state) {
- var onMount = responder.onMount;
-
- if (onMount !== null) {
- var previousInstance = currentInstance;
- currentInstance = responderInstance;
-
- try {
- batchedEventUpdates(function () {
- onMount(eventResponderContext, props, state);
- });
- } finally {
- currentInstance = previousInstance;
- }
- }
-}
-function unmountEventResponder(responderInstance) {
- var responder = responderInstance.responder;
- var onUnmount = responder.onUnmount;
-
- if (onUnmount !== null) {
- var props = responderInstance.props,
- state = responderInstance.state;
- var previousInstance = currentInstance;
- currentInstance = responderInstance;
-
- try {
- batchedEventUpdates(function () {
- onUnmount(eventResponderContext, props, state);
- });
- } finally {
- currentInstance = previousInstance;
- }
- }
-
- var rootEventTypesSet = responderInstance.rootEventTypes;
-
- if (rootEventTypesSet !== null) {
- var rootEventTypes = Array.from(rootEventTypesSet);
-
- for (var i = 0; i < rootEventTypes.length; i++) {
- var topLevelEventType = rootEventTypes[i];
- var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(topLevelEventType);
-
- if (rootEventResponderInstances !== undefined) {
- rootEventResponderInstances.delete(responderInstance);
- }
- }
- }
-}
-
-function validateResponderContext() {
- if (!(currentInstance !== null)) {
- {
- throw Error("An event responder context was used outside of an event cycle.");
- }
- }
-}
-
-function dispatchEventForResponderEventSystem(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
- if (enableFlareAPI) {
- var previousInstance = currentInstance;
- var previousTimeStamp = currentTimeStamp;
- var previousDocument = currentDocument;
- var previousPropagationBehavior = currentPropagationBehavior;
- currentPropagationBehavior = DoNotPropagateToNextResponder; // nodeType 9 is DOCUMENT_NODE
-
- currentDocument = nativeEventTarget.nodeType === 9 ? nativeEventTarget : nativeEventTarget.ownerDocument; // We might want to control timeStamp another way here
-
- currentTimeStamp = nativeEvent.timeStamp;
-
- try {
- batchedEventUpdates(function () {
- traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags);
- });
- } finally {
- currentInstance = previousInstance;
- currentTimeStamp = previousTimeStamp;
- currentDocument = previousDocument;
- currentPropagationBehavior = previousPropagationBehavior;
- }
- }
-}
-function addRootEventTypesForResponderInstance(responderInstance, rootEventTypes) {
- for (var i = 0; i < rootEventTypes.length; i++) {
- var rootEventType = rootEventTypes[i];
- registerRootEventType(rootEventType, responderInstance);
- }
-}
-
-function registerRootEventType(rootEventType, eventResponderInstance) {
- var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(rootEventType);
-
- if (rootEventResponderInstances === undefined) {
- rootEventResponderInstances = new Set();
- rootEventTypesToEventResponderInstances.set(rootEventType, rootEventResponderInstances);
- }
-
- var rootEventTypesSet = eventResponderInstance.rootEventTypes;
-
- if (rootEventTypesSet === null) {
- rootEventTypesSet = eventResponderInstance.rootEventTypes = new Set();
- }
-
- if (!!rootEventTypesSet.has(rootEventType)) {
- {
- throw 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.");
- }
- }
-
- rootEventTypesSet.add(rootEventType);
- rootEventResponderInstances.add(eventResponderInstance);
-}
-
-// A reserved attribute.
-// It is handled by React separately and shouldn't be written to the DOM.
-var RESERVED = 0; // A simple string attribute.
-// Attributes that aren't in the whitelist are presumed to have this type.
-
-var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
-// "enumerated" attributes with "true" and "false" as possible values.
-// When true, it should be set to a "true" string.
-// When false, it should be set to a "false" string.
-
-var BOOLEANISH_STRING = 2; // A real boolean attribute.
-// When true, it should be present (set either to an empty string or its name).
-// When false, it should be omitted.
-
-var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
-// When true, it should be present (set either to an empty string or its name).
-// When false, it should be omitted.
-// For any other value, should be present with that value.
-
-var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
-// When falsy, it should be removed.
-
-var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
-// When falsy, it should be removed.
-
-var POSITIVE_NUMERIC = 6;
-
-/* 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 */
-
-var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
-
-var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-var illegalAttributeNameCache = {};
-var validatedAttributeNameCache = {};
-function isAttributeNameSafe(attributeName) {
- if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
- return true;
- }
-
- if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
- return false;
- }
-
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
- validatedAttributeNameCache[attributeName] = true;
- return true;
- }
-
- illegalAttributeNameCache[attributeName] = true;
-
- {
- warning$1(false, 'Invalid attribute name: `%s`', attributeName);
- }
-
- return false;
-}
-function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
- if (propertyInfo !== null) {
- return propertyInfo.type === RESERVED;
- }
-
- if (isCustomComponentTag) {
- return false;
- }
-
- if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
- return true;
- }
-
- return false;
-}
-function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
- if (propertyInfo !== null && propertyInfo.type === RESERVED) {
- return false;
- }
-
- switch (typeof value) {
- case 'function': // $FlowIssue symbol is perfectly valid here
-
- case 'symbol':
- // eslint-disable-line
- return true;
-
- case 'boolean':
- {
- if (isCustomComponentTag) {
- return false;
- }
-
- if (propertyInfo !== null) {
- return !propertyInfo.acceptsBooleans;
- } else {
- var prefix = name.toLowerCase().slice(0, 5);
- return prefix !== 'data-' && prefix !== 'aria-';
- }
- }
-
- default:
- return false;
- }
-}
-function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
- if (value === null || typeof value === 'undefined') {
- return true;
- }
-
- if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
- return true;
- }
-
- if (isCustomComponentTag) {
- return false;
- }
-
- if (propertyInfo !== null) {
- switch (propertyInfo.type) {
- case BOOLEAN:
- return !value;
-
- case OVERLOADED_BOOLEAN:
- return value === false;
-
- case NUMERIC:
- return isNaN(value);
-
- case POSITIVE_NUMERIC:
- return isNaN(value) || value < 1;
- }
- }
-
- return false;
-}
-function getPropertyInfo(name) {
- return properties.hasOwnProperty(name) ? properties[name] : null;
-}
-
-function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
- this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
- this.attributeName = attributeName;
- this.attributeNamespace = attributeNamespace;
- this.mustUseProperty = mustUseProperty;
- this.propertyName = name;
- this.type = type;
- this.sanitizeURL = sanitizeURL;
-} // When adding attributes to this list, be sure to also add them to
-// the `possibleStandardNames` module to ensure casing and incorrect
-// name warnings.
-
-
-var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
-
-['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
-// elements (not just inputs). Now that ReactDOMInput assigns to the
-// defaultValue property -- do we need this?
-'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // A few React string attributes have a different name.
-// This is a mapping from React prop names to the attribute names.
-
-[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
- var name = _ref[0],
- attributeName = _ref[1];
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, // attributeName
- null, // attributeNamespace
- false);
-}); // These are "enumerated" HTML attributes that accept "true" and "false".
-// In React, we let users pass `true` and `false` even though technically
-// these aren't boolean attributes (they are coerced to strings).
-
-['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
- name.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-}); // These are "enumerated" SVG attributes that accept "true" and "false".
-// In React, we let users pass `true` and `false` even though technically
-// these aren't boolean attributes (they are coerced to strings).
-// Since these are SVG attributes, their attribute names are case-sensitive.
-
-['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML boolean attributes.
-
-['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
-// on the client side because the browsers are inconsistent. Instead we call focus().
-'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
-'itemScope'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
- name.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-}); // These are the few React props that we set as DOM properties
-// rather than attributes. These are all booleans.
-
-['checked', // Note: `option.selected` is not updated if `select.multiple` is
-// disabled with `removeAttribute`. We have special logic for handling this.
-'multiple', 'muted', 'selected'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML attributes that are "overloaded booleans": they behave like
-// booleans, but can also accept a string value.
-
-['capture', 'download'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML attributes that must be positive numbers.
-
-['cols', 'rows', 'size', 'span'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML attributes that must be numbers.
-
-['rowSpan', 'start'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
- name.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-});
-var CAMELIZE = /[\-\:]([a-z])/g;
-
-var capitalize = function (token) {
- return token[1].toUpperCase();
-}; // This is a list of all SVG attributes that need special casing, namespacing,
-// or boolean value assignment. Regular attributes that just accept strings
-// and have the same names are omitted, just like in the HTML whitelist.
-// Some of these attributes can be hard to find. This list was created by
-// scrapping the MDN documentation.
-
-
-['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) {
- var name = attributeName.replace(CAMELIZE, capitalize);
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, null, // attributeNamespace
- false);
-}); // String SVG attributes with the xlink namespace.
-
-['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
- var name = attributeName.replace(CAMELIZE, capitalize);
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, 'http://www.w3.org/1999/xlink', false);
-}); // String SVG attributes with the xml namespace.
-
-['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
- var name = attributeName.replace(CAMELIZE, capitalize);
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, 'http://www.w3.org/XML/1998/namespace', false);
-}); // These attribute exists both in HTML and SVG.
-// The attribute name is case-sensitive in SVG so we can't just use
-// the React name like we do for attributes that exist only in HTML.
-
-['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
- attributeName.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-}); // These attributes accept URLs. These must not allow javascript: URLS.
-// These will also need to accept Trusted Types object in the future.
-
-var xlinkHref = 'xlinkHref';
-properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
-'xlink:href', 'http://www.w3.org/1999/xlink', true);
-['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
- attributeName.toLowerCase(), // attributeName
- null, // attributeNamespace
- true);
-});
-
-var ReactDebugCurrentFrame$1 = null;
-
-{
- ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
-} // A javascript: URL can contain leading C0 control or \u0020 SPACE,
-// and any newline or tab are filtered out as if they're not part of the URL.
-// https://url.spec.whatwg.org/#url-parsing
-// Tab or newline are defined as \r\n\t:
-// https://infra.spec.whatwg.org/#ascii-tab-or-newline
-// A C0 control is a code point in the range \u0000 NULL to \u001F
-// INFORMATION SEPARATOR ONE, inclusive:
-// https://infra.spec.whatwg.org/#c0-control-or-space
-
-/* eslint-disable max-len */
-
-
-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;
-var didWarn = false;
-
-function sanitizeURL(url) {
- if (disableJavaScriptURLs) {
- if (!!isJavaScriptProtocol.test(url)) {
- {
- throw Error("React has blocked a javascript: URL as a security precaution." + (ReactDebugCurrentFrame$1.getStackAddendum()));
- }
- }
- } else if ( true && !didWarn && isJavaScriptProtocol.test(url)) {
- didWarn = true;
- 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));
- }
-}
-
-// Flow does not allow string concatenation of most non-string types. To work
-// around this limitation, we use an opaque type that can only be obtained by
-// passing the value through getToStringValue first.
-function toString(value) {
- return '' + value;
-}
-function getToStringValue(value) {
- switch (typeof value) {
- case 'boolean':
- case 'number':
- case 'object':
- case 'string':
- case 'undefined':
- return value;
-
- default:
- // function, symbol are assigned as empty strings
- return '';
- }
-}
-/** Trusted value is a wrapper for "safe" values which can be assigned to DOM execution sinks. */
-
-/**
- * We allow passing objects with toString method as element attributes or in dangerouslySetInnerHTML
- * and we do validations that the value is safe. Once we do validation we want to use the validated
- * value instead of the object (because object.toString may return something else on next call).
- *
- * If application uses Trusted Types we don't stringify trusted values, but preserve them as objects.
- */
-var toStringOrTrustedType = toString;
-
-if (enableTrustedTypesIntegration && typeof trustedTypes !== 'undefined') {
- toStringOrTrustedType = function (value) {
- if (typeof value === 'object' && (trustedTypes.isHTML(value) || trustedTypes.isScript(value) || trustedTypes.isScriptURL(value) ||
- /* TrustedURLs are deprecated and will be removed soon: https://github.com/WICG/trusted-types/pull/204 */
- trustedTypes.isURL && trustedTypes.isURL(value))) {
- // Pass Trusted Types through.
- return value;
- }
-
- return toString(value);
- };
-}
/**
- * Set attribute for a node. The attribute value can be either string or
- * Trusted value (if application uses Trusted Types).
+ * Collect dispatches (must be entirely collected before dispatching - see unit
+ * tests). Lazily allocate the array to conserve memory. We must loop through
+ * each event and perform the traversal for each one. We cannot perform a
+ * single traversal for the entire collection of events because each event may
+ * have a different target.
*/
-function setAttribute(node, attributeName, attributeValue) {
- node.setAttribute(attributeName, attributeValue);
-}
-/**
- * Set attribute with namespace for a node. The attribute value can be either string or
- * Trusted value (if application uses Trusted Types).
- */
-
-function setAttributeNS(node, attributeNamespace, attributeName, attributeValue) {
- node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
+function accumulateTwoPhaseDispatchesSingle(event) {
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
+ traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
+ }
}
/**
- * Get the value for a property on a node. Only used in DEV for SSR validation.
- * The "expected" argument is used as a hint of what the expected value is.
- * Some properties have multiple equivalent values.
+ * Accumulates without regard to direction, does not look for phased
+ * registration names. Same as `accumulateDirectDispatchesSingle` but without
+ * requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
-function getValueForProperty(node, name, expected, propertyInfo) {
- {
- if (propertyInfo.mustUseProperty) {
- var propertyName = propertyInfo.propertyName;
- return node[propertyName];
- } else {
- if (!disableJavaScriptURLs && propertyInfo.sanitizeURL) {
- // If we haven't fully disabled javascript: URLs, and if
- // the hydration is successful of a javascript: URL, we
- // still want to warn on the client.
- sanitizeURL('' + expected);
- }
-
- var attributeName = propertyInfo.attributeName;
- var stringValue = null;
-
- if (propertyInfo.type === OVERLOADED_BOOLEAN) {
- if (node.hasAttribute(attributeName)) {
- var value = node.getAttribute(attributeName);
-
- if (value === '') {
- return true;
- }
-
- if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
- return value;
- }
-
- if (value === '' + expected) {
- return expected;
- }
-
- return value;
- }
- } else if (node.hasAttribute(attributeName)) {
- if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
- // We had an attribute but shouldn't have had one, so read it
- // for the error message.
- return node.getAttribute(attributeName);
- }
-
- if (propertyInfo.type === BOOLEAN) {
- // If this was a boolean, it doesn't matter what the value is
- // the fact that we have it is the same as the expected.
- return expected;
- } // Even if this property uses a namespace we use getAttribute
- // because we assume its namespaced name is the same as our config.
- // To use getAttributeNS we need the local name which we don't have
- // in our config atm.
-
-
- stringValue = node.getAttribute(attributeName);
- }
-
- if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
- return stringValue === null ? expected : stringValue;
- } else if (stringValue === '' + expected) {
- return expected;
- } else {
- return stringValue;
- }
+function accumulateDispatches(inst, ignoredDirection, event) {
+ if (inst && event && event.dispatchConfig.registrationName) {
+ var registrationName = event.dispatchConfig.registrationName;
+ var listener = getListener(inst, registrationName);
+ if (listener) {
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
+ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
}
}
}
-/**
- * Get the value for a attribute on a node. Only used in DEV for SSR validation.
- * The third argument is used as a hint of what the expected value is. Some
- * attributes have multiple equivalent values.
- */
-
-function getValueForAttribute(node, name, expected) {
- {
- if (!isAttributeNameSafe(name)) {
- return;
- }
-
- if (!node.hasAttribute(name)) {
- return expected === undefined ? undefined : null;
- }
-
- var value = node.getAttribute(name);
-
- if (value === '' + expected) {
- return expected;
- }
-
- return value;
- }
-}
-/**
- * Sets the value for a property on a node.
- *
- * @param {DOMElement} node
- * @param {string} name
- * @param {*} value
- */
-
-function setValueForProperty(node, name, value, isCustomComponentTag) {
- var propertyInfo = getPropertyInfo(name);
-
- if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
- return;
- }
-
- if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
- value = null;
- } // If the prop isn't in the special list, treat it as a simple attribute.
-
-
- if (isCustomComponentTag || propertyInfo === null) {
- if (isAttributeNameSafe(name)) {
- var _attributeName = name;
-
- if (value === null) {
- node.removeAttribute(_attributeName);
- } else {
- setAttribute(node, _attributeName, toStringOrTrustedType(value));
- }
- }
-
- return;
- }
-
- var mustUseProperty = propertyInfo.mustUseProperty;
-
- if (mustUseProperty) {
- var propertyName = propertyInfo.propertyName;
-
- if (value === null) {
- var type = propertyInfo.type;
- node[propertyName] = type === BOOLEAN ? false : '';
- } else {
- // Contrary to `setAttribute`, object properties are properly
- // `toString`ed by IE8/9.
- node[propertyName] = value;
- }
-
- return;
- } // The rest are treated as attributes with special cases.
-
-
- var attributeName = propertyInfo.attributeName,
- attributeNamespace = propertyInfo.attributeNamespace;
-
- if (value === null) {
- node.removeAttribute(attributeName);
- } else {
- var _type = propertyInfo.type;
- var attributeValue;
-
- if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
- // If attribute type is boolean, we know for sure it won't be an execution sink
- // and we won't require Trusted Type here.
- attributeValue = '';
- } else {
- // `setAttribute` with objects becomes only `[object]` in IE8/9,
- // ('' + value) makes it output the correct toString()-value.
- attributeValue = toStringOrTrustedType(value);
-
- if (propertyInfo.sanitizeURL) {
- sanitizeURL(attributeValue.toString());
- }
- }
-
- if (attributeNamespace) {
- setAttributeNS(node, attributeNamespace, attributeName, attributeValue);
- } else {
- setAttribute(node, attributeName, attributeValue);
- }
- }
-}
-
-var ReactDebugCurrentFrame$2 = null;
-var ReactControlledValuePropTypes = {
- checkPropTypes: null
-};
-
-{
- ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
- var hasReadOnlyValue = {
- button: true,
- checkbox: true,
- image: true,
- hidden: true,
- radio: true,
- reset: true,
- submit: true
- };
- var propTypes = {
- value: function (props, propName, componentName) {
- if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
- return null;
- }
-
- 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`.');
- },
- checked: function (props, propName, componentName) {
- if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
- return null;
- }
-
- 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`.');
- }
- };
- /**
- * Provide a linked `value` attribute for controlled forms. You should not use
- * this outside of the ReactDOM controlled form components.
- */
-
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
- checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
- };
-}
-
-function isCheckable(elem) {
- var type = elem.type;
- var nodeName = elem.nodeName;
- return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
-}
-
-function getTracker(node) {
- return node._valueTracker;
-}
-
-function detachTracker(node) {
- node._valueTracker = null;
-}
-
-function getValueFromNode(node) {
- var value = '';
-
- if (!node) {
- return value;
- }
-
- if (isCheckable(node)) {
- value = node.checked ? 'true' : 'false';
- } else {
- value = node.value;
- }
-
- return value;
-}
-
-function trackValueOnNode(node) {
- var valueField = isCheckable(node) ? 'checked' : 'value';
- var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
- var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail
- // and don't track value will cause over reporting of changes,
- // but it's better then a hard failure
- // (needed for certain tests that spyOn input values and Safari)
-
- if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
- return;
- }
-
- var get = descriptor.get,
- set = descriptor.set;
- Object.defineProperty(node, valueField, {
- configurable: true,
- get: function () {
- return get.call(this);
- },
- set: function (value) {
- currentValue = '' + value;
- set.call(this, value);
- }
- }); // We could've passed this the first time
- // but it triggers a bug in IE11 and Edge 14/15.
- // Calling defineProperty() again should be equivalent.
- // https://github.com/facebook/react/issues/11768
-
- Object.defineProperty(node, valueField, {
- enumerable: descriptor.enumerable
- });
- var tracker = {
- getValue: function () {
- return currentValue;
- },
- setValue: function (value) {
- currentValue = '' + value;
- },
- stopTracking: function () {
- detachTracker(node);
- delete node[valueField];
- }
- };
- return tracker;
-}
-
-function track(node) {
- if (getTracker(node)) {
- return;
- } // TODO: Once it's just Fiber we can move this to node._wrapperState
-
-
- node._valueTracker = trackValueOnNode(node);
-}
-function updateValueIfChanged(node) {
- if (!node) {
- return false;
- }
-
- var tracker = getTracker(node); // if there is no tracker at this point it's unlikely
- // that trying again will succeed
-
- if (!tracker) {
- return true;
- }
-
- var lastValue = tracker.getValue();
- var nextValue = getValueFromNode(node);
-
- if (nextValue !== lastValue) {
- tracker.setValue(nextValue);
- return true;
- }
-
- return false;
-}
-
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var didWarnValueDefaultValue = false;
-var didWarnCheckedDefaultChecked = false;
-var didWarnControlledToUncontrolled = false;
-var didWarnUncontrolledToControlled = false;
-
-function isControlled(props) {
- var usesChecked = props.type === 'checkbox' || props.type === 'radio';
- return usesChecked ? props.checked != null : props.value != null;
-}
-/**
- * Implements an host component that allows setting these optional
- * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
- *
- * If `checked` or `value` are not supplied (or null/undefined), user actions
- * that affect the checked state or value will trigger updates to the element.
- *
- * If they are supplied (and not null/undefined), the rendered element will not
- * trigger updates to the element. Instead, the props must change in order for
- * the rendered element to be updated.
- *
- * The rendered element will be initialized as unchecked (or `defaultChecked`)
- * with an empty value (or `defaultValue`).
- *
- * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
- */
-
-
-function getHostProps(element, props) {
- var node = element;
- var checked = props.checked;
-
- var hostProps = _assign({}, props, {
- defaultChecked: undefined,
- defaultValue: undefined,
- value: undefined,
- checked: checked != null ? checked : node._wrapperState.initialChecked
- });
-
- return hostProps;
-}
-function initWrapperState(element, props) {
- {
- ReactControlledValuePropTypes.checkPropTypes('input', props);
-
- if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
- 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);
- didWarnCheckedDefaultChecked = true;
- }
-
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
- 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);
- didWarnValueDefaultValue = true;
- }
- }
-
- var node = element;
- var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
- node._wrapperState = {
- initialChecked: props.checked != null ? props.checked : props.defaultChecked,
- initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
- controlled: isControlled(props)
- };
-}
-function updateChecked(element, props) {
- var node = element;
- var checked = props.checked;
-
- if (checked != null) {
- setValueForProperty(node, 'checked', checked, false);
- }
-}
-function updateWrapper(element, props) {
- var node = element;
-
- {
- var controlled = isControlled(props);
-
- if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
- 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);
- didWarnUncontrolledToControlled = true;
- }
-
- if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
- 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);
- didWarnControlledToUncontrolled = true;
- }
- }
-
- updateChecked(element, props);
- var value = getToStringValue(props.value);
- var type = props.type;
-
- if (value != null) {
- if (type === 'number') {
- if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible.
- // eslint-disable-next-line
- node.value != value) {
- node.value = toString(value);
- }
- } else if (node.value !== toString(value)) {
- node.value = toString(value);
- }
- } else if (type === 'submit' || type === 'reset') {
- // Submit/reset inputs need the attribute removed completely to avoid
- // blank-text buttons.
- node.removeAttribute('value');
- return;
- }
-
- if (disableInputAttributeSyncing) {
- // When not syncing the value attribute, React only assigns a new value
- // whenever the defaultValue React prop has changed. When not present,
- // React does nothing
- if (props.hasOwnProperty('defaultValue')) {
- setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
- }
- } else {
- // When syncing the value attribute, the value comes from a cascade of
- // properties:
- // 1. The value React property
- // 2. The defaultValue React property
- // 3. Otherwise there should be no change
- if (props.hasOwnProperty('value')) {
- setDefaultValue(node, props.type, value);
- } else if (props.hasOwnProperty('defaultValue')) {
- setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
- }
- }
-
- if (disableInputAttributeSyncing) {
- // When not syncing the checked attribute, the attribute is directly
- // controllable from the defaultValue React property. It needs to be
- // updated as new props come in.
- if (props.defaultChecked == null) {
- node.removeAttribute('checked');
- } else {
- node.defaultChecked = !!props.defaultChecked;
- }
- } else {
- // When syncing the checked attribute, it only changes when it needs
- // to be removed, such as transitioning from a checkbox into a text input
- if (props.checked == null && props.defaultChecked != null) {
- node.defaultChecked = !!props.defaultChecked;
- }
- }
-}
-function postMountWrapper(element, props, isHydrating) {
- var node = element; // Do not assign value if it is already set. This prevents user text input
- // from being lost during SSR hydration.
-
- if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
- var type = props.type;
- var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the
- // default value provided by the browser. See: #12872
-
- if (isButton && (props.value === undefined || props.value === null)) {
- return;
- }
-
- var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input
- // from being lost during SSR hydration.
-
- if (!isHydrating) {
- if (disableInputAttributeSyncing) {
- var value = getToStringValue(props.value); // When not syncing the value attribute, the value property points
- // directly to the React prop. Only assign it if it exists.
-
- if (value != null) {
- // Always assign on buttons so that it is possible to assign an
- // empty string to clear button text.
- //
- // Otherwise, do not re-assign the value property if is empty. This
- // potentially avoids a DOM write and prevents Firefox (~60.0.1) from
- // prematurely marking required inputs as invalid. Equality is compared
- // to the current value in case the browser provided value is not an
- // empty string.
- if (isButton || value !== node.value) {
- node.value = toString(value);
- }
- }
- } else {
- // When syncing the value attribute, the value property should use
- // the wrapperState._initialValue property. This uses:
- //
- // 1. The value React property when present
- // 2. The defaultValue React property when present
- // 3. An empty string
- if (initialValue !== node.value) {
- node.value = initialValue;
- }
- }
- }
-
- if (disableInputAttributeSyncing) {
- // When not syncing the value attribute, assign the value attribute
- // directly from the defaultValue React property (when present)
- var defaultValue = getToStringValue(props.defaultValue);
-
- if (defaultValue != null) {
- node.defaultValue = toString(defaultValue);
- }
- } else {
- // Otherwise, the value attribute is synchronized to the property,
- // so we assign defaultValue to the same thing as the value property
- // assignment step above.
- node.defaultValue = initialValue;
- }
- } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
- // this is needed to work around a chrome bug where setting defaultChecked
- // will sometimes influence the value of checked (even after detachment).
- // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
- // We need to temporarily unset name to avoid disrupting radio button groups.
-
-
- var name = node.name;
-
- if (name !== '') {
- node.name = '';
- }
-
- if (disableInputAttributeSyncing) {
- // When not syncing the checked attribute, the checked property
- // never gets assigned. It must be manually set. We don't want
- // to do this when hydrating so that existing user input isn't
- // modified
- if (!isHydrating) {
- updateChecked(element, props);
- } // Only assign the checked attribute if it is defined. This saves
- // a DOM write when controlling the checked attribute isn't needed
- // (text inputs, submit/reset)
-
-
- if (props.hasOwnProperty('defaultChecked')) {
- node.defaultChecked = !node.defaultChecked;
- node.defaultChecked = !!props.defaultChecked;
- }
- } else {
- // When syncing the checked attribute, both the checked property and
- // attribute are assigned at the same time using defaultChecked. This uses:
- //
- // 1. The checked React property when present
- // 2. The defaultChecked React property when present
- // 3. Otherwise, false
- node.defaultChecked = !node.defaultChecked;
- node.defaultChecked = !!node._wrapperState.initialChecked;
- }
-
- if (name !== '') {
- node.name = name;
- }
-}
-function restoreControlledState$1(element, props) {
- var node = element;
- updateWrapper(node, props);
- updateNamedCousins(node, props);
-}
-
-function updateNamedCousins(rootNode, props) {
- var name = props.name;
-
- if (props.type === 'radio' && name != null) {
- var queryRoot = rootNode;
-
- while (queryRoot.parentNode) {
- queryRoot = queryRoot.parentNode;
- } // If `rootNode.form` was non-null, then we could try `form.elements`,
- // but that sometimes behaves strangely in IE8. We could also try using
- // `form.getElementsByName`, but that will only return direct children
- // and won't include inputs that use the HTML5 `form=` attribute. Since
- // the input might not even be in a form. It might not even be in the
- // document. Let's just use the local `querySelectorAll` to ensure we don't
- // miss anything.
-
-
- var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
-
- for (var i = 0; i < group.length; i++) {
- var otherNode = group[i];
-
- if (otherNode === rootNode || otherNode.form !== rootNode.form) {
- continue;
- } // This will throw if radio buttons rendered by different copies of React
- // and the same name are rendered into the same form (same as #1939).
- // That's probably okay; we don't support it just as we don't support
- // mixing React radio buttons with non-React ones.
-
-
- var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
-
- if (!otherProps) {
- {
- throw Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.");
- }
- } // We need update the tracked value on the named cousin since the value
- // was changed but the input saw no event or value set
-
-
- updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that
- // was previously checked to update will cause it to be come re-checked
- // as appropriate.
-
- updateWrapper(otherNode, otherProps);
- }
- }
-} // In Chrome, assigning defaultValue to certain input types triggers input validation.
-// For number inputs, the display value loses trailing decimal points. For email inputs,
-// Chrome raises "The specified value is not a valid email address".
-//
-// Here we check to see if the defaultValue has actually changed, avoiding these problems
-// when the user is inputting text
-//
-// https://github.com/facebook/react/issues/7253
-
-
-function setDefaultValue(node, type, value) {
- if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
- type !== 'number' || node.ownerDocument.activeElement !== node) {
- if (value == null) {
- node.defaultValue = toString(node._wrapperState.initialValue);
- } else if (node.defaultValue !== toString(value)) {
- node.defaultValue = toString(value);
- }
- }
-}
-
-var didWarnSelectedSetOnOption = false;
-var didWarnInvalidChild = false;
-
-function flattenChildren(children) {
- var content = ''; // Flatten children. We'll warn if they are invalid
- // during validateProps() which runs for hydration too.
- // Note that this would throw on non-element objects.
- // Elements are stringified (which is normally irrelevant
- // but matters for ).
-
- React.Children.forEach(children, function (child) {
- if (child == null) {
- return;
- }
-
- content += child; // Note: we don't warn about invalid children here.
- // Instead, this is done separately below so that
- // it happens during the hydration codepath too.
- });
- return content;
-}
-/**
- * Implements an