diff --git a/dist/react-modal.css b/dist/react-modal.css index 89746c2..d0f40db 100644 --- a/dist/react-modal.css +++ b/dist/react-modal.css @@ -1,4 +1,4 @@ -/*! react-modal v2.2.2 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-modal */ +/*! react-modal v2.3.0 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-modal */ .modal---modal-overlay---3D5Nr { position: fixed; top: 0; diff --git a/dist/react-modal.min.css b/dist/react-modal.min.css index de15c5d..bb7e13f 100644 --- a/dist/react-modal.min.css +++ b/dist/react-modal.min.css @@ -1 +1 @@ -/*! react-modal v2.2.2 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-modal */.modal---modal-overlay---3D5Nr{position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(51,51,51,.55);z-index:1050;white-space:nowrap;overflow-x:auto}.modal---modal-overlay---3D5Nr.modal---centered---1Tdo5{text-align:center}.modal---modal-overlay---3D5Nr.modal---centered---1Tdo5:before{content:'';display:inline-block;height:100%;vertical-align:middle;margin-right:-.25em}.modal---modal-overlay---3D5Nr.modal---centered---1Tdo5 .modal---modal-content---3pwnC{display:inline-block;vertical-align:middle;text-align:left}.modal---modal-content---3pwnC{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;line-height:20px;position:relative;display:inline-block;background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:0 4px 16px rgba(0,0,0,.5);box-shadow:0 4px 16px rgba(0,0,0,.5);min-width:400px;white-space:normal}.modal---modal-content---3pwnC *,.modal---modal-content---3pwnC :after,.modal---modal-content---3pwnC :before{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}.modal---modal-content---3pwnC.modal---xs---1z3ff{width:400px}.modal---modal-content---3pwnC.modal---xs---1z3ff .modal---modal-body---2HFnG{min-height:184px}.modal---modal-content---3pwnC.modal---xs---1z3ff .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:130px}.modal---modal-content---3pwnC.modal---sm---20_2_{width:544px}.modal---modal-content---3pwnC.modal---sm---20_2_ .modal---modal-body---2HFnG{min-height:246px}.modal---modal-content---3pwnC.modal---sm---20_2_ .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:192px}.modal---modal-content---3pwnC.modal---md---2-zYL{width:688px}.modal---modal-content---3pwnC.modal---md---2-zYL .modal---modal-body---2HFnG{min-height:246px}.modal---modal-content---3pwnC.modal---md---2-zYL .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:192px}.modal---modal-content---3pwnC.modal---lg---Hdvxb{width:928px}.modal---modal-content---3pwnC.modal---lg---Hdvxb .modal---modal-body---2HFnG{min-height:246px}.modal---modal-content---3pwnC.modal---lg---Hdvxb .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:192px}.modal---modal-content---3pwnC.modal---close-button---2UJ1Z .modal---modal-header---2YL1L.modal---padding---2ENnv{padding:16px 56px 16px 24px}.modal---modal-content---3pwnC .modal---close---28rLZ{position:absolute;top:16px;right:24px;padding:0;margin:0;line-height:20px;cursor:pointer;background:transparent url(data:image/svg+xml;base64,PCEtLSBHZW5lcmF0ZWQgYnkgVHJlbmQgTWljcm8gU3R5bGUgUG9ydGFsIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiB2aWV3Qm94PSIwIDAgMTYgMTYiPg0KICA8dGl0bGU+Y2xvc2U8L3RpdGxlPg0KICA8cGF0aCBmaWxsPSJyZ2IoMzQsMzQsMzQpIiBkPSJNMTUgMmwtMS0xLTYgNi02LTYtMC45OSAwLjk5IDUuOTkgNi4wMTAtNiA2IDEgMSA2LTYgNiA2IDEtMS02LTYgNi02eiI+PC9wYXRoPg0KPC9zdmc+);border:0;-webkit-appearance:none;text-shadow:none;opacity:1;-ms-filter:none;filter:none;outline:0;width:16px;height:16px;opacity:.5}.modal---modal-content---3pwnC .modal---close---28rLZ:focus,.modal---modal-content---3pwnC .modal---close---28rLZ:hover{opacity:1;-ms-filter:none;filter:none}.modal---modal-content---3pwnC .modal---modal-header---2YL1L{min-height:54px;background-color:#fff;border-bottom:1px solid #ccc;padding:0}.modal---modal-content---3pwnC .modal---modal-header---2YL1L.modal---padding---2ENnv{padding:16px 24px}.modal---modal-content---3pwnC .modal---modal-title---2JFyt{font-weight:200;color:#222;letter-spacing:-.02em;font-size:18px}.modal---modal-content---3pwnC .modal---modal-title---2JFyt.modal---ellipsis---1BpLN{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}.modal---modal-content---3pwnC .modal---modal-body---2HFnG{position:relative;padding:0}.modal---modal-content---3pwnC .modal---modal-body---2HFnG.modal---padding---2ENnv{padding:54px 24px 16px 24px}.modal---modal-content---3pwnC .modal---modal-header---2YL1L+.modal---modal-body---2HFnG.modal---padding---2ENnv{padding:16px 24px}.modal---modal-content---3pwnC .modal---modal-footer---20LPi{min-height:56px;margin-top:0;text-align:right;background-color:#eee;padding:0}.modal---modal-content---3pwnC .modal---modal-footer---20LPi.modal---padding---2ENnv{padding:12px 24px}.modal---modal-content---3pwnC .modal---modal-footer---20LPi button{min-width:80px}.modal---modal-content---3pwnC .modal---modal-footer---20LPi button+button{margin-left:8px} \ No newline at end of file +/*! react-modal v2.3.0 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-modal */.modal---modal-overlay---3D5Nr{position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(51,51,51,.55);z-index:1050;white-space:nowrap;overflow-x:auto}.modal---modal-overlay---3D5Nr.modal---centered---1Tdo5{text-align:center}.modal---modal-overlay---3D5Nr.modal---centered---1Tdo5:before{content:'';display:inline-block;height:100%;vertical-align:middle;margin-right:-.25em}.modal---modal-overlay---3D5Nr.modal---centered---1Tdo5 .modal---modal-content---3pwnC{display:inline-block;vertical-align:middle;text-align:left}.modal---modal-content---3pwnC{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;line-height:20px;position:relative;display:inline-block;background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:0 4px 16px rgba(0,0,0,.5);box-shadow:0 4px 16px rgba(0,0,0,.5);min-width:400px;white-space:normal}.modal---modal-content---3pwnC *,.modal---modal-content---3pwnC :after,.modal---modal-content---3pwnC :before{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}.modal---modal-content---3pwnC.modal---xs---1z3ff{width:400px}.modal---modal-content---3pwnC.modal---xs---1z3ff .modal---modal-body---2HFnG{min-height:184px}.modal---modal-content---3pwnC.modal---xs---1z3ff .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:130px}.modal---modal-content---3pwnC.modal---sm---20_2_{width:544px}.modal---modal-content---3pwnC.modal---sm---20_2_ .modal---modal-body---2HFnG{min-height:246px}.modal---modal-content---3pwnC.modal---sm---20_2_ .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:192px}.modal---modal-content---3pwnC.modal---md---2-zYL{width:688px}.modal---modal-content---3pwnC.modal---md---2-zYL .modal---modal-body---2HFnG{min-height:246px}.modal---modal-content---3pwnC.modal---md---2-zYL .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:192px}.modal---modal-content---3pwnC.modal---lg---Hdvxb{width:928px}.modal---modal-content---3pwnC.modal---lg---Hdvxb .modal---modal-body---2HFnG{min-height:246px}.modal---modal-content---3pwnC.modal---lg---Hdvxb .modal---modal-header---2YL1L+.modal---modal-body---2HFnG{min-height:192px}.modal---modal-content---3pwnC.modal---close-button---2UJ1Z .modal---modal-header---2YL1L.modal---padding---2ENnv{padding:16px 56px 16px 24px}.modal---modal-content---3pwnC .modal---close---28rLZ{position:absolute;top:16px;right:24px;padding:0;margin:0;line-height:20px;cursor:pointer;background:transparent url(data:image/svg+xml;base64,PCEtLSBHZW5lcmF0ZWQgYnkgVHJlbmQgTWljcm8gU3R5bGUgUG9ydGFsIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiB2aWV3Qm94PSIwIDAgMTYgMTYiPg0KICA8dGl0bGU+Y2xvc2U8L3RpdGxlPg0KICA8cGF0aCBmaWxsPSJyZ2IoMzQsMzQsMzQpIiBkPSJNMTUgMmwtMS0xLTYgNi02LTYtMC45OSAwLjk5IDUuOTkgNi4wMTAtNiA2IDEgMSA2LTYgNiA2IDEtMS02LTYgNi02eiI+PC9wYXRoPg0KPC9zdmc+);border:0;-webkit-appearance:none;text-shadow:none;opacity:1;-ms-filter:none;filter:none;outline:0;width:16px;height:16px;opacity:.5}.modal---modal-content---3pwnC .modal---close---28rLZ:focus,.modal---modal-content---3pwnC .modal---close---28rLZ:hover{opacity:1;-ms-filter:none;filter:none}.modal---modal-content---3pwnC .modal---modal-header---2YL1L{min-height:54px;background-color:#fff;border-bottom:1px solid #ccc;padding:0}.modal---modal-content---3pwnC .modal---modal-header---2YL1L.modal---padding---2ENnv{padding:16px 24px}.modal---modal-content---3pwnC .modal---modal-title---2JFyt{font-weight:200;color:#222;letter-spacing:-.02em;font-size:18px}.modal---modal-content---3pwnC .modal---modal-title---2JFyt.modal---ellipsis---1BpLN{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}.modal---modal-content---3pwnC .modal---modal-body---2HFnG{position:relative;padding:0}.modal---modal-content---3pwnC .modal---modal-body---2HFnG.modal---padding---2ENnv{padding:54px 24px 16px 24px}.modal---modal-content---3pwnC .modal---modal-header---2YL1L+.modal---modal-body---2HFnG.modal---padding---2ENnv{padding:16px 24px}.modal---modal-content---3pwnC .modal---modal-footer---20LPi{min-height:56px;margin-top:0;text-align:right;background-color:#eee;padding:0}.modal---modal-content---3pwnC .modal---modal-footer---20LPi.modal---padding---2ENnv{padding:12px 24px}.modal---modal-content---3pwnC .modal---modal-footer---20LPi button{min-width:80px}.modal---modal-content---3pwnC .modal---modal-footer---20LPi button+button{margin-left:8px} \ No newline at end of file diff --git a/docs/bundle.js b/docs/bundle.js index f8134b3..eff06a8 100644 --- a/docs/bundle.js +++ b/docs/bundle.js @@ -119,7 +119,7 @@ if(false) { /***/ "../node_modules/@trendmicro/react-buttons/lib/index.js": /***/ (function(module, exports, __webpack_require__) { -/*! react-buttons v1.3.0 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-buttons */ +/*! react-buttons v1.3.1 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-buttons */ module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache @@ -418,6 +418,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } +var getComponentType = function getComponentType(Component) { + return Component ? _react2.default.createElement(Component, null).type : undefined; +}; + var ButtonGroup = function ButtonGroup(_ref) { var _classes; @@ -437,7 +441,7 @@ var ButtonGroup = function ButtonGroup(_ref) { className: (0, _classnames2.default)(className, classes) }), _react2.default.Children.map(children, function (child) { - if (_react2.default.isValidElement(child) && child.type === _Button2.default) { + if (_react2.default.isValidElement(child) && child.type === getComponentType(_Button2.default)) { var childProps = {}; if (_constants.btnSizes.indexOf(btnSize) >= 0) { childProps.btnSize = btnSize; @@ -515,121 +519,229 @@ exports.default = ButtonToolbar; /***/ }), -/***/ "../node_modules/@trendmicro/react-portal/lib/Portal.js": +/***/ "../node_modules/@trendmicro/react-portal/LegacyPortal.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { - value: true + value: true }); +exports.default = void 0; -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; +var _propTypes = _interopRequireDefault(__webpack_require__("../node_modules/prop-types/index.js")); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _react = _interopRequireDefault(__webpack_require__("../node_modules/react/index.js")); -var _class, _temp2; +var _reactDom = _interopRequireDefault(__webpack_require__("../node_modules/react-dom/index.js")); -var _propTypes = __webpack_require__("../node_modules/prop-types/index.js"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _propTypes2 = _interopRequireDefault(_propTypes); +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var _react = __webpack_require__("../node_modules/react/index.js"); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _react2 = _interopRequireDefault(_react); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -var _reactDom = __webpack_require__("../node_modules/react-dom/index.js"); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var _reactDom2 = _interopRequireDefault(_reactDom); +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -var Portal = (_temp2 = _class = function (_PureComponent) { - _inherits(Portal, _PureComponent); +var Portal = +/*#__PURE__*/ +function (_React$Component) { + _inherits(Portal, _React$Component); - function Portal() { - var _ref; + function Portal(props) { + var _this; - var _temp, _this, _ret; + _classCallCheck(this, Portal); - _classCallCheck(this, Portal); + _this = _possibleConstructorReturn(this, _getPrototypeOf(Portal).call(this, props)); + _this.node = document.createElement('div'); - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + _this.node.setAttribute('data-reactportal', ''); + + return _this; + } + + _createClass(Portal, [{ + key: "componentDidMount", + value: function componentDidMount() { + if (this.props.node) { + this.props.node.appendChild(this.node); + } else { + document.body.appendChild(this.node); + } + + this.componentDidUpdate(); + } + }, { + key: "componentWillUnmount", + value: function componentWillUnmount() { + if (this.node) { + _reactDom.default.unmountComponentAtNode(this.node); + + if (this.node.parentNode) { + this.node.parentNode.removeChild(this.node); } - return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Portal.__proto__ || Object.getPrototypeOf(Portal)).call.apply(_ref, [this].concat(args))), _this), _this.node = null, _temp), _possibleConstructorReturn(_this, _ret); + this.node = null; + } + } + }, { + key: "componentDidUpdate", + value: function componentDidUpdate() { + _reactDom.default.render(this.props.children, this.node); + } + }, { + key: "render", + value: function render() { + return null; } + }]); - _createClass(Portal, [{ - key: 'componentDidMount', - value: function componentDidMount() { - if (!this.node) { - this.node = document.createElement('div'); - this.node.setAttribute('data-reactportal', ''); + return Portal; +}(_react.default.Component); - if (this.props.node) { - this.props.node.appendChild(this.node); - } else { - document.body.appendChild(this.node); - } - } - this.componentDidUpdate(); - } - }, { - key: 'componentWillUnmount', - value: function componentWillUnmount() { - if (this.node) { - _reactDom2.default.unmountComponentAtNode(this.node); - if (this.node.parentNode) { - this.node.parentNode.removeChild(this.node); - } - this.node = null; - } - } - }, { - key: 'componentDidUpdate', - value: function componentDidUpdate() { - var props = _extends({}, this.props); - delete props.node; +_defineProperty(Portal, "propTypes", { + node: _propTypes.default.any +}); - _reactDom2.default.render(_react2.default.createElement('div', props), this.node); - } - }, { - key: 'render', - value: function render() { - return null; +var _default = Portal; +exports.default = _default; + +/***/ }), + +/***/ "../node_modules/@trendmicro/react-portal/Portal.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _propTypes = _interopRequireDefault(__webpack_require__("../node_modules/prop-types/index.js")); + +var _react = _interopRequireDefault(__webpack_require__("../node_modules/react/index.js")); + +var _reactDom = _interopRequireDefault(__webpack_require__("../node_modules/react-dom/index.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var Portal = +/*#__PURE__*/ +function (_React$Component) { + _inherits(Portal, _React$Component); + + function Portal(props) { + var _this; + + _classCallCheck(this, Portal); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(Portal).call(this, props)); + _this.node = document.createElement('div'); + + _this.node.setAttribute('data-reactportal', ''); + + return _this; + } + + _createClass(Portal, [{ + key: "componentDidMount", + value: function componentDidMount() { + if (this.props.node) { + this.props.node.appendChild(this.node); + } else { + document.body.appendChild(this.node); + } + } + }, { + key: "componentWillUnmount", + value: function componentWillUnmount() { + if (this.node) { + if (this.node.parentNode) { + this.node.parentNode.removeChild(this.node); } - }]); - return Portal; -}(_react.PureComponent), _class.propTypes = { - node: _propTypes2.default.any -}, _temp2); -exports.default = Portal; + this.node = null; + } + } + }, { + key: "render", + value: function render() { + return _reactDom.default.createPortal(this.props.children, this.node); + } + }]); + + return Portal; +}(_react.default.Component); + +_defineProperty(Portal, "propTypes", { + node: _propTypes.default.any +}); + +var _default = Portal; +exports.default = _default; /***/ }), -/***/ "../node_modules/@trendmicro/react-portal/lib/index.js": +/***/ "../node_modules/@trendmicro/react-portal/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; -var _Portal = __webpack_require__("../node_modules/@trendmicro/react-portal/lib/Portal.js"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactDom = _interopRequireDefault(__webpack_require__("../node_modules/react-dom/index.js")); + +var _Portal = _interopRequireDefault(__webpack_require__("../node_modules/@trendmicro/react-portal/Portal.js")); -var _Portal2 = _interopRequireDefault(_Portal); +var _LegacyPortal = _interopRequireDefault(__webpack_require__("../node_modules/@trendmicro/react-portal/LegacyPortal.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = _Portal2.default; +var _default = !!_reactDom.default.createPortal ? _Portal.default : _LegacyPortal.default; + +exports.default = _default; /***/ }), @@ -688,7 +800,7 @@ module.exports = _chainedFunction2.default; /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2016 Jed Watson. + Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ @@ -710,8 +822,11 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! if (argType === 'string' || argType === 'number') { classes.push(arg); - } else if (Array.isArray(arg)) { - classes.push(classNames.apply(null, arg)); + } else if (Array.isArray(arg) && arg.length) { + var inner = classNames.apply(null, arg); + if (inner) { + classes.push(inner); + } } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { @@ -725,6 +840,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! } if (typeof module !== 'undefined' && module.exports) { + classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name @@ -748,7 +864,7 @@ exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/c // module -exports.push([module.i, "/*! react-buttons v1.3.0 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-buttons */\n.buttons---btn---2jZHN {\n display: inline-block;\n min-width: 80px;\n padding: 5px 12px;\n margin-bottom: 0;\n font-size: 13px;\n font-weight: normal;\n line-height: 20px;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n touch-action: manipulation;\n cursor: pointer;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 3px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.buttons---btn---2jZHN:focus,\n.buttons---btn---2jZHN:active:focus,\n.buttons---btn---2jZHN.buttons---active---2-a32:focus,\n.buttons---btn---2jZHN.buttons---focus---1kVJZ,\n.buttons---btn---2jZHN:active.buttons---focus---1kVJZ,\n.buttons---btn---2jZHN.buttons---active---2-a32.buttons---focus---1kVJZ {\n outline: none;\n}\n.buttons---btn---2jZHN:hover,\n.buttons---btn---2jZHN.buttons---hover---42FF2,\n.buttons---btn---2jZHN:focus,\n.buttons---btn---2jZHN.buttons---focus---1kVJZ {\n color: #222;\n text-decoration: none;\n}\n.buttons---btn---2jZHN:active,\n.buttons---btn---2jZHN.buttons---active---2-a32 {\n outline: none;\n background-image: none;\n -webkit-box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn---2jZHN.buttons---disabled---eCY9b,\n.buttons---btn---2jZHN[disabled],\nfieldset[disabled] .buttons---btn---2jZHN {\n cursor: not-allowed;\n opacity: 0.4;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)\";\n filter: alpha(opacity=40);\n}\na .buttons---btn---2jZHN.buttons---disabled---eCY9b,\nfieldset[disabled] a .buttons---btn---2jZHN {\n pointer-events: none;\n}\n.buttons---btn---2jZHN + .buttons---btn---2jZHN {\n margin-left: 8px;\n}\n.buttons---btn---2jZHN > [class*=\"loader-container\"] {\n display: inline-block;\n}\n.buttons---btn---2jZHN > [class*=\"loader-container\"] > [class*=\"loader\"] {\n margin-top: 2px;\n margin-right: 8px;\n}\n.buttons---btn-default---1wWXD {\n color: #222;\n background-color: #fbfbfb;\n background-image: -webkit-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -moz-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -o-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -ms-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: linear-gradient(to bottom, #fbfbfb 0%, #ececec 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n}\n.buttons---btn-default---1wWXD:active,\n.buttons---btn-default---1wWXD.buttons---active---2-a32 {\n color: #222;\n background-color: #eee;\n background-image: none;\n border-color: #bbb;\n -webkit-box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn-default---1wWXD:focus,\n.buttons---btn-default---1wWXD.buttons---focus---1kVJZ {\n color: #222;\n border-color: #0096cc;\n}\n.buttons---btn-default---1wWXD:hover,\n.buttons---btn-default---1wWXD.buttons---hover---42FF2 {\n color: #222;\n background-color: #fff;\n background-image: -webkit-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: -moz-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: -o-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: -ms-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: linear-gradient(to bottom, #fff 0%, #f5f5f5 100%);\n background-repeat: repeat-x;\n border-color: #999;\n}\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b:hover,\n.buttons---btn-default---1wWXD[disabled]:hover,\nfieldset[disabled] .buttons---btn-default---1wWXD:hover,\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-default---1wWXD[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-default---1wWXD.buttons---hover---42FF2,\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b:focus,\n.buttons---btn-default---1wWXD[disabled]:focus,\nfieldset[disabled] .buttons---btn-default---1wWXD:focus,\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-default---1wWXD[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-default---1wWXD.buttons---focus---1kVJZ {\n background-color: #fbfbfb;\n background-image: -webkit-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -moz-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -o-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -ms-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: linear-gradient(to bottom, #fbfbfb 0%, #ececec 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n}\n.buttons---btn-primary---Wp1wb {\n color: #fff;\n background-color: #0096cc;\n background-image: -webkit-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -moz-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -o-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -ms-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: linear-gradient(to bottom, #00a7e6 0%, #0096cc 100%);\n background-repeat: repeat-x;\n border-color: #0095ce;\n}\n.buttons---btn-primary---Wp1wb > [class*=\"loader-container\"] > [class*=\"loader\"] {\n border-color: rgba(255,255,255,0.4);\n border-left-color: #fff;\n}\n.buttons---btn-primary---Wp1wb:active,\n.buttons---btn-primary---Wp1wb.buttons---active---2-a32 {\n color: #fff;\n background-color: #009ed8;\n background-image: none;\n border-color: #00759f;\n -webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n}\n.buttons---btn-primary---Wp1wb:focus,\n.buttons---btn-primary---Wp1wb.buttons---focus---1kVJZ {\n color: #fff;\n border-color: #444;\n -webkit-box-shadow: 0 0 1px #fff inset;\n box-shadow: 0 0 1px #fff inset;\n}\n.buttons---btn-primary---Wp1wb:hover,\n.buttons---btn-primary---Wp1wb.buttons---hover---42FF2 {\n color: #fff;\n background-color: #1daee5;\n background-image: -webkit-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: -moz-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: -o-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: -ms-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: linear-gradient(to bottom, #1daee5 0%, #00a3df 100%);\n background-repeat: repeat-x;\n border-color: #00759f;\n}\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b:hover,\n.buttons---btn-primary---Wp1wb[disabled]:hover,\nfieldset[disabled] .buttons---btn-primary---Wp1wb:hover,\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-primary---Wp1wb[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-primary---Wp1wb.buttons---hover---42FF2,\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b:focus,\n.buttons---btn-primary---Wp1wb[disabled]:focus,\nfieldset[disabled] .buttons---btn-primary---Wp1wb:focus,\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-primary---Wp1wb[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-primary---Wp1wb.buttons---focus---1kVJZ {\n background-color: #0096cc;\n background-image: -webkit-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -moz-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -o-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -ms-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: linear-gradient(to bottom, #00a7e6 0%, #0096cc 100%);\n background-repeat: repeat-x;\n border-color: #0095ce;\n}\n.buttons---btn-danger---1UUqU {\n color: #fff;\n background-color: #db3d44;\n background-image: -webkit-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -moz-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -o-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -ms-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: linear-gradient(to bottom, #e15054 0%, #db3d44 100%);\n background-repeat: repeat-x;\n border-color: #d8262b;\n}\n.buttons---btn-danger---1UUqU:active,\n.buttons---btn-danger---1UUqU.buttons---active---2-a32 {\n color: #fff;\n background-color: #e15054;\n background-image: none;\n border-color: #c22327;\n -webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n}\n.buttons---btn-danger---1UUqU:focus,\n.buttons---btn-danger---1UUqU.buttons---focus---1kVJZ {\n color: #fff;\n border-color: #444;\n -webkit-box-shadow: 0 0 1px #fff inset;\n box-shadow: 0 0 1px #fff inset;\n}\n.buttons---btn-danger---1UUqU:hover,\n.buttons---btn-danger---1UUqU.buttons---hover---42FF2 {\n color: #fff;\n background-color: #e15f5f;\n background-image: -webkit-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: -moz-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: -o-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: -ms-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: linear-gradient(to bottom, #e15f5f 0%, #e15054 100%);\n background-repeat: repeat-x;\n border-color: #c22327;\n}\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b:hover,\n.buttons---btn-danger---1UUqU[disabled]:hover,\nfieldset[disabled] .buttons---btn-danger---1UUqU:hover,\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-danger---1UUqU[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-danger---1UUqU.buttons---hover---42FF2,\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b:focus,\n.buttons---btn-danger---1UUqU[disabled]:focus,\nfieldset[disabled] .buttons---btn-danger---1UUqU:focus,\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-danger---1UUqU[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-danger---1UUqU.buttons---focus---1kVJZ {\n background-color: #db3d44;\n background-image: -webkit-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -moz-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -o-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -ms-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: linear-gradient(to bottom, #e15054 0%, #db3d44 100%);\n background-repeat: repeat-x;\n border-color: #d8262b;\n}\n.buttons---btn-border---1O58b {\n color: #222;\n background-color: #fff;\n background-image: -webkit-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -moz-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -o-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -ms-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: linear-gradient(to bottom, #fff 0%, #fff 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n -webkit-transition: all 0.2s linear 0s;\n -moz-transition: all 0.2s linear 0s;\n -o-transition: all 0.2s linear 0s;\n -ms-transition: all 0.2s linear 0s;\n transition: all 0.2s linear 0s;\n}\n.buttons---btn-border---1O58b:hover,\n.buttons---btn-border---1O58b.buttons---hover---42FF2 {\n color: #222;\n background-color: #f4f4f4;\n background-image: -webkit-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: -moz-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: -o-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: -ms-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: linear-gradient(to bottom, #f4f4f4 0%, #f4f4f4 100%);\n background-repeat: repeat-x;\n border-color: #999;\n}\n.buttons---btn-border---1O58b:focus,\n.buttons---btn-border---1O58b.buttons---focus---1kVJZ {\n color: #222;\n border-color: #0096cc;\n}\n.buttons---btn-border---1O58b:active,\n.buttons---btn-border---1O58b.buttons---active---2-a32,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b {\n color: #222;\n background-color: #eee;\n background-image: none;\n border-color: #bbb;\n -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.1) inset;\n box-shadow: 0px 1px 2px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn-border---1O58b:active:hover,\n.buttons---btn-border---1O58b.buttons---active---2-a32:hover,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b:hover,\n.buttons---btn-border---1O58b:active.buttons---hover---42FF2,\n.buttons---btn-border---1O58b.buttons---active---2-a32.buttons---hover---42FF2,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b.buttons---hover---42FF2,\n.buttons---btn-border---1O58b:active:focus,\n.buttons---btn-border---1O58b.buttons---active---2-a32:focus,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b:focus,\n.buttons---btn-border---1O58b:active.buttons---focus---1kVJZ,\n.buttons---btn-border---1O58b.buttons---active---2-a32.buttons---focus---1kVJZ,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b.buttons---focus---1kVJZ {\n color: #222;\n border-color: #bbb;\n -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;\n box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b,\n.buttons---btn-border---1O58b[disabled],\nfieldset[disabled] .buttons---btn-border---1O58b {\n opacity: 0.4;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)\";\n filter: alpha(opacity=40);\n cursor: not-allowed;\n}\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b:hover,\n.buttons---btn-border---1O58b[disabled]:hover,\nfieldset[disabled] .buttons---btn-border---1O58b:hover,\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-border---1O58b[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-border---1O58b.buttons---hover---42FF2,\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b:focus,\n.buttons---btn-border---1O58b[disabled]:focus,\nfieldset[disabled] .buttons---btn-border---1O58b:focus,\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-border---1O58b[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-border---1O58b.buttons---focus---1kVJZ {\n background-color: #fff;\n background-image: -webkit-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -moz-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -o-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -ms-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: linear-gradient(to bottom, #fff 0%, #fff 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n}\n.buttons---btn-link---1xwS4 {\n padding-right: 0;\n padding-left: 0;\n font-weight: normal;\n color: #0096cc;\n border-radius: 0;\n}\n.buttons---btn-link---1xwS4,\n.buttons---btn-link---1xwS4:active,\n.buttons---btn-link---1xwS4.buttons---active---2-a32,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b,\n.buttons---btn-link---1xwS4[disabled],\nfieldset[disabled] .buttons---btn-link---1xwS4 {\n background-color: transparent;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n.buttons---btn-link---1xwS4,\n.buttons---btn-link---1xwS4:hover,\n.buttons---btn-link---1xwS4.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4:focus,\n.buttons---btn-link---1xwS4:active {\n border-color: transparent;\n}\n.buttons---btn-link---1xwS4:hover,\n.buttons---btn-link---1xwS4.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4:focus {\n color: #db3d44;\n text-decoration: underline;\n background-color: transparent;\n}\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b:hover,\n.buttons---btn-link---1xwS4[disabled]:hover,\nfieldset[disabled] .buttons---btn-link---1xwS4:hover,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-link---1xwS4.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b:focus,\n.buttons---btn-link---1xwS4[disabled]:focus,\nfieldset[disabled] .buttons---btn-link---1xwS4:focus,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-link---1xwS4[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-link---1xwS4.buttons---focus---1kVJZ {\n color: #e6e6e6;\n text-decoration: none;\n}\n.buttons---btn-lg---2xtUV,\n.buttons---btn-group-lg---3C8An > .buttons---btn---2jZHN {\n padding: 9px 12px;\n font-size: 16px;\n line-height: 24px;\n border-radius: 3px;\n}\n.buttons---btn-lg---2xtUV.buttons---btn-compact---mXDAU,\n.buttons---btn-group-lg---3C8An > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 58px;\n}\n.buttons---btn-md---HRR_F,\n.buttons---btn-group-md---3FQVP > .buttons---btn---2jZHN {\n padding: 5px 12px;\n font-size: 13px;\n line-height: 20px;\n border-radius: 3px;\n}\n.buttons---btn-md---HRR_F.buttons---btn-compact---mXDAU,\n.buttons---btn-group-md---3FQVP > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 42px;\n}\n.buttons---btn-sm---3cNnY,\n.buttons---btn-group-sm---3_QLf > .buttons---btn---2jZHN {\n padding: 4px 12px;\n font-size: 12px;\n line-height: 18px;\n border-radius: 3px;\n}\n.buttons---btn-sm---3cNnY.buttons---btn-compact---mXDAU,\n.buttons---btn-group-sm---3_QLf > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 36px;\n}\n.buttons---btn-xs---2eEDQ,\n.buttons---btn-group-xs---1c4pb > .buttons---btn---2jZHN {\n padding: 1px 12px;\n font-size: 12px;\n line-height: 18px;\n border-radius: 3px;\n}\n.buttons---btn-xs---2eEDQ.buttons---btn-compact---mXDAU,\n.buttons---btn-group-xs---1c4pb > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 28px;\n}\n.buttons---btn-block---1nSNV {\n display: block;\n width: 100%;\n}\n.buttons---btn-block---1nSNV.buttons---btn---2jZHN + .buttons---btn-block---1nSNV.buttons---btn---2jZHN,\n.buttons---btn-block---1nSNV + .buttons---btn-block---1nSNV {\n margin-left: 0;\n margin-top: 8px;\n}\ninput[type=\"submit\"].buttons---btn-block---1nSNV,\ninput[type=\"reset\"].buttons---btn-block---1nSNV,\ninput[type=\"button\"].buttons---btn-block---1nSNV {\n width: 100%;\n}\n.buttons---btn-group---1jaDo,\n.buttons---btn-group-vertical---3Lm1e {\n position: relative;\n display: inline-block;\n vertical-align: top;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN {\n position: relative;\n float: left;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:hover,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:hover,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN.buttons---hover---42FF2,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN.buttons---hover---42FF2,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:active,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:active,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN.buttons---active---2-a32,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN.buttons---active---2-a32 {\n z-index: 2;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:focus,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:focus,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN.buttons---focus---1kVJZ,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN.buttons---focus---1kVJZ {\n z-index: 3;\n}\n.buttons---btn-group---1jaDo .buttons---btn---2jZHN + .buttons---btn---2jZHN,\n.buttons---btn-group---1jaDo .buttons---btn---2jZHN + .buttons---btn-group---1jaDo,\n.buttons---btn-group---1jaDo .buttons---btn-group---1jaDo + .buttons---btn---2jZHN,\n.buttons---btn-group---1jaDo .buttons---btn-group---1jaDo + .buttons---btn-group---1jaDo {\n margin-left: -1px;\n}\n.buttons---btn-group---1jaDo + .buttons---btn-group---1jaDo {\n margin-left: 8px;\n}\n.buttons---btn-toolbar---2-GfJ {\n margin-left: -5px;\n zoom: 1;\n}\n.buttons---btn-toolbar---2-GfJ:before,\n.buttons---btn-toolbar---2-GfJ:after {\n content: \"\";\n display: table;\n}\n.buttons---btn-toolbar---2-GfJ:after {\n clear: both;\n}\n.buttons---btn-toolbar---2-GfJ .buttons---btn---2jZHN,\n.buttons---btn-toolbar---2-GfJ .buttons---btn-group---1jaDo,\n.buttons---btn-toolbar---2-GfJ .buttons---input-group---1T18I {\n float: left;\n}\n.buttons---btn-toolbar---2-GfJ > .buttons---btn---2jZHN,\n.buttons---btn-toolbar---2-GfJ > .buttons---btn-group---1jaDo,\n.buttons---btn-toolbar---2-GfJ > .buttons---input-group---1T18I {\n margin-left: 5px;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:not(:first-child):not(:last-child):not(.buttons---dropdown-toggle---vMtjL) {\n border-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:first-child {\n margin-left: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:first-child:not(:last-child):not(.buttons---dropdown-toggle---vMtjL) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:last-child:not(:first-child),\n.buttons---btn-group---1jaDo > .buttons---dropdown-toggle---vMtjL:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo {\n float: left;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:not(:first-child):not(:last-child) > .buttons---btn---2jZHN {\n border-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---btn---2jZHN:last-child,\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---dropdown-toggle---vMtjL {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:last-child:not(:first-child) > .buttons---btn---2jZHN:first-child {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.buttons---btn-group---1jaDo .buttons---dropdown-toggle---vMtjL:active,\n.buttons---btn-group---1jaDo.buttons---open---1ju75 .buttons---dropdown-toggle---vMtjL {\n outline: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN {\n display: block;\n float: none;\n width: 100%;\n max-width: 100%;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo {\n zoom: 1;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:before,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:after {\n content: \"\";\n display: table;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:after {\n clear: both;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN {\n float: none;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN + .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN + .buttons---btn-group---1jaDo,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo + .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo + .buttons---btn-group---1jaDo {\n margin-top: -1px;\n margin-left: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:not(:first-child):not(:last-child) {\n border-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:first-child:not(:last-child) {\n border-top-radius: 3px;\n border-bottom-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:last-child:not(:first-child) {\n border-top-radius: 0;\n border-bottom-radius: 3px;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:not(:first-child):not(:last-child) > .buttons---btn---2jZHN {\n border-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---btn---2jZHN:last-child,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---dropdown-toggle---vMtjL {\n border-bottom-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:last-child:not(:first-child) > .buttons---btn---2jZHN:first-child {\n border-top-radius: 0;\n}\n.buttons---btn-group-justified---3qB9u {\n display: table;\n width: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.buttons---btn-group-justified---3qB9u > .buttons---btn---2jZHN,\n.buttons---btn-group-justified---3qB9u > .buttons---btn-group---1jaDo {\n float: none;\n display: table-cell;\n width: 1%;\n}\n.buttons---btn-group-justified---3qB9u > .buttons---btn-group---1jaDo .buttons---btn---2jZHN {\n width: 100%;\n}\n.buttons---btn-group-justified---3qB9u > .buttons---btn-group---1jaDo .buttons---dropdown-menu---1fkH0 {\n left: auto;\n}\n.buttons---dropdown-toggle---vMtjL {\n min-width: 0;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn---2jZHN {\n text-align: left;\n padding-left: 12px;\n padding-right: 12px;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn-compact---mXDAU {\n text-align: center;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn-link---1xwS4 {\n color: #222;\n padding-left: 0;\n padding-right: 0;\n text-decoration: none;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn-link---1xwS4:hover,\n.buttons---dropdown-toggle---vMtjL.buttons---btn-link---1xwS4:hover > * {\n color: #0096cc;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN + .buttons---dropdown-toggle---vMtjL {\n padding-left: 8px;\n padding-right: 8px;\n min-width: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-lg---2xtUV + .buttons---dropdown-toggle---vMtjL {\n padding-left: 12px;\n padding-right: 12px;\n}\n[data-toggle=\"buttons\"] > .buttons---btn---2jZHN input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .buttons---btn---2jZHN input[type=\"checkbox\"],\n[data-toggle=\"buttons\"] > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN input[type=\"checkbox\"] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n pointer-events: none;\n}\n.buttons---btn---2jZHN.buttons---btn-compact---mXDAU .fa {\n margin-right: 0;\n}\n.buttons---btn---2jZHN .fa {\n font-size: 14px;\n margin-right: 8px;\n}\n.buttons---btn---2jZHN i.fa,\n.buttons---btn---2jZHN span.fa {\n font-size: 14px;\n color: #666;\n}\n.buttons---btn-primary---Wp1wb i.fa,\n.buttons---btn-danger---1UUqU i.fa,\n.buttons---btn-primary---Wp1wb span.fa,\n.buttons---btn-danger---1UUqU span.fa {\n color: inherit;\n}\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN i.fa,\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN i.fa,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN i.fa,\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN span.fa,\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN span.fa,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN span.fa {\n font-size: inherit;\n}\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN i.svg,\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN span.svg {\n width: 24px;\n height: 24px;\n}\n.buttons---btn---2jZHN i.svg,\n.buttons---btn---2jZHN span.svg {\n width: 16px;\n height: 16px;\n}\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN i.svg,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN i.svg,\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN span.svg,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN span.svg {\n width: 12px;\n height: 12px;\n}", ""]); +exports.push([module.i, "/*! react-buttons v1.3.1 | (c) 2018 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-buttons */\n.buttons---btn---2jZHN {\n display: inline-block;\n min-width: 80px;\n padding: 5px 12px;\n margin-bottom: 0;\n font-size: 13px;\n font-weight: normal;\n line-height: 20px;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n touch-action: manipulation;\n cursor: pointer;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 3px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.buttons---btn---2jZHN:focus,\n.buttons---btn---2jZHN:active:focus,\n.buttons---btn---2jZHN.buttons---active---2-a32:focus,\n.buttons---btn---2jZHN.buttons---focus---1kVJZ,\n.buttons---btn---2jZHN:active.buttons---focus---1kVJZ,\n.buttons---btn---2jZHN.buttons---active---2-a32.buttons---focus---1kVJZ {\n outline: none;\n}\n.buttons---btn---2jZHN:hover,\n.buttons---btn---2jZHN.buttons---hover---42FF2,\n.buttons---btn---2jZHN:focus,\n.buttons---btn---2jZHN.buttons---focus---1kVJZ {\n color: #222;\n text-decoration: none;\n}\n.buttons---btn---2jZHN:active,\n.buttons---btn---2jZHN.buttons---active---2-a32 {\n outline: none;\n background-image: none;\n -webkit-box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn---2jZHN.buttons---disabled---eCY9b,\n.buttons---btn---2jZHN[disabled],\nfieldset[disabled] .buttons---btn---2jZHN {\n cursor: not-allowed;\n opacity: 0.4;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)\";\n filter: alpha(opacity=40);\n}\na .buttons---btn---2jZHN.buttons---disabled---eCY9b,\nfieldset[disabled] a .buttons---btn---2jZHN {\n pointer-events: none;\n}\n.buttons---btn---2jZHN + .buttons---btn---2jZHN {\n margin-left: 8px;\n}\n.buttons---btn---2jZHN > [class*=\"loader-container\"] {\n display: inline-block;\n}\n.buttons---btn---2jZHN > [class*=\"loader-container\"] > [class*=\"loader\"] {\n margin-top: 2px;\n margin-right: 8px;\n}\n.buttons---btn-default---1wWXD {\n color: #222;\n background-color: #fbfbfb;\n background-image: -webkit-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -moz-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -o-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -ms-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: linear-gradient(to bottom, #fbfbfb 0%, #ececec 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n}\n.buttons---btn-default---1wWXD:active,\n.buttons---btn-default---1wWXD.buttons---active---2-a32 {\n color: #222;\n background-color: #eee;\n background-image: none;\n border-color: #bbb;\n -webkit-box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n box-shadow: 0 1px 4px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn-default---1wWXD:focus,\n.buttons---btn-default---1wWXD.buttons---focus---1kVJZ {\n color: #222;\n border-color: #0096cc;\n}\n.buttons---btn-default---1wWXD:hover,\n.buttons---btn-default---1wWXD.buttons---hover---42FF2 {\n color: #222;\n background-color: #fff;\n background-image: -webkit-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: -moz-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: -o-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: -ms-linear-gradient(top, #fff 0%, #f5f5f5 100%);\n background-image: linear-gradient(to bottom, #fff 0%, #f5f5f5 100%);\n background-repeat: repeat-x;\n border-color: #999;\n}\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b:hover,\n.buttons---btn-default---1wWXD[disabled]:hover,\nfieldset[disabled] .buttons---btn-default---1wWXD:hover,\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-default---1wWXD[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-default---1wWXD.buttons---hover---42FF2,\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b:focus,\n.buttons---btn-default---1wWXD[disabled]:focus,\nfieldset[disabled] .buttons---btn-default---1wWXD:focus,\n.buttons---btn-default---1wWXD.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-default---1wWXD[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-default---1wWXD.buttons---focus---1kVJZ {\n background-color: #fbfbfb;\n background-image: -webkit-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -moz-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -o-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: -ms-linear-gradient(top, #fbfbfb 0%, #ececec 100%);\n background-image: linear-gradient(to bottom, #fbfbfb 0%, #ececec 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n}\n.buttons---btn-primary---Wp1wb {\n color: #fff;\n background-color: #0096cc;\n background-image: -webkit-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -moz-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -o-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -ms-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: linear-gradient(to bottom, #00a7e6 0%, #0096cc 100%);\n background-repeat: repeat-x;\n border-color: #0095ce;\n}\n.buttons---btn-primary---Wp1wb > [class*=\"loader-container\"] > [class*=\"loader\"] {\n border-color: rgba(255,255,255,0.4);\n border-left-color: #fff;\n}\n.buttons---btn-primary---Wp1wb:active,\n.buttons---btn-primary---Wp1wb.buttons---active---2-a32 {\n color: #fff;\n background-color: #009ed8;\n background-image: none;\n border-color: #00759f;\n -webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n}\n.buttons---btn-primary---Wp1wb:focus,\n.buttons---btn-primary---Wp1wb.buttons---focus---1kVJZ {\n color: #fff;\n border-color: #444;\n -webkit-box-shadow: 0 0 1px #fff inset;\n box-shadow: 0 0 1px #fff inset;\n}\n.buttons---btn-primary---Wp1wb:hover,\n.buttons---btn-primary---Wp1wb.buttons---hover---42FF2 {\n color: #fff;\n background-color: #1daee5;\n background-image: -webkit-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: -moz-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: -o-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: -ms-linear-gradient(top, #1daee5 0%, #00a3df 100%);\n background-image: linear-gradient(to bottom, #1daee5 0%, #00a3df 100%);\n background-repeat: repeat-x;\n border-color: #00759f;\n}\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b:hover,\n.buttons---btn-primary---Wp1wb[disabled]:hover,\nfieldset[disabled] .buttons---btn-primary---Wp1wb:hover,\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-primary---Wp1wb[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-primary---Wp1wb.buttons---hover---42FF2,\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b:focus,\n.buttons---btn-primary---Wp1wb[disabled]:focus,\nfieldset[disabled] .buttons---btn-primary---Wp1wb:focus,\n.buttons---btn-primary---Wp1wb.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-primary---Wp1wb[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-primary---Wp1wb.buttons---focus---1kVJZ {\n background-color: #0096cc;\n background-image: -webkit-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -moz-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -o-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: -ms-linear-gradient(top, #00a7e6 0%, #0096cc 100%);\n background-image: linear-gradient(to bottom, #00a7e6 0%, #0096cc 100%);\n background-repeat: repeat-x;\n border-color: #0095ce;\n}\n.buttons---btn-danger---1UUqU {\n color: #fff;\n background-color: #db3d44;\n background-image: -webkit-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -moz-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -o-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -ms-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: linear-gradient(to bottom, #e15054 0%, #db3d44 100%);\n background-repeat: repeat-x;\n border-color: #d8262b;\n}\n.buttons---btn-danger---1UUqU:active,\n.buttons---btn-danger---1UUqU.buttons---active---2-a32 {\n color: #fff;\n background-color: #e15054;\n background-image: none;\n border-color: #c22327;\n -webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n box-shadow: 0 1px 6px rgba(0,0,0,0.15) inset;\n}\n.buttons---btn-danger---1UUqU:focus,\n.buttons---btn-danger---1UUqU.buttons---focus---1kVJZ {\n color: #fff;\n border-color: #444;\n -webkit-box-shadow: 0 0 1px #fff inset;\n box-shadow: 0 0 1px #fff inset;\n}\n.buttons---btn-danger---1UUqU:hover,\n.buttons---btn-danger---1UUqU.buttons---hover---42FF2 {\n color: #fff;\n background-color: #e15f5f;\n background-image: -webkit-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: -moz-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: -o-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: -ms-linear-gradient(top, #e15f5f 0%, #e15054 100%);\n background-image: linear-gradient(to bottom, #e15f5f 0%, #e15054 100%);\n background-repeat: repeat-x;\n border-color: #c22327;\n}\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b:hover,\n.buttons---btn-danger---1UUqU[disabled]:hover,\nfieldset[disabled] .buttons---btn-danger---1UUqU:hover,\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-danger---1UUqU[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-danger---1UUqU.buttons---hover---42FF2,\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b:focus,\n.buttons---btn-danger---1UUqU[disabled]:focus,\nfieldset[disabled] .buttons---btn-danger---1UUqU:focus,\n.buttons---btn-danger---1UUqU.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-danger---1UUqU[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-danger---1UUqU.buttons---focus---1kVJZ {\n background-color: #db3d44;\n background-image: -webkit-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -moz-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -o-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: -ms-linear-gradient(top, #e15054 0%, #db3d44 100%);\n background-image: linear-gradient(to bottom, #e15054 0%, #db3d44 100%);\n background-repeat: repeat-x;\n border-color: #d8262b;\n}\n.buttons---btn-border---1O58b {\n color: #222;\n background-color: #fff;\n background-image: -webkit-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -moz-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -o-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -ms-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: linear-gradient(to bottom, #fff 0%, #fff 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n -webkit-transition: all 0.2s linear 0s;\n -moz-transition: all 0.2s linear 0s;\n -o-transition: all 0.2s linear 0s;\n -ms-transition: all 0.2s linear 0s;\n transition: all 0.2s linear 0s;\n}\n.buttons---btn-border---1O58b:hover,\n.buttons---btn-border---1O58b.buttons---hover---42FF2 {\n color: #222;\n background-color: #f4f4f4;\n background-image: -webkit-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: -moz-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: -o-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: -ms-linear-gradient(top, #f4f4f4 0%, #f4f4f4 100%);\n background-image: linear-gradient(to bottom, #f4f4f4 0%, #f4f4f4 100%);\n background-repeat: repeat-x;\n border-color: #999;\n}\n.buttons---btn-border---1O58b:focus,\n.buttons---btn-border---1O58b.buttons---focus---1kVJZ {\n color: #222;\n border-color: #0096cc;\n}\n.buttons---btn-border---1O58b:active,\n.buttons---btn-border---1O58b.buttons---active---2-a32,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b {\n color: #222;\n background-color: #eee;\n background-image: none;\n border-color: #bbb;\n -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.1) inset;\n box-shadow: 0px 1px 2px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn-border---1O58b:active:hover,\n.buttons---btn-border---1O58b.buttons---active---2-a32:hover,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b:hover,\n.buttons---btn-border---1O58b:active.buttons---hover---42FF2,\n.buttons---btn-border---1O58b.buttons---active---2-a32.buttons---hover---42FF2,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b.buttons---hover---42FF2,\n.buttons---btn-border---1O58b:active:focus,\n.buttons---btn-border---1O58b.buttons---active---2-a32:focus,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b:focus,\n.buttons---btn-border---1O58b:active.buttons---focus---1kVJZ,\n.buttons---btn-border---1O58b.buttons---active---2-a32.buttons---focus---1kVJZ,\n.buttons---open---1ju75 > .buttons---dropdown-toggle---vMtjL.buttons---btn-border---1O58b.buttons---focus---1kVJZ {\n color: #222;\n border-color: #bbb;\n -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;\n box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;\n}\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b,\n.buttons---btn-border---1O58b[disabled],\nfieldset[disabled] .buttons---btn-border---1O58b {\n opacity: 0.4;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)\";\n filter: alpha(opacity=40);\n cursor: not-allowed;\n}\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b:hover,\n.buttons---btn-border---1O58b[disabled]:hover,\nfieldset[disabled] .buttons---btn-border---1O58b:hover,\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-border---1O58b[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-border---1O58b.buttons---hover---42FF2,\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b:focus,\n.buttons---btn-border---1O58b[disabled]:focus,\nfieldset[disabled] .buttons---btn-border---1O58b:focus,\n.buttons---btn-border---1O58b.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-border---1O58b[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-border---1O58b.buttons---focus---1kVJZ {\n background-color: #fff;\n background-image: -webkit-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -moz-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -o-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: -ms-linear-gradient(top, #fff 0%, #fff 100%);\n background-image: linear-gradient(to bottom, #fff 0%, #fff 100%);\n background-repeat: repeat-x;\n border-color: #ccc;\n}\n.buttons---btn-link---1xwS4 {\n padding-right: 0;\n padding-left: 0;\n font-weight: normal;\n color: #0096cc;\n border-radius: 0;\n}\n.buttons---btn-link---1xwS4,\n.buttons---btn-link---1xwS4:active,\n.buttons---btn-link---1xwS4.buttons---active---2-a32,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b,\n.buttons---btn-link---1xwS4[disabled],\nfieldset[disabled] .buttons---btn-link---1xwS4 {\n background-color: transparent;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n.buttons---btn-link---1xwS4,\n.buttons---btn-link---1xwS4:hover,\n.buttons---btn-link---1xwS4.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4:focus,\n.buttons---btn-link---1xwS4:active {\n border-color: transparent;\n}\n.buttons---btn-link---1xwS4:hover,\n.buttons---btn-link---1xwS4.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4:focus {\n color: #db3d44;\n text-decoration: underline;\n background-color: transparent;\n}\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b:hover,\n.buttons---btn-link---1xwS4[disabled]:hover,\nfieldset[disabled] .buttons---btn-link---1xwS4:hover,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4[disabled].buttons---hover---42FF2,\nfieldset[disabled] .buttons---btn-link---1xwS4.buttons---hover---42FF2,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b:focus,\n.buttons---btn-link---1xwS4[disabled]:focus,\nfieldset[disabled] .buttons---btn-link---1xwS4:focus,\n.buttons---btn-link---1xwS4.buttons---disabled---eCY9b.buttons---focus---1kVJZ,\n.buttons---btn-link---1xwS4[disabled].buttons---focus---1kVJZ,\nfieldset[disabled] .buttons---btn-link---1xwS4.buttons---focus---1kVJZ {\n color: #e6e6e6;\n text-decoration: none;\n}\n.buttons---btn-lg---2xtUV,\n.buttons---btn-group-lg---3C8An > .buttons---btn---2jZHN {\n padding: 9px 12px;\n font-size: 16px;\n line-height: 24px;\n border-radius: 3px;\n}\n.buttons---btn-lg---2xtUV.buttons---btn-compact---mXDAU,\n.buttons---btn-group-lg---3C8An > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 58px;\n}\n.buttons---btn-md---HRR_F,\n.buttons---btn-group-md---3FQVP > .buttons---btn---2jZHN {\n padding: 5px 12px;\n font-size: 13px;\n line-height: 20px;\n border-radius: 3px;\n}\n.buttons---btn-md---HRR_F.buttons---btn-compact---mXDAU,\n.buttons---btn-group-md---3FQVP > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 42px;\n}\n.buttons---btn-sm---3cNnY,\n.buttons---btn-group-sm---3_QLf > .buttons---btn---2jZHN {\n padding: 4px 12px;\n font-size: 12px;\n line-height: 18px;\n border-radius: 3px;\n}\n.buttons---btn-sm---3cNnY.buttons---btn-compact---mXDAU,\n.buttons---btn-group-sm---3_QLf > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 36px;\n}\n.buttons---btn-xs---2eEDQ,\n.buttons---btn-group-xs---1c4pb > .buttons---btn---2jZHN {\n padding: 1px 12px;\n font-size: 12px;\n line-height: 18px;\n border-radius: 3px;\n}\n.buttons---btn-xs---2eEDQ.buttons---btn-compact---mXDAU,\n.buttons---btn-group-xs---1c4pb > .buttons---btn---2jZHN.buttons---btn-compact---mXDAU {\n padding-left: 0;\n padding-right: 0;\n min-width: 28px;\n}\n.buttons---btn-block---1nSNV {\n display: block;\n width: 100%;\n}\n.buttons---btn-block---1nSNV.buttons---btn---2jZHN + .buttons---btn-block---1nSNV.buttons---btn---2jZHN,\n.buttons---btn-block---1nSNV + .buttons---btn-block---1nSNV {\n margin-left: 0;\n margin-top: 8px;\n}\ninput[type=\"submit\"].buttons---btn-block---1nSNV,\ninput[type=\"reset\"].buttons---btn-block---1nSNV,\ninput[type=\"button\"].buttons---btn-block---1nSNV {\n width: 100%;\n}\n.buttons---btn-group---1jaDo,\n.buttons---btn-group-vertical---3Lm1e {\n position: relative;\n display: inline-block;\n vertical-align: top;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN {\n position: relative;\n float: left;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:hover,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:hover,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN.buttons---hover---42FF2,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN.buttons---hover---42FF2,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:active,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:active,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN.buttons---active---2-a32,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN.buttons---active---2-a32 {\n z-index: 2;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:focus,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:focus,\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN.buttons---focus---1kVJZ,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN.buttons---focus---1kVJZ {\n z-index: 3;\n}\n.buttons---btn-group---1jaDo .buttons---btn---2jZHN + .buttons---btn---2jZHN,\n.buttons---btn-group---1jaDo .buttons---btn---2jZHN + .buttons---btn-group---1jaDo,\n.buttons---btn-group---1jaDo .buttons---btn-group---1jaDo + .buttons---btn---2jZHN,\n.buttons---btn-group---1jaDo .buttons---btn-group---1jaDo + .buttons---btn-group---1jaDo {\n margin-left: -1px;\n}\n.buttons---btn-group---1jaDo + .buttons---btn-group---1jaDo {\n margin-left: 8px;\n}\n.buttons---btn-toolbar---2-GfJ {\n margin-left: -5px;\n zoom: 1;\n}\n.buttons---btn-toolbar---2-GfJ:before,\n.buttons---btn-toolbar---2-GfJ:after {\n content: \"\";\n display: table;\n}\n.buttons---btn-toolbar---2-GfJ:after {\n clear: both;\n}\n.buttons---btn-toolbar---2-GfJ .buttons---btn---2jZHN,\n.buttons---btn-toolbar---2-GfJ .buttons---btn-group---1jaDo,\n.buttons---btn-toolbar---2-GfJ .buttons---input-group---1T18I {\n float: left;\n}\n.buttons---btn-toolbar---2-GfJ > .buttons---btn---2jZHN,\n.buttons---btn-toolbar---2-GfJ > .buttons---btn-group---1jaDo,\n.buttons---btn-toolbar---2-GfJ > .buttons---input-group---1T18I {\n margin-left: 5px;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:not(:first-child):not(:last-child):not(.buttons---dropdown-toggle---vMtjL) {\n border-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:first-child {\n margin-left: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:first-child:not(:last-child):not(.buttons---dropdown-toggle---vMtjL) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN:last-child:not(:first-child),\n.buttons---btn-group---1jaDo > .buttons---dropdown-toggle---vMtjL:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo {\n float: left;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:not(:first-child):not(:last-child) > .buttons---btn---2jZHN {\n border-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---btn---2jZHN:last-child,\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---dropdown-toggle---vMtjL {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-group---1jaDo:last-child:not(:first-child) > .buttons---btn---2jZHN:first-child {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.buttons---btn-group---1jaDo .buttons---dropdown-toggle---vMtjL:active,\n.buttons---btn-group---1jaDo.buttons---open---1ju75 .buttons---dropdown-toggle---vMtjL {\n outline: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN {\n display: block;\n float: none;\n width: 100%;\n max-width: 100%;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo {\n zoom: 1;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:before,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:after {\n content: \"\";\n display: table;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:after {\n clear: both;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN {\n float: none;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN + .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN + .buttons---btn-group---1jaDo,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo + .buttons---btn---2jZHN,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo + .buttons---btn-group---1jaDo {\n margin-top: -1px;\n margin-left: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:not(:first-child):not(:last-child) {\n border-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:first-child:not(:last-child) {\n border-top-radius: 3px;\n border-bottom-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn---2jZHN:last-child:not(:first-child) {\n border-top-radius: 0;\n border-bottom-radius: 3px;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:not(:first-child):not(:last-child) > .buttons---btn---2jZHN {\n border-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---btn---2jZHN:last-child,\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:first-child:not(:last-child) > .buttons---dropdown-toggle---vMtjL {\n border-bottom-radius: 0;\n}\n.buttons---btn-group-vertical---3Lm1e > .buttons---btn-group---1jaDo:last-child:not(:first-child) > .buttons---btn---2jZHN:first-child {\n border-top-radius: 0;\n}\n.buttons---btn-group-justified---3qB9u {\n display: table;\n width: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.buttons---btn-group-justified---3qB9u > .buttons---btn---2jZHN,\n.buttons---btn-group-justified---3qB9u > .buttons---btn-group---1jaDo {\n float: none;\n display: table-cell;\n width: 1%;\n}\n.buttons---btn-group-justified---3qB9u > .buttons---btn-group---1jaDo .buttons---btn---2jZHN {\n width: 100%;\n}\n.buttons---btn-group-justified---3qB9u > .buttons---btn-group---1jaDo .buttons---dropdown-menu---1fkH0 {\n left: auto;\n}\n.buttons---dropdown-toggle---vMtjL {\n min-width: 0;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn---2jZHN {\n text-align: left;\n padding-left: 12px;\n padding-right: 12px;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn-compact---mXDAU {\n text-align: center;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn-link---1xwS4 {\n color: #222;\n padding-left: 0;\n padding-right: 0;\n text-decoration: none;\n}\n.buttons---dropdown-toggle---vMtjL.buttons---btn-link---1xwS4:hover,\n.buttons---dropdown-toggle---vMtjL.buttons---btn-link---1xwS4:hover > * {\n color: #0096cc;\n}\n.buttons---btn-group---1jaDo > .buttons---btn---2jZHN + .buttons---dropdown-toggle---vMtjL {\n padding-left: 8px;\n padding-right: 8px;\n min-width: 0;\n}\n.buttons---btn-group---1jaDo > .buttons---btn-lg---2xtUV + .buttons---dropdown-toggle---vMtjL {\n padding-left: 12px;\n padding-right: 12px;\n}\n[data-toggle=\"buttons\"] > .buttons---btn---2jZHN input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .buttons---btn---2jZHN input[type=\"checkbox\"],\n[data-toggle=\"buttons\"] > .buttons---btn-group---1jaDo > .buttons---btn---2jZHN input[type=\"checkbox\"] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n pointer-events: none;\n}\n.buttons---btn---2jZHN.buttons---btn-compact---mXDAU .fa {\n margin-right: 0;\n}\n.buttons---btn---2jZHN .fa {\n font-size: 14px;\n margin-right: 8px;\n}\n.buttons---btn---2jZHN i.fa,\n.buttons---btn---2jZHN span.fa {\n font-size: 14px;\n color: #666;\n}\n.buttons---btn-primary---Wp1wb i.fa,\n.buttons---btn-danger---1UUqU i.fa,\n.buttons---btn-primary---Wp1wb span.fa,\n.buttons---btn-danger---1UUqU span.fa {\n color: inherit;\n}\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN i.fa,\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN i.fa,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN i.fa,\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN span.fa,\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN span.fa,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN span.fa {\n font-size: inherit;\n}\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN i.svg,\n.buttons---btn-lg---2xtUV.buttons---btn---2jZHN span.svg {\n width: 24px;\n height: 24px;\n}\n.buttons---btn---2jZHN i.svg,\n.buttons---btn---2jZHN span.svg {\n width: 16px;\n height: 16px;\n}\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN i.svg,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN i.svg,\n.buttons---btn-sm---3cNnY.buttons---btn---2jZHN span.svg,\n.buttons---btn-xs---2eEDQ.buttons---btn---2jZHN span.svg {\n width: 12px;\n height: 12px;\n}", ""]); // exports @@ -900,296 +1016,296 @@ module.exports = function escape(url) { /***/ }), -/***/ "../node_modules/fbjs/lib/EventListener.js": +/***/ "../node_modules/object-assign/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ - -var emptyFunction = __webpack_require__("../node_modules/fbjs/lib/emptyFunction.js"); - -/** - * Upstream version of event listener. Does not take into account specific - * nature of platform. - */ -var EventListener = { - /** - * Listen to DOM events during the bubble phase. - * - * @param {DOMEventTarget} target DOM element to register listener on. - * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. - * @param {function} callback Callback function. - * @return {object} Object with a `remove` method. - */ - listen: function listen(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, false); - return { - remove: function remove() { - target.removeEventListener(eventType, callback, false); - } - }; - } else if (target.attachEvent) { - target.attachEvent('on' + eventType, callback); - return { - remove: function remove() { - target.detachEvent('on' + eventType, callback); - } - }; - } - }, - - /** - * Listen to DOM events during the capture phase. - * - * @param {DOMEventTarget} target DOM element to register listener on. - * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. - * @param {function} callback Callback function. - * @return {object} Object with a `remove` method. - */ - capture: function capture(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, true); - return { - remove: function remove() { - target.removeEventListener(eventType, callback, true); - } - }; - } else { - if (process.env.NODE_ENV !== 'production') { - console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); - } - return { - remove: emptyFunction - }; - } - }, +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ - registerDefault: function registerDefault() {} -}; -module.exports = EventListener; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; -/***/ }), +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } -/***/ "../node_modules/fbjs/lib/ExecutionEnvironment.js": -/***/ (function(module, exports, __webpack_require__) { + return Object(val); +} -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + // Detect buggy property enumeration order in older V8 versions. + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } -var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } -/** - * Simple, lightweight module assisting with the detection and context of - * Worker. Helps avoid circular dependencies and allows code to reason about - * whether or not they are in a Worker, even if they never include the main - * `ReactWorker` dependency. - */ -var ExecutionEnvironment = { + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } - canUseDOM: canUseDOM, + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} - canUseWorkers: typeof Worker !== 'undefined', +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; - canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); - canUseViewport: canUseDOM && !!window.screen, + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } - isInWorker: !canUseDOM // For now, this is true - might change in the future. + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + return to; }; -module.exports = ExecutionEnvironment; /***/ }), -/***/ "../node_modules/fbjs/lib/camelize.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ "../node_modules/process/browser.js": +/***/ (function(module, exports) { +// shim for using process in browser +var process = module.exports = {}; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. -var _hyphenPattern = /-(.)/g; +var cachedSetTimeout; +var cachedClearTimeout; -/** - * Camelcases a hyphenated string, for example: - * - * > camelize('background-color') - * < "backgroundColor" - * - * @param {string} string - * @return {string} - */ -function camelize(string) { - return string.replace(_hyphenPattern, function (_, character) { - return character.toUpperCase(); - }); +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); } - -module.exports = camelize; - -/***/ }), - -/***/ "../node_modules/fbjs/lib/camelizeStyleName.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ - - - -var camelize = __webpack_require__("../node_modules/fbjs/lib/camelize.js"); - -var msPattern = /^-ms-/; - -/** - * Camelcases a hyphenated CSS property name, for example: - * - * > camelizeStyleName('background-color') - * < "backgroundColor" - * > camelizeStyleName('-moz-transition') - * < "MozTransition" - * > camelizeStyleName('-ms-transition') - * < "msTransition" - * - * As Andi Smith suggests - * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix - * is converted to lowercase `ms`. - * - * @param {string} string - * @return {string} - */ -function camelizeStyleName(string) { - return camelize(string.replace(msPattern, 'ms-')); +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); } - -module.exports = camelizeStyleName; - -/***/ }), - -/***/ "../node_modules/fbjs/lib/containsNode.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } -var isTextNode = __webpack_require__("../node_modules/fbjs/lib/isTextNode.js"); -/*eslint-disable no-bitwise */ -/** - * Checks if a given DOM node contains or is another DOM node. - */ -function containsNode(outerNode, innerNode) { - if (!outerNode || !innerNode) { - return false; - } else if (outerNode === innerNode) { - return true; - } else if (isTextNode(outerNode)) { - return false; - } else if (isTextNode(innerNode)) { - return containsNode(outerNode, innerNode.parentNode); - } else if ('contains' in outerNode) { - return outerNode.contains(innerNode); - } else if (outerNode.compareDocumentPosition) { - return !!(outerNode.compareDocumentPosition(innerNode) & 16); - } else { - return false; - } } +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; -module.exports = containsNode; +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} -/***/ }), +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; -/***/ "../node_modules/fbjs/lib/emptyFunction.js": -/***/ (function(module, exports, __webpack_require__) { + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} -"use strict"; +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ +function noop() {} -function makeEmptyFunction(arg) { - return function () { - return arg; - }; -} +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; -/** - * This function accepts and discards inputs; it has no side effects. This is - * primarily useful idiomatically for overridable function endpoints which - * always need to be callable, since JS lacks a null-call idiom ala Cocoa. - */ -var emptyFunction = function emptyFunction() {}; +process.listeners = function (name) { return [] } -emptyFunction.thatReturns = makeEmptyFunction; -emptyFunction.thatReturnsFalse = makeEmptyFunction(false); -emptyFunction.thatReturnsTrue = makeEmptyFunction(true); -emptyFunction.thatReturnsNull = makeEmptyFunction(null); -emptyFunction.thatReturnsThis = function () { - return this; +process.binding = function (name) { + throw new Error('process.binding is not supported'); }; -emptyFunction.thatReturnsArgument = function (arg) { - return arg; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); }; +process.umask = function() { return 0; }; -module.exports = emptyFunction; /***/ }), -/***/ "../node_modules/fbjs/lib/emptyObject.js": +/***/ "../node_modules/prop-types/checkPropTypes.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1198,177 +1314,165 @@ module.exports = emptyFunction; * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * */ -var emptyObject = {}; +var printWarning = function() {}; if (process.env.NODE_ENV !== 'production') { - Object.freeze(emptyObject); -} - -module.exports = emptyObject; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) - -/***/ }), + var ReactPropTypesSecret = __webpack_require__("../node_modules/prop-types/lib/ReactPropTypesSecret.js"); + var loggedTypeFailures = {}; -/***/ "../node_modules/fbjs/lib/focusNode.js": -/***/ (function(module, exports, __webpack_require__) { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} -"use strict"; /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ) + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + var stack = getStack ? getStack() : ''; -/** - * @param {DOMElement} node input/textarea to focus - */ - -function focusNode(node) { - // IE8 can throw "Can't move focus to the control because it is invisible, - // not enabled, or of a type that does not accept the focus." for all kinds of - // reasons that are too expensive and fragile to test. - try { - node.focus(); - } catch (e) {} -} - -module.exports = focusNode; - -/***/ }), - -/***/ "../node_modules/fbjs/lib/getActiveElement.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ - -/* eslint-disable fb-www/typeof-undefined */ - -/** - * Same as document.activeElement but wraps in a try-catch block. In IE it is - * not safe to call document.activeElement if there is nothing focused. - * - * The activeElement will be null only if the document or document body is not - * yet defined. - * - * @param {?DOMDocument} doc Defaults to current document. - * @return {?DOMElement} - */ -function getActiveElement(doc) /*?DOMElement*/{ - doc = doc || (typeof document !== 'undefined' ? document : undefined); - if (typeof doc === 'undefined') { - return null; - } - try { - return doc.activeElement || doc.body; - } catch (e) { - return doc.body; + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } } } -module.exports = getActiveElement; +module.exports = checkPropTypes; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) /***/ }), -/***/ "../node_modules/fbjs/lib/hyphenate.js": +/***/ "../node_modules/prop-types/factoryWithThrowingShims.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; - - /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ - -var _uppercasePattern = /([A-Z])/g; - -/** - * Hyphenates a camelcased string, for example: - * - * > hyphenate('backgroundColor') - * < "background-color" - * - * For CSS style names, use `hyphenateStyleName` instead which works properly - * with all vendor prefixes, including `ms`. - * - * @param {string} string - * @return {string} */ -function hyphenate(string) { - return string.replace(_uppercasePattern, '-$1').toLowerCase(); -} - -module.exports = hyphenate; -/***/ }), -/***/ "../node_modules/fbjs/lib/hyphenateStyleName.js": -/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ +var ReactPropTypesSecret = __webpack_require__("../node_modules/prop-types/lib/ReactPropTypesSecret.js"); +function emptyFunction() {} +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, -var hyphenate = __webpack_require__("../node_modules/fbjs/lib/hyphenate.js"); + any: shim, + arrayOf: getShim, + element: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim + }; -var msPattern = /^ms-/; + ReactPropTypes.checkPropTypes = emptyFunction; + ReactPropTypes.PropTypes = ReactPropTypes; -/** - * Hyphenates a camelcased CSS property name, for example: - * - * > hyphenateStyleName('backgroundColor') - * < "background-color" - * > hyphenateStyleName('MozTransition') - * < "-moz-transition" - * > hyphenateStyleName('msTransition') - * < "-ms-transition" - * - * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix - * is converted to `-ms-`. - * - * @param {string} string - * @return {string} - */ -function hyphenateStyleName(string) { - return hyphenate(string).replace(msPattern, '-ms-'); -} + return ReactPropTypes; +}; -module.exports = hyphenateStyleName; /***/ }), -/***/ "../node_modules/fbjs/lib/invariant.js": +/***/ "../node_modules/prop-types/factoryWithTypeCheckers.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1377,553 +1481,625 @@ module.exports = hyphenateStyleName; * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * */ -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ +var assign = __webpack_require__("../node_modules/object-assign/index.js"); + +var ReactPropTypesSecret = __webpack_require__("../node_modules/prop-types/lib/ReactPropTypesSecret.js"); +var checkPropTypes = __webpack_require__("../node_modules/prop-types/checkPropTypes.js"); -var validateFormat = function validateFormat(format) {}; +var printWarning = function() {}; if (process.env.NODE_ENV !== 'production') { - validateFormat = function validateFormat(format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} }; } -function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -} - -module.exports = invariant; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) - -/***/ }), - -/***/ "../node_modules/fbjs/lib/isNode.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ - -/** - * @param {*} object The object to check. - * @return {boolean} Whether or not the object is a DOM node. - */ -function isNode(object) { - var doc = object ? object.ownerDocument || object : document; - var defaultView = doc.defaultView || window; - return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); +function emptyFunctionThatReturnsNull() { + return null; } -module.exports = isNode; - -/***/ }), - -/***/ "../node_modules/fbjs/lib/isTextNode.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - */ + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } -var isNode = __webpack_require__("../node_modules/fbjs/lib/isNode.js"); - -/** - * @param {*} object The object to check. - * @return {boolean} Whether or not the object is a DOM text node. - */ -function isTextNode(object) { - return isNode(object) && object.nodeType == 3; -} + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ -module.exports = isTextNode; + var ANONYMOUS = '<>'; -/***/ }), + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), -/***/ "../node_modules/fbjs/lib/shallowEqual.js": -/***/ (function(module, exports, __webpack_require__) { + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @typechecks - * - */ + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ -/*eslint-disable no-self-compare */ + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } -var hasOwnProperty = Object.prototype.hasOwnProperty; + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - // SameValue algorithm - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - // Added the nonzero y check to make Flow happy, but it is redundant - return x !== 0 || y !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; + return chainedCheckType; } -} -/** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. - */ -function shallowEqual(objA, objB) { - if (is(objA, objB)) { - return true; - } + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); } - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) { - return false; + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); } - // Test for A's keys different from B. - for (var i = 0; i < keysA.length; i++) { - if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { - return false; + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; } + return createChainableTypeChecker(validate); } - return true; -} + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } -module.exports = shallowEqual; + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } -/***/ }), + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } -/***/ "../node_modules/fbjs/lib/warning.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - - -var emptyFunction = __webpack_require__("../node_modules/fbjs/lib/emptyFunction.js"); - -/** - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - -var warning = emptyFunction; + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } -if (process.env.NODE_ENV !== 'production') { - var printWarning = function printWarning(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } + return createChainableTypeChecker(validate); + } - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.error(message); + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; + return createChainableTypeChecker(validate); + } - warning = function warning(condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; } - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } } - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } } - printWarning.apply(undefined, [format].concat(args)); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } - }; -} - -module.exports = warning; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) + return createChainableTypeChecker(validate); + } -/***/ }), + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } -/***/ "../node_modules/object-assign/index.js": -/***/ (function(module, exports, __webpack_require__) { + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } -"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } - return Object(val); -} + return true; + default: + return false; + } + } -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } - // Detect buggy property enumeration order in older V8 versions. + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } + return false; + } - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.PropTypes = ReactPropTypes; - return to; + return ReactPropTypes; }; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) /***/ }), -/***/ "../node_modules/process/browser.js": -/***/ (function(module, exports) { +/***/ "../node_modules/prop-types/index.js": +/***/ (function(module, exports, __webpack_require__) { -// shim for using process in browser -var process = module.exports = {}; +/* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. +if (process.env.NODE_ENV !== 'production') { + var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && + Symbol.for && + Symbol.for('react.element')) || + 0xeac7; -var cachedSetTimeout; -var cachedClearTimeout; + var isValidElement = function(object) { + return typeof object === 'object' && + object !== null && + object.$$typeof === REACT_ELEMENT_TYPE; + }; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = __webpack_require__("../node_modules/prop-types/factoryWithTypeCheckers.js")(isValidElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = __webpack_require__("../node_modules/prop-types/factoryWithThrowingShims.js")(); } -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } +/***/ }), +/***/ "../node_modules/prop-types/lib/ReactPropTypesSecret.js": +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; +module.exports = ReactPropTypesSecret; /***/ }), -/***/ "../node_modules/prop-types/checkPropTypes.js": +/***/ "../node_modules/react-dom/cjs/react-dom.development.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. +/* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.7.0 + * react-dom.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1931,3400 +2107,3584 @@ process.umask = function() { return 0; }; -if (process.env.NODE_ENV !== 'production') { - var invariant = __webpack_require__("../node_modules/fbjs/lib/invariant.js"); - var warning = __webpack_require__("../node_modules/fbjs/lib/warning.js"); - var ReactPropTypesSecret = __webpack_require__("../node_modules/prop-types/lib/ReactPropTypesSecret.js"); - var loggedTypeFailures = {}; -} - -/** - * Assert that the values match with the type specs. - * Error messages are memorized and will only be shown once. - * - * @param {object} typeSpecs Map of name to a ReactPropType - * @param {object} values Runtime values that need to be type-checked - * @param {string} location e.g. "prop", "context", "child context" - * @param {string} componentName Name of the component for error messages. - * @param {?Function} getStack Returns the component stack. - * @private - */ -function checkPropTypes(typeSpecs, values, location, componentName, getStack) { - if (process.env.NODE_ENV !== 'production') { - for (var typeSpecName in typeSpecs) { - if (typeSpecs.hasOwnProperty(typeSpecName)) { - var error; - // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); - error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); - } catch (ex) { - error = ex; - } - warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); - if (error instanceof Error && !(error.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error.message] = true; - - var stack = getStack ? getStack() : ''; - - warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); - } - } - } - } -} - -module.exports = checkPropTypes; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) -/***/ }), +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; -/***/ "../node_modules/prop-types/factoryWithThrowingShims.js": -/***/ (function(module, exports, __webpack_require__) { +var React = __webpack_require__("../node_modules/react/index.js"); +var _assign = __webpack_require__("../node_modules/object-assign/index.js"); +var checkPropTypes = __webpack_require__("../node_modules/prop-types/checkPropTypes.js"); +var scheduler = __webpack_require__("../node_modules/scheduler/index.js"); +var tracing = __webpack_require__("../node_modules/scheduler/tracing.js"); -"use strict"; /** - * Copyright (c) 2013-present, Facebook, Inc. + * Use invariant() to assert state which your program assumes to be true. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. */ +var validateFormat = function () {}; +{ + validateFormat = function (format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; +} -var emptyFunction = __webpack_require__("../node_modules/fbjs/lib/emptyFunction.js"); -var invariant = __webpack_require__("../node_modules/fbjs/lib/invariant.js"); -var ReactPropTypesSecret = __webpack_require__("../node_modules/prop-types/lib/ReactPropTypesSecret.js"); +function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); -module.exports = function() { - function shim(props, propName, componentName, location, propFullName, secret) { - if (secret === ReactPropTypesSecret) { - // It is still safe when called from React. - return; + 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'; } - invariant( - false, - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use PropTypes.checkPropTypes() to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - }; - shim.isRequired = shim; - function getShim() { - return shim; - }; - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - var ReactPropTypes = { - array: shim, - bool: shim, - func: shim, - number: shim, - object: shim, - string: shim, - symbol: shim, - any: shim, - arrayOf: getShim, - element: shim, - instanceOf: getShim, - node: shim, - objectOf: getShim, - oneOf: getShim, - oneOfType: getShim, - shape: getShim, - exact: getShim - }; + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +} - ReactPropTypes.checkPropTypes = emptyFunction; - ReactPropTypes.PropTypes = ReactPropTypes; +// Relying on the `invariant()` implementation lets us +// preserve the format and params in the www builds. - return ReactPropTypes; +!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) { + this.onError(error); + } }; +{ + // In DEV mode, we swap out invokeGuardedCallback for a special version + // that plays more nicely with the browser's DevTools. The idea is to preserve + // "Pause on exceptions" behavior. Because React wraps all user-provided + // functions in invokeGuardedCallback, and the production version of + // invokeGuardedCallback uses a try-catch, all user exceptions are treated + // like caught exceptions, and the DevTools won't pause unless the developer + // takes the extra step of enabling pause on caught exceptions. This is + // untintuitive, though, because even though React has caught the error, from + // the developer's perspective, the error is uncaught. + // + // To preserve the expected "Pause on exceptions" behavior, we don't use a + // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake + // DOM node, and call the user-provided callback from inside an event handler + // for that fake event. If the callback throws, the error is "captured" using + // a global event handler. But because the error happens in a different + // event loop context, it does not interrupt the normal program flow. + // Effectively, this gives us try-catch behavior without actually using + // try-catch. Neat! -/***/ }), + // Check that the browser supports the APIs we need to implement our special + // DEV version of invokeGuardedCallback + if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { + var fakeNode = document.createElement('react'); -/***/ "../node_modules/prop-types/factoryWithTypeCheckers.js": -/***/ (function(module, exports, __webpack_require__) { + var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { + // If document doesn't exist we know for sure we will crash in this method + // 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. + !(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'); -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ + // 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; + // 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; + // 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 emptyFunction = __webpack_require__("../node_modules/fbjs/lib/emptyFunction.js"); -var invariant = __webpack_require__("../node_modules/fbjs/lib/invariant.js"); -var warning = __webpack_require__("../node_modules/fbjs/lib/warning.js"); -var assign = __webpack_require__("../node_modules/object-assign/index.js"); + // 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); -var ReactPropTypesSecret = __webpack_require__("../node_modules/prop-types/lib/ReactPropTypesSecret.js"); -var checkPropTypes = __webpack_require__("../node_modules/prop-types/checkPropTypes.js"); + // 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; + } -module.exports = function(isValidElement, throwOnDirectAccess) { - /* global Symbol */ - var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + func.apply(context, funcArgs); + didError = false; + } - /** - * Returns the iterator method function contained on the iterable object. - * - * Be sure to invoke the function with the iterable as context: - * - * var iteratorFn = getIteratorFn(myIterable); - * if (iteratorFn) { - * var iterator = iteratorFn.call(myIterable); - * ... - * } - * - * @param {?object} maybeIterable - * @return {?function} - */ - function getIteratorFn(maybeIterable) { - var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } - - /** - * Collection of methods that allow declaration and validation of props that are - * supplied to React components. Example usage: - * - * var Props = require('ReactPropTypes'); - * var MyArticle = React.createClass({ - * propTypes: { - * // An optional string prop named "description". - * description: Props.string, - * - * // A required enum prop named "category". - * category: Props.oneOf(['News','Photos']).isRequired, - * - * // A prop named "dialog" that requires an instance of Dialog. - * dialog: Props.instanceOf(Dialog).isRequired - * }, - * render: function() { ... } - * }); - * - * A more formal specification of how these methods are used: - * - * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) - * decl := ReactPropTypes.{type}(.isRequired)? - * - * Each and every declaration produces a function with the same signature. This - * allows the creation of custom validation functions. For example: - * - * var MyLink = React.createClass({ - * propTypes: { - * // An optional string or URI prop named "href". - * href: function(props, propName, componentName) { - * var propValue = props[propName]; - * if (propValue != null && typeof propValue !== 'string' && - * !(propValue instanceof URI)) { - * return new Error( - * 'Expected a string or an URI for ' + propName + ' in ' + - * componentName - * ); - * } - * } - * }, - * render: function() {...} - * }); - * - * @internal - */ - - var ANONYMOUS = '<>'; - - // Important! - // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. - var ReactPropTypes = { - array: createPrimitiveTypeChecker('array'), - bool: createPrimitiveTypeChecker('boolean'), - func: createPrimitiveTypeChecker('function'), - number: createPrimitiveTypeChecker('number'), - object: createPrimitiveTypeChecker('object'), - string: createPrimitiveTypeChecker('string'), - symbol: createPrimitiveTypeChecker('symbol'), + // Create a global error event handler. We use this to capture the value + // that was thrown. It's possible that this error handler will fire more + // than once; for example, if non-React code also calls `dispatchEvent` + // and a handler for that event throws. We should be resilient to most of + // those cases. Even if our error event handler fires more than once, the + // last error event is always used. If the callback actually does error, + // we know that the last error event is the correct one, because it's not + // possible for anything else to have happened in between our callback + // erroring and the code that follows the `dispatchEvent` call below. If + // the callback doesn't error, but the error event was fired, we know to + // ignore it because `didError` will be false, as described above. + var error = void 0; + // Use this to track whether the error event is ever called. + var didSetError = false; + var isCrossOriginError = false; - any: createAnyTypeChecker(), - arrayOf: createArrayOfTypeChecker, - element: createElementTypeChecker(), - instanceOf: createInstanceTypeChecker, - node: createNodeChecker(), - objectOf: createObjectOfTypeChecker, - oneOf: createEnumTypeChecker, - oneOfType: createUnionTypeChecker, - shape: createShapeTypeChecker, - exact: createStrictShapeTypeChecker, - }; + 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. + // We'll remember this to later decide whether to log it or not. + if (error != null && typeof error === 'object') { + try { + error._suppressLogging = true; + } catch (inner) { + // Ignore. + } + } + } + } - /** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ - /*eslint-disable no-self-compare*/ - function is(x, y) { - // SameValue algorithm - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - return x !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; - } - } - /*eslint-enable no-self-compare*/ + // Create a fake event type. + var evtType = 'react-' + (name ? name : 'invokeguardedcallback'); - /** - * We use an Error-like object for backward compatibility as people may call - * PropTypes directly and inspect their output. However, we don't use real - * Errors anymore. We don't inspect their stack anyway, and creating them - * is prohibitively expensive if they are created too often, such as what - * happens in oneOfType() for any type before the one that matched. - */ - function PropTypeError(message) { - this.message = message; - this.stack = ''; - } - // Make `instanceof Error` still work for returned errors. - PropTypeError.prototype = Error.prototype; + // Attach our event handlers + window.addEventListener('error', handleWindowError); + fakeNode.addEventListener(evtType, callCallback, false); - function createChainableTypeChecker(validate) { - if (process.env.NODE_ENV !== 'production') { - var manualPropTypeCallCache = {}; - var manualPropTypeWarningCount = 0; - } - function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { - componentName = componentName || ANONYMOUS; - propFullName = propFullName || propName; + // 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); - if (secret !== ReactPropTypesSecret) { - if (throwOnDirectAccess) { - // New behavior only for users of `prop-types` package - invariant( - false, - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use `PropTypes.checkPropTypes()` to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { - // Old behavior for people using React.PropTypes - var cacheKey = componentName + ':' + propName; - if ( - !manualPropTypeCallCache[cacheKey] && - // Avoid spamming the console because they are often not actionable except for lib authors - manualPropTypeWarningCount < 3 - ) { - warning( - false, - 'You are manually calling a React.PropTypes validation ' + - 'function for the `%s` prop on `%s`. This is deprecated ' + - 'and will throw in the standalone `prop-types` package. ' + - 'You may be seeing this warning due to a third-party PropTypes ' + - 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', - propFullName, - componentName - ); - manualPropTypeCallCache[cacheKey] = true; - manualPropTypeWarningCount++; - } - } + if (windowEventDescriptor) { + Object.defineProperty(window, 'event', windowEventDescriptor); } - if (props[propName] == null) { - if (isRequired) { - if (props[propName] === null) { - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); - } - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + + if (didError) { + if (!didSetError) { + // The callback errored, but the error event never fired. + error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); + } else if (isCrossOriginError) { + error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); } - return null; - } else { - return validate(props, propName, componentName, location, propFullName); + this.onError(error); } - } - var chainedCheckType = checkType.bind(null, false); - chainedCheckType.isRequired = checkType.bind(null, true); + // Remove our event listeners + window.removeEventListener('error', handleWindowError); + }; - return chainedCheckType; + invokeGuardedCallbackImpl = invokeGuardedCallbackDev; } +} - function createPrimitiveTypeChecker(expectedType) { - function validate(props, propName, componentName, location, propFullName, secret) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== expectedType) { - // `propValue` being instance of, say, date/regexp, pass the 'object' - // check, but we can offer a more precise error message here rather than - // 'of type `object`'. - var preciseType = getPreciseType(propValue); +var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } +// Used by Fiber to simulate a try-catch. +var hasError = false; +var caughtError = null; - function createAnyTypeChecker() { - return createChainableTypeChecker(emptyFunction.thatReturnsNull); +// 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; } +}; - function createArrayOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); - } - var propValue = props[propName]; - if (!Array.isArray(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); - } - for (var i = 0; i < propValue.length; i++) { - var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - return null; +/** + * Call a function while guarding against errors that happens within it. + * Returns an error if it throws, otherwise null. + * + * In production, this is implemented using a try-catch. The reason we don't + * use a try-catch directly is so that we can swap out a different + * implementation in DEV mode. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} context The context to use when calling the function + * @param {...*} args Arguments for function + */ +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. + * TODO: See if caughtError and rethrowError can be unified. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} context The context to use when calling the function + * @param {...*} args Arguments for function + */ +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; } - return createChainableTypeChecker(validate); } +} - function createElementTypeChecker() { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - if (!isValidElement(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); - } - return null; - } - return createChainableTypeChecker(validate); +/** + * 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; + hasRethrowError = false; + rethrowError = null; + throw error; } +} - function createInstanceTypeChecker(expectedClass) { - function validate(props, propName, componentName, location, propFullName) { - if (!(props[propName] instanceof expectedClass)) { - var expectedClassName = expectedClass.name || ANONYMOUS; - var actualClassName = getClassName(props[propName]); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); +function hasCaughtError() { + return hasError; +} + +function clearCaughtError() { + if (hasError) { + var error = caughtError; + hasError = false; + caughtError = null; + return error; + } else { + invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'); } +} - function createEnumTypeChecker(expectedValues) { - if (!Array.isArray(expectedValues)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } +/** + * Injectable ordering of event plugins. + */ +var eventPluginOrder = null; - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - for (var i = 0; i < expectedValues.length; i++) { - if (is(propValue, expectedValues[i])) { - return null; - } - } +/** + * Injectable mapping from names to event plugin modules. + */ +var namesToPlugins = {}; - var valuesString = JSON.stringify(expectedValues); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); - } - return createChainableTypeChecker(validate); +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; } - - function createObjectOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); - } - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); - } - for (var key in propValue) { - if (propValue.hasOwnProperty(key)) { - var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - } - return null; + 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; } - return createChainableTypeChecker(validate); } +} - function createUnionTypeChecker(arrayOfTypeCheckers) { - if (!Array.isArray(arrayOfTypeCheckers)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } +/** + * 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; - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (typeof checker !== 'function') { - warning( - false, - 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + - 'received %s at index %s.', - getPostfixForTypeWarning(checker), - i - ); - return emptyFunction.thatReturnsNull; + 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; +} - function validate(props, propName, componentName, location, propFullName) { - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { - return null; - } - } +/** + * 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; - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); - } - return createChainableTypeChecker(validate); - } + { + var lowerCasedName = registrationName.toLowerCase(); + possibleRegistrationNames[lowerCasedName] = registrationName; - function createNodeChecker() { - function validate(props, propName, componentName, location, propFullName) { - if (!isNode(props[propName])) { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); - } - return null; + if (registrationName === 'onDoubleClick') { + possibleRegistrationNames.ondblclick = registrationName; } - return createChainableTypeChecker(validate); } +} - function createShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - for (var key in shapeTypes) { - var checker = shapeTypes[key]; - if (!checker) { - continue; - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } +/** + * Registers plugins so that they can extract and dispatch events. + * + * @see {EventPluginHub} + */ - function createStrictShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - // We need to check all keys in case some are required but missing from - // props. - var allKeys = assign({}, props[propName], shapeTypes); - for (var key in allKeys) { - var checker = shapeTypes[key]; - if (!checker) { - return new PropTypeError( - 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + - '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + - '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') - ); - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } +/** + * Ordered list of injected plugins. + */ +var plugins = []; - return createChainableTypeChecker(validate); - } +/** + * Mapping from event name to dispatch config + */ +var eventNameDispatchConfigs = {}; - function isNode(propValue) { - switch (typeof propValue) { - case 'number': - case 'string': - case 'undefined': - return true; - case 'boolean': - return !propValue; - case 'object': - if (Array.isArray(propValue)) { - return propValue.every(isNode); - } - if (propValue === null || isValidElement(propValue)) { - return true; - } +/** + * Mapping from registration name to plugin module + */ +var registrationNameModules = {}; - var iteratorFn = getIteratorFn(propValue); - if (iteratorFn) { - var iterator = iteratorFn.call(propValue); - var step; - if (iteratorFn !== propValue.entries) { - while (!(step = iterator.next()).done) { - if (!isNode(step.value)) { - return false; - } - } - } else { - // Iterator will provide entry [k,v] tuples rather than values. - while (!(step = iterator.next()).done) { - var entry = step.value; - if (entry) { - if (!isNode(entry[1])) { - return false; - } - } - } - } - } else { - return false; - } +/** + * Mapping from registration name to event name + */ +var registrationNameDependencies = {}; - return true; - default: - return false; - } - } +/** + * 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 - function isSymbol(propType, propValue) { - // Native Symbol. - if (propType === 'symbol') { - return 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(); +} - // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' - if (propValue['@@toStringTag'] === 'Symbol') { - return true; +/** + * 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; } - - // Fallback for non-spec compliant Symbols which are polyfilled. - if (typeof Symbol === 'function' && propValue instanceof Symbol) { - return true; + 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; } - - return false; } + if (isOrderingDirty) { + recomputePluginOrdering(); + } +} - // Equivalent of `typeof` but with special handling for array and regexp. - function getPropType(propValue) { - var propType = typeof propValue; - if (Array.isArray(propValue)) { - return 'array'; - } - if (propValue instanceof RegExp) { - // Old webkits (at least until Android 4.0) return 'function' rather than - // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ - // passes PropTypes.object. - return 'object'; - } - if (isSymbol(propType, propValue)) { - return 'symbol'; +/** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var warningWithoutStack = function () {}; + +{ + warningWithoutStack = function (condition, format) { + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; } - return propType; - } - // This handles more types than `getPropType`. Only used for error messages. - // See `createPrimitiveTypeChecker`. - function getPreciseType(propValue) { - if (typeof propValue === 'undefined' || propValue === null) { - return '' + propValue; + if (format === undefined) { + throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument'); } - var propType = getPropType(propValue); - if (propType === 'object') { - if (propValue instanceof Date) { - return 'date'; - } else if (propValue instanceof RegExp) { - return 'regexp'; - } + if (args.length > 8) { + // Check before the condition to catch violations early. + throw new Error('warningWithoutStack() currently supports at most 8 arguments.'); } - return propType; - } - - // Returns a string that is postfixed to a warning about an invalid type. - // For example, "undefined" or "of type array" - function getPostfixForTypeWarning(value) { - var type = getPreciseType(value); - switch (type) { - case 'array': - case 'object': - return 'an ' + type; - case 'boolean': - case 'date': - case 'regexp': - return 'a ' + type; - default: - return type; + if (condition) { + return; } - } + if (typeof console !== 'undefined') { + var argsWithFormat = args.map(function (item) { + return '' + item; + }); + argsWithFormat.unshift('Warning: ' + format); - // Returns class name of the object, if any. - function getClassName(propValue) { - if (!propValue.constructor || !propValue.constructor.name) { - return ANONYMOUS; + // 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); } - return propValue.constructor.name; - } - - ReactPropTypes.checkPropTypes = checkPropTypes; - ReactPropTypes.PropTypes = ReactPropTypes; + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + throw new Error(message); + } catch (x) {} + }; +} - return ReactPropTypes; -}; +var warningWithoutStack$1 = warningWithoutStack; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) +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; + } +} -/***/ "../node_modules/prop-types/index.js": -/***/ (function(module, exports, __webpack_require__) { +var validateEventDispatches = void 0; +{ + validateEventDispatches = function (event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ + var listenersIsArr = Array.isArray(dispatchListeners); + var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; -if (process.env.NODE_ENV !== 'production') { - var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && - Symbol.for && - Symbol.for('react.element')) || - 0xeac7; + var instancesIsArr = Array.isArray(dispatchInstances); + var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; - var isValidElement = function(object) { - return typeof object === 'object' && - object !== null && - object.$$typeof === REACT_ELEMENT_TYPE; + !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0; }; +} - // By explicitly using `prop-types` you are opting into new development behavior. - // http://fb.me/prop-types-in-prod - var throwOnDirectAccess = true; - module.exports = __webpack_require__("../node_modules/prop-types/factoryWithTypeCheckers.js")(isValidElement, throwOnDirectAccess); -} else { - // By explicitly using `prop-types` you are opting into new production behavior. - // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__("../node_modules/prop-types/factoryWithThrowingShims.js")(); +/** + * 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; } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) +/** + * 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. + executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); + } + } else if (dispatchListeners) { + executeDispatch(event, dispatchListeners, dispatchInstances); + } + event._dispatchListeners = null; + event._dispatchInstances = null; +} -/***/ }), +/** + * @see executeDispatchesInOrderStopAtTrueImpl + */ -/***/ "../node_modules/prop-types/lib/ReactPropTypesSecret.js": -/***/ (function(module, exports, __webpack_require__) { -"use strict"; /** - * Copyright (c) 2013-present, Facebook, Inc. + * Execution of a "direct" dispatch - there must be at most one dispatch + * accumulated on the event or it is considered an error. It doesn't really make + * sense for an event with multiple dispatches (bubbled) to keep track of the + * return values at each dispatch execution, but it does tend to make sense when + * dealing with "direct" dispatches. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * @return {*} The return value of executing the single dispatch. */ +/** + * @param {SyntheticEvent} event + * @return {boolean} True iff number of dispatches accumulated is greater than 0. + */ -var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - -module.exports = ReactPropTypesSecret; - - -/***/ }), - -/***/ "../node_modules/react-dom/cjs/react-dom.development.js": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.2.0 - * react-dom.development.js +/** + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: * - * Copyright (c) 2013-present, Facebook, Inc. + * `a = accumulateInto(a, b);` * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This API should be sparingly used. Try `accumulate` for something cleaner. + * + * @return {*|array<*>} An accumulation of items. */ +function accumulateInto(current, next) { + !(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 + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + if (Array.isArray(next)) { + current.push.apply(current, next); + return current; + } + current.push(next); + return current; + } + if (Array.isArray(next)) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -var React = __webpack_require__("../node_modules/react/index.js"); -var invariant = __webpack_require__("../node_modules/fbjs/lib/invariant.js"); -var warning = __webpack_require__("../node_modules/fbjs/lib/warning.js"); -var ExecutionEnvironment = __webpack_require__("../node_modules/fbjs/lib/ExecutionEnvironment.js"); -var _assign = __webpack_require__("../node_modules/object-assign/index.js"); -var emptyFunction = __webpack_require__("../node_modules/fbjs/lib/emptyFunction.js"); -var EventListener = __webpack_require__("../node_modules/fbjs/lib/EventListener.js"); -var getActiveElement = __webpack_require__("../node_modules/fbjs/lib/getActiveElement.js"); -var shallowEqual = __webpack_require__("../node_modules/fbjs/lib/shallowEqual.js"); -var containsNode = __webpack_require__("../node_modules/fbjs/lib/containsNode.js"); -var focusNode = __webpack_require__("../node_modules/fbjs/lib/focusNode.js"); -var emptyObject = __webpack_require__("../node_modules/fbjs/lib/emptyObject.js"); -var checkPropTypes = __webpack_require__("../node_modules/prop-types/checkPropTypes.js"); -var hyphenateStyleName = __webpack_require__("../node_modules/fbjs/lib/hyphenateStyleName.js"); -var camelizeStyleName = __webpack_require__("../node_modules/fbjs/lib/camelizeStyleName.js"); + return [current, next]; +} /** - * WARNING: DO NOT manually require this module. - * This is a replacement for `invariant(...)` used by the error code system - * and will _only_ be required by the corresponding babel pass. - * It always throws. + * @param {array} arr an "accumulation" of items which is either an Array or + * a single item. Useful when paired with the `accumulate` module. This is a + * simple utility that allows us to reason about a collection of items, but + * handling the case when there is exactly one item (and we do not need to + * allocate an array). + * @param {function} cb Callback invoked with each element or a collection. + * @param {?} [scope] Scope used as `this` in a callback. */ - -!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0; - -// These attributes should be all lowercase to allow for -// case insensitive checks -var RESERVED_PROPS = { - children: true, - dangerouslySetInnerHTML: true, - defaultValue: true, - defaultChecked: true, - innerHTML: true, - suppressContentEditableWarning: true, - suppressHydrationWarning: true, - style: true -}; - -function checkMask(value, bitmask) { - return (value & bitmask) === bitmask; +function forEachAccumulated(arr, cb, scope) { + if (Array.isArray(arr)) { + arr.forEach(cb, scope); + } else if (arr) { + cb.call(scope, arr); + } } -var DOMPropertyInjection = { - /** - * Mapping from normalized, camelcased property names to a configuration that - * specifies how the associated DOM property should be accessed or rendered. - */ - MUST_USE_PROPERTY: 0x1, - HAS_BOOLEAN_VALUE: 0x4, - HAS_NUMERIC_VALUE: 0x8, - HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, - HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, - HAS_STRING_BOOLEAN_VALUE: 0x40, - - /** - * Inject some specialized knowledge about the DOM. This takes a config object - * with the following properties: - * - * Properties: object mapping DOM property name to one of the - * DOMPropertyInjection constants or null. If your attribute isn't in here, - * it won't get written to the DOM. - * - * DOMAttributeNames: object mapping React attribute name to the DOM - * attribute name. Attribute names not specified use the **lowercase** - * normalized name. - * - * DOMAttributeNamespaces: object mapping React attribute name to the DOM - * attribute namespace URL. (Attribute names not specified use no namespace.) - * - * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. - * Property names not specified use the normalized name. - * - * DOMMutationMethods: Properties that require special mutation methods. If - * `value` is undefined, the mutation method should unset the property. - * - * @param {object} domPropertyConfig the config as described above. - */ - injectDOMPropertyConfig: function (domPropertyConfig) { - var Injection = DOMPropertyInjection; - var Properties = domPropertyConfig.Properties || {}; - var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; - var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; - var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; - - for (var propName in Properties) { - !!properties.hasOwnProperty(propName) ? invariant(false, "injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.", propName) : void 0; - - var lowerCased = propName.toLowerCase(); - var propConfig = Properties[propName]; - - var propertyInfo = { - attributeName: lowerCased, - attributeNamespace: null, - propertyName: propName, - mutationMethod: null, - - mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), - hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), - hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), - hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), - hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE), - hasStringBooleanValue: checkMask(propConfig, Injection.HAS_STRING_BOOLEAN_VALUE) - }; - !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant(false, "DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s", propName) : void 0; - - if (DOMAttributeNames.hasOwnProperty(propName)) { - var attributeName = DOMAttributeNames[propName]; - - propertyInfo.attributeName = attributeName; - } - - if (DOMAttributeNamespaces.hasOwnProperty(propName)) { - propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; - } +/** + * Internal queue of events that have accumulated their dispatches and are + * waiting to have their dispatches executed. + */ +var eventQueue = null; - if (DOMMutationMethods.hasOwnProperty(propName)) { - propertyInfo.mutationMethod = DOMMutationMethods[propName]; - } +/** + * 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); - // Downcase references to whitelist properties to check for membership - // without case-sensitivity. This allows the whitelist to pick up - // `allowfullscreen`, which should be written using the property configuration - // for `allowFullscreen` - properties[propName] = propertyInfo; + if (!event.isPersistent()) { + event.constructor.release(event); } } }; +var executeDispatchesAndReleaseTopLevel = function (e) { + return executeDispatchesAndRelease(e); +}; -/* 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"; - +function isInteractive(tag) { + return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; +} -var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; +function shouldPreventMouseEvent(name, type, props) { + switch (name) { + case 'onClick': + case 'onClickCapture': + case 'onDoubleClick': + case 'onDoubleClickCapture': + case 'onMouseDown': + case 'onMouseDownCapture': + case 'onMouseMove': + case 'onMouseMoveCapture': + case 'onMouseUp': + case 'onMouseUpCapture': + return !!(props.disabled && isInteractive(type)); + default: + return false; + } +} /** - * Map from property "standard name" to an object with info about how to set - * the property in the DOM. Each object contains: + * This is a unified interface for event plugins to be installed and configured. + * + * Event plugins can implement the following properties: + * + * `extractEvents` {function(string, DOMEventTarget, string, object): *} + * Required. When a top-level event is fired, this method is expected to + * extract synthetic events that will in turn be queued and dispatched. + * + * `eventTypes` {object} + * Optional, plugins that fire events must publish a mapping of registration + * names that are used to register listeners. Values of this mapping must + * be objects that contain `registrationName` or `phasedRegistrationNames`. + * + * `executeDispatch` {function(object, function, string)} + * Optional, allows plugins to override how an event gets dispatched. By + * default, the listener is simply invoked. * - * attributeName: - * Used when rendering markup or with `*Attribute()`. - * attributeNamespace - * propertyName: - * Used on DOM node instances. (This includes properties that mutate due to - * external factors.) - * mutationMethod: - * If non-null, used instead of the property or `setAttribute()` after - * initial render. - * mustUseProperty: - * Whether the property must be accessed and mutated as an object property. - * hasBooleanValue: - * Whether the property should be removed when set to a falsey value. - * hasNumericValue: - * Whether the property must be numeric or parse as a numeric and should be - * removed when set to a falsey value. - * hasPositiveNumericValue: - * Whether the property must be positive numeric or parse as a positive - * numeric and should be removed when set to a falsey value. - * hasOverloadedBooleanValue: - * Whether the property can be used as a flag as well as with a value. - * Removed when strictly equal to false; present without a value when - * strictly equal to true; present with a value otherwise. + * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * + * @public */ -var properties = {}; /** - * Checks whether a property name is a writeable attribute. - * @method + * Methods for injecting dependencies. */ -function shouldSetAttribute(name, value) { - if (isReservedProp(name)) { - return false; - } - if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { - return false; - } - if (value === null) { - return true; - } - switch (typeof value) { - case 'boolean': - return shouldAttributeAcceptBooleanValue(name); - case 'undefined': - case 'number': - case 'string': - case 'object': - return true; - default: - // function, symbol - return false; - } -} +var injection = { + /** + * @param {array} InjectedEventPluginOrder + * @public + */ + injectEventPluginOrder: injectEventPluginOrder, -function getPropertyInfo(name) { - return properties.hasOwnProperty(name) ? properties[name] : null; -} + /** + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + */ + injectEventPluginsByName: injectEventPluginsByName +}; -function shouldAttributeAcceptBooleanValue(name) { - if (isReservedProp(name)) { - return true; +/** + * @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 = 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 propertyInfo = getPropertyInfo(name); - if (propertyInfo) { - return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue; + var props = getFiberCurrentPropsFromNode(stateNode); + if (!props) { + // Work in progress. + return null; } - var prefix = name.toLowerCase().slice(0, 5); - return prefix === 'data-' || prefix === 'aria-'; + listener = props[registrationName]; + if (shouldPreventMouseEvent(registrationName, inst.type, props)) { + return null; + } + !(!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; } /** - * Checks to see if a property name is within the list of properties - * reserved for internal React operations. These properties should - * not be set on an HTML element. + * Allows registered plugins an opportunity to extract events from top-level + * native browser events. * - * @private - * @param {string} name - * @return {boolean} If the name is within reserved props + * @return {*} An accumulation of synthetic events. + * @internal */ -function isReservedProp(name) { - return RESERVED_PROPS.hasOwnProperty(name); -} - -var injection = DOMPropertyInjection; - -var MUST_USE_PROPERTY = injection.MUST_USE_PROPERTY; -var HAS_BOOLEAN_VALUE = injection.HAS_BOOLEAN_VALUE; -var HAS_NUMERIC_VALUE = injection.HAS_NUMERIC_VALUE; -var HAS_POSITIVE_NUMERIC_VALUE = injection.HAS_POSITIVE_NUMERIC_VALUE; -var HAS_OVERLOADED_BOOLEAN_VALUE = injection.HAS_OVERLOADED_BOOLEAN_VALUE; -var HAS_STRING_BOOLEAN_VALUE = injection.HAS_STRING_BOOLEAN_VALUE; - -var HTMLDOMPropertyConfig = { - // When adding attributes to this list, be sure to also add them to - // the `possibleStandardNames` module to ensure casing and incorrect - // name warnings. - Properties: { - allowFullScreen: HAS_BOOLEAN_VALUE, - // specifies target context for links with `preload` type - async: HAS_BOOLEAN_VALUE, - // 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: HAS_BOOLEAN_VALUE, - autoPlay: HAS_BOOLEAN_VALUE, - capture: HAS_OVERLOADED_BOOLEAN_VALUE, - checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, - cols: HAS_POSITIVE_NUMERIC_VALUE, - contentEditable: HAS_STRING_BOOLEAN_VALUE, - controls: HAS_BOOLEAN_VALUE, - 'default': HAS_BOOLEAN_VALUE, - defer: HAS_BOOLEAN_VALUE, - disabled: HAS_BOOLEAN_VALUE, - download: HAS_OVERLOADED_BOOLEAN_VALUE, - draggable: HAS_STRING_BOOLEAN_VALUE, - formNoValidate: HAS_BOOLEAN_VALUE, - hidden: HAS_BOOLEAN_VALUE, - loop: HAS_BOOLEAN_VALUE, - // Caution; `option.selected` is not updated if `select.multiple` is - // disabled with `removeAttribute`. - multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, - muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, - noValidate: HAS_BOOLEAN_VALUE, - open: HAS_BOOLEAN_VALUE, - playsInline: HAS_BOOLEAN_VALUE, - readOnly: HAS_BOOLEAN_VALUE, - required: HAS_BOOLEAN_VALUE, - reversed: HAS_BOOLEAN_VALUE, - rows: HAS_POSITIVE_NUMERIC_VALUE, - rowSpan: HAS_NUMERIC_VALUE, - scoped: HAS_BOOLEAN_VALUE, - seamless: HAS_BOOLEAN_VALUE, - selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, - size: HAS_POSITIVE_NUMERIC_VALUE, - start: HAS_NUMERIC_VALUE, - // support for projecting regular DOM Elements via V1 named slots ( shadow dom ) - span: HAS_POSITIVE_NUMERIC_VALUE, - spellCheck: HAS_STRING_BOOLEAN_VALUE, - // Style must be explicitly set in the attribute list. React components - // expect a style object - style: 0, - // Keep it in the whitelist because it is case-sensitive for SVG. - tabIndex: 0, - // itemScope is for for Microdata support. - // See http://schema.org/docs/gs.html - itemScope: HAS_BOOLEAN_VALUE, - // These attributes must stay in the white-list because they have - // different attribute names (see DOMAttributeNames below) - acceptCharset: 0, - className: 0, - htmlFor: 0, - httpEquiv: 0, - // Attributes with mutation methods must be specified in the whitelist - // Set the string boolean flag to allow the behavior - value: HAS_STRING_BOOLEAN_VALUE - }, - DOMAttributeNames: { - acceptCharset: 'accept-charset', - className: 'class', - htmlFor: 'for', - httpEquiv: 'http-equiv' - }, - DOMMutationMethods: { - value: function (node, value) { - if (value == null) { - return node.removeAttribute('value'); - } - - // Number inputs get special treatment due to some edge cases in - // Chrome. Let everything else assign the value attribute as normal. - // https://github.com/facebook/react/issues/7253#issuecomment-236074326 - if (node.type !== 'number' || node.hasAttribute('value') === false) { - node.setAttribute('value', '' + value); - } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) { - // Don't assign an attribute if validation reports bad - // input. Chrome will clear the value. Additionally, don't - // operate on inputs that have focus, otherwise Chrome might - // strip off trailing decimal places and cause the user's - // cursor position to jump to the beginning of the input. - // - // In ReactDOMInput, we have an onBlur event that will trigger - // this function again when focus is lost. - node.setAttribute('value', '' + value); +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); + if (extractedEvents) { + events = accumulateInto(events, extractedEvents); } } } -}; - -var HAS_STRING_BOOLEAN_VALUE$1 = injection.HAS_STRING_BOOLEAN_VALUE; - + return events; +} -var NS = { - xlink: 'http://www.w3.org/1999/xlink', - xml: 'http://www.w3.org/XML/1998/namespace' -}; +function runEventsInBatch(events) { + if (events !== null) { + eventQueue = accumulateInto(eventQueue, events); + } -/** - * This is a list of all SVG attributes that need special casing, - * namespacing, or boolean value assignment. - * - * When adding attributes to this list, be sure to also add them to - * the `possibleStandardNames` module to ensure casing and incorrect - * name warnings. - * - * SVG Attributes List: - * https://www.w3.org/TR/SVG/attindex.html - * SMIL Spec: - * https://www.w3.org/TR/smil - */ -var ATTRS = ['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', 'x-height', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xmlns:xlink', 'xml:lang', 'xml:space']; + // Set `eventQueue` to null before processing it so that we can tell if more + // events get enqueued while processing. + var processingEventQueue = eventQueue; + eventQueue = null; -var SVGDOMPropertyConfig = { - Properties: { - autoReverse: HAS_STRING_BOOLEAN_VALUE$1, - externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE$1, - preserveAlpha: HAS_STRING_BOOLEAN_VALUE$1 - }, - DOMAttributeNames: { - autoReverse: 'autoReverse', - externalResourcesRequired: 'externalResourcesRequired', - preserveAlpha: 'preserveAlpha' - }, - DOMAttributeNamespaces: { - xlinkActuate: NS.xlink, - xlinkArcrole: NS.xlink, - xlinkHref: NS.xlink, - xlinkRole: NS.xlink, - xlinkShow: NS.xlink, - xlinkTitle: NS.xlink, - xlinkType: NS.xlink, - xmlBase: NS.xml, - xmlLang: NS.xml, - xmlSpace: NS.xml + if (!processingEventQueue) { + return; } -}; - -var CAMELIZE = /[\-\:]([a-z])/g; -var capitalize = function (token) { - return token[1].toUpperCase(); -}; -ATTRS.forEach(function (original) { - var reactName = original.replace(CAMELIZE, capitalize); + 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(); +} - SVGDOMPropertyConfig.Properties[reactName] = 0; - SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original; -}); +function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); + runEventsInBatch(events); +} -injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig); -injection.injectDOMPropertyConfig(SVGDOMPropertyConfig); +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; +var Mode = 8; +var ContextConsumer = 9; +var ContextProvider = 10; +var ForwardRef = 11; +var Profiler = 12; +var SuspenseComponent = 13; +var MemoComponent = 14; +var SimpleMemoComponent = 15; +var LazyComponent = 16; +var IncompleteClassComponent = 17; -var ReactErrorUtils = { - // Used by Fiber to simulate a try-catch. - _caughtError: null, - _hasCaughtError: false, +var randomKey = Math.random().toString(36).slice(2); +var internalInstanceKey = '__reactInternalInstance$' + randomKey; +var internalEventHandlersKey = '__reactEventHandlers$' + randomKey; - // Used by event system to capture/rethrow the first error. - _rethrowError: null, - _hasRethrowError: false, +function precacheFiberNode(hostInst, node) { + node[internalInstanceKey] = hostInst; +} - injection: { - injectErrorUtils: function (injectedErrorUtils) { - !(typeof injectedErrorUtils.invokeGuardedCallback === 'function') ? invariant(false, 'Injected invokeGuardedCallback() must be a function.') : void 0; - invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback; - } - }, - - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - invokeGuardedCallback: function (name, func, context, a, b, c, d, e, f) { - invokeGuardedCallback.apply(ReactErrorUtils, arguments); - }, +/** + * Given a DOM node, return the closest ReactDOMComponent or + * ReactDOMTextComponent instance ancestor. + */ +function getClosestInstanceFromNode(node) { + if (node[internalInstanceKey]) { + return node[internalInstanceKey]; + } - /** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if _caughtError and _rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - invokeGuardedCallbackAndCatchFirstError: function (name, func, context, a, b, c, d, e, f) { - ReactErrorUtils.invokeGuardedCallback.apply(this, arguments); - if (ReactErrorUtils.hasCaughtError()) { - var error = ReactErrorUtils.clearCaughtError(); - if (!ReactErrorUtils._hasRethrowError) { - ReactErrorUtils._hasRethrowError = true; - ReactErrorUtils._rethrowError = error; - } + 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; } - }, + } - /** - * During execution of guarded functions we will capture the first error which - * we will rethrow to be handled by the top level error handler. - */ - rethrowCaughtError: function () { - return rethrowCaughtError.apply(ReactErrorUtils, arguments); - }, + var inst = node[internalInstanceKey]; + if (inst.tag === HostComponent || inst.tag === HostText) { + // In Fiber, this will always be the deepest root. + return inst; + } - hasCaughtError: function () { - return ReactErrorUtils._hasCaughtError; - }, + return null; +} - clearCaughtError: function () { - if (ReactErrorUtils._hasCaughtError) { - var error = ReactErrorUtils._caughtError; - ReactErrorUtils._caughtError = null; - ReactErrorUtils._hasCaughtError = false; - return error; +/** + * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent + * instance, or null if the node was not rendered by this React. + */ +function getInstanceFromNode$1(node) { + var inst = node[internalInstanceKey]; + if (inst) { + if (inst.tag === HostComponent || inst.tag === HostText) { + return inst; } else { - invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'); + return null; } } -}; + return null; +} -var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) { - ReactErrorUtils._hasCaughtError = false; - ReactErrorUtils._caughtError = null; - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - ReactErrorUtils._caughtError = error; - ReactErrorUtils._hasCaughtError = true; +/** + * 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; } -}; - -{ - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // untintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { - var fakeNode = document.createElement('react'); - - var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { - // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - var didError = true; - - // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - var funcArgs = Array.prototype.slice.call(arguments, 3); - function callCallback() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); - func.apply(context, funcArgs); - didError = false; - } - - // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - var error = void 0; - // Use this to track whether the error event is ever called. - var didSetError = false; - var isCrossOriginError = false; - function onError(event) { - error = event.error; - didSetError = true; - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - } + // 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.'); +} - // Create a fake event type. - var evtType = 'react-' + (name ? name : 'invokeguardedcallback'); +function getFiberCurrentPropsFromNode$1(node) { + return node[internalEventHandlersKey] || null; +} - // Attach our event handlers - window.addEventListener('error', onError); - fakeNode.addEventListener(evtType, callCallback, false); +function updateFiberProps(node, props) { + node[internalEventHandlersKey] = props; +} - // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - var evt = document.createEvent('Event'); - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); +function getParent(inst) { + do { + 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; +} - if (didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); - } else if (isCrossOriginError) { - error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); - } - ReactErrorUtils._hasCaughtError = true; - ReactErrorUtils._caughtError = error; - } else { - ReactErrorUtils._hasCaughtError = false; - ReactErrorUtils._caughtError = null; - } +/** + * 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++; + } - // Remove our event listeners - window.removeEventListener('error', onError); - }; + // If A is deeper, crawl up. + while (depthA - depthB > 0) { + instA = getParent(instA); + depthA--; + } - invokeGuardedCallback = invokeGuardedCallbackDev; + // If B is deeper, crawl up. + while (depthB - depthA > 0) { + instB = getParent(instB); + depthB--; } -} -var rethrowCaughtError = function () { - if (ReactErrorUtils._hasRethrowError) { - var error = ReactErrorUtils._rethrowError; - ReactErrorUtils._rethrowError = null; - ReactErrorUtils._hasRethrowError = false; - throw error; + // 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; +} /** - * Injectable ordering of event plugins. + * Return if A is an ancestor of B. */ -var eventPluginOrder = null; + /** - * Injectable mapping from names to event plugin modules. + * Return the parent instance of the passed-in instance. */ -var namesToPlugins = {}; + /** - * Recomputes the plugin list using the injected plugins and plugin ordering. - * - * @private + * Simulates the traversal of a two-phase, capture/bubble event dispatch. */ -function recomputePluginOrdering() { - if (!eventPluginOrder) { - // Wait until an `eventPluginOrder` is injected. - return; +function traverseTwoPhase(inst, fn, arg) { + var path = []; + while (inst) { + path.push(inst); + inst = getParent(inst); } - 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; - } + 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); } } /** - * Publishes an event so that it can be dispatched by the supplied plugin. + * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that + * should would receive a `mouseEnter` or `mouseLeave` event. * - * @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 + * Does not invoke the callback on the nearest common ancestor because nothing + * "entered" or "left" that element. */ -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); - } +function traverseEnterLeave(from, to, fn, argFrom, argTo) { + var common = from && to ? getLowestCommonAncestor(from, to) : null; + var pathFrom = []; + while (true) { + if (!from) { + break; } - return true; - } else if (dispatchConfig.registrationName) { - publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); - return true; + if (from === common) { + break; + } + var alternate = from.alternate; + if (alternate !== null && alternate === common) { + break; + } + pathFrom.push(from); + from = getParent(from); } - 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; + 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); } } /** - * 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 + * Some event types have a notion of different registration names for different + * "phases" of propagation. This finds listeners by a given phase. */ -var eventNameDispatchConfigs = {}; +function listenerAtPhase(inst, event, propagationPhase) { + var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; + return getListener(inst, registrationName); +} /** - * Mapping from registration name to plugin module + * 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. */ -var registrationNameModules = {}; /** - * Mapping from registration name to event name + * 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. */ -var registrationNameDependencies = {}; +function accumulateDirectionalDispatches(inst, phase, event) { + { + !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0; + } + var listener = listenerAtPhase(inst, event, phase); + if (listener) { + event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } +} /** - * 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} + * 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. */ -var possibleRegistrationNames = {}; -// Trust the developer to only use possibleRegistrationNames in true +function accumulateTwoPhaseDispatchesSingle(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); + } +} /** - * 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} + * 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 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(); +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); + } + } } /** - * 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} + * Accumulates dispatches on an `SyntheticEvent`, but only for the + * `dispatchMarker`. + * @param {SyntheticEvent} event */ -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(); +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + accumulateDispatches(event._targetInst, null, event); } } -var EventPluginRegistry = Object.freeze({ - plugins: plugins, - eventNameDispatchConfigs: eventNameDispatchConfigs, - registrationNameModules: registrationNameModules, - registrationNameDependencies: registrationNameDependencies, - possibleRegistrationNames: possibleRegistrationNames, - injectEventPluginOrder: injectEventPluginOrder, - injectEventPluginsByName: injectEventPluginsByName -}); - -var getFiberCurrentPropsFromNode = null; -var getInstanceFromNode = null; -var getNodeFromInstance = null; +function accumulateTwoPhaseDispatches(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); +} -var injection$2 = { - injectComponentTree: function (Injected) { - getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode; - getInstanceFromNode = Injected.getInstanceFromNode; - getNodeFromInstance = Injected.getNodeFromInstance; - { - warning(getNodeFromInstance && getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); - } - } -}; +function accumulateEnterLeaveDispatches(leave, enter, from, to) { + traverseEnterLeave(from, to, accumulateDispatches, leave, enter); +} +function accumulateDirectDispatches(events) { + forEachAccumulated(events, accumulateDirectDispatchesSingle); +} +var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); +// Do not uses the below two methods directly! +// Instead use constants exported from DOMTopLevelEventTypes in ReactDOM. +// (It is the only module that is allowed to access these methods.) +function unsafeCastStringToDOMTopLevelType(topLevelType) { + return topLevelType; +} -var validateEventDispatches; -{ - validateEventDispatches = function (event) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; +function unsafeCastDOMTopLevelTypeToString(topLevelType) { + return topLevelType; +} - var listenersIsArr = Array.isArray(dispatchListeners); - var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; +/** + * Generate a mapping of standard vendor prefixes using the defined style property and event name. + * + * @param {string} styleProp + * @param {string} eventName + * @returns {object} + */ +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; - var instancesIsArr = Array.isArray(dispatchInstances); - var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes['Webkit' + styleProp] = 'webkit' + eventName; + prefixes['Moz' + styleProp] = 'moz' + eventName; - warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.'); - }; + return prefixes; } /** - * Dispatch the event to the listener. - * @param {SyntheticEvent} event SyntheticEvent to handle - * @param {boolean} simulated If the event is simulated (changes exn behavior) - * @param {function} listener Application-level callback - * @param {*} inst Internal component instance + * A list of event names to a configurable list of vendor prefixes. */ -function executeDispatch(event, simulated, listener, inst) { - var type = event.type || 'unknown-event'; - event.currentTarget = getNodeFromInstance(inst); - ReactErrorUtils.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); - event.currentTarget = null; -} +var vendorPrefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + animationiteration: makePrefixMap('Animation', 'AnimationIteration'), + animationstart: makePrefixMap('Animation', 'AnimationStart'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') +}; /** - * Standard/simple iteration through an event's collected dispatches. + * Event names that have already been detected and prefixed (if applicable). */ -function executeDispatchesInOrder(event, simulated) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; - { - validateEventDispatches(event); - } - if (Array.isArray(dispatchListeners)) { - for (var i = 0; i < dispatchListeners.length; i++) { - if (event.isPropagationStopped()) { - break; - } - // Listeners and Instances are two parallel arrays that are always in sync. - executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); - } - } else if (dispatchListeners) { - executeDispatch(event, simulated, dispatchListeners, dispatchInstances); - } - event._dispatchListeners = null; - event._dispatchInstances = null; -} +var prefixedEventNames = {}; /** - * @see executeDispatchesInOrderStopAtTrueImpl + * Element to check for prefixes on. + */ +var style = {}; + +/** + * Bootstrap if a DOM exists. */ +if (canUseDOM) { + style = document.createElement('div').style; + + // On some platforms, in particular some releases of Android 4.x, + // the un-prefixed "animation" and "transition" properties are defined on the + // style object but the events that fire will still be prefixed, so we need + // to check if the un-prefixed events are usable, and if not remove them from the map. + if (!('AnimationEvent' in window)) { + delete vendorPrefixes.animationend.animation; + delete vendorPrefixes.animationiteration.animation; + delete vendorPrefixes.animationstart.animation; + } + // Same as above + if (!('TransitionEvent' in window)) { + delete vendorPrefixes.transitionend.transition; + } +} /** - * Execution of a "direct" dispatch - there must be at most one dispatch - * accumulated on the event or it is considered an error. It doesn't really make - * sense for an event with multiple dispatches (bubbled) to keep track of the - * return values at each dispatch execution, but it does tend to make sense when - * dealing with "direct" dispatches. + * Attempts to determine the correct vendor prefixed event name. * - * @return {*} The return value of executing the single dispatch. + * @param {string} eventName + * @returns {string} */ +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) { + return prefixedEventNames[eventName]; + } else if (!vendorPrefixes[eventName]) { + return eventName; + } + var prefixMap = vendorPrefixes[eventName]; + + for (var styleProp in prefixMap) { + if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { + return prefixedEventNames[eventName] = prefixMap[styleProp]; + } + } + + return eventName; +} /** - * @param {SyntheticEvent} event - * @return {boolean} True iff number of dispatches accumulated is greater than 0. + * To identify top level events in ReactDOM, we use constants defined by this + * module. This is the only module that uses the unsafe* methods to express + * that the constants actually correspond to the browser event names. This lets + * us save some bundle size by avoiding a top level type -> event name map. + * The rest of ReactDOM code should import top level types from this file. */ +var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort'); +var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend')); +var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration')); +var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart')); +var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur'); +var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay'); +var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough'); +var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel'); +var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change'); +var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click'); +var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close'); +var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend'); +var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart'); +var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate'); +var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu'); +var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy'); +var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut'); +var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick'); +var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick'); +var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag'); +var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend'); +var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter'); +var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit'); +var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave'); +var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover'); +var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart'); +var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop'); +var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange'); +var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied'); +var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted'); +var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended'); +var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error'); +var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus'); +var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture'); +var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input'); +var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid'); +var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown'); +var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress'); +var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup'); +var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load'); +var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart'); +var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata'); +var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata'); +var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture'); +var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown'); +var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove'); +var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout'); +var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover'); +var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup'); +var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste'); +var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause'); +var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play'); +var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing'); +var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel'); +var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown'); + + +var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove'); +var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout'); +var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover'); +var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup'); +var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress'); +var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange'); +var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset'); +var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll'); +var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked'); +var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking'); +var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange'); +var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled'); +var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit'); +var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend'); +var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput'); +var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate'); +var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle'); +var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel'); +var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend'); +var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove'); +var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart'); +var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend')); +var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange'); +var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting'); +var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); + +// List of events that need to be individually attached to media elements. +// Note that events in this list will *not* be listened to at the top level +// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`. +var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING]; + +function getRawEventName(topLevelType) { + return unsafeCastDOMTopLevelTypeToString(topLevelType); +} /** - * Accumulates items that must not be null or undefined into the first one. This - * is used to conserve memory by avoiding array allocations, and thus sacrifices - * API cleanness. Since `current` can be null before being passed in and not - * null after this function, make sure to assign it back to `current`: + * These variables store information about text content of a target node, + * allowing comparison of content before and after a given event. * - * `a = accumulateInto(a, b);` + * Identify the node where selection currently begins, then observe + * both its text content and its current position in the DOM. Since the + * browser may natively replace the target node during composition, we can + * use its position to find its replacement. * - * This API should be sparingly used. Try `accumulate` for something cleaner. * - * @return {*|array<*>} An accumulation of items. */ -function accumulateInto(current, next) { - !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0; +var root = null; +var startText = null; +var fallbackText = null; - if (current == null) { - return next; +function initialize(nativeEventTarget) { + root = nativeEventTarget; + startText = getText(); + return true; +} + +function reset() { + root = null; + startText = null; + fallbackText = null; +} + +function getData() { + if (fallbackText) { + return fallbackText; } - // 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; + var start = void 0; + var startValue = startText; + var startLength = startValue.length; + var end = void 0; + var endValue = getText(); + var endLength = endValue.length; + + for (start = 0; start < startLength; start++) { + if (startValue[start] !== endValue[start]) { + break; } - current.push(next); - return current; } - if (Array.isArray(next)) { - // A bit too dangerous to mutate `next`. - return [current].concat(next); + var minEnd = startLength - start; + for (end = 1; end <= minEnd; end++) { + if (startValue[startLength - end] !== endValue[endLength - end]) { + break; + } } - return [current, next]; + var sliceTail = end > 1 ? 1 - end : undefined; + fallbackText = endValue.slice(start, sliceTail); + return fallbackText; } -/** - * @param {array} arr an "accumulation" of items which is either an Array or - * a single item. Useful when paired with the `accumulate` module. This is a - * simple utility that allows us to reason about a collection of items, but - * handling the case when there is exactly one item (and we do not need to - * allocate an array). - * @param {function} cb Callback invoked with each element or a collection. - * @param {?} [scope] Scope used as `this` in a callback. - */ -function forEachAccumulated(arr, cb, scope) { - if (Array.isArray(arr)) { - arr.forEach(cb, scope); - } else if (arr) { - cb.call(scope, arr); +function getText() { + if ('value' in root) { + return root.value; } + return root.textContent; } -/** - * Internal queue of events that have accumulated their dispatches and are - * waiting to have their dispatches executed. - */ -var eventQueue = null; +/* eslint valid-typeof: 0 */ + +var EVENT_POOL_SIZE = 10; /** - * Dispatches an event and releases it back into the pool, unless persistent. - * - * @param {?object} event Synthetic event to be dispatched. - * @param {boolean} simulated If the event is simulated (changes exn behavior) - * @private + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ -var executeDispatchesAndRelease = function (event, simulated) { - if (event) { - executeDispatchesInOrder(event, simulated); - - if (!event.isPersistent()) { - event.constructor.release(event); - } - } -}; -var executeDispatchesAndReleaseSimulated = function (e) { - return executeDispatchesAndRelease(e, true); -}; -var executeDispatchesAndReleaseTopLevel = function (e) { - return executeDispatchesAndRelease(e, false); +var EventInterface = { + type: null, + target: null, + // currentTarget is set when dispatching; no use in copying it here + currentTarget: function () { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function (event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null }; -function isInteractive(tag) { - return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; +function functionThatReturnsTrue() { + return true; } -function shouldPreventMouseEvent(name, type, props) { - switch (name) { - case 'onClick': - case 'onClickCapture': - case 'onDoubleClick': - case 'onDoubleClickCapture': - case 'onMouseDown': - case 'onMouseDownCapture': - case 'onMouseMove': - case 'onMouseMoveCapture': - case 'onMouseUp': - case 'onMouseUpCapture': - return !!(props.disabled && isInteractive(type)); - default: - return false; - } +function functionThatReturnsFalse() { + return false; } /** - * This is a unified interface for event plugins to be installed and configured. - * - * Event plugins can implement the following properties: - * - * `extractEvents` {function(string, DOMEventTarget, string, object): *} - * Required. When a top-level event is fired, this method is expected to - * extract synthetic events that will in turn be queued and dispatched. - * - * `eventTypes` {object} - * Optional, plugins that fire events must publish a mapping of registration - * names that are used to register listeners. Values of this mapping must - * be objects that contain `registrationName` or `phasedRegistrationNames`. + * Synthetic events are dispatched by event plugins, typically in response to a + * top-level event delegation handler. * - * `executeDispatch` {function(object, function, string)} - * Optional, allows plugins to override how an event gets dispatched. By - * default, the listener is simply invoked. + * These systems should generally use pooling to reduce the frequency of garbage + * collection. The system should check `isPersistent` to determine whether the + * event should be released into the pool after being dispatched. Users that + * need a persisted event should invoke `persist`. * - * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * Synthetic events (and subclasses) implement the DOM Level 3 Events API by + * normalizing browser quirks. Subclasses do not necessarily have to implement a + * DOM interface; custom application-specific events can also subclass this. * - * @public + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {*} targetInst Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @param {DOMEventTarget} nativeEventTarget Target node. */ +function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { + { + // these have a getter/setter for warnings + delete this.nativeEvent; + delete this.preventDefault; + delete this.stopPropagation; + delete this.isDefaultPrevented; + delete this.isPropagationStopped; + } -/** - * Methods for injecting dependencies. - */ -var injection$1 = { - /** - * @param {array} InjectedEventPluginOrder - * @public - */ - injectEventPluginOrder: injectEventPluginOrder, + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; - /** - * @param {object} injectedNamesToPlugins Map from names to plugin modules. - */ - injectEventPluginsByName: injectEventPluginsByName -}; + var Interface = this.constructor.Interface; + for (var propName in Interface) { + if (!Interface.hasOwnProperty(propName)) { + continue; + } + { + delete this[propName]; // this has a getter/setter for warnings + } + var normalize = Interface[propName]; + if (normalize) { + this[propName] = normalize(nativeEvent); + } else { + if (propName === 'target') { + this.target = nativeEventTarget; + } else { + this[propName] = nativeEvent[propName]; + } + } + } -/** - * @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 - // 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; + var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; + if (defaultPrevented) { + this.isDefaultPrevented = functionThatReturnsTrue; + } else { + this.isDefaultPrevented = functionThatReturnsFalse; } - !(!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; + this.isPropagationStopped = functionThatReturnsFalse; + return this; } -/** - * Allows registered plugins an opportunity to extract events from top-level - * native browser events. - * - * @return {*} An accumulation of synthetic events. - * @internal - */ -function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var events; - for (var i = 0; i < plugins.length; i++) { - // Not every plugin in the ordering may be loaded at runtime. - var possiblePlugin = plugins[i]; - if (possiblePlugin) { - var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); - if (extractedEvents) { - events = accumulateInto(events, extractedEvents); +_assign(SyntheticEvent.prototype, { + preventDefault: function () { + this.defaultPrevented = true; + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.preventDefault) { + event.preventDefault(); + } else if (typeof event.returnValue !== 'unknown') { + event.returnValue = false; + } + this.isDefaultPrevented = functionThatReturnsTrue; + }, + + stopPropagation: function () { + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.stopPropagation) { + event.stopPropagation(); + } else if (typeof event.cancelBubble !== 'unknown') { + // The ChangeEventPlugin registers a "propertychange" event for + // IE. This event does not support bubbling or cancelling, and + // any references to cancelBubble throw "Member not found". A + // typeof check of "unknown" circumvents this issue (and is also + // IE specific). + event.cancelBubble = true; + } + + this.isPropagationStopped = functionThatReturnsTrue; + }, + + /** + * We release all dispatched `SyntheticEvent`s after each event loop, adding + * them back into the pool. This allows a way to hold onto a reference that + * won't be added back into the pool. + */ + persist: function () { + this.isPersistent = functionThatReturnsTrue; + }, + + /** + * Checks if this event should be released back into the pool. + * + * @return {boolean} True if this should not be released, false otherwise. + */ + isPersistent: functionThatReturnsFalse, + + /** + * `PooledClass` looks for `destructor` on each instance it releases. + */ + destructor: function () { + var Interface = this.constructor.Interface; + for (var propName in Interface) { + { + Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); } } + this.dispatchConfig = null; + this._targetInst = null; + this.nativeEvent = null; + this.isDefaultPrevented = functionThatReturnsFalse; + this.isPropagationStopped = functionThatReturnsFalse; + this._dispatchListeners = null; + this._dispatchInstances = null; + { + Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); + Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse)); + Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse)); + Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {})); + Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {})); + } } - return events; -} +}); -/** - * Enqueues a synthetic event that should be dispatched when - * `processEventQueue` is invoked. - * - * @param {*} events An accumulation of synthetic events. - * @internal - */ -function enqueueEvents(events) { - if (events) { - eventQueue = accumulateInto(eventQueue, events); - } -} +SyntheticEvent.Interface = EventInterface; /** - * Dispatches all synthetic events on the event queue. - * - * @internal + * Helper to reduce boilerplate when creating subclasses. */ -function processEventQueue(simulated) { - // Set `eventQueue` to null before processing it so that we can tell if more - // events get enqueued while processing. - var processingEventQueue = eventQueue; - eventQueue = null; +SyntheticEvent.extend = function (Interface) { + var Super = this; - if (!processingEventQueue) { - return; - } + var E = function () {}; + E.prototype = Super.prototype; + var prototype = new E(); - if (simulated) { - forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); - } else { - forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); + function Class() { + return Super.apply(this, arguments); } - !!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. - ReactErrorUtils.rethrowCaughtError(); -} - -var EventPluginHub = Object.freeze({ - injection: injection$1, - getListener: getListener, - extractEvents: extractEvents, - enqueueEvents: enqueueEvents, - processEventQueue: processEventQueue -}); + _assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; -var IndeterminateComponent = 0; // Before we know whether it is functional or class -var FunctionalComponent = 1; -var ClassComponent = 2; -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 CallComponent = 7; -var CallHandlerPhase = 8; -var ReturnComponent = 9; -var Fragment = 10; + Class.Interface = _assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); -var randomKey = Math.random().toString(36).slice(2); -var internalInstanceKey = '__reactInternalInstance$' + randomKey; -var internalEventHandlersKey = '__reactEventHandlers$' + randomKey; + return Class; +}; -function precacheFiberNode$1(hostInst, node) { - node[internalInstanceKey] = hostInst; -} +addEventPoolingTo(SyntheticEvent); /** - * Given a DOM node, return the closest ReactDOMComponent or - * ReactDOMTextComponent instance ancestor. + * Helper to nullify syntheticEvent instance properties when destructing + * + * @param {String} propName + * @param {?object} getVal + * @return {object} defineProperty object */ -function getClosestInstanceFromNode(node) { - if (node[internalInstanceKey]) { - return node[internalInstanceKey]; +function getPooledWarningPropertyDefinition(propName, getVal) { + var isFunction = typeof getVal === 'function'; + return { + configurable: true, + set: set, + get: get + }; + + function set(val) { + var action = isFunction ? 'setting the method' : 'setting the property'; + warn(action, 'This is effectively a no-op'); + return val; } - // Walk up the tree until we find an ancestor whose instance we have cached. - var parents = []; - while (!node[internalInstanceKey]) { - parents.push(node); - if (node.parentNode) { - node = node.parentNode; - } else { - // Top of the tree. This node must not be part of a React tree (or is - // unmounted, potentially). - return null; - } + function get() { + var action = isFunction ? 'accessing the method' : 'accessing the property'; + var result = isFunction ? 'This is a no-op function' : 'This is set to null'; + warn(action, result); + return getVal; } - var closest = void 0; - var inst = node[internalInstanceKey]; - if (inst.tag === HostComponent || inst.tag === HostText) { - // In Fiber, this will always be the deepest root. - return inst; + function warn(action, result) { + var warningCondition = false; + !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; + } +} + +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + var EventConstructor = this; + if (EventConstructor.eventPool.length) { + var instance = EventConstructor.eventPool.pop(); + EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); + return instance; } - for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { - closest = inst; + return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); +} + +function releasePooledEvent(event) { + var EventConstructor = this; + !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0; + event.destructor(); + if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { + EventConstructor.eventPool.push(event); } +} - return closest; +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; } /** - * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent - * instance, or null if the node was not rendered by this React. + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents */ -function getInstanceFromNode$1(node) { - var inst = node[internalInstanceKey]; - if (inst) { - if (inst.tag === HostComponent || inst.tag === HostText) { - return inst; - } else { - return null; - } - } - return null; -} +var SyntheticCompositionEvent = SyntheticEvent.extend({ + data: null +}); /** - * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding - * DOM node. + * @interface Event + * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 + * /#events-inputevents */ -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; - } +var SyntheticInputEvent = SyntheticEvent.extend({ + data: null +}); - // 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.'); -} +var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space +var START_KEYCODE = 229; -function getFiberCurrentPropsFromNode$1(node) { - return node[internalEventHandlersKey] || null; -} +var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window; -function updateFiberProps$1(node, props) { - node[internalEventHandlersKey] = props; +var documentMode = null; +if (canUseDOM && 'documentMode' in document) { + documentMode = document.documentMode; } -var ReactDOMComponentTree = Object.freeze({ - precacheFiberNode: precacheFiberNode$1, - getClosestInstanceFromNode: getClosestInstanceFromNode, - getInstanceFromNode: getInstanceFromNode$1, - getNodeFromInstance: getNodeFromInstance$1, - getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode$1, - updateFiberProps: updateFiberProps$1 -}); +// Webkit offers a very useful `textInput` event that can be used to +// directly represent `beforeInput`. The IE `textinput` event is not as +// useful, so we don't use it. +var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; -function getParent(inst) { - do { - 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; -} - -/** - * 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--; - } +// In IE9+, we have access to composition events, but the data supplied +// by the native compositionend event may be incorrect. Japanese ideographic +// spaces, for instance (\u3000) are not recorded correctly. +var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); - // If B is deeper, crawl up. - while (depthB - depthA > 0) { - instB = getParent(instB); - depthB--; - } +var SPACEBAR_CODE = 32; +var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); - // 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); +// Events and their corresponding property names. +var eventTypes = { + beforeInput: { + phasedRegistrationNames: { + bubbled: 'onBeforeInput', + captured: 'onBeforeInputCapture' + }, + dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE] + }, + compositionEnd: { + phasedRegistrationNames: { + bubbled: 'onCompositionEnd', + captured: 'onCompositionEndCapture' + }, + dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] + }, + compositionStart: { + phasedRegistrationNames: { + bubbled: 'onCompositionStart', + captured: 'onCompositionStartCapture' + }, + dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] + }, + compositionUpdate: { + phasedRegistrationNames: { + bubbled: 'onCompositionUpdate', + captured: 'onCompositionUpdateCapture' + }, + dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] } - return null; -} - -/** - * Return if A is an ancestor of B. - */ - +}; -/** - * Return the parent instance of the passed-in instance. - */ -function getParentInstance(inst) { - return getParent(inst); -} +// Track whether we've ever handled a keypress on the space key. +var hasSpaceKeypress = false; /** - * Simulates the traversal of a two-phase, capture/bubble event dispatch. + * Return whether a native keypress event is assumed to be a command. + * This is required because Firefox fires `keypress` events for key commands + * (cut, copy, select-all, etc.) even though no character is inserted. */ -function traverseTwoPhase(inst, fn, arg) { - var path = []; - while (inst) { - path.push(inst); - inst = getParent(inst); - } - var i; - for (i = path.length; i-- > 0;) { - fn(path[i], 'captured', arg); - } - for (i = 0; i < path.length; i++) { - fn(path[i], 'bubbled', arg); - } +function isKeypressCommand(nativeEvent) { + return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && + // ctrlKey && altKey is equivalent to AltGr, and is not a command. + !(nativeEvent.ctrlKey && nativeEvent.altKey); } /** - * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that - * should would receive a `mouseEnter` or `mouseLeave` event. + * Translate native top level events into event types. * - * Does not invoke the callback on the nearest common ancestor because nothing - * "entered" or "left" that element. + * @param {string} topLevelType + * @return {object} */ -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); +function getCompositionEventType(topLevelType) { + switch (topLevelType) { + case TOP_COMPOSITION_START: + return eventTypes.compositionStart; + case TOP_COMPOSITION_END: + return eventTypes.compositionEnd; + case TOP_COMPOSITION_UPDATE: + return eventTypes.compositionUpdate; } } /** - * Some event types have a notion of different registration names for different - * "phases" of propagation. This finds listeners by a given phase. + * Does our fallback best-guess model think this event signifies that + * composition has begun? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} */ -function listenerAtPhase(inst, event, propagationPhase) { - var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; - return getListener(inst, registrationName); +function isFallbackCompositionStart(topLevelType, nativeEvent) { + return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE; } /** - * 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. + * Does our fallback mode think that this event is the end of composition? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} */ -function accumulateDirectionalDispatches(inst, phase, event) { - { - warning(inst, 'Dispatching inst must not be null'); - } - var listener = listenerAtPhase(inst, event, phase); - if (listener) { - event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); - event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); +function isFallbackCompositionEnd(topLevelType, nativeEvent) { + switch (topLevelType) { + case TOP_KEY_UP: + // Command keys insert or clear IME input. + return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; + case TOP_KEY_DOWN: + // Expect IME keyCode on each keydown. If we get any other + // code we must have exited earlier. + return nativeEvent.keyCode !== START_KEYCODE; + case TOP_KEY_PRESS: + case TOP_MOUSE_DOWN: + case TOP_BLUR: + // Events are not possible without cancelling IME. + return true; + default: + return false; } } /** - * 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. + * Google Input Tools provides composition data via a CustomEvent, + * with the `data` property populated in the `detail` object. If this + * is available on the event object, use it. If not, this is a plain + * composition event and we have nothing special to extract. + * + * @param {object} nativeEvent + * @return {?string} */ -function accumulateTwoPhaseDispatchesSingle(event) { - if (event && event.dispatchConfig.phasedRegistrationNames) { - traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); +function getDataFromCustomEvent(nativeEvent) { + var detail = nativeEvent.detail; + if (typeof detail === 'object' && 'data' in detail) { + return detail.data; } + return null; } /** - * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. + * Check if a composition event was triggered by Korean IME. + * Our fallback mode does not work well with IE's Korean IME, + * so just use native composition events when Korean IME is used. + * Although CompositionEvent.locale property is deprecated, + * it is available in IE, where our fallback mode is enabled. + * + * @param {object} nativeEvent + * @return {boolean} */ -function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { - if (event && event.dispatchConfig.phasedRegistrationNames) { - var targetInst = event._targetInst; - var parentInst = targetInst ? getParentInstance(targetInst) : null; - traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); - } +function isUsingKoreanIME(nativeEvent) { + return nativeEvent.locale === 'ko'; } +// Track the current IME composition status, if any. +var isComposing = false; + /** - * 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. + * @return {?object} A SyntheticCompositionEvent. */ -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); +function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var eventType = void 0; + var fallbackData = void 0; + + if (canUseCompositionEvent) { + eventType = getCompositionEventType(topLevelType); + } else if (!isComposing) { + if (isFallbackCompositionStart(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionStart; } + } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionEnd; } -} -/** - * Accumulates dispatches on an `SyntheticEvent`, but only for the - * `dispatchMarker`. - * @param {SyntheticEvent} event - */ -function accumulateDirectDispatchesSingle(event) { - if (event && event.dispatchConfig.registrationName) { - accumulateDispatches(event._targetInst, null, event); + if (!eventType) { + return null; } -} -function accumulateTwoPhaseDispatches(events) { - forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); -} + if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) { + // The current composition is stored statically and must not be + // overwritten while composition continues. + if (!isComposing && eventType === eventTypes.compositionStart) { + isComposing = initialize(nativeEventTarget); + } else if (eventType === eventTypes.compositionEnd) { + if (isComposing) { + fallbackData = getData(); + } + } + } -function accumulateTwoPhaseDispatchesSkipTarget(events) { - forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); -} + var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); -function accumulateEnterLeaveDispatches(leave, enter, from, to) { - traverseEnterLeave(from, to, accumulateDispatches, leave, enter); + if (fallbackData) { + // Inject data generated from fallback path into the synthetic event. + // This matches the property of native CompositionEventInterface. + event.data = fallbackData; + } else { + var customData = getDataFromCustomEvent(nativeEvent); + if (customData !== null) { + event.data = customData; + } + } + + accumulateTwoPhaseDispatches(event); + return event; } -function accumulateDirectDispatches(events) { - forEachAccumulated(events, accumulateDirectDispatchesSingle); +/** + * @param {TopLevelType} topLevelType Number from `TopLevelType`. + * @param {object} nativeEvent Native browser event. + * @return {?string} The string corresponding to this `beforeInput` event. + */ +function getNativeBeforeInputChars(topLevelType, nativeEvent) { + switch (topLevelType) { + case TOP_COMPOSITION_END: + return getDataFromCustomEvent(nativeEvent); + case TOP_KEY_PRESS: + /** + * If native `textInput` events are available, our goal is to make + * use of them. However, there is a special case: the spacebar key. + * In Webkit, preventing default on a spacebar `textInput` event + * cancels character insertion, but it *also* causes the browser + * to fall back to its default spacebar behavior of scrolling the + * page. + * + * Tracking at: + * https://code.google.com/p/chromium/issues/detail?id=355103 + * + * To avoid this issue, use the keypress event as if no `textInput` + * event is available. + */ + var which = nativeEvent.which; + if (which !== SPACEBAR_CODE) { + return null; + } + + hasSpaceKeypress = true; + return SPACEBAR_CHAR; + + case TOP_TEXT_INPUT: + // Record the characters to be added to the DOM. + var chars = nativeEvent.data; + + // If it's a spacebar character, assume that we have already handled + // it at the keypress level and bail immediately. Android Chrome + // doesn't give us keycodes, so we need to ignore it. + if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { + return null; + } + + return chars; + + default: + // For other native event types, do nothing. + return null; + } } -var EventPropagators = Object.freeze({ - accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, - accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, - accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches, - accumulateDirectDispatches: accumulateDirectDispatches -}); +/** + * For browsers that do not provide the `textInput` event, extract the + * appropriate string to use for SyntheticInputEvent. + * + * @param {number} topLevelType Number from `TopLevelEventTypes`. + * @param {object} nativeEvent Native browser event. + * @return {?string} The fallback string for this `beforeInput` event. + */ +function getFallbackBeforeInputChars(topLevelType, nativeEvent) { + // If we are currently composing (IME) and using a fallback to do so, + // try to extract the composed characters from the fallback object. + // If composition event is available, we extract a string only at + // compositionevent, otherwise extract it at fallback events. + if (isComposing) { + if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { + var chars = getData(); + reset(); + isComposing = false; + return chars; + } + return null; + } -var contentKey = null; + switch (topLevelType) { + case TOP_PASTE: + // If a paste event occurs after a keypress, throw out the input + // chars. Paste events should not lead to BeforeInput events. + return null; + case TOP_KEY_PRESS: + /** + * As of v27, Firefox may fire keypress events even when no character + * will be inserted. A few possibilities: + * + * - `which` is `0`. Arrow keys, Esc key, etc. + * + * - `which` is the pressed key code, but no char is available. + * Ex: 'AltGr + d` in Polish. There is no modified character for + * this key combination and no character is inserted into the + * document, but FF fires the keypress for char code `100` anyway. + * No `input` event will occur. + * + * - `which` is the pressed key code, but a command combination is + * being used. Ex: `Cmd+C`. No character is inserted, and no + * `input` event will occur. + */ + if (!isKeypressCommand(nativeEvent)) { + // IE fires the `keypress` event when a user types an emoji via + // Touch keyboard of Windows. In such a case, the `char` property + // holds an emoji character like `\uD83D\uDE0A`. Because its length + // is 2, the property `which` does not represent an emoji correctly. + // In such a case, we directly return the `char` property instead of + // using `which`. + if (nativeEvent.char && nativeEvent.char.length > 1) { + return nativeEvent.char; + } else if (nativeEvent.which) { + return String.fromCharCode(nativeEvent.which); + } + } + return null; + case TOP_COMPOSITION_END: + return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data; + default: + return null; + } +} /** - * Gets the key used to access text content on a DOM node. + * Extract a SyntheticInputEvent for `beforeInput`, based on either native + * `textInput` or fallback behavior. * - * @return {?string} Key used to access text content. - * @internal + * @return {?object} A SyntheticInputEvent. */ -function getTextContentAccessor() { - if (!contentKey && ExecutionEnvironment.canUseDOM) { - // Prefer textContent to innerText because many browsers support both but - // SVG elements don't support innerText even when
does. - contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; +function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var chars = void 0; + + if (canUseTextInputEvent) { + chars = getNativeBeforeInputChars(topLevelType, nativeEvent); + } else { + chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); + } + + // If no characters are being inserted, no BeforeInput event should + // be fired. + if (!chars) { + return null; } - return contentKey; + + var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); + + event.data = chars; + accumulateTwoPhaseDispatches(event); + return event; } /** - * This helper object stores information about text content of a target node, - * allowing comparison of content before and after a given event. + * Create an `onBeforeInput` event to match + * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. * - * Identify the node where selection currently begins, then observe - * both its text content and its current position in the DOM. Since the - * browser may natively replace the target node during composition, we can - * use its position to find its replacement. + * This event plugin is based on the native `textInput` event + * available in Chrome, Safari, Opera, and IE. This event fires after + * `onKeyPress` and `onCompositionEnd`, but before `onInput`. * + * `beforeInput` is spec'd but not implemented in any browsers, and + * the `input` event does not provide any useful information about what has + * actually been added, contrary to the spec. Thus, `textInput` is the best + * available event to identify the characters that have actually been inserted + * into the target node. * + * This plugin is also responsible for emitting `composition` events, thus + * allowing us to share composition fallback code for both `beforeInput` and + * `composition` event types. */ -var compositionState = { - _root: null, - _startText: null, - _fallbackText: null -}; - -function initialize(nativeEventTarget) { - compositionState._root = nativeEventTarget; - compositionState._startText = getText(); - return true; -} +var BeforeInputEventPlugin = { + eventTypes: eventTypes, -function reset() { - compositionState._root = null; - compositionState._startText = null; - compositionState._fallbackText = null; -} + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); -function getData() { - if (compositionState._fallbackText) { - return compositionState._fallbackText; - } + var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); - var start; - var startValue = compositionState._startText; - var startLength = startValue.length; - var end; - var endValue = getText(); - var endLength = endValue.length; + if (composition === null) { + return beforeInput; + } - for (start = 0; start < startLength; start++) { - if (startValue[start] !== endValue[start]) { - break; + if (beforeInput === null) { + return composition; } + + return [composition, beforeInput]; } +}; - var minEnd = startLength - start; - for (end = 1; end <= minEnd; end++) { - if (startValue[startLength - end] !== endValue[endLength - end]) { - break; - } +// Use to restore controlled state after a change event has fired. + +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; } + !(typeof restoreImpl === 'function') ? invariant(false, 'setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0; + var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); + restoreImpl(internalInstance.stateNode, internalInstance.type, props); +} - var sliceTail = end > 1 ? 1 - end : undefined; - compositionState._fallbackText = endValue.slice(start, sliceTail); - return compositionState._fallbackText; +function setRestoreImplementation(impl) { + restoreImpl = impl; } -function getText() { - if ('value' in compositionState._root) { - return compositionState._root.value; +function enqueueStateRestore(target) { + if (restoreTarget) { + if (restoreQueue) { + restoreQueue.push(target); + } else { + restoreQueue = [target]; + } + } else { + restoreTarget = target; } - return compositionState._root[getTextContentAccessor()]; } -/* eslint valid-typeof: 0 */ +function needsStateRestore() { + return restoreTarget !== null || restoreQueue !== null; +} -var didWarnForAddedNewProperty = false; -var isProxySupported = typeof Proxy === 'function'; -var EVENT_POOL_SIZE = 10; +function restoreStateIfNeeded() { + if (!restoreTarget) { + return; + } + var target = restoreTarget; + var queuedTargets = restoreQueue; + restoreTarget = null; + restoreQueue = null; -var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; + restoreStateOfTarget(target); + if (queuedTargets) { + for (var i = 0; i < queuedTargets.length; i++) { + restoreStateOfTarget(queuedTargets[i]); + } + } +} -/** - * @interface Event - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var EventInterface = { - type: null, - target: null, - // currentTarget is set when dispatching; no use in copying it here - currentTarget: emptyFunction.thatReturnsNull, - eventPhase: null, - bubbles: null, - cancelable: null, - timeStamp: function (event) { - return event.timeStamp || Date.now(); - }, - defaultPrevented: null, - isTrusted: null +// Used as a way to call batchedUpdates when we don't have a reference to +// 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 _interactiveUpdatesImpl = function (fn, a, b) { + return fn(a, b); }; +var _flushInteractiveUpdatesImpl = function () {}; -/** - * Synthetic events are dispatched by event plugins, typically in response to a - * top-level event delegation handler. - * - * These systems should generally use pooling to reduce the frequency of garbage - * collection. The system should check `isPersistent` to determine whether the - * event should be released into the pool after being dispatched. Users that - * need a persisted event should invoke `persist`. - * - * Synthetic events (and subclasses) implement the DOM Level 3 Events API by - * normalizing browser quirks. Subclasses do not necessarily have to implement a - * DOM interface; custom application-specific events can also subclass this. - * - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {*} targetInst Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @param {DOMEventTarget} nativeEventTarget Target node. - */ -function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { - { - // these have a getter/setter for warnings - delete this.nativeEvent; - delete this.preventDefault; - delete this.stopPropagation; +var isBatching = false; +function batchedUpdates(fn, bookkeeping) { + if (isBatching) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(bookkeeping); } - - this.dispatchConfig = dispatchConfig; - this._targetInst = targetInst; - this.nativeEvent = nativeEvent; - - var Interface = this.constructor.Interface; - for (var propName in Interface) { - if (!Interface.hasOwnProperty(propName)) { - continue; - } - { - delete this[propName]; // this has a getter/setter for warnings - } - var normalize = Interface[propName]; - if (normalize) { - this[propName] = normalize(nativeEvent); - } else { - if (propName === 'target') { - this.target = nativeEventTarget; - } else { - this[propName] = nativeEvent[propName]; - } + isBatching = true; + try { + return _batchedUpdatesImpl(fn, bookkeeping); + } finally { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + isBatching = false; + 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. + _flushInteractiveUpdatesImpl(); + restoreStateIfNeeded(); } } - - var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; - if (defaultPrevented) { - this.isDefaultPrevented = emptyFunction.thatReturnsTrue; - } else { - this.isDefaultPrevented = emptyFunction.thatReturnsFalse; - } - this.isPropagationStopped = emptyFunction.thatReturnsFalse; - return this; } -_assign(SyntheticEvent.prototype, { - preventDefault: function () { - this.defaultPrevented = true; - var event = this.nativeEvent; - if (!event) { - return; - } +function interactiveUpdates(fn, a, b) { + return _interactiveUpdatesImpl(fn, a, b); +} - if (event.preventDefault) { - event.preventDefault(); - } else if (typeof event.returnValue !== 'unknown') { - event.returnValue = false; - } - this.isDefaultPrevented = emptyFunction.thatReturnsTrue; - }, - stopPropagation: function () { - var event = this.nativeEvent; - if (!event) { - return; - } - if (event.stopPropagation) { - event.stopPropagation(); - } else if (typeof event.cancelBubble !== 'unknown') { - // The ChangeEventPlugin registers a "propertychange" event for - // IE. This event does not support bubbling or cancelling, and - // any references to cancelBubble throw "Member not found". A - // typeof check of "unknown" circumvents this issue (and is also - // IE specific). - event.cancelBubble = true; - } +function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) { + _batchedUpdatesImpl = batchedUpdatesImpl; + _interactiveUpdatesImpl = interactiveUpdatesImpl; + _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl; +} - this.isPropagationStopped = emptyFunction.thatReturnsTrue; - }, +/** + * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary + */ +var supportedInputTypes = { + color: true, + date: true, + datetime: true, + 'datetime-local': true, + email: true, + month: true, + number: true, + password: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true +}; - /** - * We release all dispatched `SyntheticEvent`s after each event loop, adding - * them back into the pool. This allows a way to hold onto a reference that - * won't be added back into the pool. - */ - persist: function () { - this.isPersistent = emptyFunction.thatReturnsTrue; - }, +function isTextInputElement(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); - /** - * Checks if this event should be released back into the pool. - * - * @return {boolean} True if this should not be released, false otherwise. - */ - isPersistent: emptyFunction.thatReturnsFalse, + if (nodeName === 'input') { + return !!supportedInputTypes[elem.type]; + } - /** - * `PooledClass` looks for `destructor` on each instance it releases. - */ - destructor: function () { - var Interface = this.constructor.Interface; - for (var propName in Interface) { - { - Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); - } - } - for (var i = 0; i < shouldBeReleasedProperties.length; i++) { - this[shouldBeReleasedProperties[i]] = null; - } - { - Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); - Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); - Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); - } + if (nodeName === 'textarea') { + return true; } -}); -SyntheticEvent.Interface = EventInterface; + return false; +} /** - * Helper to reduce boilerplate when creating subclasses. - * - * @param {function} Class - * @param {?object} Interface + * HTML nodeType values that represent the type of the node */ -SyntheticEvent.augmentClass = function (Class, Interface) { - var Super = this; - var E = function () {}; - E.prototype = Super.prototype; - var prototype = new E(); - - _assign(prototype, Class.prototype); - Class.prototype = prototype; - Class.prototype.constructor = Class; - - Class.Interface = _assign({}, Super.Interface, Interface); - Class.augmentClass = Super.augmentClass; - addEventPoolingTo(Class); -}; +var ELEMENT_NODE = 1; +var TEXT_NODE = 3; +var COMMENT_NODE = 8; +var DOCUMENT_NODE = 9; +var DOCUMENT_FRAGMENT_NODE = 11; -/** Proxying after everything set on SyntheticEvent - * to resolve Proxy issue on some WebKit browsers - * in which some Event properties are set to undefined (GH#10010) +/** + * Gets the target node from a native browser event by accounting for + * inconsistencies in browser DOM APIs. + * + * @param {object} nativeEvent Native browser event. + * @return {DOMEventTarget} Target node. */ -{ - if (isProxySupported) { - /*eslint-disable no-func-assign */ - SyntheticEvent = new Proxy(SyntheticEvent, { - construct: function (target, args) { - return this.apply(target, Object.create(target.prototype), args); - }, - apply: function (constructor, that, args) { - return new Proxy(constructor.apply(that, args), { - set: function (target, prop, value) { - if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { - warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.'); - didWarnForAddedNewProperty = true; - } - target[prop] = value; - return true; - } - }); - } - }); - /*eslint-enable no-func-assign */ +function getEventTarget(nativeEvent) { + // Fallback to nativeEvent.srcElement for IE9 + // https://github.com/facebook/react/issues/12506 + var target = nativeEvent.target || nativeEvent.srcElement || window; + + // Normalize SVG element events #4963 + if (target.correspondingUseElement) { + target = target.correspondingUseElement; } -} -addEventPoolingTo(SyntheticEvent); + // Safari may fire events on text nodes (Node.TEXT_NODE is 3). + // @see http://www.quirksmode.org/js/events_properties.html + return target.nodeType === TEXT_NODE ? target.parentNode : target; +} /** - * Helper to nullify syntheticEvent instance properties when destructing + * Checks if an event is supported in the current execution environment. * - * @param {String} propName - * @param {?object} getVal - * @return {object} defineProperty object + * NOTE: This will not work correctly for non-generic events such as `change`, + * `reset`, `load`, `error`, and `select`. + * + * Borrows from Modernizr. + * + * @param {string} eventNameSuffix Event name, e.g. "click". + * @return {boolean} True if the event is supported. + * @internal + * @license Modernizr 3.0.0pre (Custom Build) | MIT */ -function getPooledWarningPropertyDefinition(propName, getVal) { - var isFunction = typeof getVal === 'function'; - return { - configurable: true, - set: set, - get: get - }; - - function set(val) { - var action = isFunction ? 'setting the method' : 'setting the property'; - warn(action, 'This is effectively a no-op'); - return val; +function isEventSupported(eventNameSuffix) { + if (!canUseDOM) { + return false; } - function get() { - var action = isFunction ? 'accessing the method' : 'accessing the property'; - var result = isFunction ? 'This is a no-op function' : 'This is set to null'; - warn(action, result); - return getVal; - } + var eventName = 'on' + eventNameSuffix; + var isSupported = eventName in document; - function warn(action, result) { - var warningCondition = false; - warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result); - } -} - -function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { - var EventConstructor = this; - if (EventConstructor.eventPool.length) { - var instance = EventConstructor.eventPool.pop(); - EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); - return instance; + if (!isSupported) { + var element = document.createElement('div'); + element.setAttribute(eventName, 'return;'); + isSupported = typeof element[eventName] === 'function'; } - return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); -} -function releasePooledEvent(event) { - var EventConstructor = this; - !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0; - event.destructor(); - if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { - EventConstructor.eventPool.push(event); - } + return isSupported; } -function addEventPoolingTo(EventConstructor) { - EventConstructor.eventPool = []; - EventConstructor.getPooled = getPooledEvent; - EventConstructor.release = releasePooledEvent; +function isCheckable(elem) { + var type = elem.type; + var nodeName = elem.nodeName; + return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); } -var SyntheticEvent$1 = SyntheticEvent; - -/** - * @interface Event - * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents - */ -var CompositionEventInterface = { - data: null -}; - -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticEvent} - */ -function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +function getTracker(node) { + return node._valueTracker; } -SyntheticEvent$1.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); - -/** - * @interface Event - * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 - * /#events-inputevents - */ -var InputEventInterface = { - data: null -}; - -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticEvent} - */ -function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +function detachTracker(node) { + node._valueTracker = null; } -SyntheticEvent$1.augmentClass(SyntheticInputEvent, InputEventInterface); - -var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space -var START_KEYCODE = 229; +function getValueFromNode(node) { + var value = ''; + if (!node) { + return value; + } -var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; + if (isCheckable(node)) { + value = node.checked ? 'true' : 'false'; + } else { + value = node.value; + } -var documentMode = null; -if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { - documentMode = document.documentMode; + return value; } -// Webkit offers a very useful `textInput` event that can be used to -// directly represent `beforeInput`. The IE `textinput` event is not as -// useful, so we don't use it. -var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); - -// In IE9+, we have access to composition events, but the data supplied -// by the native compositionend event may be incorrect. Japanese ideographic -// spaces, for instance (\u3000) are not recorded correctly. -var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); +function trackValueOnNode(node) { + var valueField = isCheckable(node) ? 'checked' : 'value'; + var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); -/** - * Opera <= 12 includes TextEvent in window, but does not fire - * text input events. Rely on keypress instead. - */ -function isPresto() { - var opera = window.opera; - return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; -} + var currentValue = '' + node[valueField]; -var SPACEBAR_CODE = 32; -var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); + // 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; -// Events and their corresponding property names. -var eventTypes = { - beforeInput: { - phasedRegistrationNames: { - bubbled: 'onBeforeInput', - captured: 'onBeforeInputCapture' - }, - dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] - }, - compositionEnd: { - phasedRegistrationNames: { - bubbled: 'onCompositionEnd', - captured: 'onCompositionEndCapture' + Object.defineProperty(node, valueField, { + configurable: true, + get: function () { + return get.call(this); }, - dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] - }, - compositionStart: { - phasedRegistrationNames: { - bubbled: 'onCompositionStart', - captured: 'onCompositionStartCapture' + 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; }, - dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] - }, - compositionUpdate: { - phasedRegistrationNames: { - bubbled: 'onCompositionUpdate', - captured: 'onCompositionUpdateCapture' + setValue: function (value) { + currentValue = '' + value; }, - dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] - } -}; - -// Track whether we've ever handled a keypress on the space key. -var hasSpaceKeypress = false; - -/** - * Return whether a native keypress event is assumed to be a command. - * This is required because Firefox fires `keypress` events for key commands - * (cut, copy, select-all, etc.) even though no character is inserted. - */ -function isKeypressCommand(nativeEvent) { - return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && - // ctrlKey && altKey is equivalent to AltGr, and is not a command. - !(nativeEvent.ctrlKey && nativeEvent.altKey); + stopTracking: function () { + detachTracker(node); + delete node[valueField]; + } + }; + return tracker; } -/** - * Translate native top level events into event types. - * - * @param {string} topLevelType - * @return {object} - */ -function getCompositionEventType(topLevelType) { - switch (topLevelType) { - case 'topCompositionStart': - return eventTypes.compositionStart; - case 'topCompositionEnd': - return eventTypes.compositionEnd; - case 'topCompositionUpdate': - return eventTypes.compositionUpdate; +function track(node) { + if (getTracker(node)) { + return; } -} -/** - * Does our fallback best-guess model think this event signifies that - * composition has begun? - * - * @param {string} topLevelType - * @param {object} nativeEvent - * @return {boolean} - */ -function isFallbackCompositionStart(topLevelType, nativeEvent) { - return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; + // TODO: Once it's just Fiber we can move this to node._wrapperState + node._valueTracker = trackValueOnNode(node); } -/** - * Does our fallback mode think that this event is the end of composition? - * - * @param {string} topLevelType - * @param {object} nativeEvent - * @return {boolean} - */ -function isFallbackCompositionEnd(topLevelType, nativeEvent) { - switch (topLevelType) { - case 'topKeyUp': - // Command keys insert or clear IME input. - return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; - case 'topKeyDown': - // Expect IME keyCode on each keydown. If we get any other - // code we must have exited earlier. - return nativeEvent.keyCode !== START_KEYCODE; - case 'topKeyPress': - case 'topMouseDown': - case 'topBlur': - // Events are not possible without cancelling IME. - return true; - default: - return false; +function updateValueIfChanged(node) { + if (!node) { + return false; } -} -/** - * Google Input Tools provides composition data via a CustomEvent, - * with the `data` property populated in the `detail` object. If this - * is available on the event object, use it. If not, this is a plain - * composition event and we have nothing special to extract. - * - * @param {object} nativeEvent - * @return {?string} - */ -function getDataFromCustomEvent(nativeEvent) { - var detail = nativeEvent.detail; - if (typeof detail === 'object' && 'data' in detail) { - return detail.data; + var tracker = getTracker(node); + // if there is no tracker at this point it's unlikely + // that trying again will succeed + if (!tracker) { + return true; } - return null; + + var lastValue = tracker.getValue(); + var nextValue = getValueFromNode(node); + if (nextValue !== lastValue) { + tracker.setValue(nextValue); + return true; + } + return false; } -// Track the current IME composition status, if any. -var isComposing = false; +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; -/** - * @return {?object} A SyntheticCompositionEvent. - */ -function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var eventType; - var fallbackData; +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; - if (canUseCompositionEvent) { - eventType = getCompositionEventType(topLevelType); - } else if (!isComposing) { - if (isFallbackCompositionStart(topLevelType, nativeEvent)) { - eventType = eventTypes.compositionStart; +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; + } + } + } } - } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { - eventType = eventTypes.compositionEnd; + sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')'; + } else if (ownerName) { + sourceInfo = ' (created by ' + ownerName + ')'; } + return '\n in ' + (name || 'Unknown') + sourceInfo; +}; - if (!eventType) { +// 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; + +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_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + +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; } - - if (useFallbackCompositionData) { - // The current composition is stored statically and must not be - // overwritten while composition continues. - if (!isComposing && eventType === eventTypes.compositionStart) { - isComposing = initialize(nativeEventTarget); - } else if (eventType === eventTypes.compositionEnd) { - if (isComposing) { - fallbackData = getData(); - } - } + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + if (typeof maybeIterator === 'function') { + return maybeIterator; } + return null; +} - var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); - - if (fallbackData) { - // Inject data generated from fallback path into the synthetic event. - // This matches the property of native CompositionEventInterface. - event.data = fallbackData; - } else { - var customData = getDataFromCustomEvent(nativeEvent); - if (customData !== null) { - event.data = customData; - } - } +var Pending = 0; +var Resolved = 1; +var Rejected = 2; - accumulateTwoPhaseDispatches(event); - return event; +function refineResolvedLazyComponent(lazyComponent) { + return lazyComponent._status === Resolved ? lazyComponent._result : null; } -/** - * @param {TopLevelTypes} topLevelType Record from `BrowserEventConstants`. - * @param {object} nativeEvent Native browser event. - * @return {?string} The string corresponding to this `beforeInput` event. - */ -function getNativeBeforeInputChars(topLevelType, nativeEvent) { - switch (topLevelType) { - case 'topCompositionEnd': - return getDataFromCustomEvent(nativeEvent); - case 'topKeyPress': - /** - * If native `textInput` events are available, our goal is to make - * use of them. However, there is a special case: the spacebar key. - * In Webkit, preventing default on a spacebar `textInput` event - * cancels character insertion, but it *also* causes the browser - * to fall back to its default spacebar behavior of scrolling the - * page. - * - * Tracking at: - * https://code.google.com/p/chromium/issues/detail?id=355103 - * - * To avoid this issue, use the keypress event as if no `textInput` - * event is available. - */ - var which = nativeEvent.which; - if (which !== SPACEBAR_CODE) { - return null; - } +function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ''; + return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName); +} - hasSpaceKeypress = true; - return SPACEBAR_CHAR; +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.'); + } + } + if (typeof type === 'function') { + return type.displayName || type.name || null; + } + if (typeof type === 'string') { + return type; + } + switch (type) { + case REACT_CONCURRENT_MODE_TYPE: + return 'ConcurrentMode'; + 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'; + } + 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); + } + } + } + } + return null; +} - case 'topTextInput': - // Record the characters to be added to the DOM. - var chars = nativeEvent.data; +var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - // If it's a spacebar character, assume that we have already handled - // it at the keypress level and bail immediately. Android Chrome - // doesn't give us keycodes, so we need to blacklist it. - if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { - return null; +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); + } +} - return chars; +function getStackByFiberInDevAndProd(workInProgress) { + var info = ''; + var node = workInProgress; + do { + info += describeFiber(node); + node = node.return; + } while (node); + return info; +} - default: - // For other native event types, do nothing. +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); + } } + return null; } -/** - * For browsers that do not provide the `textInput` event, extract the - * appropriate string to use for SyntheticInputEvent. - * - * @param {string} topLevelType Record from `BrowserEventConstants`. - * @param {object} nativeEvent Native browser event. - * @return {?string} The fallback string for this `beforeInput` event. - */ -function getFallbackBeforeInputChars(topLevelType, nativeEvent) { - // If we are currently composing (IME) and using a fallback to do so, - // try to extract the composed characters from the fallback object. - // If composition event is available, we extract a string only at - // compositionevent, otherwise extract it at fallback events. - if (isComposing) { - if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { - var chars = getData(); - reset(); - isComposing = false; - return chars; +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; } - return null; + // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + return getStackByFiberInDevAndProd(current); } + return ''; +} - switch (topLevelType) { - case 'topPaste': - // If a paste event occurs after a keypress, throw out the input - // chars. Paste events should not lead to BeforeInput events. - return null; - case 'topKeyPress': - /** - * As of v27, Firefox may fire keypress events even when no character - * will be inserted. A few possibilities: - * - * - `which` is `0`. Arrow keys, Esc key, etc. - * - * - `which` is the pressed key code, but no char is available. - * Ex: 'AltGr + d` in Polish. There is no modified character for - * this key combination and no character is inserted into the - * document, but FF fires the keypress for char code `100` anyway. - * No `input` event will occur. - * - * - `which` is the pressed key code, but a command combination is - * being used. Ex: `Cmd+C`. No character is inserted, and no - * `input` event will occur. - */ - if (!isKeypressCommand(nativeEvent)) { - // IE fires the `keypress` event when a user types an emoji via - // Touch keyboard of Windows. In such a case, the `char` property - // holds an emoji character like `\uD83D\uDE0A`. Because its length - // is 2, the property `which` does not represent an emoji correctly. - // In such a case, we directly return the `char` property instead of - // using `which`. - if (nativeEvent.char && nativeEvent.char.length > 1) { - return nativeEvent.char; - } else if (nativeEvent.which) { - return String.fromCharCode(nativeEvent.which); - } - } - return null; - case 'topCompositionEnd': - return useFallbackCompositionData ? null : nativeEvent.data; - default: - return null; +function resetCurrentFiber() { + { + ReactDebugCurrentFrame.getCurrentStack = null; + current = null; + phase = null; + } +} + +function setCurrentFiber(fiber) { + { + ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; + current = fiber; + phase = null; + } +} + +function setCurrentPhase(lifeCyclePhase) { + { + phase = lifeCyclePhase; } } /** - * Extract a SyntheticInputEvent for `beforeInput`, based on either native - * `textInput` or fallback behavior. - * - * @return {?object} A SyntheticInputEvent. + * 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. */ -function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var chars; - if (canUseTextInputEvent) { - chars = getNativeBeforeInputChars(topLevelType, nativeEvent); - } else { - chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); - } +var warning = warningWithoutStack$1; - // If no characters are being inserted, no BeforeInput event should - // be fired. - if (!chars) { - return null; - } +{ + 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 - var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } - event.data = chars; - accumulateTwoPhaseDispatches(event); - return event; + warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack])); + }; } -/** - * Create an `onBeforeInput` event to match - * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. - * - * This event plugin is based on the native `textInput` event - * available in Chrome, Safari, Opera, and IE. This event fires after - * `onKeyPress` and `onCompositionEnd`, but before `onInput`. - * - * `beforeInput` is spec'd but not implemented in any browsers, and - * the `input` event does not provide any useful information about what has - * actually been added, contrary to the spec. Thus, `textInput` is the best - * available event to identify the characters that have actually been inserted - * into the target node. - * - * This plugin is also responsible for emitting `composition` events, thus - * allowing us to share composition fallback code for both `beforeInput` and - * `composition` event types. - */ -var BeforeInputEventPlugin = { - eventTypes: eventTypes, +var warning$1 = warning; - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; - } -}; +// A reserved attribute. +// It is handled by React separately and shouldn't be written to the DOM. +var RESERVED = 0; -// Use to restore controlled state after a change event has fired. +// A simple string attribute. +// Attributes that aren't in the whitelist are presumed to have this type. +var STRING = 1; -var fiberHostComponent = null; +// 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; -var ReactControlledComponentInjection = { - injectFiberControlledHostComponent: function (hostComponentImpl) { - // The fiber implementation doesn't use dynamic dispatch so we need to - // inject the implementation. - fiberHostComponent = hostComponentImpl; - } -}; +// 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; -var restoreTarget = null; -var restoreQueue = null; +// 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; -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; - } - !(fiberHostComponent && typeof fiberHostComponent.restoreControlledState === 'function') ? invariant(false, 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); - fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); -} +// An attribute that must be numeric or parse as a numeric. +// When falsy, it should be removed. +var NUMERIC = 5; -var injection$3 = ReactControlledComponentInjection; +// An attribute that must be positive numeric or parse as a positive numeric. +// When falsy, it should be removed. +var POSITIVE_NUMERIC = 6; -function enqueueStateRestore(target) { - if (restoreTarget) { - if (restoreQueue) { - restoreQueue.push(target); - } else { - restoreQueue = [target]; - } - } else { - restoreTarget = target; +/* 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 restoreStateIfNeeded() { - if (!restoreTarget) { - return; +function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { + if (propertyInfo !== null) { + return propertyInfo.type === RESERVED; } - var target = restoreTarget; - var queuedTargets = restoreQueue; - restoreTarget = null; - restoreQueue = null; + if (isCustomComponentTag) { + return false; + } + if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { + return true; + } + return false; +} - restoreStateOfTarget(target); - if (queuedTargets) { - for (var i = 0; i < queuedTargets.length; i++) { - restoreStateOfTarget(queuedTargets[i]); +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; } -var ReactControlledComponent = Object.freeze({ - injection: injection$3, - enqueueStateRestore: enqueueStateRestore, - restoreStateIfNeeded: restoreStateIfNeeded -}); +function getPropertyInfo(name) { + return properties.hasOwnProperty(name) ? properties[name] : null; +} -// Used as a way to call batchedUpdates when we don't have a reference to -// 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. +function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) { + 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; +} -// Defaults -var fiberBatchedUpdates = function (fn, bookkeeping) { - return fn(bookkeeping); -}; +// 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 = {}; -var isNestingBatched = false; -function batchedUpdates(fn, bookkeeping) { - if (isNestingBatched) { - // If we are currently inside another batch, we need to wait until it - // fully completes before restoring state. Therefore, we add the target to - // a queue of work. - return fiberBatchedUpdates(fn, bookkeeping); - } - isNestingBatched = true; - try { - return fiberBatchedUpdates(fn, bookkeeping); - } finally { - // Here we wait until all updates have propagated, which is important - // when using controlled components within layers: - // https://github.com/facebook/react/issues/1698 - // Then we restore state of any controlled component. - isNestingBatched = false; - restoreStateIfNeeded(); - } -} +// 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 +); -var ReactGenericBatchingInjection = { - injectFiberBatchedUpdates: function (_batchedUpdates) { - fiberBatchedUpdates = _batchedUpdates; - } -}; +// 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]; -var injection$4 = ReactGenericBatchingInjection; + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, // attributeName + null); +} // attributeNamespace +); -/** - * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary - */ -var supportedInputTypes = { - color: true, - date: true, - datetime: true, - 'datetime-local': true, - email: true, - month: true, - number: true, - password: true, - range: true, - search: true, - tel: true, - text: true, - time: true, - url: true, - week: true +// 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 +); + +// 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 +); + +// 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', '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 +); + +// 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 +); + +// 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 +); + +// 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 +); + +// 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 +); + +var CAMELIZE = /[\-\:]([a-z])/g; +var capitalize = function (token) { + return token[1].toUpperCase(); }; -function isTextInputElement(elem) { - var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); +// 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 +); - if (nodeName === 'input') { - return !!supportedInputTypes[elem.type]; - } +// String SVG attributes with the xlink namespace. +['xlink:actuate', 'xlink:arcrole', 'xlink:href', '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'); +}); - if (nodeName === 'textarea') { - return true; - } +// 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'); +}); - return false; -} +// Special case: this attribute exists both in HTML and SVG. +// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use +// its React `tabIndex` name, like we do for attributes that exist only in HTML. +properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty +'tabindex', // attributeName +null); /** - * HTML nodeType values that represent the type of the node + * 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. */ +function getValueForProperty(node, name, expected, propertyInfo) { + { + if (propertyInfo.mustUseProperty) { + var propertyName = propertyInfo.propertyName; -var ELEMENT_NODE = 1; -var TEXT_NODE = 3; -var COMMENT_NODE = 8; -var DOCUMENT_NODE = 9; -var DOCUMENT_FRAGMENT_NODE = 11; + return node[propertyName]; + } else { + var attributeName = propertyInfo.attributeName; -/** - * Gets the target node from a native browser event by accounting for - * inconsistencies in browser DOM APIs. - * - * @param {object} nativeEvent Native browser event. - * @return {DOMEventTarget} Target node. - */ -function getEventTarget(nativeEvent) { - var target = nativeEvent.target || nativeEvent.srcElement || window; + var stringValue = null; - // Normalize SVG element events #4963 - if (target.correspondingUseElement) { - target = target.correspondingUseElement; - } + 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); + } - // Safari may fire events on text nodes (Node.TEXT_NODE is 3). - // @see http://www.quirksmode.org/js/events_properties.html - return target.nodeType === TEXT_NODE ? target.parentNode : target; + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + return stringValue === null ? expected : stringValue; + } else if (stringValue === '' + expected) { + return expected; + } else { + return stringValue; + } + } + } } -var useHasFeature; -if (ExecutionEnvironment.canUseDOM) { - useHasFeature = document.implementation && document.implementation.hasFeature && - // always returns true in newer browsers as per the standard. - // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature - document.implementation.hasFeature('', '') !== true; +/** + * 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; + } } /** - * Checks if an event is supported in the current execution environment. - * - * NOTE: This will not work correctly for non-generic events such as `change`, - * `reset`, `load`, `error`, and `select`. - * - * Borrows from Modernizr. + * Sets the value for a property on a node. * - * @param {string} eventNameSuffix Event name, e.g. "click". - * @param {?boolean} capture Check if the capture phase is supported. - * @return {boolean} True if the event is supported. - * @internal - * @license Modernizr 3.0.0pre (Custom Build) | MIT + * @param {DOMElement} node + * @param {string} name + * @param {*} value */ -function isEventSupported(eventNameSuffix, capture) { - if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { - return false; +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 { + node.setAttribute(_attributeName, '' + value); + } + } + return; } + var mustUseProperty = propertyInfo.mustUseProperty; - var eventName = 'on' + eventNameSuffix; - var isSupported = eventName in document; + if (mustUseProperty) { + var propertyName = propertyInfo.propertyName; - if (!isSupported) { - var element = document.createElement('div'); - element.setAttribute(eventName, 'return;'); - isSupported = typeof element[eventName] === 'function'; + 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; - if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { - // This is the only way to test support for the `wheel` event in IE9+. - isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); + var attributeValue = void 0; + if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { + attributeValue = ''; + } else { + // `setAttribute` with objects becomes only `[object]` in IE8/9, + // ('' + value) makes it output the correct toString()-value. + attributeValue = '' + value; + } + if (attributeNamespace) { + node.setAttributeNS(attributeNamespace, attributeName, attributeValue); + } else { + node.setAttribute(attributeName, attributeValue); + } } +} - return isSupported; +// 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 isCheckable(elem) { - var type = elem.type; - var nodeName = elem.nodeName; - return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); +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 ''; + } } -function getTracker(node) { - return node._valueTracker; -} +var ReactDebugCurrentFrame$1 = null; -function detachTracker(node) { - node._valueTracker = null; -} +var ReactControlledValuePropTypes = { + checkPropTypes: null +}; -function getValueFromNode(node) { - var value = ''; - if (!node) { - return value; - } +{ + ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - if (isCheckable(node)) { - value = node.checked ? 'true' : 'false'; - } else { - value = node.value; - } + var hasReadOnlyValue = { + button: true, + checkbox: true, + image: true, + hidden: true, + radio: true, + reset: true, + submit: true + }; - return value; + var propTypes = { + value: function (props, propName, componentName) { + if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) { + 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) { + 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$1.getStackAddendum); + }; } -function trackValueOnNode(node) { - var valueField = isCheckable(node) ? 'checked' : 'value'; - var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); +var enableUserTimingAPI = true; - var currentValue = '' + node[valueField]; +var enableHooks = false; +// Helps identify side effects in begin-phase lifecycle hooks and setState reducers: +var debugRenderPhaseSideEffects = false; - // 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.get !== 'function' || typeof descriptor.set !== 'function') { - return; - } +// In some cases, StrictMode should also double-render lifecycles. +// This can be confusing for tests though, +// And it can be bad for performance in production. +// This feature flag can be used to control the behavior: +var debugRenderPhaseSideEffectsForStrictMode = true; - Object.defineProperty(node, valueField, { - enumerable: descriptor.enumerable, - configurable: true, - get: function () { - return descriptor.get.call(this); - }, - set: function (value) { - currentValue = '' + value; - descriptor.set.call(this, value); - } - }); +// 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; - var tracker = { - getValue: function () { - return currentValue; - }, - setValue: function (value) { - currentValue = '' + value; - }, - stopTracking: function () { - detachTracker(node); - delete node[valueField]; - } - }; - return tracker; -} +// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: +var warnAboutDeprecatedLifecycles = false; -function track(node) { - if (getTracker(node)) { - return; - } +// Gather advanced timing metrics for Profiler subtrees. +var enableProfilerTimer = true; - // TODO: Once it's just Fiber we can move this to node._wrapperState - node._valueTracker = trackValueOnNode(node); -} +// Trace which interactions trigger each commit. +var enableSchedulerTracing = true; -function updateValueIfChanged(node) { - if (!node) { - return false; - } +// Only used in www builds. + // TODO: true? Here it might just be 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; - } +// Only used in www builds. - var lastValue = tracker.getValue(); - var nextValue = getValueFromNode(node); - if (nextValue !== lastValue) { - tracker.setValue(nextValue); - return true; - } - return false; -} -var eventTypes$1 = { - change: { - phasedRegistrationNames: { - bubbled: 'onChange', - captured: 'onChangeCapture' - }, - dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] - } -}; +// Only used in www builds. -function createAndAccumulateChangeEvent(inst, nativeEvent, target) { - var event = SyntheticEvent$1.getPooled(eventTypes$1.change, inst, nativeEvent, target); - event.type = 'change'; - // Flag this event loop as needing state restore. - enqueueStateRestore(target); - accumulateTwoPhaseDispatches(event); - return event; + +// 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 enableStableConcurrentModeAPIs = false; + +var warnAboutShorthandPropertyCollision = 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; } -/** - * For IE shims - */ -var activeElement = null; -var activeElementInst = null; /** - * SECTION: handle `change` event + * 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 shouldUseChangeEvent(elem) { - var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); - return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; -} -function manualDispatchChangeEvent(nativeEvent) { - var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); +function getHostProps(element, props) { + var node = element; + var checked = props.checked; - // If change and propertychange bubbled, we'd just bind to it like all the - // other events and have it go through ReactBrowserEventEmitter. Since it - // doesn't, we manually listen for the events and so we have to enqueue and - // process the abstract event manually. - // - // Batching is necessary here in order to ensure that all event handlers run - // before the next rerender (including event handlers attached to ancestor - // elements instead of directly on the input). Without this, controlled - // components don't work properly in conjunction with event bubbling because - // the component is rerendered and the value reverted before all the event - // handlers can run. See https://github.com/facebook/react/issues/708. - batchedUpdates(runEventInBatch, event); -} + var hostProps = _assign({}, props, { + defaultChecked: undefined, + defaultValue: undefined, + value: undefined, + checked: checked != null ? checked : node._wrapperState.initialChecked + }); -function runEventInBatch(event) { - enqueueEvents(event); - processEventQueue(false); + return hostProps; } -function getInstIfValueChanged(targetInst) { - var targetNode = getNodeFromInstance$1(targetInst); - if (updateValueIfChanged(targetNode)) { - return targetInst; - } -} +function initWrapperState(element, props) { + { + ReactControlledValuePropTypes.checkPropTypes('input', props); -function getTargetInstForChangeEvent(topLevelType, targetInst) { - if (topLevelType === 'topChange') { - return targetInst; + 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; + } } -} -/** - * SECTION: handle `input` event - */ -var isInputEventSupported = false; -if (ExecutionEnvironment.canUseDOM) { - // IE9 claims to support the input event but fails to trigger it when - // deleting text, so we ignore its input events. - isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); -} + var node = element; + var defaultValue = props.defaultValue == null ? '' : props.defaultValue; -/** - * (For IE <=9) Starts tracking propertychange events on the passed-in element - * and override the value property so that we can distinguish user events from - * value changes in JS. - */ -function startWatchingForValueChange(target, targetInst) { - activeElement = target; - activeElementInst = targetInst; - activeElement.attachEvent('onpropertychange', handlePropertyChange); + node._wrapperState = { + initialChecked: props.checked != null ? props.checked : props.defaultChecked, + initialValue: getToStringValue(props.value != null ? props.value : defaultValue), + controlled: isControlled(props) + }; } -/** - * (For IE <=9) Removes the event listeners from the currently-tracked element, - * if any exists. - */ -function stopWatchingForValueChange() { - if (!activeElement) { - return; +function updateChecked(element, props) { + var node = element; + var checked = props.checked; + if (checked != null) { + setValueForProperty(node, 'checked', checked, false); } - activeElement.detachEvent('onpropertychange', handlePropertyChange); - activeElement = null; - activeElementInst = null; } -/** - * (For IE <=9) Handles a propertychange event, sending a `change` event if - * the value of the active element has changed. - */ +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(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); + !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0; + + // 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 eventTypes$1 = { + change: { + phasedRegistrationNames: { + bubbled: 'onChange', + captured: 'onChangeCapture' + }, + dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE] + } +}; + +function createAndAccumulateChangeEvent(inst, nativeEvent, target) { + var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target); + event.type = 'change'; + // Flag this event loop as needing state restore. + enqueueStateRestore(target); + accumulateTwoPhaseDispatches(event); + return event; +} +/** + * For IE shims + */ +var activeElement = null; +var activeElementInst = null; + +/** + * SECTION: handle `change` event + */ +function shouldUseChangeEvent(elem) { + var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; +} + +function manualDispatchChangeEvent(nativeEvent) { + var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); + + // If change and propertychange bubbled, we'd just bind to it like all the + // other events and have it go through ReactBrowserEventEmitter. Since it + // doesn't, we manually listen for the events and so we have to enqueue and + // process the abstract event manually. + // + // Batching is necessary here in order to ensure that all event handlers run + // before the next rerender (including event handlers attached to ancestor + // elements instead of directly on the input). Without this, controlled + // components don't work properly in conjunction with event bubbling because + // the component is rerendered and the value reverted before all the event + // handlers can run. See https://github.com/facebook/react/issues/708. + batchedUpdates(runEventInBatch, event); +} + +function runEventInBatch(event) { + runEventsInBatch(event); +} + +function getInstIfValueChanged(targetInst) { + var targetNode = getNodeFromInstance$1(targetInst); + if (updateValueIfChanged(targetNode)) { + return targetInst; + } +} + +function getTargetInstForChangeEvent(topLevelType, targetInst) { + if (topLevelType === TOP_CHANGE) { + return targetInst; + } +} + +/** + * SECTION: handle `input` event + */ +var isInputEventSupported = false; +if (canUseDOM) { + // IE9 claims to support the input event but fails to trigger it when + // deleting text, so we ignore its input events. + isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); +} + +/** + * (For IE <=9) Starts tracking propertychange events on the passed-in element + * and override the value property so that we can distinguish user events from + * value changes in JS. + */ +function startWatchingForValueChange(target, targetInst) { + activeElement = target; + activeElementInst = targetInst; + activeElement.attachEvent('onpropertychange', handlePropertyChange); +} + +/** + * (For IE <=9) Removes the event listeners from the currently-tracked element, + * if any exists. + */ +function stopWatchingForValueChange() { + if (!activeElement) { + return; + } + activeElement.detachEvent('onpropertychange', handlePropertyChange); + activeElement = null; + activeElementInst = null; +} + +/** + * (For IE <=9) Handles a propertychange event, sending a `change` event if + * the value of the active element has changed. + */ function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; @@ -5335,7 +5695,7 @@ function handlePropertyChange(nativeEvent) { } function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { - if (topLevelType === 'topFocus') { + if (topLevelType === TOP_FOCUS) { // In IE9, propertychange fires for most input events but is buggy and // doesn't fire when text is deleted, but conveniently, selectionchange // appears to fire in all of the remaining cases so we catch those and @@ -5348,14 +5708,14 @@ function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { // missed a blur event somehow. stopWatchingForValueChange(); startWatchingForValueChange(target, targetInst); - } else if (topLevelType === 'topBlur') { + } else if (topLevelType === TOP_BLUR) { stopWatchingForValueChange(); } } // For IE8 and IE9. function getTargetInstForInputEventPolyfill(topLevelType, targetInst) { - if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { + if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) { // On the selectionchange event, the target is just document which isn't // helpful for us so just check activeElement instead. // @@ -5382,34 +5742,27 @@ function shouldUseClickEvent(elem) { } function getTargetInstForClickEvent(topLevelType, targetInst) { - if (topLevelType === 'topClick') { + if (topLevelType === TOP_CLICK) { return getInstIfValueChanged(targetInst); } } function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) { - if (topLevelType === 'topInput' || topLevelType === 'topChange') { + if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) { return getInstIfValueChanged(targetInst); } } -function handleControlledInputBlur(inst, node) { - // TODO: In IE, inst is occasionally null. Why? - if (inst == null) { - return; - } - - // Fiber and ReactDOM keep wrapper state in separate places - var state = inst._wrapperState || node._wrapperState; +function handleControlledInputBlur(node) { + var state = node._wrapperState; if (!state || !state.controlled || node.type !== 'number') { return; } - // If controlled, assign the value attribute to the current value on blur - var value = '' + node.value; - if (node.getAttribute('value') !== value) { - node.setAttribute('value', value); + if (!disableInputAttributeSyncing) { + // If controlled, assign the value attribute to the current value on blur + setDefaultValue(node, 'number', node.value); } } @@ -5431,7 +5784,8 @@ var ChangeEventPlugin = { extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; - var getTargetInstFunc, handleEventFunc; + var getTargetInstFunc = void 0, + handleEventFunc = void 0; if (shouldUseChangeEvent(targetNode)) { getTargetInstFunc = getTargetInstForChangeEvent; } else if (isTextInputElement(targetNode)) { @@ -5458,8 +5812,8 @@ var ChangeEventPlugin = { } // When blurring, set the value attribute for number inputs - if (topLevelType === 'topBlur') { - handleControlledInputBlur(targetInst, targetNode); + if (topLevelType === TOP_BLUR) { + handleControlledInputBlur(targetNode); } } }; @@ -5473,33 +5827,12 @@ var ChangeEventPlugin = { * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that * preventing default on events is convenient in `SimpleEventPlugin` handlers. */ -var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; +var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; -/** - * @interface UIEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var UIEventInterface = { +var SyntheticUIEvent = SyntheticEvent.extend({ view: null, detail: null -}; - -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticEvent} - */ -function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); -} - -SyntheticEvent$1.augmentClass(SyntheticUIEvent, UIEventInterface); - -/** - * Translation from modifier key to the associated property in the event. - * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers - */ +}); var modifierKeyToProp = { Alt: 'altKey', @@ -5508,9 +5841,14 @@ var modifierKeyToProp = { Shift: 'shiftKey' }; -// IE8 does not implement getModifierState so we simply map it to the only -// modifier keys exposed by the event itself, does not support Lock-keys. -// Currently, all major browsers except Chrome seems to support Lock-keys. +// Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support +// getModifierState. If getModifierState is not supported, we map it to a set of +// modifier keys exposed by the event. In this case, Lock-keys are not supported. +/** + * Translation from modifier key to the associated property in the event. + * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers + */ + function modifierStateGetter(keyArg) { var syntheticEvent = this; var nativeEvent = syntheticEvent.nativeEvent; @@ -5525,11 +5863,17 @@ function getEventModifierState(nativeEvent) { return modifierStateGetter; } +var previousScreenX = 0; +var previousScreenY = 0; +// Use flags to signal movementX/Y has already been set +var isMovementXSet = false; +var isMovementYSet = false; + /** * @interface MouseEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ -var MouseEventInterface = { +var SyntheticMouseEvent = SyntheticUIEvent.extend({ screenX: null, screenY: null, clientX: null, @@ -5545,29 +5889,72 @@ var MouseEventInterface = { buttons: null, relatedTarget: function (event) { return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); + }, + movementX: function (event) { + if ('movementX' in event) { + return event.movementX; + } + + var screenX = previousScreenX; + previousScreenX = event.screenX; + + if (!isMovementXSet) { + isMovementXSet = true; + return 0; + } + + return event.type === 'mousemove' ? event.screenX - screenX : 0; + }, + movementY: function (event) { + if ('movementY' in event) { + return event.movementY; + } + + var screenY = previousScreenY; + previousScreenY = event.screenY; + + if (!isMovementYSet) { + isMovementYSet = true; + return 0; + } + + return event.type === 'mousemove' ? event.screenY - screenY : 0; } -}; +}); /** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticUIEvent} + * @interface PointerEvent + * @see http://www.w3.org/TR/pointerevents/ */ -function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); -} - -SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); +var SyntheticPointerEvent = SyntheticMouseEvent.extend({ + pointerId: null, + width: null, + height: null, + pressure: null, + tangentialPressure: null, + tiltX: null, + tiltY: null, + twist: null, + pointerType: null, + isPrimary: null +}); var eventTypes$2 = { mouseEnter: { registrationName: 'onMouseEnter', - dependencies: ['topMouseOut', 'topMouseOver'] + dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER] }, mouseLeave: { registrationName: 'onMouseLeave', - dependencies: ['topMouseOut', 'topMouseOver'] + dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER] + }, + pointerEnter: { + registrationName: 'onPointerEnter', + dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER] + }, + pointerLeave: { + registrationName: 'onPointerLeave', + dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER] } }; @@ -5582,15 +5969,19 @@ var EnterLeaveEventPlugin = { * the `mouseover` top-level event. */ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { + var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER; + var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT; + + if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { return null; } - if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { - // Must not be a mouse in or mouse out - ignoring. + + if (!isOutEvent && !isOverEvent) { + // Must not be a mouse or pointer in or out - ignoring. return null; } - var win; + var win = void 0; if (nativeEventTarget.window === nativeEventTarget) { // `nativeEventTarget` is probably a window object. win = nativeEventTarget; @@ -5604,9 +5995,9 @@ var EnterLeaveEventPlugin = { } } - var from; - var to; - if (topLevelType === 'topMouseOut') { + var from = void 0; + var to = void 0; + if (isOutEvent) { from = targetInst; var related = nativeEvent.relatedTarget || nativeEvent.toElement; to = related ? getClosestInstanceFromNode(related) : null; @@ -5621,16 +6012,33 @@ var EnterLeaveEventPlugin = { return null; } + var eventInterface = void 0, + leaveEventType = void 0, + enterEventType = void 0, + eventTypePrefix = void 0; + + if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) { + eventInterface = SyntheticMouseEvent; + leaveEventType = eventTypes$2.mouseLeave; + enterEventType = eventTypes$2.mouseEnter; + eventTypePrefix = 'mouse'; + } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) { + eventInterface = SyntheticPointerEvent; + leaveEventType = eventTypes$2.pointerLeave; + enterEventType = eventTypes$2.pointerEnter; + eventTypePrefix = 'pointer'; + } + var fromNode = from == null ? win : getNodeFromInstance$1(from); var toNode = to == null ? win : getNodeFromInstance$1(to); - var leave = SyntheticMouseEvent.getPooled(eventTypes$2.mouseLeave, from, nativeEvent, nativeEventTarget); - leave.type = 'mouseleave'; + var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget); + leave.type = eventTypePrefix + 'leave'; leave.target = fromNode; leave.relatedTarget = toNode; - var enter = SyntheticMouseEvent.getPooled(eventTypes$2.mouseEnter, to, nativeEvent, nativeEventTarget); - enter.type = 'mouseenter'; + var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget); + enter.type = eventTypePrefix + 'enter'; enter.target = toNode; enter.relatedTarget = fromNode; @@ -5640,6 +6048,58 @@ var EnterLeaveEventPlugin = { } }; +/*eslint-disable no-self-compare */ + +var hasOwnProperty$1 = Object.prototype.hasOwnProperty; + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + // Added the nonzero y check to make Flow happy, but it is redundant + return x !== 0 || y !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } +} + +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; + } + + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + for (var i = 0; i < keysA.length; i++) { + if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { + return false; + } + } + + return true; +} + /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public @@ -5669,36 +6129,32 @@ function set(key, value) { key._reactInternalFiber = value; } -var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +// Don't change these two values. They're used by React Dev Tools. +var NoEffect = /* */0; +var PerformedWork = /* */1; -var ReactCurrentOwner = ReactInternals.ReactCurrentOwner; -var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame; +// You can change the rest (and add more). +var Placement = /* */2; +var Update = /* */4; +var PlacementAndUpdate = /* */6; +var Deletion = /* */8; +var ContentReset = /* */16; +var Callback = /* */32; +var DidCapture = /* */64; +var Ref = /* */128; +var Snapshot = /* */256; +var Passive = /* */512; -function getComponentName(fiber) { - var type = fiber.type; +// Passive & Update & Callback & Ref & Snapshot +var LifecycleEffectMask = /* */932; - if (typeof type === 'string') { - return type; - } - if (typeof type === 'function') { - return type.displayName || type.name; - } - return null; -} +// Union of all host effects +var HostEffectMask = /* */1023; -// Don't change these two values: -var NoEffect = 0; // 0b00000000 -var PerformedWork = 1; // 0b00000001 +var Incomplete = /* */1024; +var ShouldCapture = /* */2048; -// You can change the rest (and add more). -var Placement = 2; // 0b00000010 -var Update = 4; // 0b00000100 -var PlacementAndUpdate = 6; // 0b00000110 -var Deletion = 8; // 0b00001000 -var ContentReset = 16; // 0b00010000 -var Callback = 32; // 0b00100000 -var Err = 64; // 0b01000000 -var Ref = 128; // 0b10000000 +var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; var MOUNTING = 1; var MOUNTED = 2; @@ -5712,15 +6168,15 @@ function isFiberMountedImpl(fiber) { if ((node.effectTag & Placement) !== NoEffect) { return MOUNTING; } - while (node['return']) { - node = node['return']; + while (node.return) { + node = node.return; if ((node.effectTag & Placement) !== NoEffect) { return MOUNTING; } } } else { - while (node['return']) { - node = node['return']; + while (node.return) { + node = node.return; } } if (node.tag === HostRoot) { @@ -5739,11 +6195,11 @@ function isFiberMounted(fiber) { function isMounted(component) { { - var owner = ReactCurrentOwner.current; + var owner = ReactCurrentOwner$1.current; if (owner !== null && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; - warning(instance._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber) || 'A component'); + !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0; instance._warnedAboutRefsInRender = true; } } @@ -5776,7 +6232,7 @@ function findCurrentFiberUsingSlowPath(fiber) { var a = fiber; var b = alternate; while (true) { - var parentA = a['return']; + var parentA = a.return; var parentB = parentA ? parentA.alternate : null; if (!parentA || !parentB) { // We're at the root. @@ -5806,7 +6262,7 @@ function findCurrentFiberUsingSlowPath(fiber) { invariant(false, 'Unable to find node on an unmounted component.'); } - if (a['return'] !== b['return']) { + if (a.return !== b.return) { // The return pointer of A and the return pointer of B point to different // fibers. We assume that return pointers never criss-cross, so A must // belong to the child set of A.return, and B must belong to the child @@ -5883,7 +6339,7 @@ function findCurrentHostFiber(parent) { if (node.tag === HostComponent || node.tag === HostText) { return node; } else if (node.child) { - node.child['return'] = node; + node.child.return = node; node = node.child; continue; } @@ -5891,12 +6347,12 @@ function findCurrentHostFiber(parent) { return null; } while (!node.sibling) { - if (!node['return'] || node['return'] === currentParent) { + if (!node.return || node.return === currentParent) { return null; } - node = node['return']; + node = node.return; } - node.sibling['return'] = node['return']; + node.sibling.return = node.return; node = node.sibling; } // Flow needs the return null here, but ESLint complains about it. @@ -5916,7 +6372,7 @@ function findCurrentHostFiberWithNoPortals(parent) { if (node.tag === HostComponent || node.tag === HostText) { return node; } else if (node.child && node.tag !== HostPortal) { - node.child['return'] = node; + node.child.return = node; node = node.child; continue; } @@ -5924,12 +6380,12 @@ function findCurrentHostFiberWithNoPortals(parent) { return null; } while (!node.sibling) { - if (!node['return'] || node['return'] === currentParent) { + if (!node.return || node.return === currentParent) { return null; } - node = node['return']; + node = node.return; } - node.sibling['return'] = node['return']; + node.sibling.return = node.return; node = node.sibling; } // Flow needs the return null here, but ESLint complains about it. @@ -5937,1487 +6393,1341 @@ function findCurrentHostFiberWithNoPortals(parent) { return null; } -var CALLBACK_BOOKKEEPING_POOL_SIZE = 10; -var callbackBookkeepingPool = []; - -/** - * Find the deepest React component completely containing the root of the - * passed-in instance (for use when entire React trees are nested within each - * other). If React trees are not nested, returns null. - */ -function findRootContainerNode(inst) { - // TODO: It may be a good idea to cache this to prevent unnecessary DOM - // traversal, but caching is difficult to do correctly without using a - // mutation observer to listen for all DOM changes. - while (inst['return']) { - inst = inst['return']; - } - if (inst.tag !== HostRoot) { - // This can happen if we're in a detached tree. - return null; - } - return inst.stateNode.containerInfo; -} - -// Used to store ancestor hierarchy in top level callback -function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { - if (callbackBookkeepingPool.length) { - var instance = callbackBookkeepingPool.pop(); - instance.topLevelType = topLevelType; - instance.nativeEvent = nativeEvent; - instance.targetInst = targetInst; - return instance; - } - return { - topLevelType: topLevelType, - nativeEvent: nativeEvent, - targetInst: targetInst, - ancestors: [] - }; +function addEventBubbleListener(element, eventType, listener) { + element.addEventListener(eventType, listener, false); } -function releaseTopLevelCallbackBookKeeping(instance) { - instance.topLevelType = null; - instance.nativeEvent = null; - instance.targetInst = null; - instance.ancestors.length = 0; - if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { - callbackBookkeepingPool.push(instance); - } +function addEventCaptureListener(element, eventType, listener) { + element.addEventListener(eventType, listener, true); } -function handleTopLevelImpl(bookKeeping) { - var targetInst = bookKeeping.targetInst; - - // Loop through the hierarchy, in case there's any nested components. - // It's important that we build the array of ancestors before calling any - // event handlers, because event handlers can modify the DOM, leading to - // inconsistencies with ReactMount's node cache. See #1105. - var ancestor = targetInst; - do { - if (!ancestor) { - bookKeeping.ancestors.push(ancestor); - break; - } - var root = findRootContainerNode(ancestor); - if (!root) { - break; - } - bookKeeping.ancestors.push(ancestor); - ancestor = getClosestInstanceFromNode(root); - } while (ancestor); +/** + * @interface Event + * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface + * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent + */ +var SyntheticAnimationEvent = SyntheticEvent.extend({ + animationName: null, + elapsedTime: null, + pseudoElement: null +}); - for (var i = 0; i < bookKeeping.ancestors.length; i++) { - targetInst = bookKeeping.ancestors[i]; - _handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); +/** + * @interface Event + * @see http://www.w3.org/TR/clipboard-apis/ + */ +var SyntheticClipboardEvent = SyntheticEvent.extend({ + clipboardData: function (event) { + return 'clipboardData' in event ? event.clipboardData : window.clipboardData; } -} - -// TODO: can we stop exporting these? -var _enabled = true; -var _handleTopLevel = void 0; - -function setHandleTopLevel(handleTopLevel) { - _handleTopLevel = handleTopLevel; -} - -function setEnabled(enabled) { - _enabled = !!enabled; -} - -function isEnabled() { - return _enabled; -} +}); /** - * Traps top-level events by using event bubbling. - * - * @param {string} topLevelType Record from `BrowserEventConstants`. - * @param {string} handlerBaseName Event name (e.g. "click"). - * @param {object} element Element on which to attach listener. - * @return {?object} An object with a remove function which will forcefully - * remove the listener. - * @internal + * @interface FocusEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ -function trapBubbledEvent(topLevelType, handlerBaseName, element) { - if (!element) { - return null; - } - return EventListener.listen(element, handlerBaseName, dispatchEvent.bind(null, topLevelType)); -} +var SyntheticFocusEvent = SyntheticUIEvent.extend({ + relatedTarget: null +}); /** - * Traps a top-level event by using event capturing. + * `charCode` represents the actual "character code" and is safe to use with + * `String.fromCharCode`. As such, only keys that correspond to printable + * characters produce a valid `charCode`, the only exception to this is Enter. + * The Tab-key is considered non-printable and does not have a `charCode`, + * presumably because it does not produce a tab-character in browsers. * - * @param {string} topLevelType Record from `BrowserEventConstants`. - * @param {string} handlerBaseName Event name (e.g. "click"). - * @param {object} element Element on which to attach listener. - * @return {?object} An object with a remove function which will forcefully - * remove the listener. - * @internal + * @param {object} nativeEvent Native browser event. + * @return {number} Normalized `charCode` property. */ -function trapCapturedEvent(topLevelType, handlerBaseName, element) { - if (!element) { - return null; - } - return EventListener.capture(element, handlerBaseName, dispatchEvent.bind(null, topLevelType)); -} +function getEventCharCode(nativeEvent) { + var charCode = void 0; + var keyCode = nativeEvent.keyCode; -function dispatchEvent(topLevelType, nativeEvent) { - if (!_enabled) { - return; - } + if ('charCode' in nativeEvent) { + charCode = nativeEvent.charCode; - var nativeEventTarget = getEventTarget(nativeEvent); - var targetInst = getClosestInstanceFromNode(nativeEventTarget); - if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { - // If we get an event (ex: img onload) before committing that - // component's mount, ignore it for now (that is, treat it as if it was an - // event on a non-React tree). We might also consider queueing events and - // dispatching them after the mount. - targetInst = null; + // FF does not set `charCode` for the Enter-key, check against `keyCode`. + if (charCode === 0 && keyCode === 13) { + charCode = 13; + } + } else { + // IE8 does not implement `charCode`, but `keyCode` has the correct value. + charCode = keyCode; } - var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); + // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) + // report Enter as charCode 10 when ctrl is pressed. + if (charCode === 10) { + charCode = 13; + } - try { - // Event queue being processed in the same cycle allows - // `preventDefault`. - batchedUpdates(handleTopLevelImpl, bookKeeping); - } finally { - releaseTopLevelCallbackBookKeeping(bookKeeping); + // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. + // Must not discard the (non-)printable Enter-key. + if (charCode >= 32 || charCode === 13) { + return charCode; } -} -var ReactDOMEventListener = Object.freeze({ - get _enabled () { return _enabled; }, - get _handleTopLevel () { return _handleTopLevel; }, - setHandleTopLevel: setHandleTopLevel, - setEnabled: setEnabled, - isEnabled: isEnabled, - trapBubbledEvent: trapBubbledEvent, - trapCapturedEvent: trapCapturedEvent, - dispatchEvent: dispatchEvent -}); + return 0; +} /** - * Generate a mapping of standard vendor prefixes using the defined style property and event name. - * - * @param {string} styleProp - * @param {string} eventName - * @returns {object} + * Normalization of deprecated HTML5 `key` values + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ -function makePrefixMap(styleProp, eventName) { - var prefixes = {}; - - prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); - prefixes['Webkit' + styleProp] = 'webkit' + eventName; - prefixes['Moz' + styleProp] = 'moz' + eventName; - prefixes['ms' + styleProp] = 'MS' + eventName; - prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); - - return prefixes; -} +var normalizeKey = { + Esc: 'Escape', + Spacebar: ' ', + Left: 'ArrowLeft', + Up: 'ArrowUp', + Right: 'ArrowRight', + Down: 'ArrowDown', + Del: 'Delete', + Win: 'OS', + Menu: 'ContextMenu', + Apps: 'ContextMenu', + Scroll: 'ScrollLock', + MozPrintableKey: 'Unidentified' +}; /** - * A list of event names to a configurable list of vendor prefixes. + * Translation from legacy `keyCode` to HTML5 `key` + * Only special keys supported, all others depend on keyboard layout or browser + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ -var vendorPrefixes = { - animationend: makePrefixMap('Animation', 'AnimationEnd'), - animationiteration: makePrefixMap('Animation', 'AnimationIteration'), - animationstart: makePrefixMap('Animation', 'AnimationStart'), - transitionend: makePrefixMap('Transition', 'TransitionEnd') +var translateToKey = { + '8': 'Backspace', + '9': 'Tab', + '12': 'Clear', + '13': 'Enter', + '16': 'Shift', + '17': 'Control', + '18': 'Alt', + '19': 'Pause', + '20': 'CapsLock', + '27': 'Escape', + '32': ' ', + '33': 'PageUp', + '34': 'PageDown', + '35': 'End', + '36': 'Home', + '37': 'ArrowLeft', + '38': 'ArrowUp', + '39': 'ArrowRight', + '40': 'ArrowDown', + '45': 'Insert', + '46': 'Delete', + '112': 'F1', + '113': 'F2', + '114': 'F3', + '115': 'F4', + '116': 'F5', + '117': 'F6', + '118': 'F7', + '119': 'F8', + '120': 'F9', + '121': 'F10', + '122': 'F11', + '123': 'F12', + '144': 'NumLock', + '145': 'ScrollLock', + '224': 'Meta' }; /** - * Event names that have already been detected and prefixed (if applicable). + * @param {object} nativeEvent Native browser event. + * @return {string} Normalized `key` property. */ -var prefixedEventNames = {}; +function getEventKey(nativeEvent) { + if (nativeEvent.key) { + // Normalize inconsistent values reported by browsers due to + // implementations of a working draft specification. -/** - * Element to check for prefixes on. - */ -var style = {}; + // FireFox implements `key` but returns `MozPrintableKey` for all + // printable characters (normalized to `Unidentified`), ignore it. + var key = normalizeKey[nativeEvent.key] || nativeEvent.key; + if (key !== 'Unidentified') { + return key; + } + } -/** - * Bootstrap if a DOM exists. - */ -if (ExecutionEnvironment.canUseDOM) { - style = document.createElement('div').style; + // Browser does not implement `key`, polyfill as much of it as we can. + if (nativeEvent.type === 'keypress') { + var charCode = getEventCharCode(nativeEvent); - // On some platforms, in particular some releases of Android 4.x, - // the un-prefixed "animation" and "transition" properties are defined on the - // style object but the events that fire will still be prefixed, so we need - // to check if the un-prefixed events are usable, and if not remove them from the map. - if (!('AnimationEvent' in window)) { - delete vendorPrefixes.animationend.animation; - delete vendorPrefixes.animationiteration.animation; - delete vendorPrefixes.animationstart.animation; + // The enter-key is technically both printable and non-printable and can + // thus be captured by `keypress`, no other non-printable key should. + return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); } - - // Same as above - if (!('TransitionEvent' in window)) { - delete vendorPrefixes.transitionend.transition; + if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { + // While user keyboard layout determines the actual meaning of each + // `keyCode` value, almost all function keys have a universal value. + return translateToKey[nativeEvent.keyCode] || 'Unidentified'; } + return ''; } /** - * Attempts to determine the correct vendor prefixed event name. - * - * @param {string} eventName - * @returns {string} + * @interface KeyboardEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ -function getVendorPrefixedEventName(eventName) { - if (prefixedEventNames[eventName]) { - return prefixedEventNames[eventName]; - } else if (!vendorPrefixes[eventName]) { - return eventName; - } +var SyntheticKeyboardEvent = SyntheticUIEvent.extend({ + key: getEventKey, + location: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + repeat: null, + locale: null, + getModifierState: getEventModifierState, + // Legacy Interface + charCode: function (event) { + // `charCode` is the result of a KeyPress event and represents the value of + // the actual printable character. - var prefixMap = vendorPrefixes[eventName]; + // KeyPress is deprecated, but its replacement is not yet final and not + // implemented in any major browser. Only KeyPress has charCode. + if (event.type === 'keypress') { + return getEventCharCode(event); + } + return 0; + }, + keyCode: function (event) { + // `keyCode` is the result of a KeyDown/Up event and represents the value of + // physical keyboard key. - for (var styleProp in prefixMap) { - if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { - return prefixedEventNames[eventName] = prefixMap[styleProp]; + // The actual meaning of the value depends on the users' keyboard layout + // which cannot be detected. Assuming that it is a US keyboard layout + // provides a surprisingly accurate mapping for US and European users. + // Due to this, it is left to the user to implement at this time. + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; + } + return 0; + }, + which: function (event) { + // `which` is an alias for either `keyCode` or `charCode` depending on the + // type of the event. + if (event.type === 'keypress') { + return getEventCharCode(event); + } + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; } + return 0; } - - return ''; -} +}); /** - * Types of raw signals from the browser caught at the top level. - * - * For events like 'submit' which don't consistently bubble (which we - * trap at a lower node than `document`), binding at `document` would - * cause duplicate events so we don't include them here. + * @interface DragEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ -var topLevelTypes$1 = { - topAbort: 'abort', - topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', - topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', - topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', - topBlur: 'blur', - topCancel: 'cancel', - topCanPlay: 'canplay', - topCanPlayThrough: 'canplaythrough', - topChange: 'change', - topClick: 'click', - topClose: 'close', - topCompositionEnd: 'compositionend', - topCompositionStart: 'compositionstart', - topCompositionUpdate: 'compositionupdate', - topContextMenu: 'contextmenu', - topCopy: 'copy', - topCut: 'cut', - topDoubleClick: 'dblclick', - topDrag: 'drag', - topDragEnd: 'dragend', - topDragEnter: 'dragenter', - topDragExit: 'dragexit', - topDragLeave: 'dragleave', - topDragOver: 'dragover', - topDragStart: 'dragstart', - topDrop: 'drop', - topDurationChange: 'durationchange', - topEmptied: 'emptied', - topEncrypted: 'encrypted', - topEnded: 'ended', - topError: 'error', - topFocus: 'focus', - topInput: 'input', - topKeyDown: 'keydown', - topKeyPress: 'keypress', - topKeyUp: 'keyup', - topLoadedData: 'loadeddata', - topLoad: 'load', - topLoadedMetadata: 'loadedmetadata', - topLoadStart: 'loadstart', - topMouseDown: 'mousedown', - topMouseMove: 'mousemove', - topMouseOut: 'mouseout', - topMouseOver: 'mouseover', - topMouseUp: 'mouseup', - topPaste: 'paste', - topPause: 'pause', - topPlay: 'play', - topPlaying: 'playing', - topProgress: 'progress', - topRateChange: 'ratechange', - topScroll: 'scroll', - topSeeked: 'seeked', - topSeeking: 'seeking', - topSelectionChange: 'selectionchange', - topStalled: 'stalled', - topSuspend: 'suspend', - topTextInput: 'textInput', - topTimeUpdate: 'timeupdate', - topToggle: 'toggle', - topTouchCancel: 'touchcancel', - topTouchEnd: 'touchend', - topTouchMove: 'touchmove', - topTouchStart: 'touchstart', - topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', - topVolumeChange: 'volumechange', - topWaiting: 'waiting', - topWheel: 'wheel' -}; +var SyntheticDragEvent = SyntheticMouseEvent.extend({ + dataTransfer: null +}); -var BrowserEventConstants = { - topLevelTypes: topLevelTypes$1 -}; +/** + * @interface TouchEvent + * @see http://www.w3.org/TR/touch-events/ + */ +var SyntheticTouchEvent = SyntheticUIEvent.extend({ + touches: null, + targetTouches: null, + changedTouches: null, + altKey: null, + metaKey: null, + ctrlKey: null, + shiftKey: null, + getModifierState: getEventModifierState +}); -function runEventQueueInBatch(events) { - enqueueEvents(events); - processEventQueue(false); -} +/** + * @interface Event + * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- + * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent + */ +var SyntheticTransitionEvent = SyntheticEvent.extend({ + propertyName: null, + elapsedTime: null, + pseudoElement: null +}); /** - * Streams a fired top-level event to `EventPluginHub` where plugins have the - * opportunity to create `ReactEvent`s to be dispatched. + * @interface WheelEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ -function handleTopLevel(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); - runEventQueueInBatch(events); -} +var SyntheticWheelEvent = SyntheticMouseEvent.extend({ + deltaX: function (event) { + return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). + 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; + }, + deltaY: function (event) { + return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). + 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). + 'wheelDelta' in event ? -event.wheelDelta : 0; + }, + + deltaZ: null, -var topLevelTypes = BrowserEventConstants.topLevelTypes; + // Browsers without "deltaMode" is reporting in raw wheel delta where one + // notch on the scroll is always +/- 120, roughly equivalent to pixels. + // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or + // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. + deltaMode: null +}); /** - * Summary of `ReactBrowserEventEmitter` event handling: - * - * - Top-level delegation is used to trap most native browser events. This - * may only occur in the main thread and is the responsibility of - * ReactDOMEventListener, which is injected and can therefore support - * pluggable event sources. This is the only work that occurs in the main - * thread. - * - * - We normalize and de-duplicate events to account for browser quirks. This - * may be done in the worker thread. - * - * - Forward these native events (with the associated top-level type used to - * trap it) to `EventPluginHub`, which in turn will ask plugins if they want - * to extract any synthetic events. - * - * - The `EventPluginHub` will then process each event by annotating them with - * "dispatches", a sequence of listeners and IDs that care about that event. - * - * - The `EventPluginHub` then dispatches the events. - * - * Overview of React and the event system: - * - * +------------+ . - * | DOM | . - * +------------+ . - * | . - * v . - * +------------+ . - * | ReactEvent | . - * | Listener | . - * +------------+ . +-----------+ - * | . +--------+|SimpleEvent| - * | . | |Plugin | - * +-----|------+ . v +-----------+ - * | | | . +--------------+ +------------+ - * | +-----------.--->|EventPluginHub| | Event | - * | | . | | +-----------+ | Propagators| - * | ReactEvent | . | | |TapEvent | |------------| - * | Emitter | . | |<---+|Plugin | |other plugin| - * | | . | | +-----------+ | utilities | - * | +-----------.--->| | +------------+ - * | | | . +--------------+ - * +-----|------+ . ^ +-----------+ - * | . | |Enter/Leave| - * + . +-------+|Plugin | - * +-------------+ . +-----------+ - * | application | . - * |-------------| . - * | | . - * | | . - * +-------------+ . - * . - * React Core . General Purpose Event Plugin System + * Turns + * ['abort', ...] + * into + * eventTypes = { + * 'abort': { + * phasedRegistrationNames: { + * bubbled: 'onAbort', + * captured: 'onAbortCapture', + * }, + * dependencies: [TOP_ABORT], + * }, + * ... + * }; + * topLevelEventsToDispatchConfig = new Map([ + * [TOP_ABORT, { sameConfig }], + * ]); */ -var alreadyListeningTo = {}; -var reactTopListenersCounter = 0; +var interactiveEventTypeNames = [[TOP_BLUR, 'blur'], [TOP_CANCEL, 'cancel'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_AUX_CLICK, 'auxClick'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_START, 'dragStart'], [TOP_DROP, 'drop'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_INVALID, 'invalid'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_POINTER_CANCEL, 'pointerCancel'], [TOP_POINTER_DOWN, 'pointerDown'], [TOP_POINTER_UP, 'pointerUp'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_RESET, 'reset'], [TOP_SEEKED, 'seeked'], [TOP_SUBMIT, 'submit'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_START, 'touchStart'], [TOP_VOLUME_CHANGE, 'volumeChange']]; +var nonInteractiveEventTypeNames = [[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_DRAG, 'drag'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_LOAD_START, 'loadStart'], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_PLAYING, 'playing'], [TOP_POINTER_MOVE, 'pointerMove'], [TOP_POINTER_OUT, 'pointerOut'], [TOP_POINTER_OVER, 'pointerOver'], [TOP_PROGRESS, 'progress'], [TOP_SCROLL, 'scroll'], [TOP_SEEKING, 'seeking'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']]; -/** - * To ensure no conflicts with other potential React instances on the page - */ -var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2); +var eventTypes$4 = {}; +var topLevelEventsToDispatchConfig = {}; -function getListeningForDocument(mountAt) { - // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` - // directly. - if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { - mountAt[topListenersIDKey] = reactTopListenersCounter++; - alreadyListeningTo[mountAt[topListenersIDKey]] = {}; - } - return alreadyListeningTo[mountAt[topListenersIDKey]]; +function addEventTypeNameToConfig(_ref, isInteractive) { + var topEvent = _ref[0], + event = _ref[1]; + + var capitalizedEvent = event[0].toUpperCase() + event.slice(1); + var onEvent = 'on' + capitalizedEvent; + + var type = { + phasedRegistrationNames: { + bubbled: onEvent, + captured: onEvent + 'Capture' + }, + dependencies: [topEvent], + isInteractive: isInteractive + }; + eventTypes$4[event] = type; + topLevelEventsToDispatchConfig[topEvent] = type; } -/** - * We listen for bubbled touch events on the document object. - * - * Firefox v8.01 (and possibly others) exhibited strange behavior when - * mounting `onmousemove` events at some node that was not the document - * element. The symptoms were that if your mouse is not moving over something - * contained within that mount point (for example on the background) the - * top-level listeners for `onmousemove` won't be called. However, if you - * register the `mousemove` on the document object, then it will of course - * catch all `mousemove`s. This along with iOS quirks, justifies restricting - * top-level listeners to the document object only, at least for these - * movement types of events and possibly all events. - * - * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html - * - * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but - * they bubble to document. - * - * @param {string} registrationName Name of listener (e.g. `onClick`). - * @param {object} contentDocumentHandle Document which owns the container - */ -function listenTo(registrationName, contentDocumentHandle) { - var mountAt = contentDocumentHandle; - var isListening = getListeningForDocument(mountAt); - var dependencies = registrationNameDependencies[registrationName]; +interactiveEventTypeNames.forEach(function (eventTuple) { + addEventTypeNameToConfig(eventTuple, true); +}); +nonInteractiveEventTypeNames.forEach(function (eventTuple) { + addEventTypeNameToConfig(eventTuple, false); +}); - for (var i = 0; i < dependencies.length; i++) { - var dependency = dependencies[i]; - if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { - if (dependency === 'topScroll') { - trapCapturedEvent('topScroll', 'scroll', mountAt); - } else if (dependency === 'topFocus' || dependency === 'topBlur') { - trapCapturedEvent('topFocus', 'focus', mountAt); - trapCapturedEvent('topBlur', 'blur', mountAt); - - // to make sure blur and focus event listeners are only attached once - isListening.topBlur = true; - isListening.topFocus = true; - } else if (dependency === 'topCancel') { - if (isEventSupported('cancel', true)) { - trapCapturedEvent('topCancel', 'cancel', mountAt); +// Only used in DEV for exhaustiveness validation. +var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING]; + +var SimpleEventPlugin = { + eventTypes: eventTypes$4, + + isInteractiveTopLevelEventType: function (topLevelType) { + var config = topLevelEventsToDispatchConfig[topLevelType]; + return config !== undefined && config.isInteractive === true; + }, + + + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; + if (!dispatchConfig) { + return null; + } + var EventConstructor = void 0; + switch (topLevelType) { + case TOP_KEY_PRESS: + // Firefox creates a keypress event for function keys too. This removes + // the unwanted keypress events. Enter is however both printable and + // non-printable. One would expect Tab to be as well (but it isn't). + if (getEventCharCode(nativeEvent) === 0) { + return null; } - isListening.topCancel = true; - } else if (dependency === 'topClose') { - if (isEventSupported('close', true)) { - trapCapturedEvent('topClose', 'close', mountAt); + /* falls through */ + case TOP_KEY_DOWN: + case TOP_KEY_UP: + EventConstructor = SyntheticKeyboardEvent; + break; + case TOP_BLUR: + case TOP_FOCUS: + EventConstructor = SyntheticFocusEvent; + break; + case TOP_CLICK: + // Firefox creates a click event on right mouse clicks. This removes the + // unwanted click events. + if (nativeEvent.button === 2) { + return null; } - isListening.topClose = true; - } else if (topLevelTypes.hasOwnProperty(dependency)) { - trapBubbledEvent(dependency, topLevelTypes[dependency], mountAt); - } - - isListening[dependency] = true; + /* falls through */ + case TOP_AUX_CLICK: + case TOP_DOUBLE_CLICK: + case TOP_MOUSE_DOWN: + case TOP_MOUSE_MOVE: + case TOP_MOUSE_UP: + // TODO: Disabled elements should not respond to mouse events + /* falls through */ + case TOP_MOUSE_OUT: + case TOP_MOUSE_OVER: + case TOP_CONTEXT_MENU: + EventConstructor = SyntheticMouseEvent; + break; + case TOP_DRAG: + case TOP_DRAG_END: + case TOP_DRAG_ENTER: + case TOP_DRAG_EXIT: + case TOP_DRAG_LEAVE: + case TOP_DRAG_OVER: + case TOP_DRAG_START: + case TOP_DROP: + EventConstructor = SyntheticDragEvent; + break; + case TOP_TOUCH_CANCEL: + case TOP_TOUCH_END: + case TOP_TOUCH_MOVE: + case TOP_TOUCH_START: + EventConstructor = SyntheticTouchEvent; + break; + case TOP_ANIMATION_END: + case TOP_ANIMATION_ITERATION: + case TOP_ANIMATION_START: + EventConstructor = SyntheticAnimationEvent; + break; + case TOP_TRANSITION_END: + EventConstructor = SyntheticTransitionEvent; + break; + case TOP_SCROLL: + EventConstructor = SyntheticUIEvent; + break; + case TOP_WHEEL: + EventConstructor = SyntheticWheelEvent; + break; + case TOP_COPY: + case TOP_CUT: + case TOP_PASTE: + EventConstructor = SyntheticClipboardEvent; + break; + case TOP_GOT_POINTER_CAPTURE: + case TOP_LOST_POINTER_CAPTURE: + case TOP_POINTER_CANCEL: + case TOP_POINTER_DOWN: + case TOP_POINTER_MOVE: + case TOP_POINTER_OUT: + case TOP_POINTER_OVER: + case TOP_POINTER_UP: + EventConstructor = SyntheticPointerEvent; + break; + default: + { + if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) { + warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType); + } + } + // HTML Events + // @see http://www.w3.org/TR/html5/index.html#events-0 + EventConstructor = SyntheticEvent; + break; } + var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); + accumulateTwoPhaseDispatches(event); + return event; } -} +}; -function isListeningToAllDependencies(registrationName, mountAt) { - var isListening = getListeningForDocument(mountAt); - var dependencies = registrationNameDependencies[registrationName]; - for (var i = 0; i < dependencies.length; i++) { - var dependency = dependencies[i]; - if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { - return false; - } - } - return true; -} +var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType; + + +var CALLBACK_BOOKKEEPING_POOL_SIZE = 10; +var callbackBookkeepingPool = []; /** - * Given any node return the first leaf node without children. - * - * @param {DOMElement|DOMTextNode} node - * @return {DOMElement|DOMTextNode} + * Find the deepest React component completely containing the root of the + * passed-in instance (for use when entire React trees are nested within each + * other). If React trees are not nested, returns null. */ -function getLeafNode(node) { - while (node && node.firstChild) { - node = node.firstChild; +function findRootContainerNode(inst) { + // TODO: It may be a good idea to cache this to prevent unnecessary DOM + // traversal, but caching is difficult to do correctly without using a + // mutation observer to listen for all DOM changes. + while (inst.return) { + inst = inst.return; } - return node; + if (inst.tag !== HostRoot) { + // This can happen if we're in a detached tree. + return null; + } + return inst.stateNode.containerInfo; } -/** - * Get the next sibling within a container. This will walk up the - * DOM if a node's siblings have been exhausted. - * - * @param {DOMElement|DOMTextNode} node - * @return {?DOMElement|DOMTextNode} - */ -function getSiblingNode(node) { - while (node) { - if (node.nextSibling) { - return node.nextSibling; - } - node = node.parentNode; +// Used to store ancestor hierarchy in top level callback +function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { + if (callbackBookkeepingPool.length) { + var instance = callbackBookkeepingPool.pop(); + instance.topLevelType = topLevelType; + instance.nativeEvent = nativeEvent; + instance.targetInst = targetInst; + return instance; } + return { + topLevelType: topLevelType, + nativeEvent: nativeEvent, + targetInst: targetInst, + ancestors: [] + }; } -/** - * Get object describing the nodes which contain characters at offset. - * - * @param {DOMElement|DOMTextNode} root - * @param {number} offset - * @return {?object} - */ -function getNodeForCharacterOffset(root, offset) { - var node = getLeafNode(root); - var nodeStart = 0; - var nodeEnd = 0; - - while (node) { - if (node.nodeType === TEXT_NODE) { - nodeEnd = nodeStart + node.textContent.length; - - if (nodeStart <= offset && nodeEnd >= offset) { - return { - node: node, - offset: offset - nodeStart - }; - } - - nodeStart = nodeEnd; - } - - node = getLeafNode(getSiblingNode(node)); +function releaseTopLevelCallbackBookKeeping(instance) { + instance.topLevelType = null; + instance.nativeEvent = null; + instance.targetInst = null; + instance.ancestors.length = 0; + if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { + callbackBookkeepingPool.push(instance); } } -/** - * @param {DOMElement} outerNode - * @return {?object} - */ -function getOffsets(outerNode) { - var selection = window.getSelection && window.getSelection(); +function handleTopLevel(bookKeeping) { + var targetInst = bookKeeping.targetInst; - if (!selection || selection.rangeCount === 0) { - return null; - } + // Loop through the hierarchy, in case there's any nested components. + // It's important that we build the array of ancestors before calling any + // event handlers, because event handlers can modify the DOM, leading to + // inconsistencies with ReactMount's node cache. See #1105. + var ancestor = targetInst; + do { + if (!ancestor) { + bookKeeping.ancestors.push(ancestor); + break; + } + var root = findRootContainerNode(ancestor); + if (!root) { + break; + } + bookKeeping.ancestors.push(ancestor); + ancestor = getClosestInstanceFromNode(root); + } while (ancestor); - var anchorNode = selection.anchorNode, - anchorOffset = selection.anchorOffset, - focusNode$$1 = selection.focusNode, - focusOffset = selection.focusOffset; + for (var i = 0; i < bookKeeping.ancestors.length; i++) { + targetInst = bookKeeping.ancestors[i]; + runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); + } +} - // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the - // up/down buttons on an . Anonymous divs do not seem to - // expose properties, triggering a "Permission denied error" if any of its - // properties are accessed. The only seemingly possible way to avoid erroring - // is to access a property that typically works for non-anonymous divs and - // catch any error that may otherwise arise. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 +// TODO: can we stop exporting these? +var _enabled = true; - try { - /* eslint-disable no-unused-expressions */ - anchorNode.nodeType; - focusNode$$1.nodeType; - /* eslint-enable no-unused-expressions */ - } catch (e) { - return null; - } +function setEnabled(enabled) { + _enabled = !!enabled; +} - return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode$$1, focusOffset); +function isEnabled() { + return _enabled; } /** - * Returns {start, end} where `start` is the character/codepoint index of - * (anchorNode, anchorOffset) within the textContent of `outerNode`, and - * `end` is the index of (focusNode, focusOffset). - * - * Returns null if you pass in garbage input but we should probably just crash. + * Traps top-level events by using event bubbling. * - * Exported only for testing. + * @param {number} topLevelType Number from `TopLevelEventTypes`. + * @param {object} element Element on which to attach listener. + * @return {?object} An object with a remove function which will forcefully + * remove the listener. + * @internal */ -function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode$$1, focusOffset) { - var length = 0; - var start = -1; - var end = -1; - var indexWithinAnchor = 0; - var indexWithinFocus = 0; - var node = outerNode; - var parentNode = null; - - outer: while (true) { - var next = null; - - while (true) { - if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { - start = length + anchorOffset; - } - if (node === focusNode$$1 && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { - end = length + focusOffset; - } - - if (node.nodeType === TEXT_NODE) { - length += node.nodeValue.length; - } - - if ((next = node.firstChild) === null) { - break; - } - // Moving from `node` to its first child `next`. - parentNode = node; - node = next; - } - - while (true) { - if (node === outerNode) { - // If `outerNode` has children, this is always the second time visiting - // it. If it has no children, this is still the first loop, and the only - // valid selection is anchorNode and focusNode both equal to this node - // and both offsets 0, in which case we will have handled above. - break outer; - } - if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { - start = length; - } - if (parentNode === focusNode$$1 && ++indexWithinFocus === focusOffset) { - end = length; - } - if ((next = node.nextSibling) !== null) { - break; - } - node = parentNode; - parentNode = node.parentNode; - } - - // Moving from `node` to its next sibling `next`. - node = next; - } - - if (start === -1 || end === -1) { - // This should never happen. (Would happen if the anchor/focus nodes aren't - // actually inside the passed-in node.) +function trapBubbledEvent(topLevelType, element) { + if (!element) { return null; } + var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; - return { - start: start, - end: end - }; + addEventBubbleListener(element, getRawEventName(topLevelType), + // Check if interactive and wrap in interactiveUpdates + dispatch.bind(null, topLevelType)); } /** - * In modern non-IE browsers, we can support both forward and backward - * selections. - * - * Note: IE10+ supports the Selection object, but it does not support - * the `extend` method, which means that even in modern IE, it's not possible - * to programmatically create a backward selection. Thus, for all IE - * versions, we use the old IE API to create our selections. + * Traps a top-level event by using event capturing. * - * @param {DOMElement|DOMTextNode} node - * @param {object} offsets + * @param {number} topLevelType Number from `TopLevelEventTypes`. + * @param {object} element Element on which to attach listener. + * @return {?object} An object with a remove function which will forcefully + * remove the listener. + * @internal */ -function setOffsets(node, offsets) { - if (!window.getSelection) { - return; +function trapCapturedEvent(topLevelType, element) { + if (!element) { + return null; } + var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; - var selection = window.getSelection(); - var length = node[getTextContentAccessor()].length; - var start = Math.min(offsets.start, length); - var end = offsets.end === undefined ? start : Math.min(offsets.end, length); + addEventCaptureListener(element, getRawEventName(topLevelType), + // Check if interactive and wrap in interactiveUpdates + dispatch.bind(null, topLevelType)); +} - // IE 11 uses modern selection, but doesn't support the extend method. - // Flip backward selections, so we can set with a single range. - if (!selection.extend && start > end) { - var temp = end; - end = start; - start = temp; +function dispatchInteractiveEvent(topLevelType, nativeEvent) { + interactiveUpdates(dispatchEvent, topLevelType, nativeEvent); +} + +function dispatchEvent(topLevelType, nativeEvent) { + if (!_enabled) { + return; } - var startMarker = getNodeForCharacterOffset(node, start); - var endMarker = getNodeForCharacterOffset(node, end); + var nativeEventTarget = getEventTarget(nativeEvent); + var targetInst = getClosestInstanceFromNode(nativeEventTarget); + if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { + // If we get an event (ex: img onload) before committing that + // component's mount, ignore it for now (that is, treat it as if it was an + // event on a non-React tree). We might also consider queueing events and + // dispatching them after the mount. + targetInst = null; + } - if (startMarker && endMarker) { - if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { - return; - } - var range = document.createRange(); - range.setStart(startMarker.node, startMarker.offset); - selection.removeAllRanges(); + var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); - if (start > end) { - selection.addRange(range); - selection.extend(endMarker.node, endMarker.offset); - } else { - range.setEnd(endMarker.node, endMarker.offset); - selection.addRange(range); - } + try { + // Event queue being processed in the same cycle allows + // `preventDefault`. + batchedUpdates(handleTopLevel, bookKeeping); + } finally { + releaseTopLevelCallbackBookKeeping(bookKeeping); } } -function isInDocument(node) { - return containsNode(document.documentElement, node); -} - /** - * @ReactInputSelection: React input selection module. Based on Selection.js, - * but modified to be suitable for react and has a couple of bug fixes (doesn't - * assume buttons have range selections allowed). - * Input selection module for React. + * Summary of `ReactBrowserEventEmitter` event handling: + * + * - Top-level delegation is used to trap most native browser events. This + * may only occur in the main thread and is the responsibility of + * ReactDOMEventListener, which is injected and can therefore support + * pluggable event sources. This is the only work that occurs in the main + * thread. + * + * - We normalize and de-duplicate events to account for browser quirks. This + * may be done in the worker thread. + * + * - Forward these native events (with the associated top-level type used to + * trap it) to `EventPluginHub`, which in turn will ask plugins if they want + * to extract any synthetic events. + * + * - The `EventPluginHub` will then process each event by annotating them with + * "dispatches", a sequence of listeners and IDs that care about that event. + * + * - The `EventPluginHub` then dispatches the events. + * + * Overview of React and the event system: + * + * +------------+ . + * | DOM | . + * +------------+ . + * | . + * v . + * +------------+ . + * | ReactEvent | . + * | Listener | . + * +------------+ . +-----------+ + * | . +--------+|SimpleEvent| + * | . | |Plugin | + * +-----|------+ . v +-----------+ + * | | | . +--------------+ +------------+ + * | +-----------.--->|EventPluginHub| | Event | + * | | . | | +-----------+ | Propagators| + * | ReactEvent | . | | |TapEvent | |------------| + * | Emitter | . | |<---+|Plugin | |other plugin| + * | | . | | +-----------+ | utilities | + * | +-----------.--->| | +------------+ + * | | | . +--------------+ + * +-----|------+ . ^ +-----------+ + * | . | |Enter/Leave| + * + . +-------+|Plugin | + * +-------------+ . +-----------+ + * | application | . + * |-------------| . + * | | . + * | | . + * +-------------+ . + * . + * React Core . General Purpose Event Plugin System */ -function hasSelectionCapabilities(elem) { - var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); - return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); -} - -function getSelectionInformation() { - var focusedElem = getActiveElement(); - return { - focusedElem: focusedElem, - selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null - }; -} +var alreadyListeningTo = {}; +var reactTopListenersCounter = 0; /** - * @restoreSelection: If any selection information was potentially lost, - * restore it. This is useful when performing operations that could remove dom - * nodes and place them back in, resulting in focus being lost. + * To ensure no conflicts with other potential React instances on the page */ -function restoreSelection(priorSelectionInformation) { - var curFocusedElem = getActiveElement(); - var priorFocusedElem = priorSelectionInformation.focusedElem; - var priorSelectionRange = priorSelectionInformation.selectionRange; - if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { - if (hasSelectionCapabilities(priorFocusedElem)) { - setSelection(priorFocusedElem, priorSelectionRange); - } - - // Focusing a node can change the scroll position, which is undesirable - var ancestors = []; - var ancestor = priorFocusedElem; - while (ancestor = ancestor.parentNode) { - if (ancestor.nodeType === ELEMENT_NODE) { - ancestors.push({ - element: ancestor, - left: ancestor.scrollLeft, - top: ancestor.scrollTop - }); - } - } - - focusNode(priorFocusedElem); +var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2); - for (var i = 0; i < ancestors.length; i++) { - var info = ancestors[i]; - info.element.scrollLeft = info.left; - info.element.scrollTop = info.top; - } +function getListeningForDocument(mountAt) { + // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` + // directly. + if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { + mountAt[topListenersIDKey] = reactTopListenersCounter++; + alreadyListeningTo[mountAt[topListenersIDKey]] = {}; } + return alreadyListeningTo[mountAt[topListenersIDKey]]; } /** - * @getSelection: Gets the selection bounds of a focused textarea, input or - * contentEditable node. - * -@input: Look up selection bounds of this input - * -@return {start: selectionStart, end: selectionEnd} + * We listen for bubbled touch events on the document object. + * + * Firefox v8.01 (and possibly others) exhibited strange behavior when + * mounting `onmousemove` events at some node that was not the document + * element. The symptoms were that if your mouse is not moving over something + * contained within that mount point (for example on the background) the + * top-level listeners for `onmousemove` won't be called. However, if you + * register the `mousemove` on the document object, then it will of course + * catch all `mousemove`s. This along with iOS quirks, justifies restricting + * top-level listeners to the document object only, at least for these + * movement types of events and possibly all events. + * + * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html + * + * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but + * they bubble to document. + * + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @param {object} mountAt Container where to mount the listener */ -function getSelection$1(input) { - var selection = void 0; +function listenTo(registrationName, mountAt) { + var isListening = getListeningForDocument(mountAt); + var dependencies = registrationNameDependencies[registrationName]; - if ('selectionStart' in input) { - // Modern browser with input or textarea. - selection = { - start: input.selectionStart, - end: input.selectionEnd - }; - } else { - // Content editable or old IE textarea. - selection = getOffsets(input); + for (var i = 0; i < dependencies.length; i++) { + var dependency = dependencies[i]; + if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { + switch (dependency) { + case TOP_SCROLL: + trapCapturedEvent(TOP_SCROLL, mountAt); + break; + case TOP_FOCUS: + case TOP_BLUR: + trapCapturedEvent(TOP_FOCUS, mountAt); + trapCapturedEvent(TOP_BLUR, mountAt); + // We set the flag for a single dependency later in this function, + // but this ensures we mark both as attached rather than just one. + isListening[TOP_BLUR] = true; + isListening[TOP_FOCUS] = true; + break; + case TOP_CANCEL: + case TOP_CLOSE: + if (isEventSupported(getRawEventName(dependency))) { + trapCapturedEvent(dependency, mountAt); + } + break; + case TOP_INVALID: + case TOP_SUBMIT: + case TOP_RESET: + // We listen to them on the target DOM elements. + // Some of them bubble so we don't want them to fire twice. + break; + default: + // By default, listen on the top level to all non-media events. + // Media events don't bubble so adding the listener wouldn't do anything. + var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1; + if (!isMediaEvent) { + trapBubbledEvent(dependency, mountAt); + } + break; + } + isListening[dependency] = true; + } } - - return selection || { start: 0, end: 0 }; } -/** - * @setSelection: Sets the selection bounds of a textarea or input and focuses - * the input. - * -@input Set selection bounds of this input or textarea - * -@offsets Object of same form that is returned from get* - */ -function setSelection(input, offsets) { - var start = offsets.start, - end = offsets.end; - - if (end === undefined) { - end = start; +function isListeningToAllDependencies(registrationName, mountAt) { + var isListening = getListeningForDocument(mountAt); + var dependencies = registrationNameDependencies[registrationName]; + for (var i = 0; i < dependencies.length; i++) { + var dependency = dependencies[i]; + if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { + return false; + } } + return true; +} - if ('selectionStart' in input) { - input.selectionStart = start; - input.selectionEnd = Math.min(end, input.value.length); - } else { - setOffsets(input, offsets); +function getActiveElement(doc) { + doc = doc || (typeof document !== 'undefined' ? document : undefined); + if (typeof doc === 'undefined') { + return null; + } + try { + return doc.activeElement || doc.body; + } catch (e) { + return doc.body; } } -var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; - -var eventTypes$3 = { - select: { - phasedRegistrationNames: { - bubbled: 'onSelect', - captured: 'onSelectCapture' - }, - dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] +/** + * Given any node return the first leaf node without children. + * + * @param {DOMElement|DOMTextNode} node + * @return {DOMElement|DOMTextNode} + */ +function getLeafNode(node) { + while (node && node.firstChild) { + node = node.firstChild; } -}; - -var activeElement$1 = null; -var activeElementInst$1 = null; -var lastSelection = null; -var mouseDown = false; + return node; +} /** - * Get an object which is a unique representation of the current selection. - * - * The return value will not be consistent across nodes or browsers, but - * two identical selections on the same node will return identical objects. + * Get the next sibling within a container. This will walk up the + * DOM if a node's siblings have been exhausted. * - * @param {DOMElement} node - * @return {object} + * @param {DOMElement|DOMTextNode} node + * @return {?DOMElement|DOMTextNode} */ -function getSelection(node) { - if ('selectionStart' in node && hasSelectionCapabilities(node)) { - return { - start: node.selectionStart, - end: node.selectionEnd - }; - } else if (window.getSelection) { - var selection = window.getSelection(); - return { - anchorNode: selection.anchorNode, - anchorOffset: selection.anchorOffset, - focusNode: selection.focusNode, - focusOffset: selection.focusOffset - }; +function getSiblingNode(node) { + while (node) { + if (node.nextSibling) { + return node.nextSibling; + } + node = node.parentNode; } } /** - * Poll selection to see whether it's changed. + * Get object describing the nodes which contain characters at offset. * - * @param {object} nativeEvent - * @return {?SyntheticEvent} + * @param {DOMElement|DOMTextNode} root + * @param {number} offset + * @return {?object} */ -function constructSelectEvent(nativeEvent, nativeEventTarget) { - // Ensure we have the right element, and that the user is not dragging a - // selection (this matches native `select` event behavior). In HTML5, select - // fires only on input and textarea thus if there's no focused element we - // won't dispatch. - if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { - return null; +function getNodeForCharacterOffset(root, offset) { + var node = getLeafNode(root); + var nodeStart = 0; + var nodeEnd = 0; + + while (node) { + if (node.nodeType === TEXT_NODE) { + nodeEnd = nodeStart + node.textContent.length; + + if (nodeStart <= offset && nodeEnd >= offset) { + return { + node: node, + offset: offset - nodeStart + }; + } + + nodeStart = nodeEnd; + } + + node = getLeafNode(getSiblingNode(node)); } +} - // Only fire when selection has actually changed. - var currentSelection = getSelection(activeElement$1); - if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { - lastSelection = currentSelection; +/** + * @param {DOMElement} outerNode + * @return {?object} + */ +function getOffsets(outerNode) { + var ownerDocument = outerNode.ownerDocument; - var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); + var win = ownerDocument && ownerDocument.defaultView || window; + var selection = win.getSelection && win.getSelection(); - syntheticEvent.type = 'select'; - syntheticEvent.target = activeElement$1; + if (!selection || selection.rangeCount === 0) { + return null; + } - accumulateTwoPhaseDispatches(syntheticEvent); + var anchorNode = selection.anchorNode, + anchorOffset = selection.anchorOffset, + focusNode = selection.focusNode, + focusOffset = selection.focusOffset; - return syntheticEvent; + // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the + // up/down buttons on an . Anonymous divs do not seem to + // expose properties, triggering a "Permission denied error" if any of its + // properties are accessed. The only seemingly possible way to avoid erroring + // is to access a property that typically works for non-anonymous divs and + // catch any error that may otherwise arise. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 + + try { + /* eslint-disable no-unused-expressions */ + anchorNode.nodeType; + focusNode.nodeType; + /* eslint-enable no-unused-expressions */ + } catch (e) { + return null; } - return null; + return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); } /** - * This plugin creates an `onSelect` event that normalizes select events - * across form elements. + * Returns {start, end} where `start` is the character/codepoint index of + * (anchorNode, anchorOffset) within the textContent of `outerNode`, and + * `end` is the index of (focusNode, focusOffset). * - * Supported elements are: - * - input (see `isTextInputElement`) - * - textarea - * - contentEditable + * Returns null if you pass in garbage input but we should probably just crash. * - * This differs from native browser implementations in the following ways: - * - Fires on contentEditable fields as well as inputs. - * - Fires for collapsed selection. - * - Fires after user input. + * Exported only for testing. */ -var SelectEventPlugin = { - eventTypes: eventTypes$3, +function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { + var length = 0; + var start = -1; + var end = -1; + var indexWithinAnchor = 0; + var indexWithinFocus = 0; + var node = outerNode; + var parentNode = null; - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var doc = nativeEventTarget.window === nativeEventTarget ? nativeEventTarget.document : nativeEventTarget.nodeType === DOCUMENT_NODE ? nativeEventTarget : nativeEventTarget.ownerDocument; - // Track whether all listeners exists for this plugin. If none exist, we do - // not extract events. See #3639. - if (!doc || !isListeningToAllDependencies('onSelect', doc)) { - return null; - } + outer: while (true) { + var next = null; - var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; + while (true) { + if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { + start = length + anchorOffset; + } + if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { + end = length + focusOffset; + } - switch (topLevelType) { - // Track the input node that has focus. - case 'topFocus': - if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { - activeElement$1 = targetNode; - activeElementInst$1 = targetInst; - lastSelection = null; - } - break; - case 'topBlur': - activeElement$1 = null; - activeElementInst$1 = null; - lastSelection = null; + if (node.nodeType === TEXT_NODE) { + length += node.nodeValue.length; + } + + if ((next = node.firstChild) === null) { break; - // Don't fire the event while the user is dragging. This matches the - // semantics of the native select event. - case 'topMouseDown': - mouseDown = true; + } + // Moving from `node` to its first child `next`. + parentNode = node; + node = next; + } + + while (true) { + if (node === outerNode) { + // If `outerNode` has children, this is always the second time visiting + // it. If it has no children, this is still the first loop, and the only + // valid selection is anchorNode and focusNode both equal to this node + // and both offsets 0, in which case we will have handled above. + break outer; + } + if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { + start = length; + } + if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { + end = length; + } + if ((next = node.nextSibling) !== null) { break; - case 'topContextMenu': - case 'topMouseUp': - mouseDown = false; - return constructSelectEvent(nativeEvent, nativeEventTarget); - // Chrome and IE fire non-standard event when selection is changed (and - // sometimes when it hasn't). IE's event fires out of order with respect - // to key and input events on deletion, so we discard it. - // - // Firefox doesn't support selectionchange, so check selection status - // after each key entry. The selection changes after keydown and before - // keyup, but we check on keydown as well in the case of holding down a - // key, when multiple keydown events are fired but only one keyup is. - // This is also our approach for IE handling, for the reason above. - case 'topSelectionChange': - if (skipSelectionChangeEvent) { - break; - } - // falls through - case 'topKeyDown': - case 'topKeyUp': - return constructSelectEvent(nativeEvent, nativeEventTarget); + } + node = parentNode; + parentNode = node.parentNode; } + // Moving from `node` to its next sibling `next`. + node = next; + } + + if (start === -1 || end === -1) { + // This should never happen. (Would happen if the anchor/focus nodes aren't + // actually inside the passed-in node.) return null; } -}; -/** - * @interface Event - * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface - * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent - */ -var AnimationEventInterface = { - animationName: null, - elapsedTime: null, - pseudoElement: null -}; + return { + start: start, + end: end + }; +} /** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticEvent} + * In modern non-IE browsers, we can support both forward and backward + * selections. + * + * Note: IE10+ supports the Selection object, but it does not support + * the `extend` method, which means that even in modern IE, it's not possible + * to programmatically create a backward selection. Thus, for all IE + * versions, we use the old IE API to create our selections. + * + * @param {DOMElement|DOMTextNode} node + * @param {object} offsets */ -function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +function setOffsets(node, offsets) { + var doc = node.ownerDocument || document; + var win = doc && doc.defaultView || window; + + // Edge fails with "Object expected" in some scenarios. + // (For instance: TinyMCE editor used in a list component that supports pasting to add more, + // fails when pasting 100+ items) + if (!win.getSelection) { + return; + } + + var selection = win.getSelection(); + var length = node.textContent.length; + var start = Math.min(offsets.start, length); + var end = offsets.end === undefined ? start : Math.min(offsets.end, length); + + // IE 11 uses modern selection, but doesn't support the extend method. + // Flip backward selections, so we can set with a single range. + if (!selection.extend && start > end) { + var temp = end; + end = start; + start = temp; + } + + var startMarker = getNodeForCharacterOffset(node, start); + var endMarker = getNodeForCharacterOffset(node, end); + + if (startMarker && endMarker) { + if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { + return; + } + var range = doc.createRange(); + range.setStart(startMarker.node, startMarker.offset); + selection.removeAllRanges(); + + if (start > end) { + selection.addRange(range); + selection.extend(endMarker.node, endMarker.offset); + } else { + range.setEnd(endMarker.node, endMarker.offset); + selection.addRange(range); + } + } } -SyntheticEvent$1.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); +function isTextNode(node) { + return node && node.nodeType === TEXT_NODE; +} -/** - * @interface Event - * @see http://www.w3.org/TR/clipboard-apis/ - */ -var ClipboardEventInterface = { - clipboardData: function (event) { - return 'clipboardData' in event ? event.clipboardData : window.clipboardData; +function containsNode(outerNode, innerNode) { + if (!outerNode || !innerNode) { + return false; + } else if (outerNode === innerNode) { + return true; + } else if (isTextNode(outerNode)) { + return false; + } else if (isTextNode(innerNode)) { + return containsNode(outerNode, innerNode.parentNode); + } else if ('contains' in outerNode) { + return outerNode.contains(innerNode); + } else if (outerNode.compareDocumentPosition) { + return !!(outerNode.compareDocumentPosition(innerNode) & 16); + } else { + return false; } -}; +} -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticEvent} - */ -function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +function isInDocument(node) { + return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node); } -SyntheticEvent$1.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); +function getActiveElementDeep() { + var win = window; + var element = getActiveElement(); + while (element instanceof win.HTMLIFrameElement) { + // Accessing the contentDocument of a HTMLIframeElement can cause the browser + // to throw, e.g. if it has a cross-origin src attribute + try { + win = element.contentDocument.defaultView; + } catch (e) { + return element; + } + element = getActiveElement(win.document); + } + return element; +} /** - * @interface FocusEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ + * @ReactInputSelection: React input selection module. Based on Selection.js, + * but modified to be suitable for react and has a couple of bug fixes (doesn't + * assume buttons have range selections allowed). + * Input selection module for React. */ -var FocusEventInterface = { - relatedTarget: null -}; /** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticUIEvent} + * @hasSelectionCapabilities: we get the element types that support selection + * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart` + * and `selectionEnd` rows. */ -function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +function hasSelectionCapabilities(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true'); } -SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); +function getSelectionInformation() { + var focusedElem = getActiveElementDeep(); + return { + focusedElem: focusedElem, + selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null + }; +} /** - * `charCode` represents the actual "character code" and is safe to use with - * `String.fromCharCode`. As such, only keys that correspond to printable - * characters produce a valid `charCode`, the only exception to this is Enter. - * The Tab-key is considered non-printable and does not have a `charCode`, - * presumably because it does not produce a tab-character in browsers. - * - * @param {object} nativeEvent Native browser event. - * @return {number} Normalized `charCode` property. + * @restoreSelection: If any selection information was potentially lost, + * restore it. This is useful when performing operations that could remove dom + * nodes and place them back in, resulting in focus being lost. */ -function getEventCharCode(nativeEvent) { - var charCode; - var keyCode = nativeEvent.keyCode; +function restoreSelection(priorSelectionInformation) { + var curFocusedElem = getActiveElementDeep(); + var priorFocusedElem = priorSelectionInformation.focusedElem; + var priorSelectionRange = priorSelectionInformation.selectionRange; + if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { + if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) { + setSelection(priorFocusedElem, priorSelectionRange); + } - if ('charCode' in nativeEvent) { - charCode = nativeEvent.charCode; + // Focusing a node can change the scroll position, which is undesirable + var ancestors = []; + var ancestor = priorFocusedElem; + while (ancestor = ancestor.parentNode) { + if (ancestor.nodeType === ELEMENT_NODE) { + ancestors.push({ + element: ancestor, + left: ancestor.scrollLeft, + top: ancestor.scrollTop + }); + } + } - // FF does not set `charCode` for the Enter-key, check against `keyCode`. - if (charCode === 0 && keyCode === 13) { - charCode = 13; + if (typeof priorFocusedElem.focus === 'function') { + priorFocusedElem.focus(); } - } else { - // IE8 does not implement `charCode`, but `keyCode` has the correct value. - charCode = keyCode; - } - // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. - // Must not discard the (non-)printable Enter-key. - if (charCode >= 32 || charCode === 13) { - return charCode; + for (var i = 0; i < ancestors.length; i++) { + var info = ancestors[i]; + info.element.scrollLeft = info.left; + info.element.scrollTop = info.top; + } } - - return 0; } /** - * Normalization of deprecated HTML5 `key` values - * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names + * @getSelection: Gets the selection bounds of a focused textarea, input or + * contentEditable node. + * -@input: Look up selection bounds of this input + * -@return {start: selectionStart, end: selectionEnd} */ -var normalizeKey = { - Esc: 'Escape', - Spacebar: ' ', - Left: 'ArrowLeft', - Up: 'ArrowUp', - Right: 'ArrowRight', - Down: 'ArrowDown', - Del: 'Delete', - Win: 'OS', - Menu: 'ContextMenu', - Apps: 'ContextMenu', - Scroll: 'ScrollLock', - MozPrintableKey: 'Unidentified' -}; +function getSelection$1(input) { + var selection = void 0; -/** - * Translation from legacy `keyCode` to HTML5 `key` - * Only special keys supported, all others depend on keyboard layout or browser - * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names - */ -var translateToKey = { - '8': 'Backspace', - '9': 'Tab', - '12': 'Clear', - '13': 'Enter', - '16': 'Shift', - '17': 'Control', - '18': 'Alt', - '19': 'Pause', - '20': 'CapsLock', - '27': 'Escape', - '32': ' ', - '33': 'PageUp', - '34': 'PageDown', - '35': 'End', - '36': 'Home', - '37': 'ArrowLeft', - '38': 'ArrowUp', - '39': 'ArrowRight', - '40': 'ArrowDown', - '45': 'Insert', - '46': 'Delete', - '112': 'F1', - '113': 'F2', - '114': 'F3', - '115': 'F4', - '116': 'F5', - '117': 'F6', - '118': 'F7', - '119': 'F8', - '120': 'F9', - '121': 'F10', - '122': 'F11', - '123': 'F12', - '144': 'NumLock', - '145': 'ScrollLock', - '224': 'Meta' -}; + if ('selectionStart' in input) { + // Modern browser with input or textarea. + selection = { + start: input.selectionStart, + end: input.selectionEnd + }; + } else { + // Content editable or old IE textarea. + selection = getOffsets(input); + } + + return selection || { start: 0, end: 0 }; +} /** - * @param {object} nativeEvent Native browser event. - * @return {string} Normalized `key` property. + * @setSelection: Sets the selection bounds of a textarea or input and focuses + * the input. + * -@input Set selection bounds of this input or textarea + * -@offsets Object of same form that is returned from get* */ -function getEventKey(nativeEvent) { - if (nativeEvent.key) { - // Normalize inconsistent values reported by browsers due to - // implementations of a working draft specification. +function setSelection(input, offsets) { + var start = offsets.start, + end = offsets.end; - // FireFox implements `key` but returns `MozPrintableKey` for all - // printable characters (normalized to `Unidentified`), ignore it. - var key = normalizeKey[nativeEvent.key] || nativeEvent.key; - if (key !== 'Unidentified') { - return key; - } + if (end === undefined) { + end = start; } - // Browser does not implement `key`, polyfill as much of it as we can. - if (nativeEvent.type === 'keypress') { - var charCode = getEventCharCode(nativeEvent); - - // The enter-key is technically both printable and non-printable and can - // thus be captured by `keypress`, no other non-printable key should. - return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); - } - if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { - // While user keyboard layout determines the actual meaning of each - // `keyCode` value, almost all function keys have a universal value. - return translateToKey[nativeEvent.keyCode] || 'Unidentified'; + if ('selectionStart' in input) { + input.selectionStart = start; + input.selectionEnd = Math.min(end, input.value.length); + } else { + setOffsets(input, offsets); } - return ''; } -/** - * @interface KeyboardEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var KeyboardEventInterface = { - key: getEventKey, - location: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - repeat: null, - locale: null, - getModifierState: getEventModifierState, - // Legacy Interface - charCode: function (event) { - // `charCode` is the result of a KeyPress event and represents the value of - // the actual printable character. - - // KeyPress is deprecated, but its replacement is not yet final and not - // implemented in any major browser. Only KeyPress has charCode. - if (event.type === 'keypress') { - return getEventCharCode(event); - } - return 0; - }, - keyCode: function (event) { - // `keyCode` is the result of a KeyDown/Up event and represents the value of - // physical keyboard key. +var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11; - // The actual meaning of the value depends on the users' keyboard layout - // which cannot be detected. Assuming that it is a US keyboard layout - // provides a surprisingly accurate mapping for US and European users. - // Due to this, it is left to the user to implement at this time. - if (event.type === 'keydown' || event.type === 'keyup') { - return event.keyCode; - } - return 0; - }, - which: function (event) { - // `which` is an alias for either `keyCode` or `charCode` depending on the - // type of the event. - if (event.type === 'keypress') { - return getEventCharCode(event); - } - if (event.type === 'keydown' || event.type === 'keyup') { - return event.keyCode; - } - return 0; +var eventTypes$3 = { + select: { + phasedRegistrationNames: { + bubbled: 'onSelect', + captured: 'onSelectCapture' + }, + dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE] } }; -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticUIEvent} - */ -function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); -} - -SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); +var activeElement$1 = null; +var activeElementInst$1 = null; +var lastSelection = null; +var mouseDown = false; /** - * @interface DragEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ + * Get an object which is a unique representation of the current selection. + * + * The return value will not be consistent across nodes or browsers, but + * two identical selections on the same node will return identical objects. + * + * @param {DOMElement} node + * @return {object} */ -var DragEventInterface = { - dataTransfer: null -}; +function getSelection(node) { + if ('selectionStart' in node && hasSelectionCapabilities(node)) { + return { + start: node.selectionStart, + end: node.selectionEnd + }; + } else { + var win = node.ownerDocument && node.ownerDocument.defaultView || window; + var selection = win.getSelection(); + return { + anchorNode: selection.anchorNode, + anchorOffset: selection.anchorOffset, + focusNode: selection.focusNode, + focusOffset: selection.focusOffset + }; + } +} /** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticMouseEvent} + * Get document associated with the event target. + * + * @param {object} nativeEventTarget + * @return {Document} */ -function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +function getEventTargetDocument(eventTarget) { + return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument; } -SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); - /** - * @interface TouchEvent - * @see http://www.w3.org/TR/touch-events/ + * Poll selection to see whether it's changed. + * + * @param {object} nativeEvent + * @param {object} nativeEventTarget + * @return {?SyntheticEvent} */ -var TouchEventInterface = { - touches: null, - targetTouches: null, - changedTouches: null, - altKey: null, - metaKey: null, - ctrlKey: null, - shiftKey: null, - getModifierState: getEventModifierState -}; +function constructSelectEvent(nativeEvent, nativeEventTarget) { + // Ensure we have the right element, and that the user is not dragging a + // selection (this matches native `select` event behavior). In HTML5, select + // fires only on input and textarea thus if there's no focused element we + // won't dispatch. + var doc = getEventTargetDocument(nativeEventTarget); -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticUIEvent} - */ -function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); -} + if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) { + return null; + } -SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); + // Only fire when selection has actually changed. + var currentSelection = getSelection(activeElement$1); + if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { + lastSelection = currentSelection; -/** - * @interface Event - * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- - * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent - */ -var TransitionEventInterface = { - propertyName: null, - elapsedTime: null, - pseudoElement: null -}; + var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticEvent} - */ -function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); -} + syntheticEvent.type = 'select'; + syntheticEvent.target = activeElement$1; -SyntheticEvent$1.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); - -/** - * @interface WheelEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var WheelEventInterface = { - deltaX: function (event) { - return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). - 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; - }, - deltaY: function (event) { - return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). - 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). - 'wheelDelta' in event ? -event.wheelDelta : 0; - }, - deltaZ: null, + accumulateTwoPhaseDispatches(syntheticEvent); - // Browsers without "deltaMode" is reporting in raw wheel delta where one - // notch on the scroll is always +/- 120, roughly equivalent to pixels. - // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or - // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. - deltaMode: null -}; + return syntheticEvent; + } -/** - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {string} dispatchMarker Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @extends {SyntheticMouseEvent} - */ -function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { - return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); + return null; } -SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); - /** - * Turns - * ['abort', ...] - * into - * eventTypes = { - * 'abort': { - * phasedRegistrationNames: { - * bubbled: 'onAbort', - * captured: 'onAbortCapture', - * }, - * dependencies: ['topAbort'], - * }, - * ... - * }; - * topLevelEventsToDispatchConfig = { - * 'topAbort': { sameConfig } - * }; + * This plugin creates an `onSelect` event that normalizes select events + * across form elements. + * + * Supported elements are: + * - input (see `isTextInputElement`) + * - textarea + * - contentEditable + * + * This differs from native browser implementations in the following ways: + * - Fires on contentEditable fields as well as inputs. + * - Fires for collapsed selection. + * - Fires after user input. */ -var eventTypes$4 = {}; -var topLevelEventsToDispatchConfig = {}; -['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'cancel', 'canPlay', 'canPlayThrough', 'click', 'close', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'toggle', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) { - var capitalizedEvent = event[0].toUpperCase() + event.slice(1); - var onEvent = 'on' + capitalizedEvent; - var topEvent = 'top' + capitalizedEvent; - - var type = { - phasedRegistrationNames: { - bubbled: onEvent, - captured: onEvent + 'Capture' - }, - dependencies: [topEvent] - }; - eventTypes$4[event] = type; - topLevelEventsToDispatchConfig[topEvent] = type; -}); - -// Only used in DEV for exhaustiveness validation. -var knownHTMLTopLevelTypes = ['topAbort', 'topCancel', 'topCanPlay', 'topCanPlayThrough', 'topClose', 'topDurationChange', 'topEmptied', 'topEncrypted', 'topEnded', 'topError', 'topInput', 'topInvalid', 'topLoad', 'topLoadedData', 'topLoadedMetadata', 'topLoadStart', 'topPause', 'topPlay', 'topPlaying', 'topProgress', 'topRateChange', 'topReset', 'topSeeked', 'topSeeking', 'topStalled', 'topSubmit', 'topSuspend', 'topTimeUpdate', 'topToggle', 'topVolumeChange', 'topWaiting']; - -var SimpleEventPlugin = { - eventTypes: eventTypes$4, +var SelectEventPlugin = { + eventTypes: eventTypes$3, extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; - if (!dispatchConfig) { + var doc = getEventTargetDocument(nativeEventTarget); + // Track whether all listeners exists for this plugin. If none exist, we do + // not extract events. See #3639. + if (!doc || !isListeningToAllDependencies('onSelect', doc)) { return null; } - var EventConstructor; + + var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; + switch (topLevelType) { - case 'topKeyPress': - // Firefox creates a keypress event for function keys too. This removes - // the unwanted keypress events. Enter is however both printable and - // non-printable. One would expect Tab to be as well (but it isn't). - if (getEventCharCode(nativeEvent) === 0) { - return null; - } - /* falls through */ - case 'topKeyDown': - case 'topKeyUp': - EventConstructor = SyntheticKeyboardEvent; - break; - case 'topBlur': - case 'topFocus': - EventConstructor = SyntheticFocusEvent; - break; - case 'topClick': - // Firefox creates a click event on right mouse clicks. This removes the - // unwanted click events. - if (nativeEvent.button === 2) { - return null; + // Track the input node that has focus. + case TOP_FOCUS: + if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { + activeElement$1 = targetNode; + activeElementInst$1 = targetInst; + lastSelection = null; } - /* falls through */ - case 'topDoubleClick': - case 'topMouseDown': - case 'topMouseMove': - case 'topMouseUp': - // TODO: Disabled elements should not respond to mouse events - /* falls through */ - case 'topMouseOut': - case 'topMouseOver': - case 'topContextMenu': - EventConstructor = SyntheticMouseEvent; - break; - case 'topDrag': - case 'topDragEnd': - case 'topDragEnter': - case 'topDragExit': - case 'topDragLeave': - case 'topDragOver': - case 'topDragStart': - case 'topDrop': - EventConstructor = SyntheticDragEvent; - break; - case 'topTouchCancel': - case 'topTouchEnd': - case 'topTouchMove': - case 'topTouchStart': - EventConstructor = SyntheticTouchEvent; break; - case 'topAnimationEnd': - case 'topAnimationIteration': - case 'topAnimationStart': - EventConstructor = SyntheticAnimationEvent; - break; - case 'topTransitionEnd': - EventConstructor = SyntheticTransitionEvent; - break; - case 'topScroll': - EventConstructor = SyntheticUIEvent; - break; - case 'topWheel': - EventConstructor = SyntheticWheelEvent; + case TOP_BLUR: + activeElement$1 = null; + activeElementInst$1 = null; + lastSelection = null; break; - case 'topCopy': - case 'topCut': - case 'topPaste': - EventConstructor = SyntheticClipboardEvent; + // Don't fire the event while the user is dragging. This matches the + // semantics of the native select event. + case TOP_MOUSE_DOWN: + mouseDown = true; break; - default: - { - if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) { - warning(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType); - } + case TOP_CONTEXT_MENU: + case TOP_MOUSE_UP: + case TOP_DRAG_END: + mouseDown = false; + return constructSelectEvent(nativeEvent, nativeEventTarget); + // Chrome and IE fire non-standard event when selection is changed (and + // sometimes when it hasn't). IE's event fires out of order with respect + // to key and input events on deletion, so we discard it. + // + // Firefox doesn't support selectionchange, so check selection status + // after each key entry. The selection changes after keydown and before + // keyup, but we check on keydown as well in the case of holding down a + // key, when multiple keydown events are fired but only one keyup is. + // This is also our approach for IE handling, for the reason above. + case TOP_SELECTION_CHANGE: + if (skipSelectionChangeEvent) { + break; } - // HTML Events - // @see http://www.w3.org/TR/html5/index.html#events-0 - EventConstructor = SyntheticEvent$1; - break; + // falls through + case TOP_KEY_DOWN: + case TOP_KEY_UP: + return constructSelectEvent(nativeEvent, nativeEventTarget); } - var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); - accumulateTwoPhaseDispatches(event); - return event; + + return null; } }; -setHandleTopLevel(handleTopLevel); - /** * Inject modules for resolving DOM hierarchy and plugin ordering. */ -injection$1.injectEventPluginOrder(DOMEventPluginOrder); -injection$2.injectComponentTree(ReactDOMComponentTree); +injection.injectEventPluginOrder(DOMEventPluginOrder); +setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1); /** * Some important event plugins included by default (without having to require * them). */ -injection$1.injectEventPluginsByName({ +injection.injectEventPluginsByName({ SimpleEventPlugin: SimpleEventPlugin, EnterLeaveEventPlugin: EnterLeaveEventPlugin, ChangeEventPlugin: ChangeEventPlugin, @@ -7425,8355 +7735,1086 @@ injection$1.injectEventPluginsByName({ BeforeInputEventPlugin: BeforeInputEventPlugin }); -var enableAsyncSubtreeAPI = true; -var enableAsyncSchedulingByDefaultInReactDOM = false; -// Exports ReactDOM.createRoot -var enableCreateRoot = false; -var enableUserTimingAPI = true; - -// Mutating mode (React DOM, React ART, React Native): -var enableMutatingReconciler = true; -// Experimental noop mode (currently unused): -var enableNoopReconciler = false; -// Experimental persistent mode (CS): -var enablePersistentReconciler = false; - -// Helps identify side effects in begin-phase lifecycle hooks and setState reducers: -var debugRenderPhaseSideEffects = false; - -// Only used in www builds. - -var valueStack = []; +var didWarnSelectedSetOnOption = false; +var didWarnInvalidChild = false; -{ - var fiberStack = []; -} +function flattenChildren(children) { + var content = ''; -var index = -1; + // 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. + }); -function createCursor(defaultValue) { - return { - current: defaultValue - }; + return content; } +/** + * Implements an