diff --git a/mitmproxy/web/__init__.py b/mitmproxy/web/__init__.py index 80a658863..5449c1bcc 100644 --- a/mitmproxy/web/__init__.py +++ b/mitmproxy/web/__init__.py @@ -73,7 +73,7 @@ class WebState(flow.State): } self.events.append(entry) app.ClientConnection.broadcast( - type="events", + type="UPDATE_EVENTLOG", cmd="add", data=entry ) diff --git a/mitmproxy/web/static/app.css b/mitmproxy/web/static/app.css index ae2e963f5..bc3f1a6a3 100644 --- a/mitmproxy/web/static/app.css +++ b/mitmproxy/web/static/app.css @@ -164,49 +164,6 @@ header .menu { max-height: 500px; overflow-y: auto; } -.menu .toggle-btn { - float: left; - width: 33.33333333%; - position: relative; - min-height: 1px; - padding-left: 2.5px; - padding-right: 2.5px; - margin-bottom: 5px; -} -@media (min-width: 768px) { - .menu .toggle-btn { - float: left; - width: 25%; - } -} -@media (min-width: 1200px) { - .menu .toggle-btn { - float: left; - width: 16.66666667%; - } -} -.menu .toggle-btn .btn { - width: 100%; -} -.menu .toggle-input-btn { - position: relative; - min-height: 1px; - padding-left: 2.5px; - padding-right: 2.5px; - margin-bottom: 5px; -} -@media (min-width: 768px) { - .menu .toggle-input-btn { - float: left; - width: 50%; - } -} -@media (min-width: 1200px) { - .menu .toggle-input-btn { - float: left; - width: 33.33333333%; - } -} .flow-table { width: 100%; overflow-y: scroll; @@ -452,6 +409,14 @@ header .menu { .eventlog .fa-close:hover { color: black; } +.eventlog .btn-toggle { + margin-top: -2px; + margin-left: 3px; + padding: 2px 2px; + font-size: 10px; + line-height: 10px; + border-radius: 2px; +} .eventlog .label { cursor: pointer; vertical-align: middle; diff --git a/mitmproxy/web/static/app.js b/mitmproxy/web/static/app.js index 12eea3e00..b78dd337a 100644 --- a/mitmproxy/web/static/app.js +++ b/mitmproxy/web/static/app.js @@ -452,40 +452,56 @@ var Query = exports.Query = { SHOW_EVENTLOG: "e" }; -},{"./dispatcher.js":22,"./utils.js":27,"jquery":"jquery"}],3:[function(require,module,exports){ -"use strict"; +},{"./dispatcher.js":22,"./utils.js":31,"jquery":"jquery"}],3:[function(require,module,exports){ +'use strict'; -var _react = require("react"); +var _react = require('react'); var _react2 = _interopRequireDefault(_react); -var _reactDom = require("react-dom"); +var _reactDom = require('react-dom'); -var _jquery = require("jquery"); +var _redux = require('redux'); -var _jquery2 = _interopRequireDefault(_jquery); +var _reactRedux = require('react-redux'); -var _connection = require("./connection"); +var _reduxLogger = require('redux-logger'); + +var _reduxLogger2 = _interopRequireDefault(_reduxLogger); + +var _connection = require('./connection'); var _connection2 = _interopRequireDefault(_connection); -var _proxyapp = require("./components/proxyapp.js"); +var _proxyapp = require('./components/proxyapp.js'); -var _actions = require("./actions.js"); +var _index = require('./ducks/index'); + +var _index2 = _interopRequireDefault(_index); + +var _eventLog = require('./ducks/eventLog'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -(0, _jquery2.default)(function () { - window.ws = new _connection2.default("/updates"); +// logger must be last +var logger = (0, _reduxLogger2.default)(); +var store = (0, _redux.createStore)(_index2.default, (0, _redux.applyMiddleware)(logger)); - window.onerror = function (msg) { - _actions.EventLogActions.add_event(msg); - }; +window.onerror = function (msg) { + store.dispatch((0, _eventLog.addLogEntry)(msg)); +}; - (0, _reactDom.render)(_proxyapp.app, document.getElementById("mitmproxy")); +document.addEventListener('DOMContentLoaded', function () { + window.ws = new _connection2.default("/updates", store.dispatch); + + (0, _reactDom.render)(_react2.default.createElement( + _reactRedux.Provider, + { store: store }, + _proxyapp.App + ), document.getElementById("mitmproxy")); }); -},{"./actions.js":2,"./components/proxyapp.js":20,"./connection":21,"jquery":"jquery","react":"react","react-dom":"react-dom"}],4:[function(require,module,exports){ +},{"./components/proxyapp.js":20,"./connection":21,"./ducks/eventLog":23,"./ducks/index":24,"react":"react","react-dom":"react-dom","react-redux":"react-redux","redux":"redux","redux-logger":"redux-logger"}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -625,28 +641,23 @@ var Splitter = exports.Splitter = _react2.default.createClass({ } }); -var ToggleButton = exports.ToggleButton = function ToggleButton(props) { +var ToggleButton = exports.ToggleButton = function ToggleButton(_ref) { + var checked = _ref.checked; + var onToggle = _ref.onToggle; + var text = _ref.text; return _react2.default.createElement( "div", - { className: "input-group toggle-btn" }, - _react2.default.createElement( - "div", - { - className: "btn " + (props.checked ? "btn-primary" : "btn-default"), - onClick: props.onToggleChanged }, - _react2.default.createElement( - "span", - { className: "fa " + (props.checked ? "fa-check-square-o" : "fa-square-o") }, - " ", - props.name - ) - ) + { className: "btn btn-toggle " + (checked ? "btn-primary" : "btn-default"), onClick: onToggle }, + _react2.default.createElement("i", { className: "fa fa-fw " + (checked ? "fa-check-square-o" : "fa-square-o") }), + " ", + text ); }; ToggleButton.propTypes = { - name: _react2.default.PropTypes.string.isRequired, - onToggleChanged: _react2.default.PropTypes.func.isRequired + checked: _react2.default.PropTypes.bool.isRequired, + onToggle: _react2.default.PropTypes.func.isRequired, + text: _react2.default.PropTypes.string.isRequired }; var ToggleInputButton = exports.ToggleInputButton = function (_React$Component) { @@ -709,7 +720,7 @@ ToggleInputButton.propTypes = { onToggleChanged: _react2.default.PropTypes.func.isRequired }; -},{"../utils.js":27,"lodash":"lodash","react":"react","react-dom":"react-dom"}],5:[function(require,module,exports){ +},{"../utils.js":31,"lodash":"lodash","react":"react","react-dom":"react-dom"}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -967,12 +978,13 @@ var ValueEditor = exports.ValueEditor = _react2.default.createClass({ } }); -},{"../utils.js":27,"react":"react","react-dom":"react-dom"}],6:[function(require,module,exports){ +},{"../utils.js":31,"react":"react","react-dom":"react-dom"}],6:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.ToggleEventLog = undefined; 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; }; }(); @@ -984,11 +996,13 @@ var _reactDom = require("react-dom"); var _reactDom2 = _interopRequireDefault(_reactDom); +var _reactRedux = require("react-redux"); + var _shallowequal = require("shallowequal"); var _shallowequal2 = _interopRequireDefault(_shallowequal); -var _actions = require("../actions.js"); +var _eventLog = require("../ducks/eventLog"); var _AutoScroll = require("./helpers/AutoScroll"); @@ -996,11 +1010,7 @@ var _AutoScroll2 = _interopRequireDefault(_AutoScroll); var _VirtualScroll = require("./helpers/VirtualScroll"); -var _view = require("../store/view.js"); - -var _lodash = require("lodash"); - -var _lodash2 = _interopRequireDefault(_lodash); +var _common = require("./common"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1010,22 +1020,36 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen 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 LogIcon(_ref) { + var event = _ref.event; + + var icon = { web: "html5", debug: "bug" }[event.level] || "info"; + return _react2.default.createElement("i", { className: "fa fa-fw fa-" + icon }); +} + +function LogEntry(_ref2) { + var event = _ref2.event; + var registerHeight = _ref2.registerHeight; + + return _react2.default.createElement( + "div", + { ref: registerHeight }, + _react2.default.createElement(LogIcon, { event: event }), + event.message + ); +} + var EventLogContents = function (_React$Component) { _inherits(EventLogContents, _React$Component); - function EventLogContents(props, context) { + function EventLogContents(props) { _classCallCheck(this, EventLogContents); - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(EventLogContents).call(this, props, context)); - - _this.view = new _view.StoreView(_this.context.eventStore, function (entry) { - return _this.props.filter[entry.level]; - }); + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(EventLogContents).call(this, props)); _this.heights = {}; - _this.state = { entries: _this.view.list, vScroll: (0, _VirtualScroll.calcVScroll)() }; + _this.state = { vScroll: (0, _VirtualScroll.calcVScroll)() }; - _this.onChange = _this.onChange.bind(_this); _this.onViewportUpdate = _this.onViewportUpdate.bind(_this); return _this; } @@ -1034,32 +1058,18 @@ var EventLogContents = function (_React$Component) { key: "componentDidMount", value: function componentDidMount() { window.addEventListener("resize", this.onViewportUpdate); - this.view.addListener("add", this.onChange); - this.view.addListener("recalculate", this.onChange); this.onViewportUpdate(); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.removeEventListener("resize", this.onViewportUpdate); - this.view.removeListener("add", this.onChange); - this.view.removeListener("recalculate", this.onChange); - this.view.close(); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { this.onViewportUpdate(); } - }, { - key: "componentWillReceiveProps", - value: function componentWillReceiveProps(nextProps) { - if (nextProps.filter !== this.props.filter) { - this.view.recalculate(function (entry) { - return nextProps.filter[entry.level]; - }); - } - } }, { key: "onViewportUpdate", value: function onViewportUpdate() { @@ -1068,11 +1078,11 @@ var EventLogContents = function (_React$Component) { var viewport = _reactDom2.default.findDOMNode(this); var vScroll = (0, _VirtualScroll.calcVScroll)({ - itemCount: this.state.entries.length, + itemCount: this.props.events.length, rowHeight: this.props.rowHeight, viewportTop: viewport.scrollTop, viewportHeight: viewport.offsetHeight, - itemHeights: this.state.entries.map(function (entry) { + itemHeights: this.props.events.map(function (entry) { return _this2.heights[entry.id]; }) }); @@ -1081,47 +1091,39 @@ var EventLogContents = function (_React$Component) { this.setState({ vScroll: vScroll }); } } - }, { - key: "onChange", - value: function onChange() { - this.setState({ entries: this.view.list }); - } }, { key: "setHeight", - value: function setHeight(id, ref) { - if (ref && !this.heights[id]) { - var height = _reactDom2.default.findDOMNode(ref).offsetHeight; + value: function setHeight(id, node) { + console.log("setHeight", id, node); + if (node && !this.heights[id]) { + var height = node.offsetHeight; if (this.heights[id] !== height) { this.heights[id] = height; this.onViewportUpdate(); } } } - }, { - key: "getIcon", - value: function getIcon(level) { - return { web: "html5", debug: "bug" }[level] || "info"; - } }, { key: "render", value: function render() { var _this3 = this; var vScroll = this.state.vScroll; - var entries = this.state.entries.slice(vScroll.start, vScroll.end); + var events = this.props.events.slice(vScroll.start, vScroll.end).map(function (event) { + return _react2.default.createElement(LogEntry, { + event: event, + key: event.id, + registerHeight: function registerHeight(node) { + return _this3.setHeight(event.id, node); + } + }); + }); return _react2.default.createElement( "pre", { onScroll: this.onViewportUpdate }, _react2.default.createElement("div", { style: { height: vScroll.paddingTop } }), - entries.map(function (entry, index) { - return _react2.default.createElement( - "div", - { key: entry.id, ref: _this3.setHeight.bind(_this3, entry.id) }, - _react2.default.createElement("i", { className: "fa fa-fw fa-" + _this3.getIcon(entry.level) }), - entry.message - ); - }), + events, _react2.default.createElement("div", { style: { height: vScroll.paddingBottom } }) ); } @@ -1130,95 +1132,80 @@ var EventLogContents = function (_React$Component) { return EventLogContents; }(_react2.default.Component); -EventLogContents.contextTypes = { - eventStore: _react2.default.PropTypes.object.isRequired -}; EventLogContents.defaultProps = { rowHeight: 18 }; -ToggleFilter.propTypes = { - name: _react2.default.PropTypes.string.isRequired, - toggleLevel: _react2.default.PropTypes.func.isRequired, - active: _react2.default.PropTypes.bool -}; +EventLogContents = (0, _AutoScroll2.default)(EventLogContents); -function ToggleFilter(_ref) { - var name = _ref.name; - var active = _ref.active; - var toggleLevel = _ref.toggleLevel; +var EventLogContentsContainer = (0, _reactRedux.connect)(function (state) { + return { + events: state.eventLog.filteredEvents + }; +})(EventLogContents); - var className = "label "; - if (active) { - className += "label-primary"; - } else { - className += "label-default"; - } +var ToggleEventLog = exports.ToggleEventLog = (0, _reactRedux.connect)(function (state) { + return { + checked: state.eventLog.visible + }; +}, function (dispatch) { + return { + onToggle: function onToggle() { + return dispatch((0, _eventLog.toggleEventLogVisibility)()); + } + }; +})(_common.ToggleButton); - function onClick(event) { - event.preventDefault(); - toggleLevel(name); - } +var ToggleFilter = (0, _reactRedux.connect)(function (state, ownProps) { + return { + checked: state.eventLog.filter[ownProps.text] + }; +}, function (dispatch, ownProps) { + return { + onToggle: function onToggle() { + return dispatch((0, _eventLog.toggleEventLogFilter)(ownProps.text)); + } + }; +})(_common.ToggleButton); +var EventLog = function EventLog(_ref3) { + var close = _ref3.close; return _react2.default.createElement( - "a", - { - href: "#", - className: className, - onClick: onClick }, - name - ); -} - -var AutoScrollEventLog = (0, _AutoScroll2.default)(EventLogContents); - -var EventLog = _react2.default.createClass({ - displayName: "EventLog", - getInitialState: function getInitialState() { - return { - filter: { - "debug": false, - "info": true, - "web": true - } - }; - }, - close: function close() { - var d = {}; - d[_actions.Query.SHOW_EVENTLOG] = undefined; - this.props.updateLocation(undefined, d); - }, - toggleLevel: function toggleLevel(level) { - var filter = _lodash2.default.extend({}, this.state.filter); - filter[level] = !filter[level]; - this.setState({ filter: filter }); - }, - render: function render() { - return _react2.default.createElement( + "div", + { className: "eventlog" }, + _react2.default.createElement( "div", - { className: "eventlog" }, + null, + "Eventlog", _react2.default.createElement( "div", - null, - "Eventlog", - _react2.default.createElement( - "div", - { className: "pull-right" }, - _react2.default.createElement(ToggleFilter, { name: "debug", active: this.state.filter.debug, toggleLevel: this.toggleLevel }), - _react2.default.createElement(ToggleFilter, { name: "info", active: this.state.filter.info, toggleLevel: this.toggleLevel }), - _react2.default.createElement(ToggleFilter, { name: "web", active: this.state.filter.web, toggleLevel: this.toggleLevel }), - _react2.default.createElement("i", { onClick: this.close, className: "fa fa-close" }) - ) - ), - _react2.default.createElement(AutoScrollEventLog, { filter: this.state.filter }) - ); - } -}); + { className: "pull-right" }, + _react2.default.createElement(ToggleFilter, { text: "debug" }), + _react2.default.createElement(ToggleFilter, { text: "info" }), + _react2.default.createElement(ToggleFilter, { text: "web" }), + _react2.default.createElement("i", { onClick: close, className: "fa fa-close" }) + ) + ), + _react2.default.createElement(EventLogContentsContainer, null) + ); +}; -exports.default = EventLog; +EventLog.propTypes = { + close: _react2.default.PropTypes.func.isRequired +}; -},{"../actions.js":2,"../store/view.js":26,"./helpers/AutoScroll":16,"./helpers/VirtualScroll":17,"lodash":"lodash","react":"react","react-dom":"react-dom","shallowequal":"shallowequal"}],7:[function(require,module,exports){ +var EventLogContainer = (0, _reactRedux.connect)(undefined, function (dispatch) { + return { + close: function close() { + return dispatch((0, _eventLog.toggleEventLogVisibility)()); + } + }; +})(EventLog); + +exports.default = EventLogContainer; + +},{"../ducks/eventLog":23,"./common":4,"./helpers/AutoScroll":16,"./helpers/VirtualScroll":17,"react":"react","react-dom":"react-dom","react-redux":"react-redux","shallowequal":"shallowequal"}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1487,7 +1474,7 @@ var all_columns = [TLSColumn, IconColumn, PathColumn, MethodColumn, StatusColumn exports.default = all_columns; -},{"../flow/utils.js":24,"../utils.js":27,"react":"react"}],8:[function(require,module,exports){ +},{"../flow/utils.js":28,"../utils.js":31,"react":"react"}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1779,7 +1766,7 @@ FlowTable.defaultProps = { }; exports.default = (0, _AutoScroll2.default)(FlowTable); -},{"../utils.js":27,"./flowtable-columns.js":7,"./helpers/AutoScroll":16,"./helpers/VirtualScroll":17,"classnames":"classnames","lodash":"lodash","react":"react","react-dom":"react-dom","shallowequal":"shallowequal"}],9:[function(require,module,exports){ +},{"../utils.js":31,"./flowtable-columns.js":7,"./helpers/AutoScroll":16,"./helpers/VirtualScroll":17,"classnames":"classnames","lodash":"lodash","react":"react","react-dom":"react-dom","shallowequal":"shallowequal"}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -2133,7 +2120,7 @@ var ContentView = _react2.default.createClass({ exports.default = ContentView; -},{"../../flow/utils.js":24,"../../utils.js":27,"lodash":"lodash","react":"react"}],10:[function(require,module,exports){ +},{"../../flow/utils.js":28,"../../utils.js":31,"lodash":"lodash","react":"react"}],10:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -2401,7 +2388,7 @@ var Details = _react2.default.createClass({ exports.default = Details; -},{"../../utils.js":27,"lodash":"lodash","react":"react"}],11:[function(require,module,exports){ +},{"../../utils.js":31,"lodash":"lodash","react":"react"}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -2895,7 +2882,7 @@ var Error = exports.Error = _react2.default.createClass({ } }); -},{"../../actions.js":2,"../../flow/utils.js":24,"../../utils.js":27,"../editor.js":5,"./contentview.js":9,"lodash":"lodash","react":"react","react-dom":"react-dom"}],13:[function(require,module,exports){ +},{"../../actions.js":2,"../../flow/utils.js":28,"../../utils.js":31,"../editor.js":5,"./contentview.js":9,"lodash":"lodash","react":"react","react-dom":"react-dom"}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -3078,7 +3065,7 @@ function Footer(_ref) { ); } -},{"../utils.js":27,"./common.js":4,"react":"react"}],15:[function(require,module,exports){ +},{"../utils.js":31,"./common.js":4,"react":"react"}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -3098,6 +3085,8 @@ var _jquery = require("jquery"); var _jquery2 = _interopRequireDefault(_jquery); +var _reactRedux = require("react-redux"); + var _filt = require("../filt/filt.js"); var _filt2 = _interopRequireDefault(_filt); @@ -3108,6 +3097,8 @@ var _common = require("./common.js"); var _actions = require("../actions.js"); +var _eventlog = require("./eventlog"); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FilterDocs = _react2.default.createClass({ @@ -3361,29 +3352,14 @@ var ViewMenu = _react2.default.createClass({ title: "View", route: "flows" }, - toggleEventLog: function toggleEventLog() { - var d = {}; - if (this.props.query[_actions.Query.SHOW_EVENTLOG]) { - d[_actions.Query.SHOW_EVENTLOG] = undefined; - } else { - d[_actions.Query.SHOW_EVENTLOG] = "t"; // any non-false value will do it, keep it short - } - - this.props.updateLocation(undefined, d); - console.log('toggleevent'); - }, render: function render() { - var showEventLog = this.props.query[_actions.Query.SHOW_EVENTLOG]; return _react2.default.createElement( "div", null, _react2.default.createElement( "div", { className: "menu-row" }, - _react2.default.createElement(_common.ToggleButton, { - checked: showEventLog, - name: "Show Eventlog", - onToggleChanged: this.toggleEventLog }) + _react2.default.createElement(_eventlog.ToggleEventLog, { text: "Show Event Log" }) ), _react2.default.createElement("div", { className: "clearfix" }) ); @@ -3410,39 +3386,39 @@ var OptionMenu = exports.OptionMenu = function OptionMenu(props) { _react2.default.createElement( "div", { className: "menu-row" }, - _react2.default.createElement(_common.ToggleButton, { name: "showhost", + _react2.default.createElement(_common.ToggleButton, { text: "showhost", checked: showhost, - onToggleChanged: function onToggleChanged() { + onToggle: function onToggle() { return _actions.SettingsActions.update({ showhost: !showhost }); } }), - _react2.default.createElement(_common.ToggleButton, { name: "no_upstream_cert", + _react2.default.createElement(_common.ToggleButton, { text: "no_upstream_cert", checked: no_upstream_cert, - onToggleChanged: function onToggleChanged() { + onToggle: function onToggle() { return _actions.SettingsActions.update({ no_upstream_cert: !no_upstream_cert }); } }), - _react2.default.createElement(_common.ToggleButton, { name: "rawtcp", + _react2.default.createElement(_common.ToggleButton, { text: "rawtcp", checked: rawtcp, - onToggleChanged: function onToggleChanged() { + onToggle: function onToggle() { return _actions.SettingsActions.update({ rawtcp: !rawtcp }); } }), - _react2.default.createElement(_common.ToggleButton, { name: "http2", + _react2.default.createElement(_common.ToggleButton, { text: "http2", checked: http2, - onToggleChanged: function onToggleChanged() { + onToggle: function onToggle() { return _actions.SettingsActions.update({ http2: !http2 }); } }), - _react2.default.createElement(_common.ToggleButton, { name: "anticache", + _react2.default.createElement(_common.ToggleButton, { text: "anticache", checked: anticache, - onToggleChanged: function onToggleChanged() { + onToggle: function onToggle() { return _actions.SettingsActions.update({ anticache: !anticache }); } }), - _react2.default.createElement(_common.ToggleButton, { name: "anticomp", + _react2.default.createElement(_common.ToggleButton, { text: "anticomp", checked: anticomp, - onToggleChanged: function onToggleChanged() { + onToggle: function onToggle() { return _actions.SettingsActions.update({ anticomp: !anticomp }); } }), @@ -3664,7 +3640,7 @@ var Header = exports.Header = _react2.default.createClass({ } }); -},{"../actions.js":2,"../filt/filt.js":23,"../utils.js":27,"./common.js":4,"jquery":"jquery","react":"react","react-dom":"react-dom"}],16:[function(require,module,exports){ +},{"../actions.js":2,"../filt/filt.js":27,"../utils.js":31,"./common.js":4,"./eventlog":6,"jquery":"jquery","react":"react","react-dom":"react-dom","react-redux":"react-redux"}],16:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -4080,7 +4056,7 @@ var MainView = _react2.default.createClass({ exports.default = MainView; -},{"../actions.js":2,"../filt/filt.js":23,"../store/view.js":26,"../utils.js":27,"./common.js":4,"./flowtable.js":8,"./flowview/index.js":11,"react":"react"}],19:[function(require,module,exports){ +},{"../actions.js":2,"../filt/filt.js":27,"../store/view.js":30,"../utils.js":31,"./common.js":4,"./flowtable.js":8,"./flowview/index.js":11,"react":"react"}],19:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -4216,13 +4192,13 @@ var Prompt = _react2.default.createClass({ exports.default = Prompt; -},{"../utils.js":27,"lodash":"lodash","react":"react","react-dom":"react-dom"}],20:[function(require,module,exports){ +},{"../utils.js":31,"lodash":"lodash","react":"react","react-dom":"react-dom"}],20:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.app = undefined; +exports.App = undefined; var _react = require("react"); @@ -4236,6 +4212,10 @@ var _lodash = require("lodash"); var _lodash2 = _interopRequireDefault(_lodash); +var _reactRedux = require("react-redux"); + +var _reactRouter = require("react-router"); + var _common = require("./common.js"); var _mainview = require("./mainview.js"); @@ -4254,12 +4234,8 @@ var _eventlog2 = _interopRequireDefault(_eventlog); var _store = require("../store/store.js"); -var _actions = require("../actions.js"); - var _utils = require("../utils.js"); -var _reactRouter = require("react-router"); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } //TODO: Move out of here, just a stub. @@ -4377,8 +4353,8 @@ var ProxyAppMain = _react2.default.createClass({ render: function render() { var query = this.getQuery(); var eventlog; - if (this.props.location.query[_actions.Query.SHOW_EVENTLOG]) { - eventlog = [_react2.default.createElement(_common.Splitter, { key: "splitter", axis: "y" }), _react2.default.createElement(_eventlog2.default, { key: "eventlog", updateLocation: this.updateLocation })]; + if (this.props.showEventLog) { + eventlog = [_react2.default.createElement(_common.Splitter, { key: "splitter", axis: "y" }), _react2.default.createElement(_eventlog2.default, { key: "eventlog" })]; } else { eventlog = null; } @@ -4393,42 +4369,58 @@ var ProxyAppMain = _react2.default.createClass({ } }); -var app = exports.app = _react2.default.createElement( +var AppContainer = (0, _reactRedux.connect)(function (state) { + return { + showEventLog: state.eventLog.visible + }; +})(ProxyAppMain); + +var App = exports.App = _react2.default.createElement( _reactRouter.Router, { history: _reactRouter.hashHistory }, _react2.default.createElement(_reactRouter.Redirect, { from: "/", to: "/flows" }), _react2.default.createElement( _reactRouter.Route, - { path: "/", component: ProxyAppMain }, + { path: "/", component: AppContainer }, _react2.default.createElement(_reactRouter.Route, { path: "flows", component: _mainview2.default }), _react2.default.createElement(_reactRouter.Route, { path: "flows/:flowId/:detailTab", component: _mainview2.default }), _react2.default.createElement(_reactRouter.Route, { path: "reports", component: Reports }) ) ); -},{"../actions.js":2,"../store/store.js":25,"../utils.js":27,"./common.js":4,"./eventlog.js":6,"./footer.js":14,"./header.js":15,"./mainview.js":18,"lodash":"lodash","react":"react","react-dom":"react-dom","react-router":"react-router"}],21:[function(require,module,exports){ +},{"../store/store.js":29,"../utils.js":31,"./common.js":4,"./eventlog.js":6,"./footer.js":14,"./header.js":15,"./mainview.js":18,"lodash":"lodash","react":"react","react-dom":"react-dom","react-redux":"react-redux","react-router":"react-router"}],21:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Connection; var _actions = require("./actions.js"); var _dispatcher = require("./dispatcher.js"); -function Connection(url) { +var _websocket = require("./ducks/websocket"); + +var websocketActions = _interopRequireWildcard(_websocket); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function Connection(url, dispatch) { if (url[0] === "/") { url = location.origin.replace("http", "ws") + url; } var ws = new WebSocket(url); ws.onopen = function () { + dispatch(websocketActions.connected()); _actions.ConnectionActions.open(); + //TODO: fetch stuff! }; - ws.onmessage = function (message) { - var m = JSON.parse(message.data); - _dispatcher.AppDispatcher.dispatchServerAction(m); + ws.onmessage = function (m) { + var message = JSON.parse(m.data); + _dispatcher.AppDispatcher.dispatchServerAction(message); + dispatch(message); }; ws.onerror = function () { _actions.ConnectionActions.error(); @@ -4437,13 +4429,12 @@ function Connection(url) { ws.onclose = function () { _actions.ConnectionActions.close(); _actions.EventLogActions.add_event("WebSocket connection closed."); + dispatch(websocketActions.disconnected()); }; return ws; } -exports.default = Connection; - -},{"./actions.js":2,"./dispatcher.js":22}],22:[function(require,module,exports){ +},{"./actions.js":2,"./dispatcher.js":22,"./ducks/websocket":26}],22:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -4473,6 +4464,197 @@ AppDispatcher.dispatchServerAction = function (action) { }; },{"flux":"flux"}],23:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +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; }; + +exports.default = reducer; +exports.toggleEventLogFilter = toggleEventLogFilter; +exports.toggleEventLogVisibility = toggleEventLogVisibility; +exports.addLogEntry = addLogEntry; + +var _list = require('./list'); + +var _list2 = _interopRequireDefault(_list); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +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 TOGGLE_FILTER = 'TOGGLE_EVENTLOG_FILTER'; +var TOGGLE_VISIBILITY = 'TOGGLE_EVENTLOG_VISIBILITY'; +var UPDATE_LIST = "UPDATE_EVENTLOG"; + +var defaultState = { + visible: false, + filter: { + "debug": false, + "info": true, + "web": true + }, + events: (0, _list2.default)(), + filteredEvents: [] +}; + +function reducer() { + var state = arguments.length <= 0 || arguments[0] === undefined ? defaultState : arguments[0]; + var action = arguments[1]; + + switch (action.type) { + case TOGGLE_FILTER: + var filter = _extends({}, state.filter, _defineProperty({}, action.filter, !state.filter[action.filter])); + return _extends({}, state, { + filter: filter, + filteredEvents: state.events.list.filter(function (x) { + return filter[x.level]; + }) + }); + case TOGGLE_VISIBILITY: + return _extends({}, state, { + visible: !state.visible + }); + case UPDATE_LIST: + var events = (0, _list2.default)(state.events, action); + return _extends({}, state, { + events: events, + filteredEvents: events.list.filter(function (x) { + return state.filter[x.level]; + }) + }); + default: + return state; + } +} + +function toggleEventLogFilter(filter) { + return { type: TOGGLE_FILTER, filter: filter }; +} +function toggleEventLogVisibility() { + return { type: TOGGLE_VISIBILITY }; +} +var id = 0; +function addLogEntry(message) { + var level = arguments.length <= 1 || arguments[1] === undefined ? "web" : arguments[1]; + + return { + type: UPDATE_LIST, + cmd: _list.ADD, + data: { message: message, level: level, id: 'log-' + id++ } + }; +} + +},{"./list":25}],24:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _redux = require('redux'); + +var _eventLog = require('./eventLog.js'); + +var _eventLog2 = _interopRequireDefault(_eventLog); + +var _websocket = require('./websocket.js'); + +var _websocket2 = _interopRequireDefault(_websocket); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var rootReducer = (0, _redux.combineReducers)({ + eventLog: _eventLog2.default, + websocket: _websocket2.default +}); + +exports.default = rootReducer; + +},{"./eventLog.js":23,"./websocket.js":26,"redux":"redux"}],25:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +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; }; + +exports.default = getList; + +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; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var ADD = exports.ADD = 'add'; + +var defaultState = { + list: [], + //isFetching: false, + //updateBeforeFetch: [], + indexOf: {} +}; + +//views: {} +function getList() { + var state = arguments.length <= 0 || arguments[0] === undefined ? defaultState : arguments[0]; + var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + switch (action.cmd) { + case ADD: + return { + list: [].concat(_toConsumableArray(state.list), [action.data]), + indexOf: _extends({}, state.indexOf, _defineProperty({}, action.data.id, state.list.length)) + }; + default: + return state; + } +} + +},{}],26:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reducer; +exports.connected = connected; +exports.disconnected = disconnected; +var CONNECTED = 'WEBSOCKET_CONNECTED'; +var DISCONNECTED = 'WEBSOCKET_DISCONNECTED'; + +var defaultState = { + connected: true +}; +/* we may want to have an error message attribute here at some point */ +function reducer() { + var state = arguments.length <= 0 || arguments[0] === undefined ? defaultState : arguments[0]; + var action = arguments[1]; + + switch (action.type) { + case CONNECTED: + return { + connected: true + }; + case DISCONNECTED: + return { + connected: false + }; + default: + return state; + } +} + +function connected() { + return { type: CONNECTED }; +} +function disconnected() { + return { type: DISCONNECTED }; +} + +},{}],27:[function(require,module,exports){ "use strict"; module.exports = function () { @@ -6376,7 +6558,7 @@ module.exports = function () { }; }(); -},{"../flow/utils.js":24}],24:[function(require,module,exports){ +},{"../flow/utils.js":28}],28:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6510,7 +6692,7 @@ var parseHttpVersion = exports.parseHttpVersion = function parseHttpVersion(http }); }; -},{"jquery":"jquery","lodash":"lodash"}],25:[function(require,module,exports){ +},{"jquery":"jquery","lodash":"lodash"}],29:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6697,7 +6879,7 @@ _lodash2.default.extend(EventLogStore.prototype, LiveListStore.prototype, { } }); -},{"../actions.js":2,"../dispatcher.js":22,"events":1,"jquery":"jquery","lodash":"lodash"}],26:[function(require,module,exports){ +},{"../actions.js":2,"../dispatcher.js":22,"events":1,"jquery":"jquery","lodash":"lodash"}],30:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6827,7 +7009,7 @@ _lodash2.default.extend(StoreView.prototype, _events.EventEmitter.prototype, { } }); -},{"../utils.js":27,"events":1,"lodash":"lodash"}],27:[function(require,module,exports){ +},{"../utils.js":31,"events":1,"lodash":"lodash"}],31:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/mitmproxy/web/static/vendor.js b/mitmproxy/web/static/vendor.js index f3a960ccb..61596f06c 100644 --- a/mitmproxy/web/static/vendor.js +++ b/mitmproxy/web/static/vendor.js @@ -180,7 +180,7 @@ var invariant = function (condition, format, a, b, c, d, e, f) { module.exports = invariant; }).call(this,require('_process')) -},{"_process":29}],5:[function(require,module,exports){ +},{"_process":33}],5:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2014-2015, Facebook, Inc. @@ -415,7 +415,7 @@ var Dispatcher = (function () { module.exports = Dispatcher; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":4}],6:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":4}],6:[function(require,module,exports){ /** * Indicates that navigation was caused by a call to history.push. */ @@ -583,7 +583,7 @@ function readState(key) { } }).call(this,require('_process')) -},{"_process":29,"warning":231}],9:[function(require,module,exports){ +},{"_process":33,"warning":249}],9:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -716,7 +716,7 @@ function parsePath(path) { } }).call(this,require('_process')) -},{"_process":29,"warning":231}],12:[function(require,module,exports){ +},{"_process":33,"warning":249}],12:[function(require,module,exports){ (function (process){ 'use strict'; @@ -764,11 +764,7 @@ function createBrowserHistory() { var useRefresh = !isSupported || forceRefresh; function getCurrentLocation(historyState) { - try { - historyState = historyState || window.history.state || {}; - } catch (e) { - historyState = {}; - } + historyState = historyState || window.history.state || {}; var path = _DOMUtils.getWindowPath(); var _historyState = historyState; @@ -900,7 +896,7 @@ exports['default'] = createBrowserHistory; module.exports = exports['default']; }).call(this,require('_process')) -},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":29,"invariant":23}],13:[function(require,module,exports){ +},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":33,"invariant":23}],13:[function(require,module,exports){ (function (process){ 'use strict'; @@ -944,7 +940,7 @@ exports['default'] = createDOMHistory; module.exports = exports['default']; }).call(this,require('_process')) -},{"./DOMUtils":9,"./ExecutionEnvironment":10,"./createHistory":15,"_process":29,"invariant":23}],14:[function(require,module,exports){ +},{"./DOMUtils":9,"./ExecutionEnvironment":10,"./createHistory":15,"_process":33,"invariant":23}],14:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1194,7 +1190,7 @@ exports['default'] = createHashHistory; module.exports = exports['default']; }).call(this,require('_process')) -},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":29,"invariant":23,"warning":231}],15:[function(require,module,exports){ +},{"./Actions":6,"./DOMStateStorage":8,"./DOMUtils":9,"./ExecutionEnvironment":10,"./PathUtils":11,"./createDOMHistory":13,"_process":33,"invariant":23,"warning":249}],15:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1486,7 +1482,7 @@ exports['default'] = createHistory; module.exports = exports['default']; }).call(this,require('_process')) -},{"./Actions":6,"./AsyncUtils":7,"./PathUtils":11,"./createLocation":16,"./deprecate":18,"./runTransitionHook":19,"_process":29,"deep-equal":1,"warning":231}],16:[function(require,module,exports){ +},{"./Actions":6,"./AsyncUtils":7,"./PathUtils":11,"./createLocation":16,"./deprecate":18,"./runTransitionHook":19,"_process":33,"deep-equal":1,"warning":249}],16:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1541,7 +1537,7 @@ exports['default'] = createLocation; module.exports = exports['default']; }).call(this,require('_process')) -},{"./Actions":6,"./PathUtils":11,"_process":29,"warning":231}],17:[function(require,module,exports){ +},{"./Actions":6,"./PathUtils":11,"_process":33,"warning":249}],17:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1699,7 +1695,7 @@ exports['default'] = createMemoryHistory; module.exports = exports['default']; }).call(this,require('_process')) -},{"./Actions":6,"./PathUtils":11,"./createHistory":15,"_process":29,"invariant":23,"warning":231}],18:[function(require,module,exports){ +},{"./Actions":6,"./PathUtils":11,"./createHistory":15,"_process":33,"invariant":23,"warning":249}],18:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1722,7 +1718,7 @@ exports['default'] = deprecate; module.exports = exports['default']; }).call(this,require('_process')) -},{"_process":29,"warning":231}],19:[function(require,module,exports){ +},{"_process":33,"warning":249}],19:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1750,7 +1746,7 @@ exports['default'] = runTransitionHook; module.exports = exports['default']; }).call(this,require('_process')) -},{"_process":29,"warning":231}],20:[function(require,module,exports){ +},{"_process":33,"warning":249}],20:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1912,7 +1908,7 @@ exports['default'] = useBasename; module.exports = exports['default']; }).call(this,require('_process')) -},{"./ExecutionEnvironment":10,"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":29,"warning":231}],21:[function(require,module,exports){ +},{"./ExecutionEnvironment":10,"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":33,"warning":249}],21:[function(require,module,exports){ (function (process){ 'use strict'; @@ -2092,7 +2088,7 @@ exports['default'] = useQueries; module.exports = exports['default']; }).call(this,require('_process')) -},{"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":29,"query-string":30,"warning":231}],22:[function(require,module,exports){ +},{"./PathUtils":11,"./deprecate":18,"./runTransitionHook":19,"_process":33,"query-string":34,"warning":249}],22:[function(require,module,exports){ /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. @@ -2120,15 +2116,13 @@ var KNOWN_STATICS = { }; module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) { - if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components - var keys = Object.getOwnPropertyNames(sourceComponent); - for (var i=0; i * Build: `lodash modern modularize exports="npm" -o ./` @@ -2997,6 +2991,148 @@ function keysIn(object) { module.exports = keys; },{"lodash._getnative":24,"lodash.isarguments":25,"lodash.isarray":26}],28:[function(require,module,exports){ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf; + +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +function getPrototype(value) { + return nativeGetPrototype(Object(value)); +} + +module.exports = getPrototype; + +},{}],29:[function(require,module,exports){ +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +module.exports = isHostObject; + +},{}],30:[function(require,module,exports){ +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = isObjectLike; + +},{}],31:[function(require,module,exports){ +var getPrototype = require('./_getPrototype'), + isHostObject = require('./_isHostObject'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var objectTag = '[object Object]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, + * else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ +function isPlainObject(value) { + if (!isObjectLike(value) || + objectToString.call(value) != objectTag || isHostObject(value)) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return (typeof Ctor == 'function' && + Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString); +} + +module.exports = isPlainObject; + +},{"./_getPrototype":28,"./_isHostObject":29,"./isObjectLike":30}],32:[function(require,module,exports){ 'use strict'; /* eslint-disable no-unused-vars */ var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -3081,7 +3217,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],29:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -3091,9 +3227,6 @@ var currentQueue; var queueIndex = -1; function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); @@ -3177,7 +3310,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],30:[function(require,module,exports){ +},{}],34:[function(require,module,exports){ 'use strict'; var strictUriEncode = require('strict-uri-encode'); @@ -3245,7 +3378,563 @@ exports.stringify = function (obj) { }).join('&') : ''; }; -},{"strict-uri-encode":230}],31:[function(require,module,exports){ +},{"strict-uri-encode":246}],35:[function(require,module,exports){ +(function (process){ +'use strict'; + +exports.__esModule = true; +exports["default"] = undefined; + +var _react = require('react'); + +var _storeShape = require('../utils/storeShape'); + +var _storeShape2 = _interopRequireDefault(_storeShape); + +var _warning = require('../utils/warning'); + +var _warning2 = _interopRequireDefault(_warning); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +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, 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; } + +var didWarnAboutReceivingStore = false; +function warnAboutReceivingStore() { + if (didWarnAboutReceivingStore) { + return; + } + didWarnAboutReceivingStore = true; + + (0, _warning2["default"])(' does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); +} + +var Provider = function (_Component) { + _inherits(Provider, _Component); + + Provider.prototype.getChildContext = function getChildContext() { + return { store: this.store }; + }; + + function Provider(props, context) { + _classCallCheck(this, Provider); + + var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); + + _this.store = props.store; + return _this; + } + + Provider.prototype.render = function render() { + var children = this.props.children; + + return _react.Children.only(children); + }; + + return Provider; +}(_react.Component); + +exports["default"] = Provider; + +if (process.env.NODE_ENV !== 'production') { + Provider.prototype.componentWillReceiveProps = function (nextProps) { + var store = this.store; + var nextStore = nextProps.store; + + if (store !== nextStore) { + warnAboutReceivingStore(); + } + }; +} + +Provider.propTypes = { + store: _storeShape2["default"].isRequired, + children: _react.PropTypes.element.isRequired +}; +Provider.childContextTypes = { + store: _storeShape2["default"].isRequired +}; +}).call(this,require('_process')) + +},{"../utils/storeShape":38,"../utils/warning":39,"_process":33,"react":"react"}],36:[function(require,module,exports){ +(function (process){ +'use strict'; + +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; }; + +exports.__esModule = true; +exports["default"] = connect; + +var _react = require('react'); + +var _storeShape = require('../utils/storeShape'); + +var _storeShape2 = _interopRequireDefault(_storeShape); + +var _shallowEqual = require('../utils/shallowEqual'); + +var _shallowEqual2 = _interopRequireDefault(_shallowEqual); + +var _wrapActionCreators = require('../utils/wrapActionCreators'); + +var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators); + +var _warning = require('../utils/warning'); + +var _warning2 = _interopRequireDefault(_warning); + +var _isPlainObject = require('lodash/isPlainObject'); + +var _isPlainObject2 = _interopRequireDefault(_isPlainObject); + +var _hoistNonReactStatics = require('hoist-non-react-statics'); + +var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); + +var _invariant = require('invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +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, 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; } + +var defaultMapStateToProps = function defaultMapStateToProps(state) { + return {}; +}; // eslint-disable-line no-unused-vars +var defaultMapDispatchToProps = function defaultMapDispatchToProps(dispatch) { + return { dispatch: dispatch }; +}; +var defaultMergeProps = function defaultMergeProps(stateProps, dispatchProps, parentProps) { + return _extends({}, parentProps, stateProps, dispatchProps); +}; + +function getDisplayName(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || 'Component'; +} + +var errorObject = { value: null }; +function tryCatch(fn, ctx) { + try { + return fn.apply(ctx); + } catch (e) { + errorObject.value = e; + return errorObject; + } +} + +// Helps track hot reloading. +var nextVersion = 0; + +function connect(mapStateToProps, mapDispatchToProps, mergeProps) { + var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; + + var shouldSubscribe = Boolean(mapStateToProps); + var mapState = mapStateToProps || defaultMapStateToProps; + + var mapDispatch = undefined; + if (typeof mapDispatchToProps === 'function') { + mapDispatch = mapDispatchToProps; + } else if (!mapDispatchToProps) { + mapDispatch = defaultMapDispatchToProps; + } else { + mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps); + } + + var finalMergeProps = mergeProps || defaultMergeProps; + var _options$pure = options.pure; + var pure = _options$pure === undefined ? true : _options$pure; + var _options$withRef = options.withRef; + var withRef = _options$withRef === undefined ? false : _options$withRef; + + var checkMergedEquals = pure && finalMergeProps !== defaultMergeProps; + + // Helps track hot reloading. + var version = nextVersion++; + + return function wrapWithConnect(WrappedComponent) { + var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')'; + + function checkStateShape(props, methodName) { + if (!(0, _isPlainObject2["default"])(props)) { + (0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.')); + } + } + + function computeMergedProps(stateProps, dispatchProps, parentProps) { + var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps); + if (process.env.NODE_ENV !== 'production') { + checkStateShape(mergedProps, 'mergeProps'); + } + return mergedProps; + } + + var Connect = function (_Component) { + _inherits(Connect, _Component); + + Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() { + return !pure || this.haveOwnPropsChanged || this.hasStoreStateChanged; + }; + + function Connect(props, context) { + _classCallCheck(this, Connect); + + var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); + + _this.version = version; + _this.store = props.store || context.store; + + (0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a , ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".')); + + var storeState = _this.store.getState(); + _this.state = { storeState: storeState }; + _this.clearCache(); + return _this; + } + + Connect.prototype.computeStateProps = function computeStateProps(store, props) { + if (!this.finalMapStateToProps) { + return this.configureFinalMapState(store, props); + } + + var state = store.getState(); + var stateProps = this.doStatePropsDependOnOwnProps ? this.finalMapStateToProps(state, props) : this.finalMapStateToProps(state); + + if (process.env.NODE_ENV !== 'production') { + checkStateShape(stateProps, 'mapStateToProps'); + } + return stateProps; + }; + + Connect.prototype.configureFinalMapState = function configureFinalMapState(store, props) { + var mappedState = mapState(store.getState(), props); + var isFactory = typeof mappedState === 'function'; + + this.finalMapStateToProps = isFactory ? mappedState : mapState; + this.doStatePropsDependOnOwnProps = this.finalMapStateToProps.length !== 1; + + if (isFactory) { + return this.computeStateProps(store, props); + } + + if (process.env.NODE_ENV !== 'production') { + checkStateShape(mappedState, 'mapStateToProps'); + } + return mappedState; + }; + + Connect.prototype.computeDispatchProps = function computeDispatchProps(store, props) { + if (!this.finalMapDispatchToProps) { + return this.configureFinalMapDispatch(store, props); + } + + var dispatch = store.dispatch; + + var dispatchProps = this.doDispatchPropsDependOnOwnProps ? this.finalMapDispatchToProps(dispatch, props) : this.finalMapDispatchToProps(dispatch); + + if (process.env.NODE_ENV !== 'production') { + checkStateShape(dispatchProps, 'mapDispatchToProps'); + } + return dispatchProps; + }; + + Connect.prototype.configureFinalMapDispatch = function configureFinalMapDispatch(store, props) { + var mappedDispatch = mapDispatch(store.dispatch, props); + var isFactory = typeof mappedDispatch === 'function'; + + this.finalMapDispatchToProps = isFactory ? mappedDispatch : mapDispatch; + this.doDispatchPropsDependOnOwnProps = this.finalMapDispatchToProps.length !== 1; + + if (isFactory) { + return this.computeDispatchProps(store, props); + } + + if (process.env.NODE_ENV !== 'production') { + checkStateShape(mappedDispatch, 'mapDispatchToProps'); + } + return mappedDispatch; + }; + + Connect.prototype.updateStatePropsIfNeeded = function updateStatePropsIfNeeded() { + var nextStateProps = this.computeStateProps(this.store, this.props); + if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) { + return false; + } + + this.stateProps = nextStateProps; + return true; + }; + + Connect.prototype.updateDispatchPropsIfNeeded = function updateDispatchPropsIfNeeded() { + var nextDispatchProps = this.computeDispatchProps(this.store, this.props); + if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) { + return false; + } + + this.dispatchProps = nextDispatchProps; + return true; + }; + + Connect.prototype.updateMergedPropsIfNeeded = function updateMergedPropsIfNeeded() { + var nextMergedProps = computeMergedProps(this.stateProps, this.dispatchProps, this.props); + if (this.mergedProps && checkMergedEquals && (0, _shallowEqual2["default"])(nextMergedProps, this.mergedProps)) { + return false; + } + + this.mergedProps = nextMergedProps; + return true; + }; + + Connect.prototype.isSubscribed = function isSubscribed() { + return typeof this.unsubscribe === 'function'; + }; + + Connect.prototype.trySubscribe = function trySubscribe() { + if (shouldSubscribe && !this.unsubscribe) { + this.unsubscribe = this.store.subscribe(this.handleChange.bind(this)); + this.handleChange(); + } + }; + + Connect.prototype.tryUnsubscribe = function tryUnsubscribe() { + if (this.unsubscribe) { + this.unsubscribe(); + this.unsubscribe = null; + } + }; + + Connect.prototype.componentDidMount = function componentDidMount() { + this.trySubscribe(); + }; + + Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) { + this.haveOwnPropsChanged = true; + } + }; + + Connect.prototype.componentWillUnmount = function componentWillUnmount() { + this.tryUnsubscribe(); + this.clearCache(); + }; + + Connect.prototype.clearCache = function clearCache() { + this.dispatchProps = null; + this.stateProps = null; + this.mergedProps = null; + this.haveOwnPropsChanged = true; + this.hasStoreStateChanged = true; + this.haveStatePropsBeenPrecalculated = false; + this.statePropsPrecalculationError = null; + this.renderedElement = null; + this.finalMapDispatchToProps = null; + this.finalMapStateToProps = null; + }; + + Connect.prototype.handleChange = function handleChange() { + if (!this.unsubscribe) { + return; + } + + var storeState = this.store.getState(); + var prevStoreState = this.state.storeState; + if (pure && prevStoreState === storeState) { + return; + } + + if (pure && !this.doStatePropsDependOnOwnProps) { + var haveStatePropsChanged = tryCatch(this.updateStatePropsIfNeeded, this); + if (!haveStatePropsChanged) { + return; + } + if (haveStatePropsChanged === errorObject) { + this.statePropsPrecalculationError = errorObject.value; + } + this.haveStatePropsBeenPrecalculated = true; + } + + this.hasStoreStateChanged = true; + this.setState({ storeState: storeState }); + }; + + Connect.prototype.getWrappedInstance = function getWrappedInstance() { + (0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.'); + + return this.refs.wrappedInstance; + }; + + Connect.prototype.render = function render() { + var haveOwnPropsChanged = this.haveOwnPropsChanged; + var hasStoreStateChanged = this.hasStoreStateChanged; + var haveStatePropsBeenPrecalculated = this.haveStatePropsBeenPrecalculated; + var statePropsPrecalculationError = this.statePropsPrecalculationError; + var renderedElement = this.renderedElement; + + this.haveOwnPropsChanged = false; + this.hasStoreStateChanged = false; + this.haveStatePropsBeenPrecalculated = false; + this.statePropsPrecalculationError = null; + + if (statePropsPrecalculationError) { + throw statePropsPrecalculationError; + } + + var shouldUpdateStateProps = true; + var shouldUpdateDispatchProps = true; + if (pure && renderedElement) { + shouldUpdateStateProps = hasStoreStateChanged || haveOwnPropsChanged && this.doStatePropsDependOnOwnProps; + shouldUpdateDispatchProps = haveOwnPropsChanged && this.doDispatchPropsDependOnOwnProps; + } + + var haveStatePropsChanged = false; + var haveDispatchPropsChanged = false; + if (haveStatePropsBeenPrecalculated) { + haveStatePropsChanged = true; + } else if (shouldUpdateStateProps) { + haveStatePropsChanged = this.updateStatePropsIfNeeded(); + } + if (shouldUpdateDispatchProps) { + haveDispatchPropsChanged = this.updateDispatchPropsIfNeeded(); + } + + var haveMergedPropsChanged = true; + if (haveStatePropsChanged || haveDispatchPropsChanged || haveOwnPropsChanged) { + haveMergedPropsChanged = this.updateMergedPropsIfNeeded(); + } else { + haveMergedPropsChanged = false; + } + + if (!haveMergedPropsChanged && renderedElement) { + return renderedElement; + } + + if (withRef) { + this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, { + ref: 'wrappedInstance' + })); + } else { + this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps); + } + + return this.renderedElement; + }; + + return Connect; + }(_react.Component); + + Connect.displayName = connectDisplayName; + Connect.WrappedComponent = WrappedComponent; + Connect.contextTypes = { + store: _storeShape2["default"] + }; + Connect.propTypes = { + store: _storeShape2["default"] + }; + + if (process.env.NODE_ENV !== 'production') { + Connect.prototype.componentWillUpdate = function componentWillUpdate() { + if (this.version === version) { + return; + } + + // We are hot reloading! + this.version = version; + this.trySubscribe(); + this.clearCache(); + }; + } + + return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent); + }; +} +}).call(this,require('_process')) + +},{"../utils/shallowEqual":37,"../utils/storeShape":38,"../utils/warning":39,"../utils/wrapActionCreators":40,"_process":33,"hoist-non-react-statics":22,"invariant":23,"lodash/isPlainObject":31,"react":"react"}],37:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports["default"] = shallowEqual; +function shallowEqual(objA, objB) { + if (objA === objB) { + return true; + } + + 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. + var hasOwn = Object.prototype.hasOwnProperty; + for (var i = 0; i < keysA.length; i++) { + if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { + return false; + } + } + + return true; +} +},{}],38:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; + +var _react = require('react'); + +exports["default"] = _react.PropTypes.shape({ + subscribe: _react.PropTypes.func.isRequired, + dispatch: _react.PropTypes.func.isRequired, + getState: _react.PropTypes.func.isRequired +}); +},{"react":"react"}],39:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports["default"] = warning; +/** + * Prints a warning in the console if it exists. + * + * @param {String} message The warning message. + * @returns {void} + */ +function warning(message) { + /* eslint-disable no-console */ + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(message); + } + /* eslint-enable no-console */ + try { + // 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); + /* eslint-disable no-empty */ + } catch (e) {} + /* eslint-enable no-empty */ +} +},{}],40:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports["default"] = wrapActionCreators; + +var _redux = require('redux'); + +function wrapActionCreators(actionCreators) { + return function (dispatch) { + return (0, _redux.bindActionCreators)(actionCreators, dispatch); + }; +} +},{"redux":"redux"}],41:[function(require,module,exports){ "use strict"; exports.__esModule = true; @@ -3334,7 +4023,7 @@ function mapAsync(array, work, callback) { }); }); } -},{}],32:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ (function (process){ 'use strict'; @@ -3367,7 +4056,7 @@ exports.default = History; module.exports = exports['default']; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./routerWarning":63,"_process":29}],33:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./routerWarning":73,"_process":33}],43:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -3396,7 +4085,7 @@ var IndexLink = _react2.default.createClass({ exports.default = IndexLink; module.exports = exports['default']; -},{"./Link":38,"react":"react"}],34:[function(require,module,exports){ +},{"./Link":48,"react":"react"}],44:[function(require,module,exports){ (function (process){ 'use strict'; @@ -3463,7 +4152,7 @@ exports.default = IndexRedirect; module.exports = exports['default']; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./Redirect":41,"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],35:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./Redirect":51,"./routerWarning":73,"_process":33,"invariant":23,"react":"react"}],45:[function(require,module,exports){ (function (process){ 'use strict'; @@ -3527,7 +4216,7 @@ exports.default = IndexRoute; module.exports = exports['default']; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./RouteUtils":44,"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],36:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./RouteUtils":54,"./routerWarning":73,"_process":33,"invariant":23,"react":"react"}],46:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -3560,7 +4249,7 @@ var component = exports.component = oneOfType([func, string]); var components = exports.components = oneOfType([component, object]); var route = exports.route = oneOfType([object, element]); var routes = exports.routes = oneOfType([route, arrayOf(route)]); -},{"react":"react"}],37:[function(require,module,exports){ +},{"react":"react"}],47:[function(require,module,exports){ (function (process){ 'use strict'; @@ -3632,7 +4321,7 @@ exports.default = Lifecycle; module.exports = exports['default']; }).call(this,require('_process')) -},{"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],38:[function(require,module,exports){ +},{"./routerWarning":73,"_process":33,"invariant":23,"react":"react"}],48:[function(require,module,exports){ (function (process){ 'use strict'; @@ -3809,7 +4498,7 @@ exports.default = Link; module.exports = exports['default']; }).call(this,require('_process')) -},{"./PropTypes":40,"./routerWarning":63,"_process":29,"react":"react"}],39:[function(require,module,exports){ +},{"./PropTypes":50,"./routerWarning":73,"_process":33,"react":"react"}],49:[function(require,module,exports){ (function (process){ 'use strict'; @@ -3898,7 +4587,6 @@ function compilePattern(pattern) { * - ** Consumes (greedy) all characters up to the next character * in the pattern, or to the end of the URL if there is none * - * The function calls callback(error, matched) when finished. * The return value is an object with the following properties: * * - remainingPathname @@ -4025,7 +4713,7 @@ function formatPattern(pattern, params) { } }).call(this,require('_process')) -},{"_process":29,"invariant":23}],40:[function(require,module,exports){ +},{"_process":33,"invariant":23}],50:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4130,7 +4818,7 @@ if (process.env.NODE_ENV !== 'production') { exports.default = defaultExport; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./deprecateObjectProperties":56,"./routerWarning":63,"_process":29,"react":"react"}],41:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./deprecateObjectProperties":66,"./routerWarning":73,"_process":33,"react":"react"}],51:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4236,7 +4924,7 @@ exports.default = Redirect; module.exports = exports['default']; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./PatternUtils":39,"./RouteUtils":44,"_process":29,"invariant":23,"react":"react"}],42:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./PatternUtils":49,"./RouteUtils":54,"_process":33,"invariant":23,"react":"react"}],52:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4297,7 +4985,7 @@ exports.default = Route; module.exports = exports['default']; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./RouteUtils":44,"_process":29,"invariant":23,"react":"react"}],43:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./RouteUtils":54,"_process":33,"invariant":23,"react":"react"}],53:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4346,7 +5034,7 @@ exports.default = RouteContext; module.exports = exports['default']; }).call(this,require('_process')) -},{"./routerWarning":63,"_process":29,"react":"react"}],44:[function(require,module,exports){ +},{"./routerWarning":73,"_process":33,"react":"react"}],54:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4462,7 +5150,7 @@ function createRoutes(routes) { } }).call(this,require('_process')) -},{"./routerWarning":63,"_process":29,"react":"react"}],45:[function(require,module,exports){ +},{"./routerWarning":73,"_process":33,"react":"react"}],55:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4674,7 +5362,7 @@ exports.default = Router; module.exports = exports['default']; }).call(this,require('_process')) -},{"./InternalPropTypes":36,"./RouteUtils":44,"./RouterContext":46,"./RouterUtils":47,"./createTransitionManager":55,"./routerWarning":63,"_process":29,"history/lib/createHashHistory":14,"history/lib/useQueries":21,"react":"react"}],46:[function(require,module,exports){ +},{"./InternalPropTypes":46,"./RouteUtils":54,"./RouterContext":56,"./RouterUtils":57,"./createTransitionManager":65,"./routerWarning":73,"_process":33,"history/lib/createHashHistory":14,"history/lib/useQueries":21,"react":"react"}],56:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4834,7 +5522,7 @@ exports.default = RouterContext; module.exports = exports['default']; }).call(this,require('_process')) -},{"./RouteUtils":44,"./deprecateObjectProperties":56,"./getRouteParams":58,"./routerWarning":63,"_process":29,"invariant":23,"react":"react"}],47:[function(require,module,exports){ +},{"./RouteUtils":54,"./deprecateObjectProperties":66,"./getRouteParams":68,"./routerWarning":73,"_process":33,"invariant":23,"react":"react"}],57:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4870,7 +5558,7 @@ function createRoutingHistory(history, transitionManager) { } }).call(this,require('_process')) -},{"./deprecateObjectProperties":56,"_process":29}],48:[function(require,module,exports){ +},{"./deprecateObjectProperties":66,"_process":33}],58:[function(require,module,exports){ (function (process){ 'use strict'; @@ -4904,7 +5592,7 @@ exports.default = RoutingContext; module.exports = exports['default']; }).call(this,require('_process')) -},{"./RouterContext":46,"./routerWarning":63,"_process":29,"react":"react"}],49:[function(require,module,exports){ +},{"./RouterContext":56,"./routerWarning":73,"_process":33,"react":"react"}],59:[function(require,module,exports){ (function (process){ 'use strict'; @@ -5030,7 +5718,7 @@ function runLeaveHooks(routes) { } }).call(this,require('_process')) -},{"./AsyncUtils":31,"./routerWarning":63,"_process":29}],50:[function(require,module,exports){ +},{"./AsyncUtils":41,"./routerWarning":73,"_process":33}],60:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5081,7 +5769,7 @@ exports.default = function () { }; module.exports = exports['default']; -},{"./RouterContext":46,"react":"react"}],51:[function(require,module,exports){ +},{"./RouterContext":56,"react":"react"}],61:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5098,7 +5786,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de exports.default = (0, _createRouterHistory2.default)(_createBrowserHistory2.default); module.exports = exports['default']; -},{"./createRouterHistory":54,"history/lib/createBrowserHistory":12}],52:[function(require,module,exports){ +},{"./createRouterHistory":64,"history/lib/createBrowserHistory":12}],62:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5176,7 +5864,7 @@ function computeChangedRoutes(prevState, nextState) { exports.default = computeChangedRoutes; module.exports = exports['default']; -},{"./PatternUtils":39}],53:[function(require,module,exports){ +},{"./PatternUtils":49}],63:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5209,7 +5897,7 @@ function createMemoryHistory(options) { return history; } module.exports = exports['default']; -},{"history/lib/createMemoryHistory":17,"history/lib/useBasename":20,"history/lib/useQueries":21}],54:[function(require,module,exports){ +},{"history/lib/createMemoryHistory":17,"history/lib/useBasename":20,"history/lib/useQueries":21}],64:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5229,7 +5917,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); module.exports = exports['default']; -},{"./useRouterHistory":64}],55:[function(require,module,exports){ +},{"./useRouterHistory":74}],65:[function(require,module,exports){ (function (process){ 'use strict'; @@ -5540,7 +6228,7 @@ function createTransitionManager(history, routes) { module.exports = exports['default']; }).call(this,require('_process')) -},{"./TransitionUtils":49,"./computeChangedRoutes":52,"./getComponents":57,"./isActive":60,"./matchRoutes":62,"./routerWarning":63,"_process":29,"history/lib/Actions":6}],56:[function(require,module,exports){ +},{"./TransitionUtils":59,"./computeChangedRoutes":62,"./getComponents":67,"./isActive":70,"./matchRoutes":72,"./routerWarning":73,"_process":33,"history/lib/Actions":6}],66:[function(require,module,exports){ (function (process){ 'use strict'; @@ -5619,7 +6307,7 @@ if (process.env.NODE_ENV !== 'production') { exports.default = deprecateObjectProperties; }).call(this,require('_process')) -},{"./routerWarning":63,"_process":29}],57:[function(require,module,exports){ +},{"./routerWarning":73,"_process":33}],67:[function(require,module,exports){ (function (process){ 'use strict'; @@ -5702,7 +6390,7 @@ exports.default = getComponents; module.exports = exports['default']; }).call(this,require('_process')) -},{"./AsyncUtils":31,"./deprecateObjectProperties":56,"./routerWarning":63,"_process":29}],58:[function(require,module,exports){ +},{"./AsyncUtils":41,"./deprecateObjectProperties":66,"./routerWarning":73,"_process":33}],68:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5731,7 +6419,7 @@ function getRouteParams(route, params) { exports.default = getRouteParams; module.exports = exports['default']; -},{"./PatternUtils":39}],59:[function(require,module,exports){ +},{"./PatternUtils":49}],69:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5748,7 +6436,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de exports.default = (0, _createRouterHistory2.default)(_createHashHistory2.default); module.exports = exports['default']; -},{"./createRouterHistory":54,"history/lib/createHashHistory":14}],60:[function(require,module,exports){ +},{"./createRouterHistory":64,"history/lib/createHashHistory":14}],70:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -5901,7 +6589,7 @@ function isActive(_ref, indexOnly, currentLocation, routes, params) { return queryIsActive(query, currentLocation.query); } module.exports = exports['default']; -},{"./PatternUtils":39}],61:[function(require,module,exports){ +},{"./PatternUtils":49}],71:[function(require,module,exports){ (function (process){ 'use strict'; @@ -5986,7 +6674,7 @@ exports.default = match; module.exports = exports['default']; }).call(this,require('_process')) -},{"./RouteUtils":44,"./RouterUtils":47,"./createMemoryHistory":53,"./createTransitionManager":55,"_process":29,"invariant":23}],62:[function(require,module,exports){ +},{"./RouteUtils":54,"./RouterUtils":57,"./createMemoryHistory":63,"./createTransitionManager":65,"_process":33,"invariant":23}],72:[function(require,module,exports){ (function (process){ 'use strict'; @@ -6098,17 +6786,13 @@ function matchRouteDeep(route, location, remainingPathname, paramNames, paramVal // Only try to match the path if the route actually has a pattern, and if // we're not just searching for potential nested absolute paths. if (remainingPathname !== null && pattern) { - try { - var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname); - if (matched) { - remainingPathname = matched.remainingPathname; - paramNames = [].concat(paramNames, matched.paramNames); - paramValues = [].concat(paramValues, matched.paramValues); - } else { - remainingPathname = null; - } - } catch (error) { - callback(error); + var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname); + if (matched) { + remainingPathname = matched.remainingPathname; + paramNames = [].concat(paramNames, matched.paramNames); + paramValues = [].concat(paramValues, matched.paramValues); + } else { + remainingPathname = null; } // By assumption, pattern is non-empty here, which is the prerequisite for @@ -6223,7 +6907,7 @@ function matchRoutes(routes, location, callback, remainingPathname) { module.exports = exports['default']; }).call(this,require('_process')) -},{"./AsyncUtils":31,"./PatternUtils":39,"./RouteUtils":44,"./routerWarning":63,"_process":29}],63:[function(require,module,exports){ +},{"./AsyncUtils":41,"./PatternUtils":49,"./RouteUtils":54,"./routerWarning":73,"_process":33}],73:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -6260,7 +6944,7 @@ function routerWarning(falseToWarn, message) { function _resetWarned() { warned = {}; } -},{"warning":231}],64:[function(require,module,exports){ +},{"warning":249}],74:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -6284,7 +6968,7 @@ function useRouterHistory(createHistory) { }; } module.exports = exports['default']; -},{"history/lib/useBasename":20,"history/lib/useQueries":21}],65:[function(require,module,exports){ +},{"history/lib/useBasename":20,"history/lib/useQueries":21}],75:[function(require,module,exports){ (function (process){ 'use strict'; @@ -6339,7 +7023,7 @@ exports.default = useRoutes; module.exports = exports['default']; }).call(this,require('_process')) -},{"./createTransitionManager":55,"./routerWarning":63,"_process":29,"history/lib/useQueries":21}],66:[function(require,module,exports){ +},{"./createTransitionManager":65,"./routerWarning":73,"_process":33,"history/lib/useQueries":21}],76:[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -6380,7 +7064,7 @@ function withRouter(WrappedComponent) { return (0, _hoistNonReactStatics2.default)(WithRouter, WrappedComponent); } module.exports = exports['default']; -},{"./PropTypes":40,"hoist-non-react-statics":22,"react":"react"}],67:[function(require,module,exports){ +},{"./PropTypes":50,"hoist-non-react-statics":22,"react":"react"}],77:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -6405,7 +7089,7 @@ var AutoFocusUtils = { }; module.exports = AutoFocusUtils; -},{"./ReactDOMComponentTree":107,"fbjs/lib/focusNode":213}],68:[function(require,module,exports){ +},{"./ReactDOMComponentTree":116,"fbjs/lib/focusNode":223}],78:[function(require,module,exports){ /** * Copyright 2013-present Facebook, Inc. * All rights reserved. @@ -6794,7 +7478,7 @@ var BeforeInputEventPlugin = { }; module.exports = BeforeInputEventPlugin; -},{"./EventConstants":82,"./EventPropagators":86,"./FallbackCompositionState":87,"./SyntheticCompositionEvent":162,"./SyntheticInputEvent":166,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/keyOf":223}],69:[function(require,module,exports){ +},{"./EventConstants":92,"./EventPropagators":96,"./FallbackCompositionState":97,"./SyntheticCompositionEvent":172,"./SyntheticInputEvent":176,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/keyOf":233}],79:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -6943,7 +7627,7 @@ var CSSProperty = { }; module.exports = CSSProperty; -},{}],70:[function(require,module,exports){ +},{}],80:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -6960,7 +7644,7 @@ module.exports = CSSProperty; var CSSProperty = require('./CSSProperty'); var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment'); -var ReactInstrumentation = require('./ReactInstrumentation'); +var ReactPerf = require('./ReactPerf'); var camelizeStyleName = require('fbjs/lib/camelizeStyleName'); var dangerousStyleValue = require('./dangerousStyleValue'); @@ -7114,10 +7798,6 @@ var CSSPropertyOperations = { * @param {ReactDOMComponent} component */ setValueForStyles: function (node, styles, component) { - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(component._debugID, 'update styles', styles); - } - var style = node.style; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { @@ -7149,10 +7829,14 @@ var CSSPropertyOperations = { }; +ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', { + setValueForStyles: 'setValueForStyles' +}); + module.exports = CSSPropertyOperations; }).call(this,require('_process')) -},{"./CSSProperty":69,"./ReactInstrumentation":136,"./dangerousStyleValue":179,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/camelizeStyleName":207,"fbjs/lib/hyphenateStyleName":218,"fbjs/lib/memoizeStringOnly":225,"fbjs/lib/warning":229}],71:[function(require,module,exports){ +},{"./CSSProperty":79,"./ReactPerf":157,"./dangerousStyleValue":189,"_process":33,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/camelizeStyleName":217,"fbjs/lib/hyphenateStyleName":228,"fbjs/lib/memoizeStringOnly":235,"fbjs/lib/warning":239}],81:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -7261,7 +7945,7 @@ PooledClass.addPoolingTo(CallbackQueue); module.exports = CallbackQueue; }).call(this,require('_process')) -},{"./PooledClass":91,"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],72:[function(require,module,exports){ +},{"./PooledClass":101,"_process":33,"fbjs/lib/invariant":229,"object-assign":32}],82:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -7587,8 +8271,7 @@ var ChangeEventPlugin = { }; module.exports = ChangeEventPlugin; -},{"./EventConstants":82,"./EventPluginHub":83,"./EventPropagators":86,"./ReactDOMComponentTree":107,"./ReactUpdates":155,"./SyntheticEvent":164,"./getEventTarget":187,"./isEventSupported":194,"./isTextInputElement":195,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/keyOf":223}],73:[function(require,module,exports){ -(function (process){ +},{"./EventConstants":92,"./EventPluginHub":93,"./EventPropagators":96,"./ReactDOMComponentTree":116,"./ReactUpdates":165,"./SyntheticEvent":174,"./getEventTarget":197,"./isEventSupported":204,"./isTextInputElement":205,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/keyOf":233}],83:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -7605,8 +8288,7 @@ module.exports = ChangeEventPlugin; var DOMLazyTree = require('./DOMLazyTree'); var Danger = require('./Danger'); var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes'); -var ReactDOMComponentTree = require('./ReactDOMComponentTree'); -var ReactInstrumentation = require('./ReactInstrumentation'); +var ReactPerf = require('./ReactPerf'); var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction'); var setInnerHTML = require('./setInnerHTML'); @@ -7701,25 +8383,6 @@ function replaceDelimitedText(openingComment, closingComment, stringText) { removeDelimitedText(parentNode, openingComment, closingComment); } } - - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 'replace text', stringText); - } -} - -var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; -if (process.env.NODE_ENV !== 'production') { - dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { - Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); - if (prevInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onNativeOperation(prevInstance._debugID, 'replace with', markup.toString()); - } else { - var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); - if (nextInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onNativeOperation(nextInstance._debugID, 'mount', markup.toString()); - } - } - }; } /** @@ -7727,7 +8390,7 @@ if (process.env.NODE_ENV !== 'production') { */ var DOMChildrenOperations = { - dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, + dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, replaceDelimitedText: replaceDelimitedText, @@ -7739,42 +8402,23 @@ var DOMChildrenOperations = { * @internal */ processUpdates: function (parentNode, updates) { - if (process.env.NODE_ENV !== 'production') { - var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; - } - for (var k = 0; k < updates.length; k++) { var update = updates[k]; switch (update.type) { case ReactMultiChildUpdateTypes.INSERT_MARKUP: insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'insert child', { toIndex: update.toIndex, content: update.content.toString() }); - } break; case ReactMultiChildUpdateTypes.MOVE_EXISTING: moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'move child', { fromIndex: update.fromIndex, toIndex: update.toIndex }); - } break; case ReactMultiChildUpdateTypes.SET_MARKUP: setInnerHTML(parentNode, update.content); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'replace children', update.content.toString()); - } break; case ReactMultiChildUpdateTypes.TEXT_CONTENT: setTextContent(parentNode, update.content); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'replace text', update.content.toString()); - } break; case ReactMultiChildUpdateTypes.REMOVE_NODE: removeChild(parentNode, update.fromNode); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'remove child', { fromIndex: update.fromIndex }); - } break; } } @@ -7782,10 +8426,12 @@ var DOMChildrenOperations = { }; -module.exports = DOMChildrenOperations; -}).call(this,require('_process')) +ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { + replaceDelimitedText: 'replaceDelimitedText' +}); -},{"./DOMLazyTree":74,"./Danger":78,"./ReactDOMComponentTree":107,"./ReactInstrumentation":136,"./ReactMultiChildUpdateTypes":141,"./createMicrosoftUnsafeLocalFunction":178,"./setInnerHTML":199,"./setTextContent":200,"_process":29}],74:[function(require,module,exports){ +module.exports = DOMChildrenOperations; +},{"./DOMLazyTree":84,"./Danger":88,"./ReactMultiChildUpdateTypes":152,"./ReactPerf":157,"./createMicrosoftUnsafeLocalFunction":188,"./setInnerHTML":209,"./setTextContent":210}],84:[function(require,module,exports){ /** * Copyright 2015-present, Facebook, Inc. * All rights reserved. @@ -7799,14 +8445,9 @@ module.exports = DOMChildrenOperations; 'use strict'; -var DOMNamespaces = require('./DOMNamespaces'); - var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction'); var setTextContent = require('./setTextContent'); -var ELEMENT_NODE_TYPE = 1; -var DOCUMENT_FRAGMENT_NODE_TYPE = 11; - /** * In IE (8-11) and Edge, appending nodes with no children is dramatically * faster than appending a full subtree, so we essentially queue up the @@ -7841,10 +8482,8 @@ var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, // DocumentFragments aren't actually part of the DOM after insertion so // appending children won't update the DOM. We need to ensure the fragment // is properly populated first, breaking out of our lazy approach for just - // this level. Also, some plugins (like Flash Player) will read - // nodes immediately upon insertion into the DOM, so - // must also be populated prior to insertion into the DOM. - if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) { + // this level. + if (tree.node.nodeType === 11) { insertTreeChildren(tree); parentNode.insertBefore(tree.node, referenceNode); } else { @@ -7882,17 +8521,12 @@ function queueText(tree, text) { } } -function toString() { - return this.node.nodeName; -} - function DOMLazyTree(node) { return { node: node, children: [], html: null, - text: null, - toString: toString + text: null }; } @@ -7903,7 +8537,7 @@ DOMLazyTree.queueHTML = queueHTML; DOMLazyTree.queueText = queueText; module.exports = DOMLazyTree; -},{"./DOMNamespaces":75,"./createMicrosoftUnsafeLocalFunction":178,"./setTextContent":200}],75:[function(require,module,exports){ +},{"./createMicrosoftUnsafeLocalFunction":188,"./setTextContent":210}],85:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -7924,7 +8558,7 @@ var DOMNamespaces = { }; module.exports = DOMNamespaces; -},{}],76:[function(require,module,exports){ +},{}],86:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -8141,7 +8775,7 @@ var DOMProperty = { module.exports = DOMProperty; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],77:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],87:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -8157,9 +8791,8 @@ module.exports = DOMProperty; 'use strict'; var DOMProperty = require('./DOMProperty'); -var ReactDOMComponentTree = require('./ReactDOMComponentTree'); var ReactDOMInstrumentation = require('./ReactDOMInstrumentation'); -var ReactInstrumentation = require('./ReactInstrumentation'); +var ReactPerf = require('./ReactPerf'); var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser'); var warning = require('fbjs/lib/warning'); @@ -8267,6 +8900,9 @@ var DOMPropertyOperations = { * @param {*} value */ setValueForProperty: function (node, name, value) { + if (process.env.NODE_ENV !== 'production') { + ReactDOMInstrumentation.debugTool.onSetValueForProperty(node, name, value); + } var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; if (propertyInfo) { var mutationMethod = propertyInfo.mutationMethod; @@ -8274,7 +8910,6 @@ var DOMPropertyOperations = { mutationMethod(node, value); } else if (shouldIgnoreValue(propertyInfo, value)) { this.deleteValueForProperty(node, name); - return; } else if (propertyInfo.mustUseProperty) { var propName = propertyInfo.propertyName; // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the @@ -8299,14 +8934,6 @@ var DOMPropertyOperations = { } } else if (DOMProperty.isCustomAttribute(name)) { DOMPropertyOperations.setValueForAttribute(node, name, value); - return; - } - - if (process.env.NODE_ENV !== 'production') { - ReactDOMInstrumentation.debugTool.onSetValueForProperty(node, name, value); - var payload = {}; - payload[name] = value; - ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'update attribute', payload); } }, @@ -8319,12 +8946,6 @@ var DOMPropertyOperations = { } else { node.setAttribute(name, '' + value); } - - if (process.env.NODE_ENV !== 'production') { - var payload = {}; - payload[name] = value; - ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'update attribute', payload); - } }, /** @@ -8334,6 +8955,9 @@ var DOMPropertyOperations = { * @param {string} name */ deleteValueForProperty: function (node, name) { + if (process.env.NODE_ENV !== 'production') { + ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name); + } var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; if (propertyInfo) { var mutationMethod = propertyInfo.mutationMethod; @@ -8355,19 +8979,20 @@ var DOMPropertyOperations = { } else if (DOMProperty.isCustomAttribute(name)) { node.removeAttribute(name); } - - if (process.env.NODE_ENV !== 'production') { - ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name); - ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'remove attribute', name); - } } }; +ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', { + setValueForProperty: 'setValueForProperty', + setValueForAttribute: 'setValueForAttribute', + deleteValueForProperty: 'deleteValueForProperty' +}); + module.exports = DOMPropertyOperations; }).call(this,require('_process')) -},{"./DOMProperty":76,"./ReactDOMComponentTree":107,"./ReactDOMInstrumentation":115,"./ReactInstrumentation":136,"./quoteAttributeValueForBrowser":197,"_process":29,"fbjs/lib/warning":229}],78:[function(require,module,exports){ +},{"./DOMProperty":86,"./ReactDOMInstrumentation":124,"./ReactPerf":157,"./quoteAttributeValueForBrowser":207,"_process":33,"fbjs/lib/warning":239}],88:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -8515,7 +9140,7 @@ var Danger = { module.exports = Danger; }).call(this,require('_process')) -},{"./DOMLazyTree":74,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/createNodesFromMarkup":210,"fbjs/lib/emptyFunction":211,"fbjs/lib/getMarkupWrap":215,"fbjs/lib/invariant":219}],79:[function(require,module,exports){ +},{"./DOMLazyTree":84,"_process":33,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/createNodesFromMarkup":220,"fbjs/lib/emptyFunction":221,"fbjs/lib/getMarkupWrap":225,"fbjs/lib/invariant":229}],89:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -8543,7 +9168,7 @@ var keyOf = require('fbjs/lib/keyOf'); var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })]; module.exports = DefaultEventPluginOrder; -},{"fbjs/lib/keyOf":223}],80:[function(require,module,exports){ +},{"fbjs/lib/keyOf":233}],90:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -8594,7 +9219,7 @@ var DisabledInputUtils = { }; module.exports = DisabledInputUtils; -},{}],81:[function(require,module,exports){ +},{}],91:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -8700,7 +9325,7 @@ var EnterLeaveEventPlugin = { }; module.exports = EnterLeaveEventPlugin; -},{"./EventConstants":82,"./EventPropagators":86,"./ReactDOMComponentTree":107,"./SyntheticMouseEvent":168,"fbjs/lib/keyOf":223}],82:[function(require,module,exports){ +},{"./EventConstants":92,"./EventPropagators":96,"./ReactDOMComponentTree":116,"./SyntheticMouseEvent":178,"fbjs/lib/keyOf":233}],92:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -8798,7 +9423,7 @@ var EventConstants = { }; module.exports = EventConstants; -},{"fbjs/lib/keyMirror":222}],83:[function(require,module,exports){ +},{"fbjs/lib/keyMirror":232}],93:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -9037,7 +9662,7 @@ var EventPluginHub = { module.exports = EventPluginHub; }).call(this,require('_process')) -},{"./EventPluginRegistry":84,"./EventPluginUtils":85,"./ReactErrorUtils":129,"./accumulateInto":175,"./forEachAccumulated":183,"_process":29,"fbjs/lib/invariant":219}],84:[function(require,module,exports){ +},{"./EventPluginRegistry":94,"./EventPluginUtils":95,"./ReactErrorUtils":140,"./accumulateInto":185,"./forEachAccumulated":193,"_process":33,"fbjs/lib/invariant":229}],94:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -9282,7 +9907,7 @@ var EventPluginRegistry = { module.exports = EventPluginRegistry; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],85:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],95:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -9513,7 +10138,7 @@ var EventPluginUtils = { module.exports = EventPluginUtils; }).call(this,require('_process')) -},{"./EventConstants":82,"./ReactErrorUtils":129,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],86:[function(require,module,exports){ +},{"./EventConstants":92,"./ReactErrorUtils":140,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],96:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -9654,7 +10279,7 @@ var EventPropagators = { module.exports = EventPropagators; }).call(this,require('_process')) -},{"./EventConstants":82,"./EventPluginHub":83,"./EventPluginUtils":85,"./accumulateInto":175,"./forEachAccumulated":183,"_process":29,"fbjs/lib/warning":229}],87:[function(require,module,exports){ +},{"./EventConstants":92,"./EventPluginHub":93,"./EventPluginUtils":95,"./accumulateInto":185,"./forEachAccumulated":193,"_process":33,"fbjs/lib/warning":239}],97:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -9750,7 +10375,7 @@ _assign(FallbackCompositionState.prototype, { PooledClass.addPoolingTo(FallbackCompositionState); module.exports = FallbackCompositionState; -},{"./PooledClass":91,"./getTextContentAccessor":191,"object-assign":28}],88:[function(require,module,exports){ +},{"./PooledClass":101,"./getTextContentAccessor":201,"object-assign":32}],98:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -9960,7 +10585,7 @@ var HTMLDOMPropertyConfig = { }; module.exports = HTMLDOMPropertyConfig; -},{"./DOMProperty":76}],89:[function(require,module,exports){ +},{"./DOMProperty":86}],99:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -10019,7 +10644,7 @@ var KeyEscapeUtils = { }; module.exports = KeyEscapeUtils; -},{}],90:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -10156,7 +10781,7 @@ var LinkedValueUtils = { module.exports = LinkedValueUtils; }).call(this,require('_process')) -},{"./ReactPropTypeLocations":148,"./ReactPropTypes":149,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],91:[function(require,module,exports){ +},{"./ReactPropTypeLocations":159,"./ReactPropTypes":160,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],101:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -10279,7 +10904,7 @@ var PooledClass = { module.exports = PooledClass; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],92:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],102:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -10370,7 +10995,7 @@ var React = { module.exports = React; }).call(this,require('_process')) -},{"./ReactChildren":95,"./ReactClass":96,"./ReactComponent":97,"./ReactDOMFactories":111,"./ReactElement":126,"./ReactElementValidator":127,"./ReactPropTypes":149,"./ReactVersion":156,"./onlyChild":196,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],93:[function(require,module,exports){ +},{"./ReactChildren":105,"./ReactClass":106,"./ReactComponent":107,"./ReactDOMFactories":120,"./ReactElement":137,"./ReactElementValidator":138,"./ReactPropTypes":160,"./ReactVersion":166,"./onlyChild":206,"_process":33,"fbjs/lib/warning":239,"object-assign":32}],103:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -10688,7 +11313,7 @@ var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { }); module.exports = ReactBrowserEventEmitter; -},{"./EventConstants":82,"./EventPluginRegistry":84,"./ReactEventEmitterMixin":130,"./ViewportMetrics":174,"./getVendorPrefixedEventName":192,"./isEventSupported":194,"object-assign":28}],94:[function(require,module,exports){ +},{"./EventConstants":92,"./EventPluginRegistry":94,"./ReactEventEmitterMixin":141,"./ViewportMetrics":184,"./getVendorPrefixedEventName":202,"./isEventSupported":204,"object-assign":32}],104:[function(require,module,exports){ (function (process){ /** * Copyright 2014-present, Facebook, Inc. @@ -10817,7 +11442,7 @@ var ReactChildReconciler = { module.exports = ReactChildReconciler; }).call(this,require('_process')) -},{"./KeyEscapeUtils":89,"./ReactReconciler":151,"./instantiateReactComponent":193,"./shouldUpdateReactComponent":201,"./traverseAllChildren":202,"_process":29,"fbjs/lib/warning":229}],95:[function(require,module,exports){ +},{"./KeyEscapeUtils":99,"./ReactReconciler":162,"./instantiateReactComponent":203,"./shouldUpdateReactComponent":211,"./traverseAllChildren":212,"_process":33,"fbjs/lib/warning":239}],105:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -10875,8 +11500,6 @@ function forEachSingleChild(bookKeeping, child, name) { /** * Iterates through children that are typically specified as `props.children`. * - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach - * * The provided forEachFunc(child, index) will be called for each * leaf child. * @@ -10952,9 +11575,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { /** * Maps children that are typically specified as `props.children`. * - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map - * - * The provided mapFunction(child, key, index) will be called for each + * The provided mapFunction(child, index) will be called for each * leaf child. * * @param {?*} children Children tree container. @@ -10979,8 +11600,6 @@ function forEachSingleChildDummy(traverseContext, child, name) { * Count the number of children that are typically specified as * `props.children`. * - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count - * * @param {?*} children Children tree container. * @return {number} The number of children. */ @@ -10991,8 +11610,6 @@ function countChildren(children, context) { /** * Flatten a children object (typically specified as `props.children`) and * return an array with appropriately re-keyed children. - * - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray */ function toArray(children) { var result = []; @@ -11009,7 +11626,7 @@ var ReactChildren = { }; module.exports = ReactChildren; -},{"./PooledClass":91,"./ReactElement":126,"./traverseAllChildren":202,"fbjs/lib/emptyFunction":211}],96:[function(require,module,exports){ +},{"./PooledClass":101,"./ReactElement":137,"./traverseAllChildren":212,"fbjs/lib/emptyFunction":221}],106:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -11640,7 +12257,6 @@ var ReactClass = { /** * Creates a composite component class given a class specification. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass * * @param {object} spec Class specification (which must define `render`). * @return {function} Component constructor function. @@ -11737,7 +12353,7 @@ var ReactClass = { module.exports = ReactClass; }).call(this,require('_process')) -},{"./ReactComponent":97,"./ReactElement":126,"./ReactNoopUpdateQueue":145,"./ReactPropTypeLocationNames":147,"./ReactPropTypeLocations":148,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/keyMirror":222,"fbjs/lib/keyOf":223,"fbjs/lib/warning":229,"object-assign":28}],97:[function(require,module,exports){ +},{"./ReactComponent":107,"./ReactElement":137,"./ReactNoopUpdateQueue":155,"./ReactPropTypeLocationNames":158,"./ReactPropTypeLocations":159,"_process":33,"fbjs/lib/emptyObject":222,"fbjs/lib/invariant":229,"fbjs/lib/keyMirror":232,"fbjs/lib/keyOf":233,"fbjs/lib/warning":239,"object-assign":32}],107:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -11862,7 +12478,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = ReactComponent; }).call(this,require('_process')) -},{"./ReactInstrumentation":136,"./ReactNoopUpdateQueue":145,"./canDefineProperty":177,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],98:[function(require,module,exports){ +},{"./ReactInstrumentation":147,"./ReactNoopUpdateQueue":155,"./canDefineProperty":187,"_process":33,"fbjs/lib/emptyObject":222,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],108:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -11878,6 +12494,7 @@ module.exports = ReactComponent; var DOMChildrenOperations = require('./DOMChildrenOperations'); var ReactDOMIDOperations = require('./ReactDOMIDOperations'); +var ReactPerf = require('./ReactPerf'); /** * Abstracts away all functionality of the reconciler that requires knowledge of @@ -11901,8 +12518,12 @@ var ReactComponentBrowserEnvironment = { }; +ReactPerf.measureMethods(ReactComponentBrowserEnvironment, 'ReactComponentBrowserEnvironment', { + replaceNodeWithMarkup: 'replaceNodeWithMarkup' +}); + module.exports = ReactComponentBrowserEnvironment; -},{"./DOMChildrenOperations":73,"./ReactDOMIDOperations":113}],99:[function(require,module,exports){ +},{"./DOMChildrenOperations":83,"./ReactDOMIDOperations":122,"./ReactPerf":157}],109:[function(require,module,exports){ (function (process){ /** * Copyright 2014-present, Facebook, Inc. @@ -11957,156 +12578,7 @@ var ReactComponentEnvironment = { module.exports = ReactComponentEnvironment; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],100:[function(require,module,exports){ -(function (process){ -/** - * Copyright 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactComponentTreeDevtool - */ - -'use strict'; - -var invariant = require('fbjs/lib/invariant'); - -var tree = {}; -var rootIDs = []; - -function updateTree(id, update) { - if (!tree[id]) { - tree[id] = { - parentID: null, - ownerID: null, - text: null, - childIDs: [], - displayName: 'Unknown', - isMounted: false, - updateCount: 0 - }; - } - update(tree[id]); -} - -function purgeDeep(id) { - var item = tree[id]; - if (item) { - var childIDs = item.childIDs; - - delete tree[id]; - childIDs.forEach(purgeDeep); - } -} - -var ReactComponentTreeDevtool = { - onSetDisplayName: function (id, displayName) { - updateTree(id, function (item) { - return item.displayName = displayName; - }); - }, - onSetChildren: function (id, nextChildIDs) { - updateTree(id, function (item) { - var prevChildIDs = item.childIDs; - item.childIDs = nextChildIDs; - - nextChildIDs.forEach(function (nextChildID) { - var nextChild = tree[nextChildID]; - !nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected devtool events to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0; - !(nextChild.displayName != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetDisplayName() to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0; - !(nextChild.childIDs != null || nextChild.text != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() or onSetText() to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0; - !nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0; - - if (prevChildIDs.indexOf(nextChildID) === -1) { - nextChild.parentID = id; - } - }); - }); - }, - onSetOwner: function (id, ownerID) { - updateTree(id, function (item) { - return item.ownerID = ownerID; - }); - }, - onSetText: function (id, text) { - updateTree(id, function (item) { - return item.text = text; - }); - }, - onMountComponent: function (id) { - updateTree(id, function (item) { - return item.isMounted = true; - }); - }, - onMountRootComponent: function (id) { - rootIDs.push(id); - }, - onUpdateComponent: function (id) { - updateTree(id, function (item) { - return item.updateCount++; - }); - }, - onUnmountComponent: function (id) { - updateTree(id, function (item) { - return item.isMounted = false; - }); - rootIDs = rootIDs.filter(function (rootID) { - return rootID !== id; - }); - }, - purgeUnmountedComponents: function () { - if (ReactComponentTreeDevtool._preventPurging) { - // Should only be used for testing. - return; - } - - Object.keys(tree).filter(function (id) { - return !tree[id].isMounted; - }).forEach(purgeDeep); - }, - isMounted: function (id) { - var item = tree[id]; - return item ? item.isMounted : false; - }, - getChildIDs: function (id) { - var item = tree[id]; - return item ? item.childIDs : []; - }, - getDisplayName: function (id) { - var item = tree[id]; - return item ? item.displayName : 'Unknown'; - }, - getOwnerID: function (id) { - var item = tree[id]; - return item ? item.ownerID : null; - }, - getParentID: function (id) { - var item = tree[id]; - return item ? item.parentID : null; - }, - getText: function (id) { - var item = tree[id]; - return item ? item.text : null; - }, - getUpdateCount: function (id) { - var item = tree[id]; - return item ? item.updateCount : 0; - }, - getRootIDs: function () { - return rootIDs; - }, - getRegisteredIDs: function () { - return Object.keys(tree); - } -}; - -module.exports = ReactComponentTreeDevtool; -}).call(this,require('_process')) - -},{"_process":29,"fbjs/lib/invariant":219}],101:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],110:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -12130,6 +12602,7 @@ var ReactErrorUtils = require('./ReactErrorUtils'); var ReactInstanceMap = require('./ReactInstanceMap'); var ReactInstrumentation = require('./ReactInstrumentation'); var ReactNodeTypes = require('./ReactNodeTypes'); +var ReactPerf = require('./ReactPerf'); var ReactPropTypeLocations = require('./ReactPropTypeLocations'); var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames'); var ReactReconciler = require('./ReactReconciler'); @@ -12165,28 +12638,6 @@ function warnIfInvalidElement(Component, element) { } } -function invokeComponentDidMountWithTimer() { - var publicInstance = this._instance; - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidMount'); - } - publicInstance.componentDidMount(); - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidMount'); - } -} - -function invokeComponentDidUpdateWithTimer(prevProps, prevState, prevContext) { - var publicInstance = this._instance; - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidUpdate'); - } - publicInstance.componentDidUpdate(prevProps, prevState, prevContext); - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidUpdate'); - } -} - function shouldConstruct(Component) { return Component.prototype && Component.prototype.isReactComponent; } @@ -12246,7 +12697,6 @@ var ReactCompositeComponentMixin = { this._nativeContainerInfo = null; // See ReactUpdateQueue - this._updateBatchNumber = null; this._pendingElement = null; this._pendingStateQueue = null; this._pendingReplaceState = false; @@ -12355,11 +12805,7 @@ var ReactCompositeComponentMixin = { } if (inst.componentDidMount) { - if (process.env.NODE_ENV !== 'production') { - transaction.getReactMountReady().enqueue(invokeComponentDidMountWithTimer, this); - } else { - transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); - } + transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); } return markup; @@ -12380,35 +12826,11 @@ var ReactCompositeComponentMixin = { _constructComponentWithoutOwner: function (publicProps, publicContext) { var Component = this._currentElement.type; - var instanceOrElement; if (shouldConstruct(Component)) { - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'ctor'); - } - } - instanceOrElement = new Component(publicProps, publicContext, ReactUpdateQueue); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'ctor'); - } - } + return new Component(publicProps, publicContext, ReactUpdateQueue); } else { - // This can still be an instance in case of factory components - // but we'll count this as time spent rendering as the more common case. - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render'); - } - } - instanceOrElement = Component(publicProps, publicContext, ReactUpdateQueue); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render'); - } - } + return Component(publicProps, publicContext, ReactUpdateQueue); } - return instanceOrElement; }, performInitialMountWithErrorHandling: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) { @@ -12438,17 +12860,7 @@ var ReactCompositeComponentMixin = { performInitialMount: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) { var inst = this._instance; if (inst.componentWillMount) { - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillMount'); - } - } inst.componentWillMount(); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillMount'); - } - } // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingStateQueue` without triggering a re-render. if (this._pendingStateQueue) { @@ -12466,12 +12878,6 @@ var ReactCompositeComponentMixin = { var markup = ReactReconciler.mountComponent(this._renderedComponent, transaction, nativeParent, nativeContainerInfo, this._processChildContext(context)); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onSetChildren(this._debugID, this._renderedComponent._debugID !== 0 ? [this._renderedComponent._debugID] : []); - } - } - return markup; }, @@ -12493,22 +12899,12 @@ var ReactCompositeComponentMixin = { if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { inst._calledComponentWillUnmount = true; - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUnmount'); - } - } if (safely) { var name = this.getName() + '.componentWillUnmount()'; ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst)); } else { inst.componentWillUnmount(); } - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUnmount'); - } - } } if (this._renderedComponent) { @@ -12691,10 +13087,10 @@ var ReactCompositeComponentMixin = { performUpdateIfNecessary: function (transaction) { if (this._pendingElement != null) { ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context); - } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) { + } + + if (this._pendingStateQueue !== null || this._pendingForceUpdate) { this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); - } else { - this._updateBatchNumber = null; } }, @@ -12741,41 +13137,17 @@ var ReactCompositeComponentMixin = { // _pendingStateQueue which will ensure that any state updates gets // immediately reconciled instead of waiting for the next batch. if (willReceive && inst.componentWillReceiveProps) { - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillReceiveProps'); - } - } inst.componentWillReceiveProps(nextProps, nextContext); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillReceiveProps'); - } - } } var nextState = this._processPendingState(nextProps, nextContext); - var shouldUpdate = true; - if (!this._pendingForceUpdate && inst.shouldComponentUpdate) { - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'shouldComponentUpdate'); - } - } - shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'shouldComponentUpdate'); - } - } - } + var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext); if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0; } - this._updateBatchNumber = null; if (shouldUpdate) { this._pendingForceUpdate = false; // Will set `this.props`, `this.state` and `this.context`. @@ -12841,17 +13213,7 @@ var ReactCompositeComponentMixin = { } if (inst.componentWillUpdate) { - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUpdate'); - } - } inst.componentWillUpdate(nextProps, nextState, nextContext); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUpdate'); - } - } } this._currentElement = nextElement; @@ -12863,11 +13225,7 @@ var ReactCompositeComponentMixin = { this._updateRenderedComponent(transaction, unmaskedContext); if (hasComponentDidUpdate) { - if (process.env.NODE_ENV !== 'production') { - transaction.getReactMountReady().enqueue(invokeComponentDidUpdateWithTimer.bind(this, prevProps, prevState, prevContext), this); - } else { - transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); - } + transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); } }, @@ -12889,16 +13247,8 @@ var ReactCompositeComponentMixin = { this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement); this._renderedComponent = this._instantiateReactComponent(nextRenderedElement); - var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, transaction, this._nativeParent, this._nativeContainerInfo, this._processChildContext(context)); - - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onSetChildren(this._debugID, this._renderedComponent._debugID !== 0 ? [this._renderedComponent._debugID] : []); - } - } - - this._replaceNodeWithMarkup(oldNativeNode, nextMarkup, prevComponentInstance); + this._replaceNodeWithMarkup(oldNativeNode, nextMarkup); } }, @@ -12907,8 +13257,8 @@ var ReactCompositeComponentMixin = { * * @protected */ - _replaceNodeWithMarkup: function (oldNativeNode, nextMarkup, prevInstance) { - ReactComponentEnvironment.replaceNodeWithMarkup(oldNativeNode, nextMarkup, prevInstance); + _replaceNodeWithMarkup: function (oldNativeNode, nextMarkup) { + ReactComponentEnvironment.replaceNodeWithMarkup(oldNativeNode, nextMarkup); }, /** @@ -12916,19 +13266,7 @@ var ReactCompositeComponentMixin = { */ _renderValidatedComponentWithoutOwnerOrContext: function () { var inst = this._instance; - - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render'); - } - } var renderedComponent = inst.render(); - if (process.env.NODE_ENV !== 'production') { - if (this._debugID !== 0) { - ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render'); - } - } - if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (renderedComponent === undefined && inst.render._isMockFunction) { @@ -12955,7 +13293,6 @@ var ReactCompositeComponentMixin = { !( // TODO: An `isValidNode` function would probably be more appropriate renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0; - return renderedComponent; }, @@ -13024,6 +13361,12 @@ var ReactCompositeComponentMixin = { }; +ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', { + mountComponent: 'mountComponent', + updateComponent: 'updateComponent', + _renderValidatedComponent: '_renderValidatedComponent' +}); + var ReactCompositeComponent = { Mixin: ReactCompositeComponentMixin @@ -13033,7 +13376,7 @@ var ReactCompositeComponent = { module.exports = ReactCompositeComponent; }).call(this,require('_process')) -},{"./ReactComponentEnvironment":99,"./ReactCurrentOwner":102,"./ReactElement":126,"./ReactErrorUtils":129,"./ReactInstanceMap":135,"./ReactInstrumentation":136,"./ReactNodeTypes":144,"./ReactPropTypeLocationNames":147,"./ReactPropTypeLocations":148,"./ReactReconciler":151,"./ReactUpdateQueue":154,"./shouldUpdateReactComponent":201,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],102:[function(require,module,exports){ +},{"./ReactComponentEnvironment":109,"./ReactCurrentOwner":111,"./ReactElement":137,"./ReactErrorUtils":140,"./ReactInstanceMap":146,"./ReactInstrumentation":147,"./ReactNodeTypes":154,"./ReactPerf":157,"./ReactPropTypeLocationNames":158,"./ReactPropTypeLocations":159,"./ReactReconciler":162,"./ReactUpdateQueue":164,"./shouldUpdateReactComponent":211,"_process":33,"fbjs/lib/emptyObject":222,"fbjs/lib/invariant":229,"fbjs/lib/warning":239,"object-assign":32}],111:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -13065,7 +13408,7 @@ var ReactCurrentOwner = { }; module.exports = ReactCurrentOwner; -},{}],103:[function(require,module,exports){ +},{}],112:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -13085,6 +13428,7 @@ module.exports = ReactCurrentOwner; var ReactDOMComponentTree = require('./ReactDOMComponentTree'); var ReactDefaultInjection = require('./ReactDefaultInjection'); var ReactMount = require('./ReactMount'); +var ReactPerf = require('./ReactPerf'); var ReactReconciler = require('./ReactReconciler'); var ReactUpdates = require('./ReactUpdates'); var ReactVersion = require('./ReactVersion'); @@ -13096,9 +13440,11 @@ var warning = require('fbjs/lib/warning'); ReactDefaultInjection.inject(); +var render = ReactPerf.measure('React', 'render', ReactMount.render); + var React = { findDOMNode: findDOMNode, - render: ReactMount.render, + render: render, unmountComponentAtNode: ReactMount.unmountComponentAtNode, version: ReactVersion, @@ -13170,7 +13516,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = React; }).call(this,require('_process')) -},{"./ReactDOMComponentTree":107,"./ReactDefaultInjection":125,"./ReactMount":139,"./ReactReconciler":151,"./ReactUpdates":155,"./ReactVersion":156,"./findDOMNode":181,"./getNativeComponentFromComposite":189,"./renderSubtreeIntoContainer":198,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/warning":229}],104:[function(require,module,exports){ +},{"./ReactDOMComponentTree":116,"./ReactDefaultInjection":134,"./ReactMount":150,"./ReactPerf":157,"./ReactReconciler":162,"./ReactUpdates":165,"./ReactVersion":166,"./findDOMNode":191,"./getNativeComponentFromComposite":199,"./renderSubtreeIntoContainer":208,"_process":33,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/warning":239}],113:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -13195,7 +13541,7 @@ var ReactDOMButton = { }; module.exports = ReactDOMButton; -},{"./DisabledInputUtils":80}],105:[function(require,module,exports){ +},{"./DisabledInputUtils":90}],114:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -13232,11 +13578,9 @@ var ReactDOMInput = require('./ReactDOMInput'); var ReactDOMOption = require('./ReactDOMOption'); var ReactDOMSelect = require('./ReactDOMSelect'); var ReactDOMTextarea = require('./ReactDOMTextarea'); -var ReactInstrumentation = require('./ReactInstrumentation'); var ReactMultiChild = require('./ReactMultiChild'); -var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction'); +var ReactPerf = require('./ReactPerf'); -var emptyFunction = require('fbjs/lib/emptyFunction'); var escapeTextContentForBrowser = require('./escapeTextContentForBrowser'); var invariant = require('fbjs/lib/invariant'); var isEventSupported = require('./isEventSupported'); @@ -13355,9 +13699,6 @@ function assertValidProps(component, props) { } function enqueuePutListener(inst, registrationName, listener, transaction) { - if (transaction instanceof ReactServerRenderingTransaction) { - return; - } if (process.env.NODE_ENV !== 'production') { // IE8 has no API for event capturing and the `onScroll` event doesn't // bubble. @@ -13366,6 +13707,10 @@ function enqueuePutListener(inst, registrationName, listener, transaction) { var containerInfo = inst._nativeContainerInfo; var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; + if (!doc) { + // Server rendering. + return; + } listenTo(registrationName, doc); transaction.getReactMountReady().enqueue(putListener, { inst: inst, @@ -13384,19 +13729,6 @@ function optionPostMount() { ReactDOMOption.postMountWrapper(inst); } -var setContentChildForInstrumentation = emptyFunction; -if (process.env.NODE_ENV !== 'production') { - setContentChildForInstrumentation = function (contentToUse) { - var debugID = this._debugID; - var contentDebugID = debugID + '#text'; - this._contentDebugID = contentDebugID; - ReactInstrumentation.debugTool.onSetDisplayName(contentDebugID, '#text'); - ReactInstrumentation.debugTool.onSetText(contentDebugID, '' + contentToUse); - ReactInstrumentation.debugTool.onMountComponent(contentDebugID); - ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); - }; -} - // There are so many media events, it makes sense to just // maintain a list rather than create a `trapBubbledEvent` for each var mediaEvents = { @@ -13557,7 +13889,6 @@ function ReactDOMComponent(element) { this._flags = 0; if (process.env.NODE_ENV !== 'production') { this._ancestorInfo = null; - this._contentDebugID = null; } } @@ -13673,7 +14004,7 @@ ReactDOMComponent.Mixin = { div.innerHTML = '<' + type + '>'; el = div.removeChild(div.firstChild); } else { - el = ownerDocument.createElement(this._currentElement.type, props.is || null); + el = ownerDocument.createElement(this._currentElement.type); } } else { el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type); @@ -13803,9 +14134,6 @@ ReactDOMComponent.Mixin = { if (contentToUse != null) { // TODO: Validate that text is allowed as a child of this node ret = escapeTextContentForBrowser(contentToUse); - if (process.env.NODE_ENV !== 'production') { - setContentChildForInstrumentation.call(this, contentToUse); - } } else if (childrenToUse != null) { var mountImages = this.mountChildren(childrenToUse, transaction, context); ret = mountImages.join(''); @@ -13840,9 +14168,6 @@ ReactDOMComponent.Mixin = { var childrenToUse = contentToUse != null ? null : props.children; if (contentToUse != null) { // TODO: Validate that text is allowed as a child of this node - if (process.env.NODE_ENV !== 'production') { - setContentChildForInstrumentation.call(this, contentToUse); - } DOMLazyTree.queueText(lazyTree, contentToUse); } else if (childrenToUse != null) { var mountImages = this.mountChildren(childrenToUse, transaction, context); @@ -14051,34 +14376,17 @@ ReactDOMComponent.Mixin = { this.updateChildren(null, transaction, context); } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { this.updateTextContent(''); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); - } } if (nextContent != null) { if (lastContent !== nextContent) { this.updateTextContent('' + nextContent); - if (process.env.NODE_ENV !== 'production') { - this._contentDebugID = this._debugID + '#text'; - setContentChildForInstrumentation.call(this, nextContent); - } } } else if (nextHtml != null) { if (lastHtml !== nextHtml) { this.updateMarkup('' + nextHtml); } - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); - } } else if (nextChildren != null) { - if (process.env.NODE_ENV !== 'production') { - if (this._contentDebugID) { - ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); - this._contentDebugID = null; - } - } - this.updateChildren(nextChildren, transaction, context); } }, @@ -14128,13 +14436,6 @@ ReactDOMComponent.Mixin = { this._rootNodeID = null; this._domID = null; this._wrapperState = null; - - if (process.env.NODE_ENV !== 'production') { - if (this._contentDebugID) { - ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); - this._contentDebugID = null; - } - } }, getPublicInstance: function () { @@ -14143,12 +14444,17 @@ ReactDOMComponent.Mixin = { }; +ReactPerf.measureMethods(ReactDOMComponent.Mixin, 'ReactDOMComponent', { + mountComponent: 'mountComponent', + receiveComponent: 'receiveComponent' +}); + _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); module.exports = ReactDOMComponent; }).call(this,require('_process')) -},{"./AutoFocusUtils":67,"./CSSPropertyOperations":70,"./DOMLazyTree":74,"./DOMNamespaces":75,"./DOMProperty":76,"./DOMPropertyOperations":77,"./EventConstants":82,"./EventPluginHub":83,"./EventPluginRegistry":84,"./ReactBrowserEventEmitter":93,"./ReactComponentBrowserEnvironment":98,"./ReactDOMButton":104,"./ReactDOMComponentFlags":106,"./ReactDOMComponentTree":107,"./ReactDOMInput":114,"./ReactDOMOption":116,"./ReactDOMSelect":117,"./ReactDOMTextarea":120,"./ReactInstrumentation":136,"./ReactMultiChild":140,"./ReactServerRenderingTransaction":153,"./escapeTextContentForBrowser":180,"./isEventSupported":194,"./validateDOMNesting":203,"_process":29,"fbjs/lib/emptyFunction":211,"fbjs/lib/invariant":219,"fbjs/lib/keyOf":223,"fbjs/lib/shallowEqual":228,"fbjs/lib/warning":229,"object-assign":28}],106:[function(require,module,exports){ +},{"./AutoFocusUtils":77,"./CSSPropertyOperations":80,"./DOMLazyTree":84,"./DOMNamespaces":85,"./DOMProperty":86,"./DOMPropertyOperations":87,"./EventConstants":92,"./EventPluginHub":93,"./EventPluginRegistry":94,"./ReactBrowserEventEmitter":103,"./ReactComponentBrowserEnvironment":108,"./ReactDOMButton":113,"./ReactDOMComponentFlags":115,"./ReactDOMComponentTree":116,"./ReactDOMInput":123,"./ReactDOMOption":125,"./ReactDOMSelect":126,"./ReactDOMTextarea":129,"./ReactMultiChild":151,"./ReactPerf":157,"./escapeTextContentForBrowser":190,"./isEventSupported":204,"./validateDOMNesting":213,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/keyOf":233,"fbjs/lib/shallowEqual":238,"fbjs/lib/warning":239,"object-assign":32}],115:[function(require,module,exports){ /** * Copyright 2015-present, Facebook, Inc. * All rights reserved. @@ -14167,7 +14473,7 @@ var ReactDOMComponentFlags = { }; module.exports = ReactDOMComponentFlags; -},{}],107:[function(require,module,exports){ +},{}],116:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -14357,7 +14663,7 @@ var ReactDOMComponentTree = { module.exports = ReactDOMComponentTree; }).call(this,require('_process')) -},{"./DOMProperty":76,"./ReactDOMComponentFlags":106,"_process":29,"fbjs/lib/invariant":219}],108:[function(require,module,exports){ +},{"./DOMProperty":86,"./ReactDOMComponentFlags":115,"_process":33,"fbjs/lib/invariant":229}],117:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -14394,7 +14700,7 @@ function ReactDOMContainerInfo(topLevelWrapper, node) { module.exports = ReactDOMContainerInfo; }).call(this,require('_process')) -},{"./validateDOMNesting":203,"_process":29}],109:[function(require,module,exports){ +},{"./validateDOMNesting":213,"_process":33}],118:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -14459,7 +14765,7 @@ ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool); module.exports = ReactDOMDebugTool; }).call(this,require('_process')) -},{"./ReactDOMUnknownPropertyDevtool":122,"_process":29,"fbjs/lib/warning":229}],110:[function(require,module,exports){ +},{"./ReactDOMUnknownPropertyDevtool":131,"_process":33,"fbjs/lib/warning":239}],119:[function(require,module,exports){ /** * Copyright 2014-present, Facebook, Inc. * All rights reserved. @@ -14520,7 +14826,7 @@ _assign(ReactDOMEmptyComponent.prototype, { }); module.exports = ReactDOMEmptyComponent; -},{"./DOMLazyTree":74,"./ReactDOMComponentTree":107,"object-assign":28}],111:[function(require,module,exports){ +},{"./DOMLazyTree":84,"./ReactDOMComponentTree":116,"object-assign":32}],120:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -14700,7 +15006,7 @@ var ReactDOMFactories = mapObject({ module.exports = ReactDOMFactories; }).call(this,require('_process')) -},{"./ReactElement":126,"./ReactElementValidator":127,"_process":29,"fbjs/lib/mapObject":224}],112:[function(require,module,exports){ +},{"./ReactElement":137,"./ReactElementValidator":138,"_process":33,"fbjs/lib/mapObject":234}],121:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -14719,7 +15025,7 @@ var ReactDOMFeatureFlags = { }; module.exports = ReactDOMFeatureFlags; -},{}],113:[function(require,module,exports){ +},{}],122:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -14735,6 +15041,7 @@ module.exports = ReactDOMFeatureFlags; var DOMChildrenOperations = require('./DOMChildrenOperations'); var ReactDOMComponentTree = require('./ReactDOMComponentTree'); +var ReactPerf = require('./ReactPerf'); /** * Operations used to process updates to DOM nodes. @@ -14753,8 +15060,12 @@ var ReactDOMIDOperations = { } }; +ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { + dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates' +}); + module.exports = ReactDOMIDOperations; -},{"./DOMChildrenOperations":73,"./ReactDOMComponentTree":107}],114:[function(require,module,exports){ +},{"./DOMChildrenOperations":83,"./ReactDOMComponentTree":116,"./ReactPerf":157}],123:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -14843,8 +15154,6 @@ var ReactDOMInput = { if (process.env.NODE_ENV !== 'production') { LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); - var owner = inst._currentElement._owner; - if (props.valueLink !== undefined && !didWarnValueLink) { process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; didWarnValueLink = true; @@ -14854,11 +15163,11 @@ var ReactDOMInput = { didWarnCheckedLink = true; } if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { - process.env.NODE_ENV !== 'production' ? warning(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', owner && owner.getName() || 'A component', props.type) : void 0; + process.env.NODE_ENV !== 'production' ? warning(false, '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') : void 0; didWarnCheckedDefaultChecked = true; } if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { - process.env.NODE_ENV !== 'production' ? warning(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', owner && owner.getName() || 'A component', props.type) : void 0; + process.env.NODE_ENV !== 'production' ? warning(false, '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') : void 0; didWarnValueDefaultValue = true; } warnIfValueIsNull(props); @@ -14889,7 +15198,7 @@ var ReactDOMInput = { var owner = inst._currentElement._owner; if ((initialValue || !inst._wrapperState.controlled) && controlled && !didWarnUncontrolledToControlled) { - process.env.NODE_ENV !== 'production' ? warning(false, '%s 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', owner && owner.getName() || 'A component', props.type) : void 0; + process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a 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', owner && owner.getName() || 'A component', props.type) : void 0; didWarnUncontrolledToControlled = true; } if (inst._wrapperState.controlled && (defaultValue || !controlled) && !didWarnControlledToUncontrolled) { @@ -14964,7 +15273,7 @@ function _handleChange(event) { module.exports = ReactDOMInput; }).call(this,require('_process')) -},{"./DOMPropertyOperations":77,"./DisabledInputUtils":80,"./LinkedValueUtils":90,"./ReactDOMComponentTree":107,"./ReactUpdates":155,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],115:[function(require,module,exports){ +},{"./DOMPropertyOperations":87,"./DisabledInputUtils":90,"./LinkedValueUtils":100,"./ReactDOMComponentTree":116,"./ReactUpdates":165,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239,"object-assign":32}],124:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -14981,7 +15290,7 @@ module.exports = ReactDOMInput; var ReactDOMDebugTool = require('./ReactDOMDebugTool'); module.exports = { debugTool: ReactDOMDebugTool }; -},{"./ReactDOMDebugTool":109}],116:[function(require,module,exports){ +},{"./ReactDOMDebugTool":118}],125:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -15094,7 +15403,7 @@ var ReactDOMOption = { module.exports = ReactDOMOption; }).call(this,require('_process')) -},{"./ReactChildren":95,"./ReactDOMComponentTree":107,"./ReactDOMSelect":117,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],117:[function(require,module,exports){ +},{"./ReactChildren":105,"./ReactDOMComponentTree":116,"./ReactDOMSelect":126,"_process":33,"fbjs/lib/warning":239,"object-assign":32}],126:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -15311,7 +15620,7 @@ function _handleChange(event) { module.exports = ReactDOMSelect; }).call(this,require('_process')) -},{"./DisabledInputUtils":80,"./LinkedValueUtils":90,"./ReactDOMComponentTree":107,"./ReactUpdates":155,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],118:[function(require,module,exports){ +},{"./DisabledInputUtils":90,"./LinkedValueUtils":100,"./ReactDOMComponentTree":116,"./ReactUpdates":165,"_process":33,"fbjs/lib/warning":239,"object-assign":32}],127:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -15524,7 +15833,7 @@ var ReactDOMSelection = { }; module.exports = ReactDOMSelection; -},{"./getNodeForCharacterOffset":190,"./getTextContentAccessor":191,"fbjs/lib/ExecutionEnvironment":205}],119:[function(require,module,exports){ +},{"./getNodeForCharacterOffset":200,"./getTextContentAccessor":201,"fbjs/lib/ExecutionEnvironment":215}],128:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -15544,7 +15853,7 @@ var _assign = require('object-assign'); var DOMChildrenOperations = require('./DOMChildrenOperations'); var DOMLazyTree = require('./DOMLazyTree'); var ReactDOMComponentTree = require('./ReactDOMComponentTree'); -var ReactInstrumentation = require('./ReactInstrumentation'); +var ReactPerf = require('./ReactPerf'); var escapeTextContentForBrowser = require('./escapeTextContentForBrowser'); var invariant = require('fbjs/lib/invariant'); @@ -15592,8 +15901,6 @@ _assign(ReactDOMTextComponent.prototype, { */ mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) { if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText); - var parentInfo; if (nativeParent != null) { parentInfo = nativeParent._ancestorInfo; @@ -15657,10 +15964,6 @@ _assign(ReactDOMTextComponent.prototype, { this._stringText = nextStringText; var commentNodes = this.getNativeNode(); DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText); - - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onSetText(this._debugID, nextStringText); - } } } }, @@ -15695,10 +15998,15 @@ _assign(ReactDOMTextComponent.prototype, { }); +ReactPerf.measureMethods(ReactDOMTextComponent.prototype, 'ReactDOMTextComponent', { + mountComponent: 'mountComponent', + receiveComponent: 'receiveComponent' +}); + module.exports = ReactDOMTextComponent; }).call(this,require('_process')) -},{"./DOMChildrenOperations":73,"./DOMLazyTree":74,"./ReactDOMComponentTree":107,"./ReactInstrumentation":136,"./escapeTextContentForBrowser":180,"./validateDOMNesting":203,"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],120:[function(require,module,exports){ +},{"./DOMChildrenOperations":83,"./DOMLazyTree":84,"./ReactDOMComponentTree":116,"./ReactPerf":157,"./escapeTextContentForBrowser":190,"./validateDOMNesting":213,"_process":33,"fbjs/lib/invariant":229,"object-assign":32}],129:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -15844,7 +16152,7 @@ function _handleChange(event) { module.exports = ReactDOMTextarea; }).call(this,require('_process')) -},{"./DOMPropertyOperations":77,"./DisabledInputUtils":80,"./LinkedValueUtils":90,"./ReactDOMComponentTree":107,"./ReactUpdates":155,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],121:[function(require,module,exports){ +},{"./DOMPropertyOperations":87,"./DisabledInputUtils":90,"./LinkedValueUtils":100,"./ReactDOMComponentTree":116,"./ReactUpdates":165,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239,"object-assign":32}],130:[function(require,module,exports){ (function (process){ /** * Copyright 2015-present, Facebook, Inc. @@ -15982,7 +16290,7 @@ module.exports = { }; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],122:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],131:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -16050,7 +16358,7 @@ var ReactDOMUnknownPropertyDevtool = { module.exports = ReactDOMUnknownPropertyDevtool; }).call(this,require('_process')) -},{"./DOMProperty":76,"./EventPluginRegistry":84,"_process":29,"fbjs/lib/warning":229}],123:[function(require,module,exports){ +},{"./DOMProperty":86,"./EventPluginRegistry":94,"_process":33,"fbjs/lib/warning":239}],132:[function(require,module,exports){ (function (process){ /** * Copyright 2016-present, Facebook, Inc. @@ -16065,9 +16373,7 @@ module.exports = ReactDOMUnknownPropertyDevtool; 'use strict'; -var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment'); - -var performanceNow = require('fbjs/lib/performanceNow'); +var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool'); var warning = require('fbjs/lib/warning'); var eventHandlers = []; @@ -16088,70 +16394,6 @@ function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) { } } -var isProfiling = false; -var flushHistory = []; -var currentFlushNesting = 0; -var currentFlushMeasurements = null; -var currentFlushStartTime = null; -var currentTimerDebugID = null; -var currentTimerStartTime = null; -var currentTimerType = null; - -function clearHistory() { - ReactComponentTreeDevtool.purgeUnmountedComponents(); - ReactNativeOperationHistoryDevtool.clearHistory(); -} - -function getTreeSnapshot(registeredIDs) { - return registeredIDs.reduce(function (tree, id) { - var ownerID = ReactComponentTreeDevtool.getOwnerID(id); - var parentID = ReactComponentTreeDevtool.getParentID(id); - tree[id] = { - displayName: ReactComponentTreeDevtool.getDisplayName(id), - text: ReactComponentTreeDevtool.getText(id), - updateCount: ReactComponentTreeDevtool.getUpdateCount(id), - childIDs: ReactComponentTreeDevtool.getChildIDs(id), - // Text nodes don't have owners but this is close enough. - ownerID: ownerID || ReactComponentTreeDevtool.getOwnerID(parentID), - parentID: parentID - }; - return tree; - }, {}); -} - -function resetMeasurements() { - if (process.env.NODE_ENV !== 'production') { - var previousStartTime = currentFlushStartTime; - var previousMeasurements = currentFlushMeasurements || []; - var previousOperations = ReactNativeOperationHistoryDevtool.getHistory(); - - if (!isProfiling || currentFlushNesting === 0) { - currentFlushStartTime = null; - currentFlushMeasurements = null; - clearHistory(); - return; - } - - if (previousMeasurements.length || previousOperations.length) { - var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs(); - flushHistory.push({ - duration: performanceNow() - previousStartTime, - measurements: previousMeasurements || [], - operations: previousOperations || [], - treeSnapshot: getTreeSnapshot(registeredIDs) - }); - } - - clearHistory(); - currentFlushStartTime = performanceNow(); - currentFlushMeasurements = []; - } -} - -function checkDebugID(debugID) { - process.env.NODE_ENV !== 'production' ? warning(debugID, 'ReactDebugTool: debugID may not be empty.') : void 0; -} - var ReactDebugTool = { addDevtool: function (devtool) { eventHandlers.push(devtool); @@ -16164,147 +16406,35 @@ var ReactDebugTool = { } } }, - beginProfiling: function () { - if (process.env.NODE_ENV !== 'production') { - if (isProfiling) { - return; - } - - isProfiling = true; - flushHistory.length = 0; - resetMeasurements(); - } - }, - endProfiling: function () { - if (process.env.NODE_ENV !== 'production') { - if (!isProfiling) { - return; - } - - isProfiling = false; - resetMeasurements(); - } - }, - getFlushHistory: function () { - if (process.env.NODE_ENV !== 'production') { - return flushHistory; - } - }, - onBeginFlush: function () { - if (process.env.NODE_ENV !== 'production') { - currentFlushNesting++; - resetMeasurements(); - } - emitEvent('onBeginFlush'); - }, - onEndFlush: function () { - if (process.env.NODE_ENV !== 'production') { - resetMeasurements(); - currentFlushNesting--; - } - emitEvent('onEndFlush'); - }, - onBeginLifeCycleTimer: function (debugID, timerType) { - checkDebugID(debugID); - emitEvent('onBeginLifeCycleTimer', debugID, timerType); - if (process.env.NODE_ENV !== 'production') { - if (isProfiling && currentFlushNesting > 0) { - process.env.NODE_ENV !== 'production' ? warning(!currentTimerType, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; - currentTimerStartTime = performanceNow(); - currentTimerDebugID = debugID; - currentTimerType = timerType; - } - } - }, - onEndLifeCycleTimer: function (debugID, timerType) { - checkDebugID(debugID); - if (process.env.NODE_ENV !== 'production') { - if (isProfiling && currentFlushNesting > 0) { - process.env.NODE_ENV !== 'production' ? warning(currentTimerType === timerType, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; - currentFlushMeasurements.push({ - timerType: timerType, - instanceID: debugID, - duration: performanceNow() - currentTimerStartTime - }); - currentTimerStartTime = null; - currentTimerDebugID = null; - currentTimerType = null; - } - } - emitEvent('onEndLifeCycleTimer', debugID, timerType); - }, - onBeginReconcilerTimer: function (debugID, timerType) { - checkDebugID(debugID); - emitEvent('onBeginReconcilerTimer', debugID, timerType); - }, - onEndReconcilerTimer: function (debugID, timerType) { - checkDebugID(debugID); - emitEvent('onEndReconcilerTimer', debugID, timerType); - }, onBeginProcessingChildContext: function () { emitEvent('onBeginProcessingChildContext'); }, onEndProcessingChildContext: function () { emitEvent('onEndProcessingChildContext'); }, - onNativeOperation: function (debugID, type, payload) { - checkDebugID(debugID); - emitEvent('onNativeOperation', debugID, type, payload); - }, onSetState: function () { emitEvent('onSetState'); }, - onSetDisplayName: function (debugID, displayName) { - checkDebugID(debugID); - emitEvent('onSetDisplayName', debugID, displayName); + onMountRootComponent: function (internalInstance) { + emitEvent('onMountRootComponent', internalInstance); }, - onSetChildren: function (debugID, childDebugIDs) { - checkDebugID(debugID); - emitEvent('onSetChildren', debugID, childDebugIDs); + onMountComponent: function (internalInstance) { + emitEvent('onMountComponent', internalInstance); }, - onSetOwner: function (debugID, ownerDebugID) { - checkDebugID(debugID); - emitEvent('onSetOwner', debugID, ownerDebugID); + onUpdateComponent: function (internalInstance) { + emitEvent('onUpdateComponent', internalInstance); }, - onSetText: function (debugID, text) { - checkDebugID(debugID); - emitEvent('onSetText', debugID, text); - }, - onMountRootComponent: function (debugID) { - checkDebugID(debugID); - emitEvent('onMountRootComponent', debugID); - }, - onMountComponent: function (debugID) { - checkDebugID(debugID); - emitEvent('onMountComponent', debugID); - }, - onUpdateComponent: function (debugID) { - checkDebugID(debugID); - emitEvent('onUpdateComponent', debugID); - }, - onUnmountComponent: function (debugID) { - checkDebugID(debugID); - emitEvent('onUnmountComponent', debugID); + onUnmountComponent: function (internalInstance) { + emitEvent('onUnmountComponent', internalInstance); } }; -if (process.env.NODE_ENV !== 'production') { - var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool'); - var ReactNativeOperationHistoryDevtool = require('./ReactNativeOperationHistoryDevtool'); - var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool'); - ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool); - ReactDebugTool.addDevtool(ReactComponentTreeDevtool); - ReactDebugTool.addDevtool(ReactNativeOperationHistoryDevtool); - var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; - if (/[?&]react_perf\b/.test(url)) { - ReactDebugTool.beginProfiling(); - } -} +ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool); module.exports = ReactDebugTool; }).call(this,require('_process')) -},{"./ReactComponentTreeDevtool":100,"./ReactInvalidSetStateWarningDevTool":137,"./ReactNativeOperationHistoryDevtool":143,"_process":29,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/performanceNow":227,"fbjs/lib/warning":229}],124:[function(require,module,exports){ +},{"./ReactInvalidSetStateWarningDevTool":148,"_process":33,"fbjs/lib/warning":239}],133:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -16373,7 +16503,8 @@ var ReactDefaultBatchingStrategy = { }; module.exports = ReactDefaultBatchingStrategy; -},{"./ReactUpdates":155,"./Transaction":173,"fbjs/lib/emptyFunction":211,"object-assign":28}],125:[function(require,module,exports){ +},{"./ReactUpdates":165,"./Transaction":183,"fbjs/lib/emptyFunction":221,"object-assign":32}],134:[function(require,module,exports){ +(function (process){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -16391,6 +16522,7 @@ var BeforeInputEventPlugin = require('./BeforeInputEventPlugin'); var ChangeEventPlugin = require('./ChangeEventPlugin'); var DefaultEventPluginOrder = require('./DefaultEventPluginOrder'); var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin'); +var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment'); var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig'); var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment'); var ReactDOMComponent = require('./ReactDOMComponent'); @@ -16453,12 +16585,553 @@ function inject() { ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); + + if (process.env.NODE_ENV !== 'production') { + var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; + if (/[?&]react_perf\b/.test(url)) { + var ReactDefaultPerf = require('./ReactDefaultPerf'); + ReactDefaultPerf.start(); + } + } } module.exports = { inject: inject }; -},{"./BeforeInputEventPlugin":68,"./ChangeEventPlugin":72,"./DefaultEventPluginOrder":79,"./EnterLeaveEventPlugin":81,"./HTMLDOMPropertyConfig":88,"./ReactComponentBrowserEnvironment":98,"./ReactDOMComponent":105,"./ReactDOMComponentTree":107,"./ReactDOMEmptyComponent":110,"./ReactDOMTextComponent":119,"./ReactDOMTreeTraversal":121,"./ReactDefaultBatchingStrategy":124,"./ReactEventListener":131,"./ReactInjection":133,"./ReactReconcileTransaction":150,"./SVGDOMPropertyConfig":157,"./SelectEventPlugin":158,"./SimpleEventPlugin":159}],126:[function(require,module,exports){ +}).call(this,require('_process')) + +},{"./BeforeInputEventPlugin":78,"./ChangeEventPlugin":82,"./DefaultEventPluginOrder":89,"./EnterLeaveEventPlugin":91,"./HTMLDOMPropertyConfig":98,"./ReactComponentBrowserEnvironment":108,"./ReactDOMComponent":114,"./ReactDOMComponentTree":116,"./ReactDOMEmptyComponent":119,"./ReactDOMTextComponent":128,"./ReactDOMTreeTraversal":130,"./ReactDefaultBatchingStrategy":133,"./ReactDefaultPerf":135,"./ReactEventListener":142,"./ReactInjection":144,"./ReactReconcileTransaction":161,"./SVGDOMPropertyConfig":167,"./SelectEventPlugin":168,"./SimpleEventPlugin":169,"_process":33,"fbjs/lib/ExecutionEnvironment":215}],135:[function(require,module,exports){ +(function (process){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDefaultPerf + */ + +'use strict'; + +var DOMProperty = require('./DOMProperty'); +var ReactDOMComponentTree = require('./ReactDOMComponentTree'); +var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis'); +var ReactMount = require('./ReactMount'); +var ReactPerf = require('./ReactPerf'); + +var performanceNow = require('fbjs/lib/performanceNow'); +var warning = require('fbjs/lib/warning'); + +function roundFloat(val) { + return Math.floor(val * 100) / 100; +} + +function addValue(obj, key, val) { + obj[key] = (obj[key] || 0) + val; +} + +// Composite/text components don't have any built-in ID: we have to make our own +var compositeIDMap; +var compositeIDCounter = 17000; +function getIDOfComposite(inst) { + if (!compositeIDMap) { + compositeIDMap = new WeakMap(); + } + if (compositeIDMap.has(inst)) { + return compositeIDMap.get(inst); + } else { + var id = compositeIDCounter++; + compositeIDMap.set(inst, id); + return id; + } +} + +function getID(inst) { + if (inst.hasOwnProperty('_rootNodeID')) { + return inst._rootNodeID; + } else { + return getIDOfComposite(inst); + } +} + +function stripComplexValues(key, value) { + if (typeof value !== 'object' || Array.isArray(value) || value == null) { + return value; + } + var prototype = Object.getPrototypeOf(value); + if (!prototype || prototype === Object.prototype) { + return value; + } + return ''; +} + +// This implementation of ReactPerf is going away some time mid 15.x. +// While we plan to keep most of the API, the actual format of measurements +// will change dramatically. To signal this, we wrap them into an opaque-ish +// object to discourage reaching into it until the API stabilizes. +function wrapLegacyMeasurements(measurements) { + return { __unstable_this_format_will_change: measurements }; +} +function unwrapLegacyMeasurements(measurements) { + return measurements && measurements.__unstable_this_format_will_change || measurements; +} + +var warnedAboutPrintDOM = false; +var warnedAboutGetMeasurementsSummaryMap = false; + +var ReactDefaultPerf = { + _allMeasurements: [], // last item in the list is the current one + _mountStack: [0], + _compositeStack: [], + _injected: false, + + start: function () { + if (!ReactDefaultPerf._injected) { + ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure); + } + + ReactDefaultPerf._allMeasurements.length = 0; + ReactPerf.enableMeasure = true; + }, + + stop: function () { + ReactPerf.enableMeasure = false; + }, + + getLastMeasurements: function () { + return wrapLegacyMeasurements(ReactDefaultPerf._allMeasurements); + }, + + printExclusive: function (measurements) { + measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements); + var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements); + console.table(summary.map(function (item) { + return { + 'Component class name': item.componentName, + 'Total inclusive time (ms)': roundFloat(item.inclusive), + 'Exclusive mount time (ms)': roundFloat(item.exclusive), + 'Exclusive render time (ms)': roundFloat(item.render), + 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count), + 'Render time per instance (ms)': roundFloat(item.render / item.count), + 'Instances': item.count + }; + })); + // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct + // number. + }, + + printInclusive: function (measurements) { + measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements); + var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements); + console.table(summary.map(function (item) { + return { + 'Owner > component': item.componentName, + 'Inclusive time (ms)': roundFloat(item.time), + 'Instances': item.count + }; + })); + console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); + }, + + getMeasurementsSummaryMap: function (measurements) { + process.env.NODE_ENV !== 'production' ? warning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.') : void 0; + warnedAboutGetMeasurementsSummaryMap = true; + return ReactDefaultPerf.getWasted(measurements); + }, + + getWasted: function (measurements) { + measurements = unwrapLegacyMeasurements(measurements); + var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true); + return summary.map(function (item) { + return { + 'Owner > component': item.componentName, + 'Wasted time (ms)': item.time, + 'Instances': item.count + }; + }); + }, + + printWasted: function (measurements) { + measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements); + console.table(ReactDefaultPerf.getWasted(measurements)); + console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); + }, + + printDOM: function (measurements) { + process.env.NODE_ENV !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0; + warnedAboutPrintDOM = true; + return ReactDefaultPerf.printOperations(measurements); + }, + + printOperations: function (measurements) { + measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements); + var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements); + console.table(summary.map(function (item) { + var result = {}; + result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id; + result.type = item.type; + result.args = JSON.stringify(item.args, stripComplexValues); + return result; + })); + console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); + }, + + _recordWrite: function (id, fnName, totalTime, args) { + // TODO: totalTime isn't that useful since it doesn't count paints/reflows + var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]; + var writes = entry.writes; + writes[id] = writes[id] || []; + writes[id].push({ + type: fnName, + time: totalTime, + args: args + }); + }, + + measure: function (moduleName, fnName, func) { + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var totalTime; + var rv; + var start; + + var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]; + + if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') { + // A "measurement" is a set of metrics recorded for each flush. We want + // to group the metrics for a given flush together so we can look at the + // components that rendered and the DOM operations that actually + // happened to determine the amount of "wasted work" performed. + ReactDefaultPerf._allMeasurements.push(entry = { + exclusive: {}, + inclusive: {}, + render: {}, + counts: {}, + writes: {}, + displayNames: {}, + hierarchy: {}, + totalTime: 0, + created: {} + }); + start = performanceNow(); + rv = func.apply(this, args); + entry.totalTime = performanceNow() - start; + return rv; + } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations' || moduleName === 'ReactComponentBrowserEnvironment') { + start = performanceNow(); + rv = func.apply(this, args); + totalTime = performanceNow() - start; + + if (fnName === '_mountImageIntoNode') { + ReactDefaultPerf._recordWrite('', fnName, totalTime, args[0]); + } else if (fnName === 'dangerouslyProcessChildrenUpdates') { + // special format + args[1].forEach(function (update) { + var writeArgs = {}; + if (update.fromIndex !== null) { + writeArgs.fromIndex = update.fromIndex; + } + if (update.toIndex !== null) { + writeArgs.toIndex = update.toIndex; + } + if (update.content !== null) { + writeArgs.content = update.content; + } + ReactDefaultPerf._recordWrite(args[0]._rootNodeID, update.type, totalTime, writeArgs); + }); + } else { + // basic format + var id = args[0]; + if (moduleName === 'EventPluginHub') { + id = id._rootNodeID; + } else if (fnName === 'replaceNodeWithMarkup') { + // Old node is already unmounted; can't get its instance + id = ReactDOMComponentTree.getInstanceFromNode(args[1].node)._rootNodeID; + } else if (fnName === 'replaceDelimitedText') { + id = getID(ReactDOMComponentTree.getInstanceFromNode(args[0])); + } else if (typeof id === 'object') { + id = getID(ReactDOMComponentTree.getInstanceFromNode(args[0])); + } + ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1)); + } + return rv; + } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()? + fnName === '_renderValidatedComponent')) { + + if (this._currentElement.type === ReactMount.TopLevelWrapper) { + return func.apply(this, args); + } + + var rootNodeID = getIDOfComposite(this); + var isRender = fnName === '_renderValidatedComponent'; + var isMount = fnName === 'mountComponent'; + + var mountStack = ReactDefaultPerf._mountStack; + + if (isRender) { + addValue(entry.counts, rootNodeID, 1); + } else if (isMount) { + entry.created[rootNodeID] = true; + mountStack.push(0); + } + + ReactDefaultPerf._compositeStack.push(rootNodeID); + + start = performanceNow(); + rv = func.apply(this, args); + totalTime = performanceNow() - start; + + ReactDefaultPerf._compositeStack.pop(); + + if (isRender) { + addValue(entry.render, rootNodeID, totalTime); + } else if (isMount) { + var subMountTime = mountStack.pop(); + mountStack[mountStack.length - 1] += totalTime; + addValue(entry.exclusive, rootNodeID, totalTime - subMountTime); + addValue(entry.inclusive, rootNodeID, totalTime); + } else { + addValue(entry.inclusive, rootNodeID, totalTime); + } + + entry.displayNames[rootNodeID] = { + current: this.getName(), + owner: this._currentElement._owner ? this._currentElement._owner.getName() : '' + }; + + return rv; + } else if ((moduleName === 'ReactDOMComponent' || moduleName === 'ReactDOMTextComponent') && (fnName === 'mountComponent' || fnName === 'receiveComponent')) { + + rv = func.apply(this, args); + entry.hierarchy[getID(this)] = ReactDefaultPerf._compositeStack.slice(); + return rv; + } else { + return func.apply(this, args); + } + }; + } +}; + +module.exports = ReactDefaultPerf; +}).call(this,require('_process')) + +},{"./DOMProperty":86,"./ReactDOMComponentTree":116,"./ReactDefaultPerfAnalysis":136,"./ReactMount":150,"./ReactPerf":157,"_process":33,"fbjs/lib/performanceNow":237,"fbjs/lib/warning":239}],136:[function(require,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDefaultPerfAnalysis + */ + +'use strict'; + +// Don't try to save users less than 1.2ms (a number I made up) + +var _assign = require('object-assign'); + +var DONT_CARE_THRESHOLD = 1.2; +var DOM_OPERATION_TYPES = { + '_mountImageIntoNode': 'set innerHTML', + INSERT_MARKUP: 'set innerHTML', + MOVE_EXISTING: 'move', + REMOVE_NODE: 'remove', + SET_MARKUP: 'set innerHTML', + TEXT_CONTENT: 'set textContent', + 'setValueForProperty': 'update attribute', + 'setValueForAttribute': 'update attribute', + 'deleteValueForProperty': 'remove attribute', + 'setValueForStyles': 'update styles', + 'replaceNodeWithMarkup': 'replace', + 'replaceDelimitedText': 'replace' +}; + +function getTotalTime(measurements) { + // TODO: return number of DOM ops? could be misleading. + // TODO: measure dropped frames after reconcile? + // TODO: log total time of each reconcile and the top-level component + // class that triggered it. + var totalTime = 0; + for (var i = 0; i < measurements.length; i++) { + var measurement = measurements[i]; + totalTime += measurement.totalTime; + } + return totalTime; +} + +function getDOMSummary(measurements) { + var items = []; + measurements.forEach(function (measurement) { + Object.keys(measurement.writes).forEach(function (id) { + measurement.writes[id].forEach(function (write) { + items.push({ + id: id, + type: DOM_OPERATION_TYPES[write.type] || write.type, + args: write.args + }); + }); + }); + }); + return items; +} + +function getExclusiveSummary(measurements) { + var candidates = {}; + var displayName; + + for (var i = 0; i < measurements.length; i++) { + var measurement = measurements[i]; + var allIDs = _assign({}, measurement.exclusive, measurement.inclusive); + + for (var id in allIDs) { + displayName = measurement.displayNames[id].current; + + candidates[displayName] = candidates[displayName] || { + componentName: displayName, + inclusive: 0, + exclusive: 0, + render: 0, + count: 0 + }; + if (measurement.render[id]) { + candidates[displayName].render += measurement.render[id]; + } + if (measurement.exclusive[id]) { + candidates[displayName].exclusive += measurement.exclusive[id]; + } + if (measurement.inclusive[id]) { + candidates[displayName].inclusive += measurement.inclusive[id]; + } + if (measurement.counts[id]) { + candidates[displayName].count += measurement.counts[id]; + } + } + } + + // Now make a sorted array with the results. + var arr = []; + for (displayName in candidates) { + if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) { + arr.push(candidates[displayName]); + } + } + + arr.sort(function (a, b) { + return b.exclusive - a.exclusive; + }); + + return arr; +} + +function getInclusiveSummary(measurements, onlyClean) { + var candidates = {}; + var inclusiveKey; + + for (var i = 0; i < measurements.length; i++) { + var measurement = measurements[i]; + var allIDs = _assign({}, measurement.exclusive, measurement.inclusive); + var cleanComponents; + + if (onlyClean) { + cleanComponents = getUnchangedComponents(measurement); + } + + for (var id in allIDs) { + if (onlyClean && !cleanComponents[id]) { + continue; + } + + var displayName = measurement.displayNames[id]; + + // Inclusive time is not useful for many components without knowing where + // they are instantiated. So we aggregate inclusive time with both the + // owner and current displayName as the key. + inclusiveKey = displayName.owner + ' > ' + displayName.current; + + candidates[inclusiveKey] = candidates[inclusiveKey] || { + componentName: inclusiveKey, + time: 0, + count: 0 + }; + + if (measurement.inclusive[id]) { + candidates[inclusiveKey].time += measurement.inclusive[id]; + } + if (measurement.counts[id]) { + candidates[inclusiveKey].count += measurement.counts[id]; + } + } + } + + // Now make a sorted array with the results. + var arr = []; + for (inclusiveKey in candidates) { + if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) { + arr.push(candidates[inclusiveKey]); + } + } + + arr.sort(function (a, b) { + return b.time - a.time; + }); + + return arr; +} + +function getUnchangedComponents(measurement) { + // For a given reconcile, look at which components did not actually + // render anything to the DOM and return a mapping of their ID to + // the amount of time it took to render the entire subtree. + var cleanComponents = {}; + var writes = measurement.writes; + var hierarchy = measurement.hierarchy; + var dirtyComposites = {}; + Object.keys(writes).forEach(function (id) { + writes[id].forEach(function (write) { + // Root mounting (innerHTML set) is recorded with an ID of '' + if (id !== '' && hierarchy.hasOwnProperty(id)) { + hierarchy[id].forEach(function (c) { + return dirtyComposites[c] = true; + }); + } + }); + }); + var allIDs = _assign({}, measurement.exclusive, measurement.inclusive); + + for (var id in allIDs) { + var isDirty = false; + // See if any of the DOM operations applied to this component's subtree. + if (dirtyComposites[id]) { + isDirty = true; + } + // check if component newly created + if (measurement.created[id]) { + isDirty = true; + } + if (!isDirty && measurement.counts[id] > 0) { + cleanComponents[id] = true; + } + } + return cleanComponents; +} + +var ReactDefaultPerfAnalysis = { + getExclusiveSummary: getExclusiveSummary, + getInclusiveSummary: getInclusiveSummary, + getDOMSummary: getDOMSummary, + getTotalTime: getTotalTime +}; + +module.exports = ReactDefaultPerfAnalysis; +},{"object-assign":32}],137:[function(require,module,exports){ (function (process){ /** * Copyright 2014-present, Facebook, Inc. @@ -16575,10 +17248,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) { return element; }; -/** - * Create and return a new ReactElement of the given type. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement - */ ReactElement.createElement = function (type, config, children) { var propName; @@ -16592,11 +17261,6 @@ ReactElement.createElement = function (type, config, children) { if (config != null) { if (process.env.NODE_ENV !== 'production') { - process.env.NODE_ENV !== 'production' ? warning( - /* eslint-disable no-proto */ - config.__proto__ == null || config.__proto__ === Object.prototype, - /* eslint-enable no-proto */ - 'React.createElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0; ref = !config.hasOwnProperty('ref') || Object.getOwnPropertyDescriptor(config, 'ref').get ? null : config.ref; key = !config.hasOwnProperty('key') || Object.getOwnPropertyDescriptor(config, 'key').get ? null : '' + config.key; } else { @@ -16668,10 +17332,6 @@ ReactElement.createElement = function (type, config, children) { return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); }; -/** - * Return a function that produces ReactElements of a given type. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory - */ ReactElement.createFactory = function (type) { var factory = ReactElement.createElement.bind(null, type); // Expose the type on the factory and the prototype so that it can be @@ -16689,10 +17349,6 @@ ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { return newElement; }; -/** - * Clone and return a new ReactElement using element as the starting point. - * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement - */ ReactElement.cloneElement = function (element, config, children) { var propName; @@ -16713,13 +17369,6 @@ ReactElement.cloneElement = function (element, config, children) { var owner = element._owner; if (config != null) { - if (process.env.NODE_ENV !== 'production') { - process.env.NODE_ENV !== 'production' ? warning( - /* eslint-disable no-proto */ - config.__proto__ == null || config.__proto__ === Object.prototype, - /* eslint-enable no-proto */ - 'React.cloneElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0; - } if (config.ref !== undefined) { // Silently steal the ref from the parent. ref = config.ref; @@ -16762,8 +17411,6 @@ ReactElement.cloneElement = function (element, config, children) { }; /** - * Verifies the object is a ReactElement. - * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement * @param {?object} object * @return {boolean} True if `object` is a valid component. * @final @@ -16775,7 +17422,7 @@ ReactElement.isValidElement = function (object) { module.exports = ReactElement; }).call(this,require('_process')) -},{"./ReactCurrentOwner":102,"./canDefineProperty":177,"_process":29,"fbjs/lib/warning":229,"object-assign":28}],127:[function(require,module,exports){ +},{"./ReactCurrentOwner":111,"./canDefineProperty":187,"_process":33,"fbjs/lib/warning":239,"object-assign":32}],138:[function(require,module,exports){ (function (process){ /** * Copyright 2014-present, Facebook, Inc. @@ -17060,7 +17707,7 @@ var ReactElementValidator = { module.exports = ReactElementValidator; }).call(this,require('_process')) -},{"./ReactCurrentOwner":102,"./ReactElement":126,"./ReactPropTypeLocationNames":147,"./ReactPropTypeLocations":148,"./canDefineProperty":177,"./getIteratorFn":188,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],128:[function(require,module,exports){ +},{"./ReactCurrentOwner":111,"./ReactElement":137,"./ReactPropTypeLocationNames":158,"./ReactPropTypeLocations":159,"./canDefineProperty":187,"./getIteratorFn":198,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],139:[function(require,module,exports){ /** * Copyright 2014-present, Facebook, Inc. * All rights reserved. @@ -17091,7 +17738,7 @@ var ReactEmptyComponent = { ReactEmptyComponent.injection = ReactEmptyComponentInjection; module.exports = ReactEmptyComponent; -},{}],129:[function(require,module,exports){ +},{}],140:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -17171,7 +17818,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = ReactErrorUtils; }).call(this,require('_process')) -},{"_process":29}],130:[function(require,module,exports){ +},{"_process":33}],141:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17205,7 +17852,7 @@ var ReactEventEmitterMixin = { }; module.exports = ReactEventEmitterMixin; -},{"./EventPluginHub":83}],131:[function(require,module,exports){ +},{"./EventPluginHub":93}],142:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17363,7 +18010,7 @@ var ReactEventListener = { }; module.exports = ReactEventListener; -},{"./PooledClass":91,"./ReactDOMComponentTree":107,"./ReactUpdates":155,"./getEventTarget":187,"fbjs/lib/EventListener":204,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/getUnboundedScrollPosition":216,"object-assign":28}],132:[function(require,module,exports){ +},{"./PooledClass":101,"./ReactDOMComponentTree":116,"./ReactUpdates":165,"./getEventTarget":197,"fbjs/lib/EventListener":214,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/getUnboundedScrollPosition":226,"object-assign":32}],143:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17385,7 +18032,7 @@ var ReactFeatureFlags = { }; module.exports = ReactFeatureFlags; -},{}],133:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17407,6 +18054,7 @@ var ReactClass = require('./ReactClass'); var ReactEmptyComponent = require('./ReactEmptyComponent'); var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter'); var ReactNativeComponent = require('./ReactNativeComponent'); +var ReactPerf = require('./ReactPerf'); var ReactUpdates = require('./ReactUpdates'); var ReactInjection = { @@ -17418,11 +18066,12 @@ var ReactInjection = { EventPluginUtils: EventPluginUtils.injection, EventEmitter: ReactBrowserEventEmitter.injection, NativeComponent: ReactNativeComponent.injection, + Perf: ReactPerf.injection, Updates: ReactUpdates.injection }; module.exports = ReactInjection; -},{"./DOMProperty":76,"./EventPluginHub":83,"./EventPluginUtils":85,"./ReactBrowserEventEmitter":93,"./ReactClass":96,"./ReactComponentEnvironment":99,"./ReactEmptyComponent":128,"./ReactNativeComponent":142,"./ReactUpdates":155}],134:[function(require,module,exports){ +},{"./DOMProperty":86,"./EventPluginHub":93,"./EventPluginUtils":95,"./ReactBrowserEventEmitter":103,"./ReactClass":106,"./ReactComponentEnvironment":109,"./ReactEmptyComponent":139,"./ReactNativeComponent":153,"./ReactPerf":157,"./ReactUpdates":165}],145:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17547,7 +18196,7 @@ var ReactInputSelection = { }; module.exports = ReactInputSelection; -},{"./ReactDOMSelection":118,"fbjs/lib/containsNode":208,"fbjs/lib/focusNode":213,"fbjs/lib/getActiveElement":214}],135:[function(require,module,exports){ +},{"./ReactDOMSelection":127,"fbjs/lib/containsNode":218,"fbjs/lib/focusNode":223,"fbjs/lib/getActiveElement":224}],146:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17596,7 +18245,7 @@ var ReactInstanceMap = { }; module.exports = ReactInstanceMap; -},{}],136:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ /** * Copyright 2016-present, Facebook, Inc. * All rights reserved. @@ -17613,7 +18262,7 @@ module.exports = ReactInstanceMap; var ReactDebugTool = require('./ReactDebugTool'); module.exports = { debugTool: ReactDebugTool }; -},{"./ReactDebugTool":123}],137:[function(require,module,exports){ +},{"./ReactDebugTool":132}],148:[function(require,module,exports){ (function (process){ /** * Copyright 2016-present, Facebook, Inc. @@ -17653,7 +18302,7 @@ var ReactInvalidSetStateWarningDevTool = { module.exports = ReactInvalidSetStateWarningDevTool; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/warning":229}],138:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/warning":239}],149:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -17704,7 +18353,7 @@ var ReactMarkupChecksum = { }; module.exports = ReactMarkupChecksum; -},{"./adler32":176}],139:[function(require,module,exports){ +},{"./adler32":186}],150:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -17730,6 +18379,7 @@ var ReactElement = require('./ReactElement'); var ReactFeatureFlags = require('./ReactFeatureFlags'); var ReactInstrumentation = require('./ReactInstrumentation'); var ReactMarkupChecksum = require('./ReactMarkupChecksum'); +var ReactPerf = require('./ReactPerf'); var ReactReconciler = require('./ReactReconciler'); var ReactUpdateQueue = require('./ReactUpdateQueue'); var ReactUpdates = require('./ReactUpdates'); @@ -17967,10 +18617,6 @@ var ReactMount = { * @return {ReactComponent} nextComponent */ _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onBeginFlush(); - } - // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. @@ -17981,12 +18627,6 @@ var ReactMount = { ReactBrowserEventEmitter.ensureScrollValueMonitoring(); var componentInstance = instantiateReactComponent(nextElement); - if (process.env.NODE_ENV !== 'production') { - // Mute future events from the top level wrapper. - // It is an implementation detail that devtools should not know about. - componentInstance._debugID = 0; - } - // The initial render is synchronous but any updates that happen during // rendering, in componentWillMount or componentDidMount, will be batched // according to the current batching strategy. @@ -17997,9 +18637,7 @@ var ReactMount = { instancesByReactRootID[wrapperID] = componentInstance; if (process.env.NODE_ENV !== 'production') { - // The instance here is TopLevelWrapper so we report mount for its child. - ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID); - ReactInstrumentation.debugTool.onEndFlush(); + ReactInstrumentation.debugTool.onMountRootComponent(componentInstance); } return componentInstance; @@ -18079,7 +18717,6 @@ var ReactMount = { /** * Renders a React component into the DOM in the supplied `container`. - * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render * * If the React component was previously rendered into `container`, this will * perform an update on it and only mutate the DOM as necessary to reflect the @@ -18096,7 +18733,6 @@ var ReactMount = { /** * Unmounts and destroys the React component rendered in the `container`. - * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode * * @param {DOMElement} container DOM element containing a React component. * @return {boolean} True if a component was found in and unmounted from @@ -18188,20 +18824,18 @@ var ReactMount = { setInnerHTML(container, markup); ReactDOMComponentTree.precacheNode(instance, container.firstChild); } - - if (process.env.NODE_ENV !== 'production') { - var nativeNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); - if (nativeNode._debugID !== 0) { - ReactInstrumentation.debugTool.onNativeOperation(nativeNode._debugID, 'mount', markup.toString()); - } - } } }; +ReactPerf.measureMethods(ReactMount, 'ReactMount', { + _renderNewRootComponent: '_renderNewRootComponent', + _mountImageIntoNode: '_mountImageIntoNode' +}); + module.exports = ReactMount; }).call(this,require('_process')) -},{"./DOMLazyTree":74,"./DOMProperty":76,"./ReactBrowserEventEmitter":93,"./ReactCurrentOwner":102,"./ReactDOMComponentTree":107,"./ReactDOMContainerInfo":108,"./ReactDOMFeatureFlags":112,"./ReactElement":126,"./ReactFeatureFlags":132,"./ReactInstrumentation":136,"./ReactMarkupChecksum":138,"./ReactReconciler":151,"./ReactUpdateQueue":154,"./ReactUpdates":155,"./instantiateReactComponent":193,"./setInnerHTML":199,"./shouldUpdateReactComponent":201,"_process":29,"fbjs/lib/emptyObject":212,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],140:[function(require,module,exports){ +},{"./DOMLazyTree":84,"./DOMProperty":86,"./ReactBrowserEventEmitter":103,"./ReactCurrentOwner":111,"./ReactDOMComponentTree":116,"./ReactDOMContainerInfo":117,"./ReactDOMFeatureFlags":121,"./ReactElement":137,"./ReactFeatureFlags":143,"./ReactInstrumentation":147,"./ReactMarkupChecksum":149,"./ReactPerf":157,"./ReactReconciler":162,"./ReactUpdateQueue":164,"./ReactUpdates":165,"./instantiateReactComponent":203,"./setInnerHTML":209,"./shouldUpdateReactComponent":211,"_process":33,"fbjs/lib/emptyObject":222,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],151:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -18217,14 +18851,12 @@ module.exports = ReactMount; 'use strict'; var ReactComponentEnvironment = require('./ReactComponentEnvironment'); -var ReactInstrumentation = require('./ReactInstrumentation'); var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes'); var ReactCurrentOwner = require('./ReactCurrentOwner'); var ReactReconciler = require('./ReactReconciler'); var ReactChildReconciler = require('./ReactChildReconciler'); -var emptyFunction = require('fbjs/lib/emptyFunction'); var flattenChildren = require('./flattenChildren'); var invariant = require('fbjs/lib/invariant'); @@ -18341,15 +18973,6 @@ function processQueue(inst, updateQueue) { ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue); } -var setChildrenForInstrumentation = emptyFunction; -if (process.env.NODE_ENV !== 'production') { - setChildrenForInstrumentation = function (children) { - ReactInstrumentation.debugTool.onSetChildren(this._debugID, children ? Object.keys(children).map(function (key) { - return children[key]._debugID; - }) : []); - }; -} - /** * ReactMultiChild are capable of reconciling multiple children. * @@ -18411,7 +19034,6 @@ var ReactMultiChild = { mountChildren: function (nestedChildren, transaction, context) { var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); this._renderedChildren = children; - var mountImages = []; var index = 0; for (var name in children) { @@ -18422,11 +19044,6 @@ var ReactMultiChild = { mountImages.push(mountImage); } } - - if (process.env.NODE_ENV !== 'production') { - setChildrenForInstrumentation.call(this, children); - } - return mountImages; }, @@ -18533,10 +19150,6 @@ var ReactMultiChild = { processQueue(this, updates); } this._renderedChildren = nextChildren; - - if (process.env.NODE_ENV !== 'production') { - setChildrenForInstrumentation.call(this, nextChildren); - } }, /** @@ -18628,7 +19241,7 @@ var ReactMultiChild = { module.exports = ReactMultiChild; }).call(this,require('_process')) -},{"./ReactChildReconciler":94,"./ReactComponentEnvironment":99,"./ReactCurrentOwner":102,"./ReactInstrumentation":136,"./ReactMultiChildUpdateTypes":141,"./ReactReconciler":151,"./flattenChildren":182,"_process":29,"fbjs/lib/emptyFunction":211,"fbjs/lib/invariant":219}],141:[function(require,module,exports){ +},{"./ReactChildReconciler":104,"./ReactComponentEnvironment":109,"./ReactCurrentOwner":111,"./ReactMultiChildUpdateTypes":152,"./ReactReconciler":162,"./flattenChildren":192,"_process":33,"fbjs/lib/invariant":229}],152:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -18661,7 +19274,7 @@ var ReactMultiChildUpdateTypes = keyMirror({ }); module.exports = ReactMultiChildUpdateTypes; -},{"fbjs/lib/keyMirror":222}],142:[function(require,module,exports){ +},{"fbjs/lib/keyMirror":232}],153:[function(require,module,exports){ (function (process){ /** * Copyright 2014-present, Facebook, Inc. @@ -18760,45 +19373,7 @@ var ReactNativeComponent = { module.exports = ReactNativeComponent; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],143:[function(require,module,exports){ -/** - * Copyright 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactNativeOperationHistoryDevtool - */ - -'use strict'; - -var history = []; - -var ReactNativeOperationHistoryDevtool = { - onNativeOperation: function (debugID, type, payload) { - history.push({ - instanceID: debugID, - type: type, - payload: payload - }); - }, - clearHistory: function () { - if (ReactNativeOperationHistoryDevtool._preventClearing) { - // Should only be used for tests. - return; - } - - history = []; - }, - getHistory: function () { - return history; - } -}; - -module.exports = ReactNativeOperationHistoryDevtool; -},{}],144:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229,"object-assign":32}],154:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -18839,7 +19414,7 @@ var ReactNodeTypes = { module.exports = ReactNodeTypes; }).call(this,require('_process')) -},{"./ReactElement":126,"_process":29,"fbjs/lib/invariant":219}],145:[function(require,module,exports){ +},{"./ReactElement":137,"_process":33,"fbjs/lib/invariant":229}],155:[function(require,module,exports){ (function (process){ /** * Copyright 2015-present, Facebook, Inc. @@ -18938,7 +19513,7 @@ var ReactNoopUpdateQueue = { module.exports = ReactNoopUpdateQueue; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/warning":229}],146:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/warning":239}],156:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -19034,7 +19609,107 @@ var ReactOwner = { module.exports = ReactOwner; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],147:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],157:[function(require,module,exports){ +(function (process){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactPerf + */ + +'use strict'; + +/** + * ReactPerf is a general AOP system designed to measure performance. This + * module only has the hooks: see ReactDefaultPerf for the analysis tool. + */ + +var ReactPerf = { + /** + * Boolean to enable/disable measurement. Set to false by default to prevent + * accidental logging and perf loss. + */ + enableMeasure: false, + + /** + * Holds onto the measure function in use. By default, don't measure + * anything, but we'll override this if we inject a measure function. + */ + storedMeasure: _noMeasure, + + /** + * @param {object} object + * @param {string} objectName + * @param {object} methodNames + */ + measureMethods: function (object, objectName, methodNames) { + if (process.env.NODE_ENV !== 'production') { + for (var key in methodNames) { + if (!methodNames.hasOwnProperty(key)) { + continue; + } + object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]); + } + } + }, + + /** + * Use this to wrap methods you want to measure. Zero overhead in production. + * + * @param {string} objName + * @param {string} fnName + * @param {function} func + * @return {function} + */ + measure: function (objName, fnName, func) { + if (process.env.NODE_ENV !== 'production') { + var measuredFunc = null; + var wrapper = function () { + if (ReactPerf.enableMeasure) { + if (!measuredFunc) { + measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); + } + return measuredFunc.apply(this, arguments); + } + return func.apply(this, arguments); + }; + wrapper.displayName = objName + '_' + fnName; + return wrapper; + } + return func; + }, + + injection: { + /** + * @param {function} measure + */ + injectMeasure: function (measure) { + ReactPerf.storedMeasure = measure; + } + } +}; + +/** + * Simply passes through the measured function, without measuring it. + * + * @param {string} objName + * @param {string} fnName + * @param {function} func + * @return {function} + */ +function _noMeasure(objName, fnName, func) { + return func; +} + +module.exports = ReactPerf; +}).call(this,require('_process')) + +},{"_process":33}],158:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -19062,7 +19737,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = ReactPropTypeLocationNames; }).call(this,require('_process')) -},{"_process":29}],148:[function(require,module,exports){ +},{"_process":33}],159:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -19085,7 +19760,7 @@ var ReactPropTypeLocations = keyMirror({ }); module.exports = ReactPropTypeLocations; -},{"fbjs/lib/keyMirror":222}],149:[function(require,module,exports){ +},{"fbjs/lib/keyMirror":232}],160:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -19466,7 +20141,7 @@ function getClassName(propValue) { } module.exports = ReactPropTypes; -},{"./ReactElement":126,"./ReactPropTypeLocationNames":147,"./getIteratorFn":188,"fbjs/lib/emptyFunction":211}],150:[function(require,module,exports){ +},{"./ReactElement":137,"./ReactPropTypeLocationNames":158,"./getIteratorFn":198,"fbjs/lib/emptyFunction":221}],161:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -19629,7 +20304,7 @@ _assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); PooledClass.addPoolingTo(ReactReconcileTransaction); module.exports = ReactReconcileTransaction; -},{"./CallbackQueue":71,"./PooledClass":91,"./ReactBrowserEventEmitter":93,"./ReactInputSelection":134,"./Transaction":173,"object-assign":28}],151:[function(require,module,exports){ +},{"./CallbackQueue":81,"./PooledClass":101,"./ReactBrowserEventEmitter":103,"./ReactInputSelection":145,"./Transaction":183,"object-assign":32}],162:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -19647,8 +20322,6 @@ module.exports = ReactReconcileTransaction; var ReactRef = require('./ReactRef'); var ReactInstrumentation = require('./ReactInstrumentation'); -var invariant = require('fbjs/lib/invariant'); - /** * Helper to call ReactRef.attachRefs with this composite component, split out * to avoid allocations in the transaction mount-ready queue. @@ -19671,20 +20344,12 @@ var ReactReconciler = { * @internal */ mountComponent: function (internalInstance, transaction, nativeParent, nativeContainerInfo, context) { - if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'mountComponent'); - } - } var markup = internalInstance.mountComponent(transaction, nativeParent, nativeContainerInfo, context); if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { transaction.getReactMountReady().enqueue(attachRefs, internalInstance); } if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'mountComponent'); - ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); - } + ReactInstrumentation.debugTool.onMountComponent(internalInstance); } return markup; }, @@ -19704,18 +20369,10 @@ var ReactReconciler = { * @internal */ unmountComponent: function (internalInstance, safely) { - if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'unmountComponent'); - } - } ReactRef.detachRefs(internalInstance, internalInstance._currentElement); internalInstance.unmountComponent(safely); if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'unmountComponent'); - ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); - } + ReactInstrumentation.debugTool.onUnmountComponent(internalInstance); } }, @@ -19745,12 +20402,6 @@ var ReactReconciler = { return; } - if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'receiveComponent'); - } - } - var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); if (refsChanged) { @@ -19764,10 +20415,7 @@ var ReactReconciler = { } if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'receiveComponent'); - ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); - } + ReactInstrumentation.debugTool.onUpdateComponent(internalInstance); } }, @@ -19778,24 +20426,10 @@ var ReactReconciler = { * @param {ReactReconcileTransaction} transaction * @internal */ - performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { - if (internalInstance._updateBatchNumber !== updateBatchNumber) { - // The component's enqueued batch number should always be the current - // batch or the following one. - !(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : invariant(false) : void 0; - return; - } - if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary'); - } - } + performUpdateIfNecessary: function (internalInstance, transaction) { internalInstance.performUpdateIfNecessary(transaction); if (process.env.NODE_ENV !== 'production') { - if (internalInstance._debugID !== 0) { - ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary'); - ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); - } + ReactInstrumentation.debugTool.onUpdateComponent(internalInstance); } } @@ -19804,7 +20438,7 @@ var ReactReconciler = { module.exports = ReactReconciler; }).call(this,require('_process')) -},{"./ReactInstrumentation":136,"./ReactRef":152,"_process":29,"fbjs/lib/invariant":219}],152:[function(require,module,exports){ +},{"./ReactInstrumentation":147,"./ReactRef":163,"_process":33}],163:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -19883,81 +20517,7 @@ ReactRef.detachRefs = function (instance, element) { }; module.exports = ReactRef; -},{"./ReactOwner":146}],153:[function(require,module,exports){ -/** - * Copyright 2014-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactServerRenderingTransaction - */ - -'use strict'; - -var _assign = require('object-assign'); - -var PooledClass = require('./PooledClass'); -var Transaction = require('./Transaction'); - -/** - * Executed within the scope of the `Transaction` instance. Consider these as - * being member methods, but with an implied ordering while being isolated from - * each other. - */ -var TRANSACTION_WRAPPERS = []; - -var noopCallbackQueue = { - enqueue: function () {} -}; - -/** - * @class ReactServerRenderingTransaction - * @param {boolean} renderToStaticMarkup - */ -function ReactServerRenderingTransaction(renderToStaticMarkup) { - this.reinitializeTransaction(); - this.renderToStaticMarkup = renderToStaticMarkup; - this.useCreateElement = false; -} - -var Mixin = { - /** - * @see Transaction - * @abstract - * @final - * @return {array} Empty list of operation wrap procedures. - */ - getTransactionWrappers: function () { - return TRANSACTION_WRAPPERS; - }, - - /** - * @return {object} The queue to collect `onDOMReady` callbacks with. - */ - getReactMountReady: function () { - return noopCallbackQueue; - }, - - /** - * `PooledClass` looks for this, and will invoke this before allowing this - * instance to be reused. - */ - destructor: function () {}, - - checkpoint: function () {}, - - rollback: function () {} -}; - -_assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin); - -PooledClass.addPoolingTo(ReactServerRenderingTransaction); - -module.exports = ReactServerRenderingTransaction; -},{"./PooledClass":91,"./Transaction":173,"object-assign":28}],154:[function(require,module,exports){ +},{"./ReactOwner":156}],164:[function(require,module,exports){ (function (process){ /** * Copyright 2015-present, Facebook, Inc. @@ -20176,7 +20736,7 @@ var ReactUpdateQueue = { module.exports = ReactUpdateQueue; }).call(this,require('_process')) -},{"./ReactCurrentOwner":102,"./ReactInstanceMap":135,"./ReactUpdates":155,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],155:[function(require,module,exports){ +},{"./ReactCurrentOwner":111,"./ReactInstanceMap":146,"./ReactUpdates":165,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],165:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -20196,14 +20756,13 @@ var _assign = require('object-assign'); var CallbackQueue = require('./CallbackQueue'); var PooledClass = require('./PooledClass'); var ReactFeatureFlags = require('./ReactFeatureFlags'); -var ReactInstrumentation = require('./ReactInstrumentation'); +var ReactPerf = require('./ReactPerf'); var ReactReconciler = require('./ReactReconciler'); var Transaction = require('./Transaction'); var invariant = require('fbjs/lib/invariant'); var dirtyComponents = []; -var updateBatchNumber = 0; var asapCallbackQueue = CallbackQueue.getPooled(); var asapEnqueued = false; @@ -20298,13 +20857,6 @@ function runBatchedUpdates(transaction) { // them before their children by sorting the array. dirtyComponents.sort(mountOrderComparator); - // Any updates enqueued while reconciling must be performed after this entire - // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and - // C, B could update twice in a single batch if C's render enqueues an update - // to B (since B would have already updated, we should skip it, and the only - // way we can know to do so is by checking the batch counter). - updateBatchNumber++; - for (var i = 0; i < len; i++) { // If a component is unmounted before pending changes apply, it will still // be here, but we assume that it has cleared its _pendingCallbacks and @@ -20328,7 +20880,7 @@ function runBatchedUpdates(transaction) { console.time(markerName); } - ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); + ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction); if (markerName) { console.timeEnd(markerName); @@ -20343,10 +20895,6 @@ function runBatchedUpdates(transaction) { } var flushBatchedUpdates = function () { - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onBeginFlush(); - } - // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents // array and perform any updates enqueued by mount-ready handlers (i.e., // componentDidUpdate) but we need to check here too in order to catch @@ -20366,11 +20914,8 @@ var flushBatchedUpdates = function () { CallbackQueue.release(queue); } } - - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onEndFlush(); - } }; +flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates); /** * Mark a component as needing a rerender, adding an optional callback to a @@ -20391,9 +20936,6 @@ function enqueueUpdate(component) { } dirtyComponents.push(component); - if (component._updateBatchNumber == null) { - component._updateBatchNumber = updateBatchNumber + 1; - } } /** @@ -20439,7 +20981,7 @@ var ReactUpdates = { module.exports = ReactUpdates; }).call(this,require('_process')) -},{"./CallbackQueue":71,"./PooledClass":91,"./ReactFeatureFlags":132,"./ReactInstrumentation":136,"./ReactReconciler":151,"./Transaction":173,"_process":29,"fbjs/lib/invariant":219,"object-assign":28}],156:[function(require,module,exports){ +},{"./CallbackQueue":81,"./PooledClass":101,"./ReactFeatureFlags":143,"./ReactPerf":157,"./ReactReconciler":162,"./Transaction":183,"_process":33,"fbjs/lib/invariant":229,"object-assign":32}],166:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -20453,8 +20995,8 @@ module.exports = ReactUpdates; 'use strict'; -module.exports = '15.1.0'; -},{}],157:[function(require,module,exports){ +module.exports = '15.0.2'; +},{}],167:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -20755,7 +21297,7 @@ Object.keys(ATTRS).forEach(function (key) { }); module.exports = SVGDOMPropertyConfig; -},{}],158:[function(require,module,exports){ +},{}],168:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -20952,7 +21494,7 @@ var SelectEventPlugin = { }; module.exports = SelectEventPlugin; -},{"./EventConstants":82,"./EventPropagators":86,"./ReactDOMComponentTree":107,"./ReactInputSelection":134,"./SyntheticEvent":164,"./isTextInputElement":195,"fbjs/lib/ExecutionEnvironment":205,"fbjs/lib/getActiveElement":214,"fbjs/lib/keyOf":223,"fbjs/lib/shallowEqual":228}],159:[function(require,module,exports){ +},{"./EventConstants":92,"./EventPropagators":96,"./ReactDOMComponentTree":116,"./ReactInputSelection":145,"./SyntheticEvent":174,"./isTextInputElement":205,"fbjs/lib/ExecutionEnvironment":215,"fbjs/lib/getActiveElement":224,"fbjs/lib/keyOf":233,"fbjs/lib/shallowEqual":238}],169:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -21583,7 +22125,7 @@ var SimpleEventPlugin = { module.exports = SimpleEventPlugin; }).call(this,require('_process')) -},{"./EventConstants":82,"./EventPropagators":86,"./ReactDOMComponentTree":107,"./SyntheticAnimationEvent":160,"./SyntheticClipboardEvent":161,"./SyntheticDragEvent":163,"./SyntheticEvent":164,"./SyntheticFocusEvent":165,"./SyntheticKeyboardEvent":167,"./SyntheticMouseEvent":168,"./SyntheticTouchEvent":169,"./SyntheticTransitionEvent":170,"./SyntheticUIEvent":171,"./SyntheticWheelEvent":172,"./getEventCharCode":184,"_process":29,"fbjs/lib/EventListener":204,"fbjs/lib/emptyFunction":211,"fbjs/lib/invariant":219,"fbjs/lib/keyOf":223}],160:[function(require,module,exports){ +},{"./EventConstants":92,"./EventPropagators":96,"./ReactDOMComponentTree":116,"./SyntheticAnimationEvent":170,"./SyntheticClipboardEvent":171,"./SyntheticDragEvent":173,"./SyntheticEvent":174,"./SyntheticFocusEvent":175,"./SyntheticKeyboardEvent":177,"./SyntheticMouseEvent":178,"./SyntheticTouchEvent":179,"./SyntheticTransitionEvent":180,"./SyntheticUIEvent":181,"./SyntheticWheelEvent":182,"./getEventCharCode":194,"_process":33,"fbjs/lib/EventListener":214,"fbjs/lib/emptyFunction":221,"fbjs/lib/invariant":229,"fbjs/lib/keyOf":233}],170:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -21623,7 +22165,7 @@ function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, na SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); module.exports = SyntheticAnimationEvent; -},{"./SyntheticEvent":164}],161:[function(require,module,exports){ +},{"./SyntheticEvent":174}],171:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -21662,7 +22204,7 @@ function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, na SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); module.exports = SyntheticClipboardEvent; -},{"./SyntheticEvent":164}],162:[function(require,module,exports){ +},{"./SyntheticEvent":174}],172:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -21699,7 +22241,7 @@ function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); module.exports = SyntheticCompositionEvent; -},{"./SyntheticEvent":164}],163:[function(require,module,exports){ +},{"./SyntheticEvent":174}],173:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -21736,7 +22278,7 @@ function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeE SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); module.exports = SyntheticDragEvent; -},{"./SyntheticMouseEvent":168}],164:[function(require,module,exports){ +},{"./SyntheticMouseEvent":178}],174:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -22001,7 +22543,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) { } }).call(this,require('_process')) -},{"./PooledClass":91,"_process":29,"fbjs/lib/emptyFunction":211,"fbjs/lib/warning":229,"object-assign":28}],165:[function(require,module,exports){ +},{"./PooledClass":101,"_process":33,"fbjs/lib/emptyFunction":221,"fbjs/lib/warning":239,"object-assign":32}],175:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22038,7 +22580,7 @@ function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, native SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); module.exports = SyntheticFocusEvent; -},{"./SyntheticUIEvent":171}],166:[function(require,module,exports){ +},{"./SyntheticUIEvent":181}],176:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22076,7 +22618,7 @@ function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, native SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); module.exports = SyntheticInputEvent; -},{"./SyntheticEvent":164}],167:[function(require,module,exports){ +},{"./SyntheticEvent":174}],177:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22161,7 +22703,7 @@ function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nat SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); module.exports = SyntheticKeyboardEvent; -},{"./SyntheticUIEvent":171,"./getEventCharCode":184,"./getEventKey":185,"./getEventModifierState":186}],168:[function(require,module,exports){ +},{"./SyntheticUIEvent":181,"./getEventCharCode":194,"./getEventKey":195,"./getEventModifierState":196}],178:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22234,7 +22776,7 @@ function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, native SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); module.exports = SyntheticMouseEvent; -},{"./SyntheticUIEvent":171,"./ViewportMetrics":174,"./getEventModifierState":186}],169:[function(require,module,exports){ +},{"./SyntheticUIEvent":181,"./ViewportMetrics":184,"./getEventModifierState":196}],179:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22280,7 +22822,7 @@ function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, native SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); module.exports = SyntheticTouchEvent; -},{"./SyntheticUIEvent":171,"./getEventModifierState":186}],170:[function(require,module,exports){ +},{"./SyntheticUIEvent":181,"./getEventModifierState":196}],180:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22320,7 +22862,7 @@ function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, n SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); module.exports = SyntheticTransitionEvent; -},{"./SyntheticEvent":164}],171:[function(require,module,exports){ +},{"./SyntheticEvent":174}],181:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22380,7 +22922,7 @@ function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEve SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); module.exports = SyntheticUIEvent; -},{"./SyntheticEvent":164,"./getEventTarget":187}],172:[function(require,module,exports){ +},{"./SyntheticEvent":174,"./getEventTarget":197}],182:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22435,7 +22977,7 @@ function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, native SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); module.exports = SyntheticWheelEvent; -},{"./SyntheticMouseEvent":168}],173:[function(require,module,exports){ +},{"./SyntheticMouseEvent":178}],183:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -22670,7 +23212,7 @@ var Transaction = { module.exports = Transaction; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],174:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],184:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22698,7 +23240,7 @@ var ViewportMetrics = { }; module.exports = ViewportMetrics; -},{}],175:[function(require,module,exports){ +},{}],185:[function(require,module,exports){ (function (process){ /** * Copyright 2014-present, Facebook, Inc. @@ -22761,7 +23303,7 @@ function accumulateInto(current, next) { module.exports = accumulateInto; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/invariant":219}],176:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/invariant":229}],186:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22805,7 +23347,7 @@ function adler32(data) { } module.exports = adler32; -},{}],177:[function(require,module,exports){ +},{}],187:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -22833,7 +23375,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = canDefineProperty; }).call(this,require('_process')) -},{"_process":29}],178:[function(require,module,exports){ +},{"_process":33}],188:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22866,7 +23408,7 @@ var createMicrosoftUnsafeLocalFunction = function (func) { }; module.exports = createMicrosoftUnsafeLocalFunction; -},{}],179:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -22947,7 +23489,7 @@ function dangerousStyleValue(name, value, component) { module.exports = dangerousStyleValue; }).call(this,require('_process')) -},{"./CSSProperty":69,"_process":29,"fbjs/lib/warning":229}],180:[function(require,module,exports){ +},{"./CSSProperty":79,"_process":33,"fbjs/lib/warning":239}],190:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -22986,7 +23528,7 @@ function escapeTextContentForBrowser(text) { } module.exports = escapeTextContentForBrowser; -},{}],181:[function(require,module,exports){ +},{}],191:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -23012,8 +23554,6 @@ var warning = require('fbjs/lib/warning'); /** * Returns the DOM node rendered by this element. * - * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode - * * @param {ReactComponent|DOMElement} componentOrElement * @return {?DOMElement} The root node of this element. */ @@ -23048,7 +23588,7 @@ function findDOMNode(componentOrElement) { module.exports = findDOMNode; }).call(this,require('_process')) -},{"./ReactCurrentOwner":102,"./ReactDOMComponentTree":107,"./ReactInstanceMap":135,"./getNativeComponentFromComposite":189,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],182:[function(require,module,exports){ +},{"./ReactCurrentOwner":111,"./ReactDOMComponentTree":116,"./ReactInstanceMap":146,"./getNativeComponentFromComposite":199,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],192:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -23101,7 +23641,7 @@ function flattenChildren(children) { module.exports = flattenChildren; }).call(this,require('_process')) -},{"./KeyEscapeUtils":89,"./traverseAllChildren":202,"_process":29,"fbjs/lib/warning":229}],183:[function(require,module,exports){ +},{"./KeyEscapeUtils":99,"./traverseAllChildren":212,"_process":33,"fbjs/lib/warning":239}],193:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23132,7 +23672,7 @@ var forEachAccumulated = function (arr, cb, scope) { }; module.exports = forEachAccumulated; -},{}],184:[function(require,module,exports){ +},{}],194:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23183,7 +23723,7 @@ function getEventCharCode(nativeEvent) { } module.exports = getEventCharCode; -},{}],185:[function(require,module,exports){ +},{}],195:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23286,7 +23826,7 @@ function getEventKey(nativeEvent) { } module.exports = getEventKey; -},{"./getEventCharCode":184}],186:[function(require,module,exports){ +},{"./getEventCharCode":194}],196:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23330,7 +23870,7 @@ function getEventModifierState(nativeEvent) { } module.exports = getEventModifierState; -},{}],187:[function(require,module,exports){ +},{}],197:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23366,7 +23906,7 @@ function getEventTarget(nativeEvent) { } module.exports = getEventTarget; -},{}],188:[function(require,module,exports){ +},{}],198:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23407,7 +23947,7 @@ function getIteratorFn(maybeIterable) { } module.exports = getIteratorFn; -},{}],189:[function(require,module,exports){ +},{}],199:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23438,7 +23978,7 @@ function getNativeComponentFromComposite(inst) { } module.exports = getNativeComponentFromComposite; -},{"./ReactNodeTypes":144}],190:[function(require,module,exports){ +},{"./ReactNodeTypes":154}],200:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23513,7 +24053,7 @@ function getNodeForCharacterOffset(root, offset) { } module.exports = getNodeForCharacterOffset; -},{}],191:[function(require,module,exports){ +},{}],201:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23547,7 +24087,7 @@ function getTextContentAccessor() { } module.exports = getTextContentAccessor; -},{"fbjs/lib/ExecutionEnvironment":205}],192:[function(require,module,exports){ +},{"fbjs/lib/ExecutionEnvironment":215}],202:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23649,7 +24189,7 @@ function getVendorPrefixedEventName(eventName) { } module.exports = getVendorPrefixedEventName; -},{"fbjs/lib/ExecutionEnvironment":205}],193:[function(require,module,exports){ +},{"fbjs/lib/ExecutionEnvironment":215}],203:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -23669,7 +24209,6 @@ var _assign = require('object-assign'); var ReactCompositeComponent = require('./ReactCompositeComponent'); var ReactEmptyComponent = require('./ReactEmptyComponent'); var ReactNativeComponent = require('./ReactNativeComponent'); -var ReactInstrumentation = require('./ReactInstrumentation'); var invariant = require('fbjs/lib/invariant'); var warning = require('fbjs/lib/warning'); @@ -23692,21 +24231,6 @@ function getDeclarationErrorAddendum(owner) { return ''; } -function getDisplayName(instance) { - var element = instance._currentElement; - if (element == null) { - return '#empty'; - } else if (typeof element === 'string' || typeof element === 'number') { - return '#text'; - } else if (typeof element.type === 'string') { - return element.type; - } else if (instance.getName) { - return instance.getName() || 'Unknown'; - } else { - return element.type.displayName || element.type.name || 'Unknown'; - } -} - /** * Check if the type reference is a known internal type. I.e. not a user * provided composite type. @@ -23718,8 +24242,6 @@ function isInternalComponentType(type) { return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; } -var nextDebugID = 1; - /** * Given a ReactNode, create an instance that will actually be mounted. * @@ -23730,8 +24252,7 @@ var nextDebugID = 1; function instantiateReactComponent(node) { var instance; - var isEmpty = node === null || node === false; - if (isEmpty) { + if (node === null || node === false) { instance = ReactEmptyComponent.create(instantiateReactComponent); } else if (typeof node === 'object') { var element = node; @@ -23769,20 +24290,6 @@ function instantiateReactComponent(node) { instance._warnedAboutRefsInRender = false; } - if (process.env.NODE_ENV !== 'production') { - var debugID = isEmpty ? 0 : nextDebugID++; - instance._debugID = debugID; - - if (debugID !== 0) { - var displayName = getDisplayName(instance); - ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName); - var owner = node && node._owner; - if (owner) { - ReactInstrumentation.debugTool.onSetOwner(debugID, owner._debugID); - } - } - } - // Internal instances should fully constructed at this point, so they should // not get any new fields added to them at this point. if (process.env.NODE_ENV !== 'production') { @@ -23797,7 +24304,7 @@ function instantiateReactComponent(node) { module.exports = instantiateReactComponent; }).call(this,require('_process')) -},{"./ReactCompositeComponent":101,"./ReactEmptyComponent":128,"./ReactInstrumentation":136,"./ReactNativeComponent":142,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229,"object-assign":28}],194:[function(require,module,exports){ +},{"./ReactCompositeComponent":110,"./ReactEmptyComponent":139,"./ReactNativeComponent":153,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239,"object-assign":32}],204:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23858,7 +24365,7 @@ function isEventSupported(eventNameSuffix, capture) { } module.exports = isEventSupported; -},{"fbjs/lib/ExecutionEnvironment":205}],195:[function(require,module,exports){ +},{"fbjs/lib/ExecutionEnvironment":215}],205:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23900,7 +24407,7 @@ function isTextInputElement(elem) { } module.exports = isTextInputElement; -},{}],196:[function(require,module,exports){ +},{}],206:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -23920,13 +24427,10 @@ var invariant = require('fbjs/lib/invariant'); /** * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. - * - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only - * - * The current implementation of this function assumes that a single child gets - * passed without a wrapper, but the purpose of this helper function is to - * abstract away the particular structure of children. + * is only one child in the collection. The current implementation of this + * function assumes that a single child gets passed without a wrapper, but the + * purpose of this helper function is to abstract away the particular structure + * of children. * * @param {?object} children Child collection structure. * @return {ReactElement} The first and only `ReactElement` contained in the @@ -23940,7 +24444,7 @@ function onlyChild(children) { module.exports = onlyChild; }).call(this,require('_process')) -},{"./ReactElement":126,"_process":29,"fbjs/lib/invariant":219}],197:[function(require,module,exports){ +},{"./ReactElement":137,"_process":33,"fbjs/lib/invariant":229}],207:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23967,7 +24471,7 @@ function quoteAttributeValueForBrowser(value) { } module.exports = quoteAttributeValueForBrowser; -},{"./escapeTextContentForBrowser":180}],198:[function(require,module,exports){ +},{"./escapeTextContentForBrowser":190}],208:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -23984,7 +24488,7 @@ module.exports = quoteAttributeValueForBrowser; var ReactMount = require('./ReactMount'); module.exports = ReactMount.renderSubtreeIntoContainer; -},{"./ReactMount":139}],199:[function(require,module,exports){ +},{"./ReactMount":150}],209:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -24067,7 +24571,7 @@ if (ExecutionEnvironment.canUseDOM) { } module.exports = setInnerHTML; -},{"./createMicrosoftUnsafeLocalFunction":178,"fbjs/lib/ExecutionEnvironment":205}],200:[function(require,module,exports){ +},{"./createMicrosoftUnsafeLocalFunction":188,"fbjs/lib/ExecutionEnvironment":215}],210:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -24108,7 +24612,7 @@ if (ExecutionEnvironment.canUseDOM) { } module.exports = setTextContent; -},{"./escapeTextContentForBrowser":180,"./setInnerHTML":199,"fbjs/lib/ExecutionEnvironment":205}],201:[function(require,module,exports){ +},{"./escapeTextContentForBrowser":190,"./setInnerHTML":209,"fbjs/lib/ExecutionEnvironment":215}],211:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -24151,7 +24655,7 @@ function shouldUpdateReactComponent(prevElement, nextElement) { } module.exports = shouldUpdateReactComponent; -},{}],202:[function(require,module,exports){ +},{}],212:[function(require,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -24313,7 +24817,7 @@ function traverseAllChildren(children, callback, traverseContext) { module.exports = traverseAllChildren; }).call(this,require('_process')) -},{"./KeyEscapeUtils":89,"./ReactCurrentOwner":102,"./ReactElement":126,"./getIteratorFn":188,"_process":29,"fbjs/lib/invariant":219,"fbjs/lib/warning":229}],203:[function(require,module,exports){ +},{"./KeyEscapeUtils":99,"./ReactCurrentOwner":111,"./ReactElement":137,"./getIteratorFn":198,"_process":33,"fbjs/lib/invariant":229,"fbjs/lib/warning":239}],213:[function(require,module,exports){ (function (process){ /** * Copyright 2015-present, Facebook, Inc. @@ -24686,7 +25190,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = validateDOMNesting; }).call(this,require('_process')) -},{"_process":29,"fbjs/lib/emptyFunction":211,"fbjs/lib/warning":229,"object-assign":28}],204:[function(require,module,exports){ +},{"_process":33,"fbjs/lib/emptyFunction":221,"fbjs/lib/warning":239,"object-assign":32}],214:[function(require,module,exports){ (function (process){ 'use strict'; @@ -24723,18 +25227,18 @@ var EventListener = { * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ - listen: function listen(target, eventType, callback) { + listen: function (target, eventType, callback) { if (target.addEventListener) { target.addEventListener(eventType, callback, false); return { - remove: function remove() { + remove: function () { target.removeEventListener(eventType, callback, false); } }; } else if (target.attachEvent) { target.attachEvent('on' + eventType, callback); return { - remove: function remove() { + remove: function () { target.detachEvent('on' + eventType, callback); } }; @@ -24749,11 +25253,11 @@ var EventListener = { * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ - capture: function capture(target, eventType, callback) { + capture: function (target, eventType, callback) { if (target.addEventListener) { target.addEventListener(eventType, callback, true); return { - remove: function remove() { + remove: function () { target.removeEventListener(eventType, callback, true); } }; @@ -24767,13 +25271,13 @@ var EventListener = { } }, - registerDefault: function registerDefault() {} + registerDefault: function () {} }; module.exports = EventListener; }).call(this,require('_process')) -},{"./emptyFunction":211,"_process":29}],205:[function(require,module,exports){ +},{"./emptyFunction":221,"_process":33}],215:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -24809,7 +25313,7 @@ var ExecutionEnvironment = { }; module.exports = ExecutionEnvironment; -},{}],206:[function(require,module,exports){ +},{}],216:[function(require,module,exports){ "use strict"; /** @@ -24841,7 +25345,7 @@ function camelize(string) { } module.exports = camelize; -},{}],207:[function(require,module,exports){ +},{}],217:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -24881,7 +25385,7 @@ function camelizeStyleName(string) { } module.exports = camelizeStyleName; -},{"./camelize":206}],208:[function(require,module,exports){ +},{"./camelize":216}],218:[function(require,module,exports){ 'use strict'; /** @@ -24892,7 +25396,7 @@ module.exports = camelizeStyleName; * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * + * @typechecks */ var isTextNode = require('./isTextNode'); @@ -24901,6 +25405,10 @@ var isTextNode = require('./isTextNode'); /** * Checks if a given DOM node contains or is another DOM node. + * + * @param {?DOMNode} outerNode Outer DOM node. + * @param {?DOMNode} innerNode Inner DOM node. + * @return {boolean} True if `outerNode` contains or is `innerNode`. */ function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { @@ -24911,7 +25419,7 @@ function containsNode(outerNode, innerNode) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); - } else if ('contains' in outerNode) { + } else if (outerNode.contains) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); @@ -24921,7 +25429,7 @@ function containsNode(outerNode, innerNode) { } module.exports = containsNode; -},{"./isTextNode":221}],209:[function(require,module,exports){ +},{"./isTextNode":231}],219:[function(require,module,exports){ (function (process){ 'use strict'; @@ -25051,7 +25559,7 @@ function createArrayFromMixed(obj) { module.exports = createArrayFromMixed; }).call(this,require('_process')) -},{"./invariant":219,"_process":29}],210:[function(require,module,exports){ +},{"./invariant":229,"_process":33}],220:[function(require,module,exports){ (function (process){ 'use strict'; @@ -25138,7 +25646,7 @@ function createNodesFromMarkup(markup, handleScript) { module.exports = createNodesFromMarkup; }).call(this,require('_process')) -},{"./ExecutionEnvironment":205,"./createArrayFromMixed":209,"./getMarkupWrap":215,"./invariant":219,"_process":29}],211:[function(require,module,exports){ +},{"./ExecutionEnvironment":215,"./createArrayFromMixed":219,"./getMarkupWrap":225,"./invariant":229,"_process":33}],221:[function(require,module,exports){ "use strict"; /** @@ -25149,7 +25657,6 @@ module.exports = createNodesFromMarkup; * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * */ function makeEmptyFunction(arg) { @@ -25163,7 +25670,7 @@ function makeEmptyFunction(arg) { * 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() {}; +function emptyFunction() {} emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); @@ -25177,7 +25684,7 @@ emptyFunction.thatReturnsArgument = function (arg) { }; module.exports = emptyFunction; -},{}],212:[function(require,module,exports){ +},{}],222:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2013-present, Facebook, Inc. @@ -25200,7 +25707,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = emptyObject; }).call(this,require('_process')) -},{"_process":29}],213:[function(require,module,exports){ +},{"_process":33}],223:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25227,7 +25734,7 @@ function focusNode(node) { } module.exports = focusNode; -},{}],214:[function(require,module,exports){ +},{}],224:[function(require,module,exports){ 'use strict'; /** @@ -25262,7 +25769,7 @@ function getActiveElement() /*?DOMElement*/{ } module.exports = getActiveElement; -},{}],215:[function(require,module,exports){ +},{}],225:[function(require,module,exports){ (function (process){ 'use strict'; @@ -25360,7 +25867,7 @@ function getMarkupWrap(nodeName) { module.exports = getMarkupWrap; }).call(this,require('_process')) -},{"./ExecutionEnvironment":205,"./invariant":219,"_process":29}],216:[function(require,module,exports){ +},{"./ExecutionEnvironment":215,"./invariant":229,"_process":33}],226:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25399,7 +25906,7 @@ function getUnboundedScrollPosition(scrollable) { } module.exports = getUnboundedScrollPosition; -},{}],217:[function(require,module,exports){ +},{}],227:[function(require,module,exports){ 'use strict'; /** @@ -25432,7 +25939,7 @@ function hyphenate(string) { } module.exports = hyphenate; -},{}],218:[function(require,module,exports){ +},{}],228:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25471,7 +25978,7 @@ function hyphenateStyleName(string) { } module.exports = hyphenateStyleName; -},{"./hyphenate":217}],219:[function(require,module,exports){ +},{"./hyphenate":227}],229:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2013-present, Facebook, Inc. @@ -25524,7 +26031,7 @@ function invariant(condition, format, a, b, c, d, e, f) { module.exports = invariant; }).call(this,require('_process')) -},{"_process":29}],220:[function(require,module,exports){ +},{"_process":33}],230:[function(require,module,exports){ 'use strict'; /** @@ -25547,7 +26054,7 @@ function isNode(object) { } module.exports = isNode; -},{}],221:[function(require,module,exports){ +},{}],231:[function(require,module,exports){ 'use strict'; /** @@ -25572,7 +26079,7 @@ function isTextNode(object) { } module.exports = isTextNode; -},{"./isNode":220}],222:[function(require,module,exports){ +},{"./isNode":230}],232:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2013-present, Facebook, Inc. @@ -25607,7 +26114,7 @@ var invariant = require('./invariant'); * @param {object} obj * @return {object} */ -var keyMirror = function keyMirror(obj) { +var keyMirror = function (obj) { var ret = {}; var key; !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : void 0; @@ -25623,7 +26130,7 @@ var keyMirror = function keyMirror(obj) { module.exports = keyMirror; }).call(this,require('_process')) -},{"./invariant":219,"_process":29}],223:[function(require,module,exports){ +},{"./invariant":229,"_process":33}],233:[function(require,module,exports){ "use strict"; /** @@ -25646,7 +26153,7 @@ module.exports = keyMirror; * 'xa12' in that case. Resolve keys you want to use once at startup time, then * reuse those resolutions. */ -var keyOf = function keyOf(oneKeyObj) { +var keyOf = function (oneKeyObj) { var key; for (key in oneKeyObj) { if (!oneKeyObj.hasOwnProperty(key)) { @@ -25658,7 +26165,7 @@ var keyOf = function keyOf(oneKeyObj) { }; module.exports = keyOf; -},{}],224:[function(require,module,exports){ +},{}],234:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25709,7 +26216,7 @@ function mapObject(object, callback, context) { } module.exports = mapObject; -},{}],225:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25718,7 +26225,6 @@ module.exports = mapObject; * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * * @typechecks static-only */ @@ -25726,6 +26232,9 @@ module.exports = mapObject; /** * Memoizes the return value of a function that accepts one string argument. + * + * @param {function} callback + * @return {function} */ function memoizeStringOnly(callback) { @@ -25739,7 +26248,7 @@ function memoizeStringOnly(callback) { } module.exports = memoizeStringOnly; -},{}],226:[function(require,module,exports){ +},{}],236:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25762,7 +26271,7 @@ if (ExecutionEnvironment.canUseDOM) { } module.exports = performance || {}; -},{"./ExecutionEnvironment":205}],227:[function(require,module,exports){ +},{"./ExecutionEnvironment":215}],237:[function(require,module,exports){ 'use strict'; /** @@ -25786,17 +26295,17 @@ var performanceNow; * because of Facebook's testing infrastructure. */ if (performance.now) { - performanceNow = function performanceNow() { + performanceNow = function () { return performance.now(); }; } else { - performanceNow = function performanceNow() { + performanceNow = function () { return Date.now(); }; } module.exports = performanceNow; -},{"./performance":226}],228:[function(require,module,exports){ +},{"./performance":236}],238:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -25863,7 +26372,7 @@ function shallowEqual(objA, objB) { } module.exports = shallowEqual; -},{}],229:[function(require,module,exports){ +},{}],239:[function(require,module,exports){ (function (process){ /** * Copyright 2014-2015, Facebook, Inc. @@ -25889,7 +26398,7 @@ var emptyFunction = require('./emptyFunction'); var warning = emptyFunction; if (process.env.NODE_ENV !== 'production') { - warning = function warning(condition, format) { + warning = 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]; } @@ -25923,7 +26432,579 @@ if (process.env.NODE_ENV !== 'production') { module.exports = warning; }).call(this,require('_process')) -},{"./emptyFunction":211,"_process":29}],230:[function(require,module,exports){ +},{"./emptyFunction":221,"_process":33}],240:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; + +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; }; + +exports["default"] = applyMiddleware; + +var _compose = require('./compose'); + +var _compose2 = _interopRequireDefault(_compose); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** + * Creates a store enhancer that applies middleware to the dispatch method + * of the Redux store. This is handy for a variety of tasks, such as expressing + * asynchronous actions in a concise manner, or logging every action payload. + * + * See `redux-thunk` package as an example of the Redux middleware. + * + * Because middleware is potentially asynchronous, this should be the first + * store enhancer in the composition chain. + * + * Note that each middleware will be given the `dispatch` and `getState` functions + * as named arguments. + * + * @param {...Function} middlewares The middleware chain to be applied. + * @returns {Function} A store enhancer applying the middleware. + */ +function applyMiddleware() { + for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { + middlewares[_key] = arguments[_key]; + } + + return function (createStore) { + return function (reducer, initialState, enhancer) { + var store = createStore(reducer, initialState, enhancer); + var _dispatch = store.dispatch; + var chain = []; + + var middlewareAPI = { + getState: store.getState, + dispatch: function dispatch(action) { + return _dispatch(action); + } + }; + chain = middlewares.map(function (middleware) { + return middleware(middlewareAPI); + }); + _dispatch = _compose2["default"].apply(undefined, chain)(store.dispatch); + + return _extends({}, store, { + dispatch: _dispatch + }); + }; + }; +} +},{"./compose":243}],241:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports["default"] = bindActionCreators; +function bindActionCreator(actionCreator, dispatch) { + return function () { + return dispatch(actionCreator.apply(undefined, arguments)); + }; +} + +/** + * Turns an object whose values are action creators, into an object with the + * same keys, but with every function wrapped into a `dispatch` call so they + * may be invoked directly. This is just a convenience method, as you can call + * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. + * + * For convenience, you can also pass a single function as the first argument, + * and get a function in return. + * + * @param {Function|Object} actionCreators An object whose values are action + * creator functions. One handy way to obtain it is to use ES6 `import * as` + * syntax. You may also pass a single function. + * + * @param {Function} dispatch The `dispatch` function available on your Redux + * store. + * + * @returns {Function|Object} The object mimicking the original object, but with + * every action creator wrapped into the `dispatch` call. If you passed a + * function as `actionCreators`, the return value will also be a single + * function. + */ +function bindActionCreators(actionCreators, dispatch) { + if (typeof actionCreators === 'function') { + return bindActionCreator(actionCreators, dispatch); + } + + if (typeof actionCreators !== 'object' || actionCreators === null) { + throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?'); + } + + var keys = Object.keys(actionCreators); + var boundActionCreators = {}; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var actionCreator = actionCreators[key]; + if (typeof actionCreator === 'function') { + boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); + } + } + return boundActionCreators; +} +},{}],242:[function(require,module,exports){ +(function (process){ +'use strict'; + +exports.__esModule = true; +exports["default"] = combineReducers; + +var _createStore = require('./createStore'); + +var _isPlainObject = require('lodash/isPlainObject'); + +var _isPlainObject2 = _interopRequireDefault(_isPlainObject); + +var _warning = require('./utils/warning'); + +var _warning2 = _interopRequireDefault(_warning); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function getUndefinedStateErrorMessage(key, action) { + var actionType = action && action.type; + var actionName = actionType && '"' + actionType.toString() + '"' || 'an action'; + + return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.'; +} + +function getUnexpectedStateShapeWarningMessage(inputState, reducers, action) { + var reducerKeys = Object.keys(reducers); + var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'initialState argument passed to createStore' : 'previous state received by the reducer'; + + if (reducerKeys.length === 0) { + return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; + } + + if (!(0, _isPlainObject2["default"])(inputState)) { + return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"'); + } + + var unexpectedKeys = Object.keys(inputState).filter(function (key) { + return !reducers.hasOwnProperty(key); + }); + + if (unexpectedKeys.length > 0) { + return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.'); + } +} + +function assertReducerSanity(reducers) { + Object.keys(reducers).forEach(function (key) { + var reducer = reducers[key]; + var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT }); + + if (typeof initialState === 'undefined') { + throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.'); + } + + var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.'); + if (typeof reducer(undefined, { type: type }) === 'undefined') { + throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.'); + } + }); +} + +/** + * Turns an object whose values are different reducer functions, into a single + * reducer function. It will call every child reducer, and gather their results + * into a single state object, whose keys correspond to the keys of the passed + * reducer functions. + * + * @param {Object} reducers An object whose values correspond to different + * reducer functions that need to be combined into one. One handy way to obtain + * it is to use ES6 `import * as reducers` syntax. The reducers may never return + * undefined for any action. Instead, they should return their initial state + * if the state passed to them was undefined, and the current state for any + * unrecognized action. + * + * @returns {Function} A reducer function that invokes every reducer inside the + * passed object, and builds a state object with the same shape. + */ +function combineReducers(reducers) { + var reducerKeys = Object.keys(reducers); + var finalReducers = {}; + for (var i = 0; i < reducerKeys.length; i++) { + var key = reducerKeys[i]; + if (typeof reducers[key] === 'function') { + finalReducers[key] = reducers[key]; + } + } + var finalReducerKeys = Object.keys(finalReducers); + + var sanityError; + try { + assertReducerSanity(finalReducers); + } catch (e) { + sanityError = e; + } + + return function combination() { + var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var action = arguments[1]; + + if (sanityError) { + throw sanityError; + } + + if (process.env.NODE_ENV !== 'production') { + var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action); + if (warningMessage) { + (0, _warning2["default"])(warningMessage); + } + } + + var hasChanged = false; + var nextState = {}; + for (var i = 0; i < finalReducerKeys.length; i++) { + var key = finalReducerKeys[i]; + var reducer = finalReducers[key]; + var previousStateForKey = state[key]; + var nextStateForKey = reducer(previousStateForKey, action); + if (typeof nextStateForKey === 'undefined') { + var errorMessage = getUndefinedStateErrorMessage(key, action); + throw new Error(errorMessage); + } + nextState[key] = nextStateForKey; + hasChanged = hasChanged || nextStateForKey !== previousStateForKey; + } + return hasChanged ? nextState : state; + }; +} +}).call(this,require('_process')) + +},{"./createStore":244,"./utils/warning":245,"_process":33,"lodash/isPlainObject":31}],243:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports["default"] = compose; +/** + * Composes single-argument functions from right to left. The rightmost + * function can take multiple arguments as it provides the signature for + * the resulting composite function. + * + * @param {...Function} funcs The functions to compose. + * @returns {Function} A function obtained by composing the argument functions + * from right to left. For example, compose(f, g, h) is identical to doing + * (...args) => f(g(h(...args))). + */ + +function compose() { + for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) { + funcs[_key] = arguments[_key]; + } + + if (funcs.length === 0) { + return function (arg) { + return arg; + }; + } else { + var _ret = function () { + var last = funcs[funcs.length - 1]; + var rest = funcs.slice(0, -1); + return { + v: function v() { + return rest.reduceRight(function (composed, f) { + return f(composed); + }, last.apply(undefined, arguments)); + } + }; + }(); + + if (typeof _ret === "object") return _ret.v; + } +} +},{}],244:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports.ActionTypes = undefined; +exports["default"] = createStore; + +var _isPlainObject = require('lodash/isPlainObject'); + +var _isPlainObject2 = _interopRequireDefault(_isPlainObject); + +var _symbolObservable = require('symbol-observable'); + +var _symbolObservable2 = _interopRequireDefault(_symbolObservable); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** + * These are private action types reserved by Redux. + * For any unknown actions, you must return the current state. + * If the current state is undefined, you must return the initial state. + * Do not reference these action types directly in your code. + */ +var ActionTypes = exports.ActionTypes = { + INIT: '@@redux/INIT' +}; + +/** + * Creates a Redux store that holds the state tree. + * The only way to change the data in the store is to call `dispatch()` on it. + * + * There should only be a single store in your app. To specify how different + * parts of the state tree respond to actions, you may combine several reducers + * into a single reducer function by using `combineReducers`. + * + * @param {Function} reducer A function that returns the next state tree, given + * the current state tree and the action to handle. + * + * @param {any} [initialState] The initial state. You may optionally specify it + * to hydrate the state from the server in universal apps, or to restore a + * previously serialized user session. + * If you use `combineReducers` to produce the root reducer function, this must be + * an object with the same shape as `combineReducers` keys. + * + * @param {Function} enhancer The store enhancer. You may optionally specify it + * to enhance the store with third-party capabilities such as middleware, + * time travel, persistence, etc. The only store enhancer that ships with Redux + * is `applyMiddleware()`. + * + * @returns {Store} A Redux store that lets you read the state, dispatch actions + * and subscribe to changes. + */ +function createStore(reducer, initialState, enhancer) { + var _ref2; + + if (typeof initialState === 'function' && typeof enhancer === 'undefined') { + enhancer = initialState; + initialState = undefined; + } + + if (typeof enhancer !== 'undefined') { + if (typeof enhancer !== 'function') { + throw new Error('Expected the enhancer to be a function.'); + } + + return enhancer(createStore)(reducer, initialState); + } + + if (typeof reducer !== 'function') { + throw new Error('Expected the reducer to be a function.'); + } + + var currentReducer = reducer; + var currentState = initialState; + var currentListeners = []; + var nextListeners = currentListeners; + var isDispatching = false; + + function ensureCanMutateNextListeners() { + if (nextListeners === currentListeners) { + nextListeners = currentListeners.slice(); + } + } + + /** + * Reads the state tree managed by the store. + * + * @returns {any} The current state tree of your application. + */ + function getState() { + return currentState; + } + + /** + * Adds a change listener. It will be called any time an action is dispatched, + * and some part of the state tree may potentially have changed. You may then + * call `getState()` to read the current state tree inside the callback. + * + * You may call `dispatch()` from a change listener, with the following + * caveats: + * + * 1. The subscriptions are snapshotted just before every `dispatch()` call. + * If you subscribe or unsubscribe while the listeners are being invoked, this + * will not have any effect on the `dispatch()` that is currently in progress. + * However, the next `dispatch()` call, whether nested or not, will use a more + * recent snapshot of the subscription list. + * + * 2. The listener should not expect to see all state changes, as the state + * might have been updated multiple times during a nested `dispatch()` before + * the listener is called. It is, however, guaranteed that all subscribers + * registered before the `dispatch()` started will be called with the latest + * state by the time it exits. + * + * @param {Function} listener A callback to be invoked on every dispatch. + * @returns {Function} A function to remove this change listener. + */ + function subscribe(listener) { + if (typeof listener !== 'function') { + throw new Error('Expected listener to be a function.'); + } + + var isSubscribed = true; + + ensureCanMutateNextListeners(); + nextListeners.push(listener); + + return function unsubscribe() { + if (!isSubscribed) { + return; + } + + isSubscribed = false; + + ensureCanMutateNextListeners(); + var index = nextListeners.indexOf(listener); + nextListeners.splice(index, 1); + }; + } + + /** + * Dispatches an action. It is the only way to trigger a state change. + * + * The `reducer` function, used to create the store, will be called with the + * current state tree and the given `action`. Its return value will + * be considered the **next** state of the tree, and the change listeners + * will be notified. + * + * The base implementation only supports plain object actions. If you want to + * dispatch a Promise, an Observable, a thunk, or something else, you need to + * wrap your store creating function into the corresponding middleware. For + * example, see the documentation for the `redux-thunk` package. Even the + * middleware will eventually dispatch plain object actions using this method. + * + * @param {Object} action A plain object representing “what changed”. It is + * a good idea to keep actions serializable so you can record and replay user + * sessions, or use the time travelling `redux-devtools`. An action must have + * a `type` property which may not be `undefined`. It is a good idea to use + * string constants for action types. + * + * @returns {Object} For convenience, the same action object you dispatched. + * + * Note that, if you use a custom middleware, it may wrap `dispatch()` to + * return something else (for example, a Promise you can await). + */ + function dispatch(action) { + if (!(0, _isPlainObject2["default"])(action)) { + throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); + } + + if (typeof action.type === 'undefined') { + throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); + } + + if (isDispatching) { + throw new Error('Reducers may not dispatch actions.'); + } + + try { + isDispatching = true; + currentState = currentReducer(currentState, action); + } finally { + isDispatching = false; + } + + var listeners = currentListeners = nextListeners; + for (var i = 0; i < listeners.length; i++) { + listeners[i](); + } + + return action; + } + + /** + * Replaces the reducer currently used by the store to calculate the state. + * + * You might need this if your app implements code splitting and you want to + * load some of the reducers dynamically. You might also need this if you + * implement a hot reloading mechanism for Redux. + * + * @param {Function} nextReducer The reducer for the store to use instead. + * @returns {void} + */ + function replaceReducer(nextReducer) { + if (typeof nextReducer !== 'function') { + throw new Error('Expected the nextReducer to be a function.'); + } + + currentReducer = nextReducer; + dispatch({ type: ActionTypes.INIT }); + } + + /** + * Interoperability point for observable/reactive libraries. + * @returns {observable} A minimal observable of state changes. + * For more information, see the observable proposal: + * https://github.com/zenparsing/es-observable + */ + function observable() { + var _ref; + + var outerSubscribe = subscribe; + return _ref = { + /** + * The minimal observable subscription method. + * @param {Object} observer Any object that can be used as an observer. + * The observer object should have a `next` method. + * @returns {subscription} An object with an `unsubscribe` method that can + * be used to unsubscribe the observable from the store, and prevent further + * emission of values from the observable. + */ + + subscribe: function subscribe(observer) { + if (typeof observer !== 'object') { + throw new TypeError('Expected the observer to be an object.'); + } + + function observeState() { + if (observer.next) { + observer.next(getState()); + } + } + + observeState(); + var unsubscribe = outerSubscribe(observeState); + return { unsubscribe: unsubscribe }; + } + }, _ref[_symbolObservable2["default"]] = function () { + return this; + }, _ref; + } + + // When a store is created, an "INIT" action is dispatched so that every + // reducer returns their initial state. This effectively populates + // the initial state tree. + dispatch({ type: ActionTypes.INIT }); + + return _ref2 = { + dispatch: dispatch, + subscribe: subscribe, + getState: getState, + replaceReducer: replaceReducer + }, _ref2[_symbolObservable2["default"]] = observable, _ref2; +} +},{"lodash/isPlainObject":31,"symbol-observable":247}],245:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports["default"] = warning; +/** + * Prints a warning in the console if it exists. + * + * @param {String} message The warning message. + * @returns {void} + */ +function warning(message) { + /* eslint-disable no-console */ + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(message); + } + /* eslint-enable no-console */ + try { + // This error was thrown as a convenience so that if you enable + // "break on all exceptions" in your console, + // it would pause the execution at this line. + throw new Error(message); + /* eslint-disable no-empty */ + } catch (e) {} + /* eslint-enable no-empty */ +} +},{}],246:[function(require,module,exports){ 'use strict'; module.exports = function (str) { return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { @@ -25931,7 +27012,37 @@ module.exports = function (str) { }); }; -},{}],231:[function(require,module,exports){ +},{}],247:[function(require,module,exports){ +(function (global){ +/* global window */ +'use strict'; + +module.exports = require('./ponyfill')(global || window || this); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"./ponyfill":248}],248:[function(require,module,exports){ +'use strict'; + +module.exports = function symbolObservablePonyfill(root) { + var result; + var Symbol = root.Symbol; + + if (typeof Symbol === 'function') { + if (Symbol.observable) { + result = Symbol.observable; + } else { + result = Symbol('observable'); + Symbol.observable = result; + } + } else { + result = '@@observable'; + } + + return result; +}; + +},{}],249:[function(require,module,exports){ (function (process){ /** * Copyright 2014-2015, Facebook, Inc. @@ -25996,7 +27107,7 @@ module.exports = warning; }).call(this,require('_process')) -},{"_process":29}],"classnames":[function(require,module,exports){ +},{"_process":33}],"classnames":[function(require,module,exports){ /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see @@ -26060,7 +27171,7 @@ module.exports.Dispatcher = require('./lib/Dispatcher'); },{"./lib/Dispatcher":5}],"jquery":[function(require,module,exports){ /*! - * jQuery JavaScript Library v2.2.4 + * jQuery JavaScript Library v2.2.3 * http://jquery.com/ * * Includes Sizzle.js @@ -26070,7 +27181,7 @@ module.exports.Dispatcher = require('./lib/Dispatcher'); * Released under the MIT license * http://jquery.org/license * - * Date: 2016-05-20T17:23Z + * Date: 2016-04-05T19:26Z */ (function( global, factory ) { @@ -26126,7 +27237,7 @@ var support = {}; var - version = "2.2.4", + version = "2.2.3", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -31067,14 +32178,13 @@ jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, - isSimulated: false, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; - if ( e && !this.isSimulated ) { + if ( e ) { e.preventDefault(); } }, @@ -31083,7 +32193,7 @@ jQuery.Event.prototype = { this.isPropagationStopped = returnTrue; - if ( e && !this.isSimulated ) { + if ( e ) { e.stopPropagation(); } }, @@ -31092,7 +32202,7 @@ jQuery.Event.prototype = { this.isImmediatePropagationStopped = returnTrue; - if ( e && !this.isSimulated ) { + if ( e ) { e.stopImmediatePropagation(); } @@ -32023,6 +33133,19 @@ function getWidthOrHeight( elem, name, extra ) { styles = getStyles( elem ), isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + // Support: IE11 only + // In IE 11 fullscreen elements inside of an iframe have + // 100x too small dimensions (gh-1764). + if ( document.msFullscreenElement && window.top !== window ) { + + // Support: IE11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + if ( elem.getClientRects().length ) { + val = Math.round( elem.getBoundingClientRect()[ name ] * 100 ); + } + } + // Some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 @@ -33913,7 +35036,6 @@ jQuery.extend( jQuery.event, { }, // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events simulate: function( type, elem, event ) { var e = jQuery.extend( new jQuery.Event(), @@ -33921,10 +35043,27 @@ jQuery.extend( jQuery.event, { { type: type, isSimulated: true + + // Previously, `originalEvent: {}` was set here, so stopPropagation call + // would not be triggered on donor event, since in our own + // jQuery.event.stopPropagation function we had a check for existence of + // originalEvent.stopPropagation method, so, consequently it would be a noop. + // + // But now, this "simulate" function is used only for events + // for which stopPropagation() is noop, so there is no need for that anymore. + // + // For the 1.x branch though, guard for "click" and "submit" + // events is still used, but was moved to jQuery.event.stopPropagation function + // because `originalEvent` should point to the original event for the constancy + // with other events and for more focused logic } ); jQuery.event.trigger( e, null, elem ); + + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } } } ); @@ -35878,7 +37017,8 @@ return jQuery; (function (global){ /** * @license - * lodash + * lodash 4.11.2 (Custom Build) + * Build: `lodash -d -o ./foo/lodash.js` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -35890,7 +37030,7 @@ return jQuery; var undefined; /** Used as the semantic version number. */ - var VERSION = '4.13.1'; + var VERSION = '4.11.2'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -35994,7 +37134,7 @@ return jQuery; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; /** * Used to match `RegExp` @@ -36127,7 +37267,7 @@ return jQuery; 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'isFinite', 'parseInt', 'setTimeout' + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ @@ -36206,6 +37346,12 @@ return jQuery; '`': '`' }; + /** Used to determine if values are of the language type `Object`. */ + var objectTypes = { + 'function': true, + 'object': true + }; + /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', @@ -36221,25 +37367,41 @@ return jQuery; freeParseInt = parseInt; /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports; + var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module; + var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; + var moduleExports = (freeModule && freeModule.exports === freeExports) + ? freeExports + : undefined; /** Detect free variable `global` from Node.js. */ - var freeGlobal = checkGlobal(typeof global == 'object' && global); + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); /** Detect free variable `self`. */ - var freeSelf = checkGlobal(typeof self == 'object' && self); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + + /** Detect free variable `window`. */ + var freeWindow = checkGlobal(objectTypes[typeof window] && window); /** Detect `this` as the global object. */ - var thisGlobal = checkGlobal(typeof this == 'object' && this); + var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || thisGlobal || Function('return this')(); + /** + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ + var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ @@ -36295,7 +37457,7 @@ return jQuery; * A specialized version of `baseAggregator` for arrays. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. @@ -36303,7 +37465,7 @@ return jQuery; */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { var value = array[index]; @@ -36312,18 +37474,42 @@ return jQuery; return accumulator; } + /** + * Creates a new array concatenating `array` with `other`. + * + * @private + * @param {Array} array The first array to concatenate. + * @param {Array} other The second array to concatenate. + * @returns {Array} Returns the new concatenated array. + */ + function arrayConcat(array, other) { + var index = -1, + length = array.length, + othIndex = -1, + othLength = other.length, + result = Array(length + othLength); + + while (++index < length) { + result[index] = array[index]; + } + while (++othIndex < othLength) { + result[index++] = other[othIndex]; + } + return result; + } + /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { @@ -36338,12 +37524,12 @@ return jQuery; * iteratee shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { - var length = array ? array.length : 0; + var length = array.length; while (length--) { if (iteratee(array[length], length, array) === false) { @@ -36358,14 +37544,14 @@ return jQuery; * iteratee shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (!predicate(array[index], index, array)) { @@ -36380,13 +37566,13 @@ return jQuery; * iteratee shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, - length = array ? array.length : 0, + length = array.length, resIndex = 0, result = []; @@ -36404,27 +37590,26 @@ return jQuery; * specifying an index to search from. * * @private - * @param {Array} [array] The array to search. + * @param {Array} array The array to search. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { - var length = array ? array.length : 0; - return !!length && baseIndexOf(array, value, 0) > -1; + return !!array.length && baseIndexOf(array, value, 0) > -1; } /** * This function is like `arrayIncludes` except that it accepts a comparator. * * @private - * @param {Array} [array] The array to search. + * @param {Array} array The array to search. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (comparator(value, array[index])) { @@ -36439,13 +37624,13 @@ return jQuery; * shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array ? array.length : 0, + length = array.length, result = Array(length); while (++index < length) { @@ -36478,7 +37663,7 @@ return jQuery; * iteratee shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as @@ -36487,7 +37672,7 @@ return jQuery; */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, - length = array ? array.length : 0; + length = array.length; if (initAccum && length) { accumulator = array[++index]; @@ -36503,7 +37688,7 @@ return jQuery; * iteratee shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as @@ -36511,7 +37696,7 @@ return jQuery; * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array ? array.length : 0; + var length = array.length; if (initAccum && length) { accumulator = array[--length]; } @@ -36526,14 +37711,14 @@ return jQuery; * shorthands. * * @private - * @param {Array} [array] The array to iterate over. + * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (predicate(array[index], index, array)) { @@ -36544,21 +37729,23 @@ return jQuery; } /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. + * The base implementation of methods like `_.find` and `_.findKey`, without + * support for iteratee shorthands, which iterates over `collection` using + * `eachFunc`. * * @private * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ - function baseFindKey(collection, predicate, eachFunc) { + function baseFind(collection, predicate, eachFunc, retKey) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { - result = key; + result = retKey ? key : value; return false; } }); @@ -36572,13 +37759,12 @@ return jQuery; * @private * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { + function baseFindIndex(array, predicate, fromRight) { var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); + index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { @@ -36739,7 +37925,7 @@ return jQuery; * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. + * @returns {Object} Returns the new array of key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { @@ -36752,7 +37938,7 @@ return jQuery; * * @private * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. + * @returns {Function} Returns the new function. */ function baseUnary(func) { return function(value) { @@ -36776,18 +37962,6 @@ return jQuery; }); } - /** - * Checks if a cache value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - /** * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol * that is not found in the character symbols. @@ -36885,18 +38059,6 @@ return jQuery; return '\\' + stringEscapes[chr]; } - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * @@ -36908,7 +38070,7 @@ return jQuery; */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); + index = fromIndex + (fromRight ? 0 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; @@ -36956,11 +38118,11 @@ return jQuery; } /** - * Converts `map` to its key-value pairs. + * Converts `map` to an array. * * @private * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. + * @returns {Array} Returns the converted array. */ function mapToArray(map) { var index = -1, @@ -36998,11 +38160,11 @@ return jQuery; } /** - * Converts `set` to an array of its values. + * Converts `set` to an array. * * @private * @param {Object} set The set to convert. - * @returns {Array} Returns the values. + * @returns {Array} Returns the converted array. */ function setToArray(set) { var index = -1, @@ -37014,23 +38176,6 @@ return jQuery; return result; } - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - /** * Gets the number of symbols in `string`. * @@ -37099,10 +38244,10 @@ return jQuery; * lodash.isFunction(lodash.bar); * // => true * - * // Use `context` to stub `Date#getTime` use in `_.now`. - * var stubbed = _.runInContext({ + * // Use `context` to mock `Date#getTime` use in `_.now`. + * var mock = _.runInContext({ * 'Date': function() { - * return { 'getTime': stubGetTime }; + * return { 'getTime': getTimeMock }; * } * }); * @@ -37124,15 +38269,6 @@ return jQuery; objectProto = context.Object.prototype, stringProto = context.String.prototype; - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - /** Used to resolve the decompiled source of functions. */ var funcToString = context.Function.prototype.toString; @@ -37166,16 +38302,15 @@ return jQuery; Reflect = context.Reflect, Symbol = context.Symbol, Uint8Array = context.Uint8Array, + clearTimeout = context.clearTimeout, enumerate = Reflect ? Reflect.enumerate : undefined, getOwnPropertySymbols = Object.getOwnPropertySymbols, iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, + setTimeout = context.setTimeout, splice = arrayProto.splice; - /** Built-in method references that are mockable. */ - var setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); }; - /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeFloor = Math.floor, @@ -37294,24 +38429,22 @@ return jQuery; * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`, * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`, - * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, - * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, - * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, - * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` + * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`, + * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, + * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`, + * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, + * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, + * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, + * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, + * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`, + * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, + * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, + * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, + * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`, + * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`, + * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, + * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -37570,212 +38703,64 @@ return jQuery; * * @private * @constructor - * @param {Array} [entries] The key-value pairs to cache. + * @returns {Object} Returns the new hash object. */ - function Hash(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - } + function Hash() {} /** * Removes `key` and its value from the hash. * * @private - * @name delete - * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ - function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; + function hashDelete(hash, key) { + return hashHas(hash, key) && delete hash[key]; } /** * Gets the hash value for `key`. * * @private - * @name get - * @memberOf Hash + * @param {Object} hash The hash to query. * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ - function hashGet(key) { - var data = this.__data__; + function hashGet(hash, key) { if (nativeCreate) { - var result = data[key]; + var result = hash[key]; return result === HASH_UNDEFINED ? undefined : result; } - return hasOwnProperty.call(data, key) ? data[key] : undefined; + return hasOwnProperty.call(hash, key) ? hash[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private - * @name has - * @memberOf Hash + * @param {Object} hash The hash to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); + function hashHas(hash, key) { + return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); } /** * Sets the hash `key` to `value`. * * @private - * @name set - * @memberOf Hash + * @param {Object} hash The hash to modify. * @param {string} key The key of the value to set. * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. */ - function hashSet(key, value) { - var data = this.__data__; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; + function hashSet(hash, key, value) { + hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; } - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - } - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; + // Avoid inheriting from `Object.prototype` when possible. + Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; /*------------------------------------------------------------------------*/ @@ -37784,15 +38769,15 @@ return jQuery; * * @private * @constructor - * @param {Array} [entries] The key-value pairs to cache. + * @param {Array} [values] The values to cache. */ - function MapCache(entries) { + function MapCache(values) { var index = -1, - length = entries ? entries.length : 0; + length = values ? values.length : 0; this.clear(); while (++index < length) { - var entry = entries[index]; + var entry = values[index]; this.set(entry[0], entry[1]); } } @@ -37804,10 +38789,10 @@ return jQuery; * @name clear * @memberOf MapCache */ - function mapCacheClear() { + function mapClear() { this.__data__ = { 'hash': new Hash, - 'map': new (Map || ListCache), + 'map': Map ? new Map : [], 'string': new Hash }; } @@ -37821,8 +38806,12 @@ return jQuery; * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ - function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); + function mapDelete(key) { + var data = this.__data__; + if (isKeyable(key)) { + return hashDelete(typeof key == 'string' ? data.string : data.hash, key); + } + return Map ? data.map['delete'](key) : assocDelete(data.map, key); } /** @@ -37834,8 +38823,12 @@ return jQuery; * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); + function mapGet(key) { + var data = this.__data__; + if (isKeyable(key)) { + return hashGet(typeof key == 'string' ? data.string : data.hash, key); + } + return Map ? data.map.get(key) : assocGet(data.map, key); } /** @@ -37847,8 +38840,12 @@ return jQuery; * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); + function mapHas(key) { + var data = this.__data__; + if (isKeyable(key)) { + return hashHas(typeof key == 'string' ? data.string : data.hash, key); + } + return Map ? data.map.has(key) : assocHas(data.map, key); } /** @@ -37861,23 +38858,30 @@ return jQuery; * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ - function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); + function mapSet(key, value) { + var data = this.__data__; + if (isKeyable(key)) { + hashSet(typeof key == 'string' ? data.string : data.hash, key, value); + } else if (Map) { + data.map.set(key, value); + } else { + assocSet(data.map, key, value); + } return this; } // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; + MapCache.prototype.clear = mapClear; + MapCache.prototype['delete'] = mapDelete; + MapCache.prototype.get = mapGet; + MapCache.prototype.has = mapHas; + MapCache.prototype.set = mapSet; /*------------------------------------------------------------------------*/ /** * - * Creates an array cache object to store unique values. + * Creates a set cache object to store unique values. * * @private * @constructor @@ -37889,41 +38893,52 @@ return jQuery; this.__data__ = new MapCache; while (++index < length) { - this.add(values[index]); + this.push(values[index]); } } /** - * Adds `value` to the array cache. + * Checks if `value` is in `cache`. * * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache + * @param {Object} cache The set cache to search. * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ - function setCacheHas(value) { - return this.__data__.has(value); + function cacheHas(cache, value) { + var map = cache.__data__; + if (isKeyable(value)) { + var data = map.__data__, + hash = typeof value == 'string' ? data.string : data.hash; + + return hash[value] === HASH_UNDEFINED; + } + return map.has(value); + } + + /** + * Adds `value` to the set cache. + * + * @private + * @name push + * @memberOf SetCache + * @param {*} value The value to cache. + */ + function cachePush(value) { + var map = this.__data__; + if (isKeyable(value)) { + var data = map.__data__, + hash = typeof value == 'string' ? data.string : data.hash; + + hash[value] = HASH_UNDEFINED; + } + else { + map.set(value, HASH_UNDEFINED); + } } // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; + SetCache.prototype.push = cachePush; /*------------------------------------------------------------------------*/ @@ -37932,10 +38947,17 @@ return jQuery; * * @private * @constructor - * @param {Array} [entries] The key-value pairs to cache. + * @param {Array} [values] The values to cache. */ - function Stack(entries) { - this.__data__ = new ListCache(entries); + function Stack(values) { + var index = -1, + length = values ? values.length : 0; + + this.clear(); + while (++index < length) { + var entry = values[index]; + this.set(entry[0], entry[1]); + } } /** @@ -37946,7 +38968,7 @@ return jQuery; * @memberOf Stack */ function stackClear() { - this.__data__ = new ListCache; + this.__data__ = { 'array': [], 'map': null }; } /** @@ -37959,7 +38981,10 @@ return jQuery; * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { - return this.__data__['delete'](key); + var data = this.__data__, + array = data.array; + + return array ? assocDelete(array, key) : data.map['delete'](key); } /** @@ -37972,7 +38997,10 @@ return jQuery; * @returns {*} Returns the entry value. */ function stackGet(key) { - return this.__data__.get(key); + var data = this.__data__, + array = data.array; + + return array ? assocGet(array, key) : data.map.get(key); } /** @@ -37985,7 +39013,10 @@ return jQuery; * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { - return this.__data__.has(key); + var data = this.__data__, + array = data.array; + + return array ? assocHas(array, key) : data.map.has(key); } /** @@ -37999,11 +39030,21 @@ return jQuery; * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) { - cache = this.__data__ = new MapCache(cache.__data__); + var data = this.__data__, + array = data.array; + + if (array) { + if (array.length < (LARGE_ARRAY_SIZE - 1)) { + assocSet(array, key, value); + } else { + data.array = null; + data.map = new MapCache(array); + } + } + var map = data.map; + if (map) { + map.set(key, value); } - cache.set(key, value); return this; } @@ -38016,6 +39057,90 @@ return jQuery; /*------------------------------------------------------------------------*/ + /** + * Removes `key` and its value from the associative array. + * + * @private + * @param {Array} array The array to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function assocDelete(array, key) { + var index = assocIndexOf(array, key); + if (index < 0) { + return false; + } + var lastIndex = array.length - 1; + if (index == lastIndex) { + array.pop(); + } else { + splice.call(array, index, 1); + } + return true; + } + + /** + * Gets the associative array value for `key`. + * + * @private + * @param {Array} array The array to query. + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function assocGet(array, key) { + var index = assocIndexOf(array, key); + return index < 0 ? undefined : array[index][1]; + } + + /** + * Checks if an associative array value for `key` exists. + * + * @private + * @param {Array} array The array to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function assocHas(array, key) { + return assocIndexOf(array, key) > -1; + } + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + /** + * Sets the associative array `key` to `value`. + * + * @private + * @param {Array} array The array to modify. + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + */ + function assocSet(array, key, value) { + var index = assocIndexOf(array, key); + if (index < 0) { + array.push([key, value]); + } else { + array[index][1] = value; + } + } + + /*------------------------------------------------------------------------*/ + /** * Used by `_.defaults` to customize its `_.assignIn` use. * @@ -38068,24 +39193,6 @@ return jQuery; } } - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to search. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - /** * Aggregates elements of `collection` on `accumulator` with keys transformed * by `iteratee` and values set by `setter`. @@ -38123,7 +39230,7 @@ return jQuery; * @private * @param {Object} object The object to iterate over. * @param {string[]} paths The property paths of elements to pick. - * @returns {Array} Returns the picked elements. + * @returns {Array} Returns the new array of picked elements. */ function baseAt(object, paths) { var index = -1, @@ -38238,7 +39345,7 @@ return jQuery; * * @private * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. */ function baseConforms(source) { var props = keys(source), @@ -38551,7 +39658,7 @@ return jQuery; * @private * @param {Object} object The object to inspect. * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. + * @returns {Array} Returns the new array of filtered property names. */ function baseFunctions(object, props) { return arrayFilter(props, function(key) { @@ -38592,7 +39699,9 @@ return jQuery; */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + return isArray(object) + ? result + : arrayPush(result, symbolsFunc(object)); } /** @@ -38612,7 +39721,7 @@ return jQuery; * The base implementation of `_.has` without support for deep paths. * * @private - * @param {Object} [object] The object to query. + * @param {Object} object The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ @@ -38620,21 +39729,20 @@ return jQuery; // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); + return hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private - * @param {Object} [object] The object to query. + * @param {Object} object The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { - return object != null && key in Object(object); + return key in Object(object); } /** @@ -38888,22 +39996,6 @@ return jQuery; return true; } - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - /** * The base implementation of `_.iteratee`. * @@ -39001,7 +40093,7 @@ return jQuery; * * @private * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. */ function baseMatches(source) { var matchData = getMatchData(source); @@ -39019,7 +40111,7 @@ return jQuery; * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { @@ -39234,7 +40326,7 @@ return jQuery; * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { @@ -39247,7 +40339,7 @@ return jQuery; * * @private * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. + * @returns {Function} Returns the new function. */ function basePropertyDeep(path) { return function(object) { @@ -39272,9 +40364,6 @@ return jQuery; length = values.length, seen = array; - if (array === values) { - values = copyArray(values); - } if (iteratee) { seen = arrayMap(array, baseUnary(iteratee)); } @@ -39351,7 +40440,7 @@ return jQuery; * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. + * @returns {Array} Returns the new array of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, @@ -40065,7 +41154,7 @@ return jQuery; * placeholders, and provided arguments into a single array of arguments. * * @private - * @param {Array} args The provided arguments. + * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. * @params {boolean} [isCurried] Specify composing for a curried function. @@ -40100,7 +41189,7 @@ return jQuery; * is tailored for `_.partialRight`. * * @private - * @param {Array} args The provided arguments. + * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. * @params {boolean} [isCurried] Specify composing for a curried function. @@ -40222,7 +41311,7 @@ return jQuery; customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - customizer = (assigner.length > 3 && typeof customizer == 'function') + customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; @@ -40321,7 +41410,7 @@ return jQuery; * * @private * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. + * @returns {Function} Returns the new function. */ function createCaseFirst(methodName) { return function(string) { @@ -40406,7 +41495,7 @@ return jQuery; var length = arguments.length, args = Array(length), index = length, - placeholder = getHolder(wrapper); + placeholder = getPlaceholder(wrapper); while (index--) { args[index] = arguments[index]; @@ -40427,31 +41516,6 @@ return jQuery; return wrapper; } - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - predicate = getIteratee(predicate, 3); - if (!isArrayLike(collection)) { - var props = keys(collection); - } - var index = findIndexFunc(props || collection, function(value, key) { - if (props) { - key = value; - value = iterable[key]; - } - return predicate(value, key, iterable); - }, fromIndex); - return index > -1 ? collection[props ? props[index] : index] : undefined; - }; - } - /** * Creates a `_.flow` or `_.flowRight` function. * @@ -40546,14 +41610,14 @@ return jQuery; function wrapper() { var length = arguments.length, - args = Array(length), - index = length; + index = length, + args = Array(length); while (index--) { args[index] = arguments[index]; } if (isCurried) { - var placeholder = getHolder(wrapper), + var placeholder = getPlaceholder(wrapper), holdersCount = countHolders(args, placeholder); } if (partials) { @@ -40642,7 +41706,7 @@ return jQuery; * * @private * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. + * @returns {Function} Returns the new invoker function. */ function createOver(arrayFunc) { return rest(function(iteratees) { @@ -40815,7 +41879,7 @@ return jQuery; var func = Math[methodName]; return function(number, precision) { number = toNumber(number); - precision = nativeMin(toInteger(precision), 292); + precision = toInteger(precision); if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. @@ -40840,26 +41904,6 @@ return jQuery; return new Set(values); }; - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - /** * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. @@ -40877,7 +41921,6 @@ return jQuery; * 64 - `_.partialRight` * 128 - `_.rearg` * 256 - `_.ary` - * 512 - `_.flip` * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to be partially applied. * @param {Array} [holders] The `partials` placeholder indexes. @@ -40956,7 +41999,9 @@ return jQuery; * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + var index = -1, + isPartial = bitmask & PARTIAL_COMPARE_FLAG, + isUnordered = bitmask & UNORDERED_COMPARE_FLAG, arrLength = array.length, othLength = other.length; @@ -40968,10 +42013,7 @@ return jQuery; if (stacked) { return stacked == other; } - var index = -1, - result = true, - seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; - + var result = true; stack.set(array, other); // Ignore non-index properties. @@ -40992,12 +42034,10 @@ return jQuery; break; } // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!seen.has(othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { - return seen.add(othIndex); - } + if (isUnordered) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { result = false; break; @@ -41231,18 +42271,6 @@ return jQuery; return result; } - /** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ - function getHolder(func) { - var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; - return object.placeholder; - } - /** * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, * this function returns the custom method, otherwise it returns `baseIteratee`. @@ -41273,21 +42301,6 @@ return jQuery; */ var getLength = baseProperty('length'); - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - /** * Gets the property names, values, and compare flags of `object`. * @@ -41296,14 +42309,11 @@ return jQuery; * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { - var result = keys(object), + var result = toPairs(object), length = result.length; while (length--) { - var key = result[length], - value = object[key]; - - result[length] = [key, value, isStrictComparable(value)]; + result[length][2] = isStrictComparable(result[length][1]); } return result; } @@ -41317,8 +42327,20 @@ return jQuery; * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; + var value = object[key]; + return isNative(value) ? value : undefined; + } + + /** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getPlaceholder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; } /** @@ -41347,7 +42369,9 @@ return jQuery; // Fallback for IE < 11. if (!getOwnPropertySymbols) { - getSymbols = stubArray; + getSymbols = function() { + return []; + }; } /** @@ -41568,7 +42592,7 @@ return jQuery; * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { - return isArray(value) || isArguments(value); + return isArrayLikeObject(value) && (isArray(value) || isArguments(value)); } /** @@ -41679,26 +42703,6 @@ return jQuery; return !!data && func === data[0]; } - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ - var isMaskable = coreJsData ? isFunction : stubFalse; - /** * Checks if `value` is likely a prototype object. * @@ -41732,7 +42736,7 @@ return jQuery; * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. */ function matchesStrictComparable(key, srcValue) { return function(object) { @@ -41984,7 +42988,7 @@ return jQuery; * @param {Array} array The array to process. * @param {number} [size=1] The length of each chunk * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. + * @returns {Array} Returns the new array containing chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); @@ -42067,16 +43071,16 @@ return jQuery; */ function concat() { var length = arguments.length, - args = Array(length ? length - 1 : 0), - array = arguments[0], - index = length; + array = castArray(arguments[0]); - while (index--) { - args[index - 1] = arguments[index]; + if (length < 2) { + return length ? copyArray(array) : []; } - return length - ? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)) - : []; + var args = Array(length - 1); + while (length--) { + args[length - 1] = arguments[length]; + } + return arrayConcat(array, baseFlatten(args, 1)); } /** @@ -42095,8 +43099,8 @@ return jQuery; * @see _.without, _.xor * @example * - * _.difference([2, 1], [2, 3]); - * // => [1] + * _.difference([3, 2, 1], [4, 2]); + * // => [3, 1] */ var difference = rest(function(array, values) { return isArrayLikeObject(array) @@ -42121,8 +43125,8 @@ return jQuery; * @returns {Array} Returns the new array of filtered values. * @example * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] + * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); + * // => [3.1, 1.3] * * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); @@ -42374,7 +43378,6 @@ return jQuery; * @param {Array} array The array to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * @@ -42399,16 +43402,10 @@ return jQuery; * _.findIndex(users, 'active'); * // => 2 */ - function findIndex(array, predicate, fromIndex) { - var length = array ? array.length : 0; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, getIteratee(predicate, 3), index); + function findIndex(array, predicate) { + return (array && array.length) + ? baseFindIndex(array, getIteratee(predicate, 3)) + : -1; } /** @@ -42422,7 +43419,6 @@ return jQuery; * @param {Array} array The array to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * @@ -42447,19 +43443,10 @@ return jQuery; * _.findLastIndex(users, 'active'); * // => 0 */ - function findLastIndex(array, predicate, fromIndex) { - var length = array ? array.length : 0; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); + function findLastIndex(array, predicate) { + return (array && array.length) + ? baseFindIndex(array, getIteratee(predicate, 3), true) + : -1; } /** @@ -42606,11 +43593,11 @@ return jQuery; if (!length) { return -1; } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); + fromIndex = toInteger(fromIndex); + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); } - return baseIndexOf(array, value, index); + return baseIndexOf(array, value, fromIndex); } /** @@ -42645,7 +43632,7 @@ return jQuery; * @returns {Array} Returns the new array of intersecting values. * @example * - * _.intersection([2, 1], [2, 3]); + * _.intersection([2, 1], [4, 2], [1, 2]); * // => [2] */ var intersection = rest(function(arrays) { @@ -42671,7 +43658,7 @@ return jQuery; * @returns {Array} Returns the new array of intersecting values. * @example * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1] * * // The `_.property` iteratee shorthand. @@ -42801,7 +43788,7 @@ return jQuery; ) + 1; } if (value !== value) { - return indexOfNaN(array, index - 1, true); + return indexOfNaN(array, index, true); } while (index--) { if (array[index] === value) { @@ -42812,8 +43799,8 @@ return jQuery; } /** - * Gets the element at index `n` of `array`. If `n` is negative, the nth - * element from the end is returned. + * Gets the nth element of `array`. If `n` is negative, the nth element + * from the end is returned. * * @static * @memberOf _ @@ -42853,11 +43840,11 @@ return jQuery; * @returns {Array} Returns `array`. * @example * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * var array = [1, 2, 3, 1, 2, 3]; * - * _.pull(array, 'a', 'c'); + * _.pull(array, 2, 3); * console.log(array); - * // => ['b', 'b'] + * // => [1, 1] */ var pull = rest(pullAll); @@ -42875,11 +43862,11 @@ return jQuery; * @returns {Array} Returns `array`. * @example * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * var array = [1, 2, 3, 1, 2, 3]; * - * _.pullAll(array, ['a', 'c']); + * _.pullAll(array, [2, 3]); * console.log(array); - * // => ['b', 'b'] + * // => [1, 1] */ function pullAll(array, values) { return (array && array.length && values && values.length) @@ -42961,14 +43948,14 @@ return jQuery; * @returns {Array} Returns the new array of removed elements. * @example * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = _.pullAt(array, [1, 3]); + * var array = [5, 10, 15, 20]; + * var evens = _.pullAt(array, 1, 3); * * console.log(array); - * // => ['a', 'c'] + * // => [5, 15] * - * console.log(pulled); - * // => ['b', 'd'] + * console.log(evens); + * // => [10, 20] */ var pullAt = rest(function(array, indexes) { indexes = baseFlatten(indexes, 1); @@ -43108,6 +44095,9 @@ return jQuery; * * _.sortedIndex([30, 50], 40); * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); @@ -43130,13 +44120,13 @@ return jQuery; * into `array`. * @example * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; * - * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 0 + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 * * // The `_.property` iteratee shorthand. - * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { @@ -43156,8 +44146,8 @@ return jQuery; * @returns {number} Returns the index of the matched value, else `-1`. * @example * - * _.sortedIndexOf([4, 5, 5, 5, 6], 5); - * // => 1 + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 */ function sortedIndexOf(array, value) { var length = array ? array.length : 0; @@ -43185,8 +44175,8 @@ return jQuery; * into `array`. * @example * - * _.sortedLastIndex([4, 5, 5, 5, 6], 5); - * // => 4 + * _.sortedLastIndex([4, 5], 4); + * // => 1 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); @@ -43209,13 +44199,8 @@ return jQuery; * into `array`. * @example * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 1 - * * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { @@ -43235,7 +44220,7 @@ return jQuery; * @returns {number} Returns the index of the matched value, else `-1`. * @example * - * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); + * _.sortedLastIndexOf([1, 1, 2, 2], 2); * // => 3 */ function sortedLastIndexOf(array, value) { @@ -43475,8 +44460,8 @@ return jQuery; * @returns {Array} Returns the new array of combined values. * @example * - * _.union([2], [1, 2]); - * // => [2, 1] + * _.union([2, 1], [4, 2], [1, 2]); + * // => [2, 1, 4] */ var union = rest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); @@ -43498,8 +44483,8 @@ return jQuery; * @returns {Array} Returns the new array of combined values. * @example * - * _.unionBy([2.1], [1.2, 2.3], Math.floor); - * // => [2.1, 1.2] + * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1, 1.2, 4.3] * * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -43606,7 +44591,7 @@ return jQuery; * @returns {Array} Returns the new duplicate free array. * @example * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] @@ -43695,13 +44680,13 @@ return jQuery; * @memberOf _ * @since 0.1.0 * @category Array - * @param {Array} array The array to inspect. + * @param {Array} array The array to filter. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @see _.difference, _.xor * @example * - * _.without([2, 1, 2, 3], 1, 2); + * _.without([1, 2, 1, 3], 1, 2); * // => [3] */ var without = rest(function(array, values) { @@ -43721,12 +44706,12 @@ return jQuery; * @since 2.4.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of filtered values. + * @returns {Array} Returns the new array of values. * @see _.difference, _.without * @example * - * _.xor([2, 1], [2, 3]); - * // => [1, 3] + * _.xor([2, 1], [4, 2]); + * // => [1, 4] */ var xor = rest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); @@ -43745,11 +44730,11 @@ return jQuery; * @param {...Array} [arrays] The arrays to inspect. * @param {Array|Function|Object|string} [iteratee=_.identity] * The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. + * @returns {Array} Returns the new array of values. * @example * - * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2, 3.4] + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] * * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -43774,7 +44759,7 @@ return jQuery; * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. + * @returns {Array} Returns the new array of values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; @@ -43982,6 +44967,9 @@ return jQuery; * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] + * + * _(['a', 'b', 'c']).at(0, 2).value(); + * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { paths = baseFlatten(paths, 1); @@ -44244,7 +45232,6 @@ return jQuery; * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': 1, '6': 2 } * - * // The `_.property` iteratee shorthand. * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ @@ -44350,7 +45337,6 @@ return jQuery; * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -44375,7 +45361,14 @@ return jQuery; * _.find(users, 'active'); * // => object for 'barney' */ - var find = createFind(findIndex); + function find(collection, predicate) { + predicate = getIteratee(predicate, 3); + if (isArray(collection)) { + var index = baseFindIndex(collection, predicate); + return index > -1 ? collection[index] : undefined; + } + return baseFind(collection, predicate, baseEach); + } /** * This method is like `_.find` except that it iterates over elements of @@ -44388,7 +45381,6 @@ return jQuery; * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -44397,7 +45389,14 @@ return jQuery; * }); * // => 3 */ - var findLast = createFind(findLastIndex); + function findLast(collection, predicate) { + predicate = getIteratee(predicate, 3); + if (isArray(collection)) { + var index = baseFindIndex(collection, predicate, true); + return index > -1 ? collection[index] : undefined; + } + return baseFind(collection, predicate, baseEachRight); + } /** * Creates a flattened array of values by running each element in `collection` @@ -44508,8 +45507,9 @@ return jQuery; * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee, 3)); + return (typeof iteratee == 'function' && isArray(collection)) + ? arrayEach(collection, iteratee) + : baseEach(collection, getIteratee(iteratee)); } /** @@ -44533,8 +45533,9 @@ return jQuery; * // => Logs `2` then `1`. */ function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee, 3)); + return (typeof iteratee == 'function' && isArray(collection)) + ? arrayEachRight(collection, iteratee) + : baseEachRight(collection, getIteratee(iteratee)); } /** @@ -45154,6 +46155,7 @@ return jQuery; * @static * @memberOf _ * @since 2.4.0 + * @type {Function} * @category Date * @returns {number} Returns the timestamp. * @example @@ -45161,11 +46163,9 @@ return jQuery; * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. + * // => Logs the number of milliseconds it took for the deferred function to be invoked. */ - function now() { - return Date.now(); - } + var now = Date.now; /*------------------------------------------------------------------------*/ @@ -45216,7 +46216,7 @@ return jQuery; * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. + * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.ary(parseInt, 1)); @@ -45269,7 +46269,7 @@ return jQuery; * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * **Note:** Unlike native `Function#bind` this method doesn't set the "length" * property of bound functions. * * @static @@ -45300,7 +46300,7 @@ return jQuery; var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); + var holders = replaceHolders(partials, getPlaceholder(bind)); bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); @@ -45354,7 +46354,7 @@ return jQuery; var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); + var holders = replaceHolders(partials, getPlaceholder(bindKey)); bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); @@ -45509,7 +46509,7 @@ return jQuery; maxWait, result, timerId, - lastCallTime, + lastCallTime = 0, lastInvokeTime = 0, leading = false, maxing = false, @@ -45560,7 +46560,7 @@ return jQuery; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + return (!lastCallTime || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } @@ -45574,6 +46574,7 @@ return jQuery; } function trailingEdge(time) { + clearTimeout(timerId); timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been @@ -45586,8 +46587,11 @@ return jQuery; } function cancel() { - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastCallTime = lastInvokeTime = 0; + lastArgs = lastThis = timerId = undefined; } function flush() { @@ -45608,6 +46612,7 @@ return jQuery; } if (maxing) { // Handle invocations in a tight loop. + clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } @@ -45675,7 +46680,7 @@ return jQuery; * @since 4.0.0 * @category Function * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. + * @returns {Function} Returns the new function. * @example * * var flipped = _.flip(function() { @@ -45708,7 +46713,7 @@ return jQuery; * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. + * @returns {Function} Returns the new memoizing function. * @example * * var object = { 'a': 1, 'b': 2 }; @@ -45766,7 +46771,7 @@ return jQuery; * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. + * @returns {Function} Returns the new function. * @example * * function isEven(n) { @@ -45831,7 +46836,7 @@ return jQuery; * * var func = _.overArgs(function(x, y) { * return [x, y]; - * }, [square, doubled]); + * }, square, doubled); * * func(9, 3); * // => [81, 6] @@ -45890,7 +46895,7 @@ return jQuery; * // => 'hi fred' */ var partial = rest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); + var holders = replaceHolders(partials, getPlaceholder(partial)); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); @@ -45927,7 +46932,7 @@ return jQuery; * // => 'hello fred' */ var partialRight = rest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); + var holders = replaceHolders(partials, getPlaceholder(partialRight)); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); @@ -45948,7 +46953,7 @@ return jQuery; * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; - * }, [2, 0, 1]); + * }, 2, 0, 1); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] @@ -46129,7 +47134,7 @@ return jQuery; * @since 4.0.0 * @category Function * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. + * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.unary(parseInt)); @@ -46587,7 +47592,7 @@ return jQuery; * _.isBuffer(new Uint8Array(2)); * // => false */ - var isBuffer = !Buffer ? stubFalse : function(value) { + var isBuffer = !Buffer ? constant(false) : function(value) { return value instanceof Buffer; }; @@ -46805,14 +47810,14 @@ return jQuery; * _.isFinite(3); * // => true * - * _.isFinite(Number.MIN_VALUE); + * _.isFinite(Number.MAX_VALUE); + * // => true + * + * _.isFinite(3.14); * // => true * * _.isFinite(Infinity); * // => false - * - * _.isFinite('3'); - * // => false */ function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); @@ -47087,15 +48092,7 @@ return jQuery; } /** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the - * presence of the `core-js` package because `core-js` circumvents this kind - * of detection. Despite multiple requests, the `core-js` maintainer has made - * it clear: any attempt to fix the detection will be obstructed. As a result, - * we're left with little choice but to throw an error. Unfortunately, this - * also affects packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on `core-js`. + * Checks if `value` is a native function. * * @static * @memberOf _ @@ -47113,10 +48110,11 @@ return jQuery; * // => false */ function isNative(value) { - if (isMaskable(value)) { - throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.'); + if (!isObject(value)) { + return false; } - return baseIsNative(value); + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } /** @@ -47540,45 +48538,10 @@ return jQuery; return func(value); } - /** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */ - function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - return value === value ? value : 0; - } - /** * Converts `value` to an integer. * - * **Note:** This method is loosely based on + * **Note:** This function is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -47589,7 +48552,7 @@ return jQuery; * @returns {number} Returns the converted integer. * @example * - * _.toInteger(3.2); + * _.toInteger(3); * // => 3 * * _.toInteger(Number.MIN_VALUE); @@ -47598,14 +48561,20 @@ return jQuery; * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * - * _.toInteger('3.2'); + * _.toInteger('3'); * // => 3 */ function toInteger(value) { - var result = toFinite(value), - remainder = result % 1; - - return result === result ? (remainder ? result - remainder : result) : 0; + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + var remainder = value % 1; + return value === value ? (remainder ? value - remainder : value) : 0; } /** @@ -47623,7 +48592,7 @@ return jQuery; * @returns {number} Returns the converted integer. * @example * - * _.toLength(3.2); + * _.toLength(3); * // => 3 * * _.toLength(Number.MIN_VALUE); @@ -47632,7 +48601,7 @@ return jQuery; * _.toLength(Infinity); * // => 4294967295 * - * _.toLength('3.2'); + * _.toLength('3'); * // => 3 */ function toLength(value) { @@ -47650,8 +48619,8 @@ return jQuery; * @returns {number} Returns the number. * @example * - * _.toNumber(3.2); - * // => 3.2 + * _.toNumber(3); + * // => 3 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 @@ -47659,8 +48628,8 @@ return jQuery; * _.toNumber(Infinity); * // => Infinity * - * _.toNumber('3.2'); - * // => 3.2 + * _.toNumber('3'); + * // => 3 */ function toNumber(value) { if (typeof value == 'number') { @@ -47723,7 +48692,7 @@ return jQuery; * @returns {number} Returns the converted integer. * @example * - * _.toSafeInteger(3.2); + * _.toSafeInteger(3); * // => 3 * * _.toSafeInteger(Number.MIN_VALUE); @@ -47732,7 +48701,7 @@ return jQuery; * _.toSafeInteger(Infinity); * // => 9007199254740991 * - * _.toSafeInteger('3.2'); + * _.toSafeInteger('3'); * // => 3 */ function toSafeInteger(value) { @@ -47925,13 +48894,16 @@ return jQuery; * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths of elements to pick. - * @returns {Array} Returns the picked values. + * @returns {Array} Returns the new array of picked elements. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] + * + * _.at(['a', 'b', 'c'], 0, 2); + * // => ['a', 'c'] */ var at = rest(function(object, paths) { return baseAt(object, baseFlatten(paths, 1)); @@ -48064,7 +49036,7 @@ return jQuery; * // => 'barney' */ function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + return baseFind(object, getIteratee(predicate, 3), baseForOwn, true); } /** @@ -48104,7 +49076,7 @@ return jQuery; * // => 'pebbles' */ function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true); } /** @@ -48138,7 +49110,7 @@ return jQuery; function forIn(object, iteratee) { return object == null ? object - : baseFor(object, getIteratee(iteratee, 3), keysIn); + : baseFor(object, getIteratee(iteratee), keysIn); } /** @@ -48170,7 +49142,7 @@ return jQuery; function forInRight(object, iteratee) { return object == null ? object - : baseForRight(object, getIteratee(iteratee, 3), keysIn); + : baseForRight(object, getIteratee(iteratee), keysIn); } /** @@ -48202,7 +49174,7 @@ return jQuery; * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forOwn(object, iteratee) { - return object && baseForOwn(object, getIteratee(iteratee, 3)); + return object && baseForOwn(object, getIteratee(iteratee)); } /** @@ -48232,7 +49204,7 @@ return jQuery; * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. */ function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, getIteratee(iteratee, 3)); + return object && baseForOwnRight(object, getIteratee(iteratee)); } /** @@ -48244,7 +49216,7 @@ return jQuery; * @memberOf _ * @category Object * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. + * @returns {Array} Returns the new array of property names. * @see _.functionsIn * @example * @@ -48271,7 +49243,7 @@ return jQuery; * @since 4.0.0 * @category Object * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. + * @returns {Array} Returns the new array of property names. * @see _.functions * @example * @@ -48624,7 +49596,7 @@ return jQuery; * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by + * are merged recursively.Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * @@ -48909,8 +49881,7 @@ return jQuery; /** * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. + * which can be consumed by `_.fromPairs`. * * @static * @memberOf _ @@ -48918,7 +49889,7 @@ return jQuery; * @alias entries * @category Object * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. + * @returns {Array} Returns the new array of key-value pairs. * @example * * function Foo() { @@ -48931,12 +49902,13 @@ return jQuery; * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ - var toPairs = createToPairs(keys); + function toPairs(object) { + return baseToPairs(object, keys(object)); + } /** * Creates an array of own and inherited enumerable string keyed-value pairs - * for `object` which can be consumed by `_.fromPairs`. If `object` is a map - * or set, its entries are returned. + * for `object` which can be consumed by `_.fromPairs`. * * @static * @memberOf _ @@ -48944,7 +49916,7 @@ return jQuery; * @alias entriesIn * @category Object * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. + * @returns {Array} Returns the new array of key-value pairs. * @example * * function Foo() { @@ -48955,24 +49927,25 @@ return jQuery; * Foo.prototype.c = 3; * * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) + * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) */ - var toPairsIn = createToPairs(keysIn); + function toPairsIn(object) { + return baseToPairs(object, keysIn(object)); + } /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. + * potentially mutating the `accumulator` object. The iteratee is invoked + * with four arguments: (accumulator, value, key, object). Iteratee functions + * may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 1.3.0 * @category Object - * @param {Object} object The object to iterate over. + * @param {Array|Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. @@ -49394,7 +50367,7 @@ return jQuery; * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search up to. + * @param {number} [position=string.length] The position to search from. * @returns {boolean} Returns `true` if `string` ends with `target`, * else `false`. * @example @@ -49788,7 +50761,7 @@ return jQuery; * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the string segments. + * @returns {Array} Returns the new array of string segments. * @example * * _.split('a-b-c', '-', 2); @@ -49933,6 +50906,12 @@ return jQuery; * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' * + * // Use custom template delimiters. + * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; + * var compiled = _.template('hello {{ user }}!'); + * compiled({ 'user': 'mustache' }); + * // => 'hello mustache!' + * * // Use backslashes to treat delimiters as plain text. * var compiled = _.template('<%= "\\<%- value %\\>" %>'); * compiled({ 'value': 'ignored' }); @@ -49958,15 +50937,9 @@ return jQuery; * // return __p; * // } * - * // Use custom template delimiters. - * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; - * var compiled = _.template('hello {{ user }}!'); - * compiled({ 'user': 'mustache' }); - * // => 'hello mustache!' - * * // Use the `source` property to inline compiled templates for meaningful * // line numbers in error messages and stack traces. - * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ + * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ @@ -50479,7 +51452,7 @@ return jQuery; * } * }; * - * _.bindAll(view, ['onClick']); + * _.bindAll(view, 'onClick'); * jQuery(element).on('click', view.onClick); * // => Logs 'clicked docs' when clicked. */ @@ -50502,7 +51475,7 @@ return jQuery; * @since 4.0.0 * @category Util * @param {Array} pairs The predicate-function pairs. - * @returns {Function} Returns the new composite function. + * @returns {Function} Returns the new function. * @example * * var func = _.cond([ @@ -50552,7 +51525,7 @@ return jQuery; * @since 4.0.0 * @category Util * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. * @example * * var users = [ @@ -50560,7 +51533,7 @@ return jQuery; * { 'user': 'fred', 'age': 40 } * ]; * - * _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } })); + * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); * // => [{ 'user': 'fred', 'age': 40 }] */ function conforms(source) { @@ -50575,15 +51548,13 @@ return jQuery; * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new constant function. + * @returns {Function} Returns the new function. * @example * - * var objects = _.times(2, _.constant({ 'a': 1 })); + * var object = { 'user': 'fred' }; + * var getter = _.constant(object); * - * console.log(objects); - * // => [{ 'a': 1 }, { 'a': 1 }] - * - * console.log(objects[0] === objects[1]); + * getter() === object; * // => true */ function constant(value) { @@ -50602,7 +51573,7 @@ return jQuery; * @since 3.0.0 * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. - * @returns {Function} Returns the new composite function. + * @returns {Function} Returns the new function. * @see _.flowRight * @example * @@ -50610,7 +51581,7 @@ return jQuery; * return n * n; * } * - * var addSquare = _.flow([_.add, square]); + * var addSquare = _.flow(_.add, square); * addSquare(1, 2); * // => 9 */ @@ -50625,7 +51596,7 @@ return jQuery; * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. - * @returns {Function} Returns the new composite function. + * @returns {Function} Returns the new function. * @see _.flow * @example * @@ -50633,7 +51604,7 @@ return jQuery; * return n * n; * } * - * var addSquare = _.flowRight([square, _.add]); + * var addSquare = _.flowRight(square, _.add); * addSquare(1, 2); * // => 9 */ @@ -50652,7 +51623,7 @@ return jQuery; * * var object = { 'user': 'fred' }; * - * console.log(_.identity(object) === object); + * _.identity(object) === object; * // => true */ function identity(value) { @@ -50718,7 +51689,7 @@ return jQuery; * @since 3.0.0 * @category Util * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. * @example * * var users = [ @@ -50746,7 +51717,7 @@ return jQuery; * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. + * @returns {Function} Returns the new function. * @example * * var users = [ @@ -50771,7 +51742,7 @@ return jQuery; * @category Util * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. - * @returns {Function} Returns the new invoker function. + * @returns {Function} Returns the new function. * @example * * var objects = [ @@ -50802,7 +51773,7 @@ return jQuery; * @category Util * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. - * @returns {Function} Returns the new invoker function. + * @returns {Function} Returns the new function. * @example * * var array = _.times(3, _.constant), @@ -50913,7 +51884,8 @@ return jQuery; } /** - * A method that returns `undefined`. + * A no-operation function that returns `undefined` regardless of the + * arguments it receives. * * @static * @memberOf _ @@ -50921,15 +51893,17 @@ return jQuery; * @category Util * @example * - * _.times(2, _.noop); - * // => [undefined, undefined] + * var object = { 'user': 'fred' }; + * + * _.noop(object) === undefined; + * // => true */ function noop() { // No operation performed. } /** - * Creates a function that gets the argument at index `n`. If `n` is negative, + * Creates a function that returns its nth argument. If `n` is negative, * the nth argument from the end is returned. * * @static @@ -50937,7 +51911,7 @@ return jQuery; * @since 4.0.0 * @category Util * @param {number} [n=0] The index of the argument to return. - * @returns {Function} Returns the new pass-thru function. + * @returns {Function} Returns the new function. * @example * * var func = _.nthArg(1); @@ -50968,7 +51942,7 @@ return jQuery; * @returns {Function} Returns the new function. * @example * - * var func = _.over([Math.max, Math.min]); + * var func = _.over(Math.max, Math.min); * * func(1, 2, 3, 4); * // => [4, 1] @@ -50988,7 +51962,7 @@ return jQuery; * @returns {Function} Returns the new function. * @example * - * var func = _.overEvery([Boolean, isFinite]); + * var func = _.overEvery(Boolean, isFinite); * * func('1'); * // => true @@ -51014,7 +51988,7 @@ return jQuery; * @returns {Function} Returns the new function. * @example * - * var func = _.overSome([Boolean, isFinite]); + * var func = _.overSome(Boolean, isFinite); * * func('1'); * // => true @@ -51035,7 +52009,7 @@ return jQuery; * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. + * @returns {Function} Returns the new function. * @example * * var objects = [ @@ -51062,7 +52036,7 @@ return jQuery; * @since 3.0.0 * @category Util * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. + * @returns {Function} Returns the new function. * @example * * var array = [0, 1, 2], @@ -51096,7 +52070,7 @@ return jQuery; * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. - * @returns {Array} Returns the range of numbers. + * @returns {Array} Returns the new array of numbers. * @see _.inRange, _.rangeRight * @example * @@ -51134,7 +52108,7 @@ return jQuery; * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. - * @returns {Array} Returns the range of numbers. + * @returns {Array} Returns the new array of numbers. * @see _.inRange, _.range * @example * @@ -51161,101 +52135,6 @@ return jQuery; */ var rangeRight = createRange(true); - /** - * A method that returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ - function stubArray() { - return []; - } - - /** - * A method that returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ - function stubFalse() { - return false; - } - - /** - * A method that returns a new empty object. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Object} Returns the new empty object. - * @example - * - * var objects = _.times(2, _.stubObject); - * - * console.log(objects); - * // => [{}, {}] - * - * console.log(objects[0] === objects[1]); - * // => false - */ - function stubObject() { - return {}; - } - - /** - * A method that returns an empty string. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {string} Returns the empty string. - * @example - * - * _.times(2, _.stubString); - * // => ['', ''] - */ - function stubString() { - return ''; - } - - /** - * A method that returns `true`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `true`. - * @example - * - * _.times(2, _.stubTrue); - * // => [true, true] - */ - function stubTrue() { - return true; - } - /** * Invokes the iteratee `n` times, returning an array of the results of * each invocation. The iteratee is invoked with one argument; (index). @@ -51272,8 +52151,8 @@ return jQuery; * _.times(3, String); * // => ['0', '1', '2'] * - * _.times(4, _.constant(0)); - * // => [0, 0, 0, 0] + * _.times(4, _.constant(true)); + * // => [true, true, true, true] */ function times(n, iteratee) { n = toInteger(n); @@ -51309,6 +52188,15 @@ return jQuery; * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] + * + * var path = ['a', 'b', 'c'], + * newPath = _.toPath(path); + * + * console.log(newPath); + * // => ['a', 'b', 'c'] + * + * console.log(path === newPath); + * // => false */ function toPath(value) { if (isArray(value)) { @@ -51947,11 +52835,6 @@ return jQuery; lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; - lodash.stubArray = stubArray; - lodash.stubFalse = stubFalse; - lodash.stubObject = stubObject; - lodash.stubString = stubString; - lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; @@ -51986,7 +52869,6 @@ return jQuery; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; - lodash.toFinite = toFinite; lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; @@ -52258,7 +53140,7 @@ return jQuery; // also prevents errors in cases where Lodash is loaded by a script tag in the // presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch // for more details. Use `_.noConflict` to remove Lodash from the global object. - (freeSelf || {})._ = _; + (freeWindow || freeSelf || {})._ = _; // Some AMD build optimizers like r.js check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { @@ -52269,9 +53151,11 @@ return jQuery; }); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. - else if (freeModule) { + else if (freeExports && freeModule) { // Export for Node.js. - (freeModule.exports = _)._ = _; + if (moduleExports) { + (freeModule.exports = _)._ = _; + } // Export for CommonJS support. freeExports._ = _; } @@ -52288,7 +53172,25 @@ return jQuery; module.exports = require('react/lib/ReactDOM'); -},{"react/lib/ReactDOM":103}],"react-router":[function(require,module,exports){ +},{"react/lib/ReactDOM":112}],"react-redux":[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports.connect = exports.Provider = undefined; + +var _Provider = require('./components/Provider'); + +var _Provider2 = _interopRequireDefault(_Provider); + +var _connect = require('./components/connect'); + +var _connect2 = _interopRequireDefault(_connect); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +exports.Provider = _Provider2["default"]; +exports.connect = _connect2["default"]; +},{"./components/Provider":35,"./components/connect":36}],"react-router":[function(require,module,exports){ 'use strict'; exports.__esModule = true; @@ -52445,12 +53347,291 @@ exports.applyRouterMiddleware = _applyRouterMiddleware3.default; exports.browserHistory = _browserHistory3.default; exports.hashHistory = _hashHistory3.default; exports.createMemoryHistory = _createMemoryHistory3.default; -},{"./History":32,"./IndexLink":33,"./IndexRedirect":34,"./IndexRoute":35,"./Lifecycle":37,"./Link":38,"./PatternUtils":39,"./PropTypes":40,"./Redirect":41,"./Route":42,"./RouteContext":43,"./RouteUtils":44,"./Router":45,"./RouterContext":46,"./RoutingContext":48,"./applyRouterMiddleware":50,"./browserHistory":51,"./createMemoryHistory":53,"./hashHistory":59,"./match":61,"./useRouterHistory":64,"./useRoutes":65,"./withRouter":66}],"react":[function(require,module,exports){ +},{"./History":42,"./IndexLink":43,"./IndexRedirect":44,"./IndexRoute":45,"./Lifecycle":47,"./Link":48,"./PatternUtils":49,"./PropTypes":50,"./Redirect":51,"./Route":52,"./RouteContext":53,"./RouteUtils":54,"./Router":55,"./RouterContext":56,"./RoutingContext":58,"./applyRouterMiddleware":60,"./browserHistory":61,"./createMemoryHistory":63,"./hashHistory":69,"./match":71,"./useRouterHistory":74,"./useRoutes":75,"./withRouter":76}],"react":[function(require,module,exports){ 'use strict'; module.exports = require('./lib/React'); -},{"./lib/React":92}],"shallowequal":[function(require,module,exports){ +},{"./lib/React":102}],"redux-logger":[function(require,module,exports){ +"use strict"; + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + +var repeat = function repeat(str, times) { + return new Array(times + 1).join(str); +}; +var pad = function pad(num, maxLength) { + return repeat("0", maxLength - num.toString().length) + num; +}; +var formatTime = function formatTime(time) { + return "@ " + pad(time.getHours(), 2) + ":" + pad(time.getMinutes(), 2) + ":" + pad(time.getSeconds(), 2) + "." + pad(time.getMilliseconds(), 3); +}; + +// Use the new performance api to get better precision if available +var timer = typeof performance !== "undefined" && typeof performance.now === "function" ? performance : Date; + +/** + * parse the level option of createLogger + * + * @property {string | function | object} level - console[level] + * @property {object} action + * @property {array} payload + * @property {string} type + */ + +function getLogLevel(level, action, payload, type) { + switch (typeof level === "undefined" ? "undefined" : _typeof(level)) { + case "object": + return typeof level[type] === "function" ? level[type].apply(level, _toConsumableArray(payload)) : level[type]; + case "function": + return level(action); + default: + return level; + } +} + +/** + * Creates logger with followed options + * + * @namespace + * @property {object} options - options for logger + * @property {string | function | object} options.level - console[level] + * @property {boolean} options.duration - print duration of each action? + * @property {boolean} options.timestamp - print timestamp with each action? + * @property {object} options.colors - custom colors + * @property {object} options.logger - implementation of the `console` API + * @property {boolean} options.logErrors - should errors in action execution be caught, logged, and re-thrown? + * @property {boolean} options.collapsed - is group collapsed? + * @property {boolean} options.predicate - condition which resolves logger behavior + * @property {function} options.stateTransformer - transform state before print + * @property {function} options.actionTransformer - transform action before print + * @property {function} options.errorTransformer - transform error before print + */ + +function createLogger() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var _options$level = options.level; + var level = _options$level === undefined ? "log" : _options$level; + var _options$logger = options.logger; + var logger = _options$logger === undefined ? console : _options$logger; + var _options$logErrors = options.logErrors; + var logErrors = _options$logErrors === undefined ? true : _options$logErrors; + var collapsed = options.collapsed; + var predicate = options.predicate; + var _options$duration = options.duration; + var duration = _options$duration === undefined ? false : _options$duration; + var _options$timestamp = options.timestamp; + var timestamp = _options$timestamp === undefined ? true : _options$timestamp; + var transformer = options.transformer; + var _options$stateTransfo = options.stateTransformer; + var // deprecated + stateTransformer = _options$stateTransfo === undefined ? function (state) { + return state; + } : _options$stateTransfo; + var _options$actionTransf = options.actionTransformer; + var actionTransformer = _options$actionTransf === undefined ? function (actn) { + return actn; + } : _options$actionTransf; + var _options$errorTransfo = options.errorTransformer; + var errorTransformer = _options$errorTransfo === undefined ? function (error) { + return error; + } : _options$errorTransfo; + var _options$colors = options.colors; + var colors = _options$colors === undefined ? { + title: function title() { + return "#000000"; + }, + prevState: function prevState() { + return "#9E9E9E"; + }, + action: function action() { + return "#03A9F4"; + }, + nextState: function nextState() { + return "#4CAF50"; + }, + error: function error() { + return "#F20404"; + } + } : _options$colors; + + // exit if console undefined + + if (typeof logger === "undefined") { + return function () { + return function (next) { + return function (action) { + return next(action); + }; + }; + }; + } + + if (transformer) { + console.error("Option 'transformer' is deprecated, use stateTransformer instead"); + } + + var logBuffer = []; + function printBuffer() { + logBuffer.forEach(function (logEntry, key) { + var started = logEntry.started; + var startedTime = logEntry.startedTime; + var action = logEntry.action; + var prevState = logEntry.prevState; + var error = logEntry.error; + var took = logEntry.took; + var nextState = logEntry.nextState; + + var nextEntry = logBuffer[key + 1]; + if (nextEntry) { + nextState = nextEntry.prevState; + took = nextEntry.started - started; + } + // message + var formattedAction = actionTransformer(action); + var isCollapsed = typeof collapsed === "function" ? collapsed(function () { + return nextState; + }, action) : collapsed; + + var formattedTime = formatTime(startedTime); + var titleCSS = colors.title ? "color: " + colors.title(formattedAction) + ";" : null; + var title = "action " + (timestamp ? formattedTime : "") + " " + formattedAction.type + " " + (duration ? "(in " + took.toFixed(2) + " ms)" : ""); + + // render + try { + if (isCollapsed) { + if (colors.title) logger.groupCollapsed("%c " + title, titleCSS);else logger.groupCollapsed(title); + } else { + if (colors.title) logger.group("%c " + title, titleCSS);else logger.group(title); + } + } catch (e) { + logger.log(title); + } + + var prevStateLevel = getLogLevel(level, formattedAction, [prevState], "prevState"); + var actionLevel = getLogLevel(level, formattedAction, [formattedAction], "action"); + var errorLevel = getLogLevel(level, formattedAction, [error, prevState], "error"); + var nextStateLevel = getLogLevel(level, formattedAction, [nextState], "nextState"); + + if (prevStateLevel) { + if (colors.prevState) logger[prevStateLevel]("%c prev state", "color: " + colors.prevState(prevState) + "; font-weight: bold", prevState);else logger[prevStateLevel]("prev state", prevState); + } + + if (actionLevel) { + if (colors.action) logger[actionLevel]("%c action", "color: " + colors.action(formattedAction) + "; font-weight: bold", formattedAction);else logger[actionLevel]("action", formattedAction); + } + + if (error && errorLevel) { + if (colors.error) logger[errorLevel]("%c error", "color: " + colors.error(error, prevState) + "; font-weight: bold", error);else logger[errorLevel]("error", error); + } + + if (nextStateLevel) { + if (colors.nextState) logger[nextStateLevel]("%c next state", "color: " + colors.nextState(nextState) + "; font-weight: bold", nextState);else logger[nextStateLevel]("next state", nextState); + } + + try { + logger.groupEnd(); + } catch (e) { + logger.log("—— log end ——"); + } + }); + logBuffer.length = 0; + } + + return function (_ref) { + var getState = _ref.getState; + return function (next) { + return function (action) { + // exit early if predicate function returns false + if (typeof predicate === "function" && !predicate(getState, action)) { + return next(action); + } + + var logEntry = {}; + logBuffer.push(logEntry); + + logEntry.started = timer.now(); + logEntry.startedTime = new Date(); + logEntry.prevState = stateTransformer(getState()); + logEntry.action = action; + + var returnedValue = undefined; + if (logErrors) { + try { + returnedValue = next(action); + } catch (e) { + logEntry.error = errorTransformer(e); + } + } else { + returnedValue = next(action); + } + + logEntry.took = timer.now() - logEntry.started; + logEntry.nextState = stateTransformer(getState()); + + printBuffer(); + + if (logEntry.error) throw logEntry.error; + return returnedValue; + }; + }; + }; +} + +module.exports = createLogger; +},{}],"redux":[function(require,module,exports){ +(function (process){ +'use strict'; + +exports.__esModule = true; +exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined; + +var _createStore = require('./createStore'); + +var _createStore2 = _interopRequireDefault(_createStore); + +var _combineReducers = require('./combineReducers'); + +var _combineReducers2 = _interopRequireDefault(_combineReducers); + +var _bindActionCreators = require('./bindActionCreators'); + +var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators); + +var _applyMiddleware = require('./applyMiddleware'); + +var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware); + +var _compose = require('./compose'); + +var _compose2 = _interopRequireDefault(_compose); + +var _warning = require('./utils/warning'); + +var _warning2 = _interopRequireDefault(_warning); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/* +* This is a dummy function to check if the function name has been altered by minification. +* If the function has been minified and NODE_ENV !== 'production', warn the user. +*/ +function isCrushed() {} + +if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') { + (0, _warning2["default"])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.'); +} + +exports.createStore = _createStore2["default"]; +exports.combineReducers = _combineReducers2["default"]; +exports.bindActionCreators = _bindActionCreators2["default"]; +exports.applyMiddleware = _applyMiddleware2["default"]; +exports.compose = _compose2["default"]; +}).call(this,require('_process')) + +},{"./applyMiddleware":240,"./bindActionCreators":241,"./combineReducers":242,"./compose":243,"./createStore":244,"./utils/warning":245,"_process":33}],"shallowequal":[function(require,module,exports){ 'use strict'; var fetchKeys = require('lodash.keys'); diff --git a/web/package.json b/web/package.json index 88e976e13..bb32a2dce 100644 --- a/web/package.json +++ b/web/package.json @@ -23,11 +23,15 @@ "lodash": "^4.11.2", "react": "^15.0.2", "react-dom": "^15.0.2", + "react-redux": "^4.4.5", "react-router": "^2.4.0", + "redux": "^3.5.2", + "redux-logger": "^2.6.1", "shallowequal": "^0.2.2" }, "devDependencies": { "babel-core": "^6.7.7", + "babel-eslint": "^6.0.4", "babel-jest": "^12.0.2", "babel-plugin-transform-class-properties": "^6.6.0", "babel-plugin-transform-object-rest-spread": "^6.8.0", diff --git a/web/src/css/eventlog.less b/web/src/css/eventlog.less index 26dea3ccd..908312cd5 100644 --- a/web/src/css/eventlog.less +++ b/web/src/css/eventlog.less @@ -33,6 +33,14 @@ } } + .btn-toggle { + margin-top: -2px; + margin-left: 3px; + padding: 2px 2px; + font-size: 10px; + line-height: 10px; + border-radius: 2px; + } .label { cursor: pointer; vertical-align: middle; diff --git a/web/src/css/header.less b/web/src/css/header.less index b1bd9c041..4813b9333 100644 --- a/web/src/css/header.less +++ b/web/src/css/header.less @@ -32,20 +32,3 @@ header { overflow-y: auto; } } - -.menu .toggle-btn { - .make-xs-column(4, @menu-row-gutter-width); - .make-sm-column(3, @menu-row-gutter-width); - .make-lg-column(2, @menu-row-gutter-width); - margin-bottom:5px; -} - -.menu .toggle-btn .btn { - width: 100%; -} - -.menu .toggle-input-btn { - .make-sm-column(6, @menu-row-gutter-width); - .make-lg-column(4, @menu-row-gutter-width); - margin-bottom:5px; -} \ No newline at end of file diff --git a/web/src/js/app.js b/web/src/js/app.js index e21fa499a..fc99f1d2e 100644 --- a/web/src/js/app.js +++ b/web/src/js/app.js @@ -1,17 +1,28 @@ import React from "react" -import { render } from 'react-dom' -import $ from "jquery" +import {render} from 'react-dom' +import {applyMiddleware, createStore} from 'redux' +import {Provider} from 'react-redux' +import createLogger from 'redux-logger'; + import Connection from "./connection" -import {app} from "./components/proxyapp.js" -import { EventLogActions } from "./actions.js" +import {App} from "./components/proxyapp.js" +import rootReducer from './ducks/index'; +import {addLogEntry} from "./ducks/eventLog"; -$(function () { - window.ws = new Connection("/updates"); +// logger must be last +const logger = createLogger(); +const store = createStore(rootReducer, applyMiddleware(logger)); - window.onerror = function (msg) { - EventLogActions.add_event(msg); - }; +window.onerror = function (msg) { + store.dispatch(addLogEntry(msg)); +}; + +document.addEventListener('DOMContentLoaded', () => { + window.ws = new Connection("/updates", store.dispatch); + + render( + {App}, + document.getElementById("mitmproxy") + ); - render(app, document.getElementById("mitmproxy")); }); - diff --git a/web/src/js/components/common.js b/web/src/js/components/common.js index 87c34ffc1..3496f1de9 100644 --- a/web/src/js/components/common.js +++ b/web/src/js/components/common.js @@ -108,18 +108,17 @@ export var Splitter = React.createClass({ } }); -export const ToggleButton = (props) => -
-
-  {props.name} -
+export const ToggleButton = ({checked, onToggle, text}) => +
+ +   + {text}
; ToggleButton.propTypes = { - name: React.PropTypes.string.isRequired, - onToggleChanged: React.PropTypes.func.isRequired + checked: React.PropTypes.bool.isRequired, + onToggle: React.PropTypes.func.isRequired, + text: React.PropTypes.string.isRequired }; export class ToggleInputButton extends React.Component { diff --git a/web/src/js/components/eventlog.js b/web/src/js/components/eventlog.js index 6e4f90968..95889a66a 100644 --- a/web/src/js/components/eventlog.js +++ b/web/src/js/components/eventlog.js @@ -1,86 +1,72 @@ import React from "react" import ReactDOM from "react-dom" +import {connect} from 'react-redux' import shallowEqual from "shallowequal" -import {Query} from "../actions.js" +import {toggleEventLogFilter, toggleEventLogVisibility} from "../ducks/eventLog" import AutoScroll from "./helpers/AutoScroll"; import {calcVScroll} from "./helpers/VirtualScroll" -import {StoreView} from "../store/view.js" -import _ from "lodash" +import {ToggleButton} from "./common"; + +function LogIcon({event}) { + let icon = {web: "html5", debug: "bug"}[event.level] || "info"; + return +} + +function LogEntry({event, registerHeight}) { + return
+ + {event.message} +
; +} class EventLogContents extends React.Component { - static contextTypes = { - eventStore: React.PropTypes.object.isRequired, - }; - static defaultProps = { rowHeight: 18, }; - constructor(props, context) { - super(props, context); - - this.view = new StoreView( - this.context.eventStore, - entry => this.props.filter[entry.level] - ); + constructor(props) { + super(props); this.heights = {}; - this.state = { entries: this.view.list, vScroll: calcVScroll() }; + this.state = {vScroll: calcVScroll()}; - this.onChange = this.onChange.bind(this); this.onViewportUpdate = this.onViewportUpdate.bind(this); } componentDidMount() { window.addEventListener("resize", this.onViewportUpdate); - this.view.addListener("add", this.onChange); - this.view.addListener("recalculate", this.onChange); this.onViewportUpdate(); } componentWillUnmount() { window.removeEventListener("resize", this.onViewportUpdate); - this.view.removeListener("add", this.onChange); - this.view.removeListener("recalculate", this.onChange); - this.view.close(); } componentDidUpdate() { this.onViewportUpdate(); } - componentWillReceiveProps(nextProps) { - if (nextProps.filter !== this.props.filter) { - this.view.recalculate( - entry => nextProps.filter[entry.level] - ); - } - } - onViewportUpdate() { const viewport = ReactDOM.findDOMNode(this); const vScroll = calcVScroll({ - itemCount: this.state.entries.length, + itemCount: this.props.events.length, rowHeight: this.props.rowHeight, viewportTop: viewport.scrollTop, viewportHeight: viewport.offsetHeight, - itemHeights: this.state.entries.map(entry => this.heights[entry.id]), + itemHeights: this.props.events.map(entry => this.heights[entry.id]), }); if (!shallowEqual(this.state.vScroll, vScroll)) { - this.setState({ vScroll }); + this.setState({vScroll}); } } - onChange() { - this.setState({ entries: this.view.list }); - } - - setHeight(id, ref) { - if (ref && !this.heights[id]) { - const height = ReactDOM.findDOMNode(ref).offsetHeight; + setHeight(id, node) { + console.log("setHeight", id, node); + if (node && !this.heights[id]) { + const height = node.offsetHeight; if (this.heights[id] !== height) { this.heights[id] = height; this.onViewportUpdate(); @@ -88,97 +74,81 @@ class EventLogContents extends React.Component { } } - getIcon(level) { - return { web: "html5", debug: "bug" }[level] || "info"; - } - render() { const vScroll = this.state.vScroll; - const entries = this.state.entries.slice(vScroll.start, vScroll.end); + const events = this.props.events + .slice(vScroll.start, vScroll.end) + .map(event => + this.setHeight(event.id, node)} + /> + ); return (
                 
- {entries.map((entry, index) => ( -
- - {entry.message} -
- ))} + {events}
); } } -ToggleFilter.propTypes = { - name: React.PropTypes.string.isRequired, - toggleLevel: React.PropTypes.func.isRequired, - active: React.PropTypes.bool, +EventLogContents = AutoScroll(EventLogContents); + + +const EventLogContentsContainer = connect( + state => ({ + events: state.eventLog.filteredEvents + }) +)(EventLogContents); + + +export const ToggleEventLog = connect( + state => ({ + checked: state.eventLog.visible + }), + dispatch => ({ + onToggle: () => dispatch(toggleEventLogVisibility()) + }) +)(ToggleButton); + + +const ToggleFilter = connect( + (state, ownProps) => ({ + checked: state.eventLog.filter[ownProps.text] + }), + (dispatch, ownProps) => ({ + onToggle: () => dispatch(toggleEventLogFilter(ownProps.text)) + }) +)(ToggleButton); + + +const EventLog = ({close}) => +
+
+ Eventlog +
+ + + + +
+
+ +
; + +EventLog.propTypes = { + close: React.PropTypes.func.isRequired }; -function ToggleFilter ({ name, active, toggleLevel }) { - let className = "label "; - if (active) { - className += "label-primary"; - } else { - className += "label-default"; - } +const EventLogContainer = connect( + undefined, + dispatch => ({ + close: () => dispatch(toggleEventLogVisibility()) + }) +)(EventLog); - function onClick(event) { - event.preventDefault(); - toggleLevel(name); - } - - return ( - - {name} - - ); -} - -const AutoScrollEventLog = AutoScroll(EventLogContents); - -var EventLog = React.createClass({ - getInitialState() { - return { - filter: { - "debug": false, - "info": true, - "web": true - } - }; - }, - close() { - var d = {}; - d[Query.SHOW_EVENTLOG] = undefined; - this.props.updateLocation(undefined, d); - }, - toggleLevel(level) { - var filter = _.extend({}, this.state.filter); - filter[level] = !filter[level]; - this.setState({filter: filter}); - }, - render() { - return ( -
-
- Eventlog -
- - - - -
- -
- -
- ); - } -}); - -export default EventLog; +export default EventLogContainer; diff --git a/web/src/js/components/header.js b/web/src/js/components/header.js index adc8bb9b2..4152e95c2 100644 --- a/web/src/js/components/header.js +++ b/web/src/js/components/header.js @@ -1,6 +1,7 @@ import React from "react"; import ReactDOM from 'react-dom'; import $ from "jquery"; +import {connect} from 'react-redux' import Filt from "../filt/filt.js"; import {Key} from "../utils.js"; @@ -8,6 +9,7 @@ import {ToggleInputButton, ToggleButton} from "./common.js"; import {SettingsActions, FlowActions} from "../actions.js"; import {Query} from "../actions.js"; import {SettingsState} from "./common.js"; +import {ToggleEventLog} from "./eventlog" var FilterDocs = React.createClass({ statics: { @@ -224,26 +226,11 @@ var ViewMenu = React.createClass({ title: "View", route: "flows" }, - toggleEventLog: function () { - var d = {}; - if (this.props.query[Query.SHOW_EVENTLOG]) { - d[Query.SHOW_EVENTLOG] = undefined; - } else { - d[Query.SHOW_EVENTLOG] = "t"; // any non-false value will do it, keep it short - } - - this.props.updateLocation(undefined, d); - console.log('toggleevent'); - }, render: function () { - var showEventLog = this.props.query[Query.SHOW_EVENTLOG]; return (
- +
@@ -256,29 +243,29 @@ export const OptionMenu = (props) => { return (
- SettingsActions.update({showhost: !showhost})} + onToggle={() => SettingsActions.update({showhost: !showhost})} /> - SettingsActions.update({no_upstream_cert: !no_upstream_cert})} + onToggle={() => SettingsActions.update({no_upstream_cert: !no_upstream_cert})} /> - SettingsActions.update({rawtcp: !rawtcp})} + onToggle={() => SettingsActions.update({rawtcp: !rawtcp})} /> - SettingsActions.update({http2: !http2})} + onToggle={() => SettingsActions.update({http2: !http2})} /> - SettingsActions.update({anticache: !anticache})} + onToggle={() => SettingsActions.update({anticache: !anticache})} /> - SettingsActions.update({anticomp: !anticomp})} + onToggle={() => SettingsActions.update({anticomp: !anticomp})} /> , - + ]; } else { eventlog = null; @@ -142,13 +143,17 @@ var ProxyAppMain = React.createClass({ } }); +const AppContainer = connect( + state => ({ + showEventLog: state.eventLog.visible + }) +)(ProxyAppMain); -import { Route, Router as ReactRouter, hashHistory, Redirect} from "react-router"; -export var app = ( +export var App = ( - + diff --git a/web/src/js/connection.js b/web/src/js/connection.js index 6177938e8..75c2cf258 100644 --- a/web/src/js/connection.js +++ b/web/src/js/connection.js @@ -1,19 +1,22 @@ - import {ConnectionActions, EventLogActions} from "./actions.js"; import {AppDispatcher} from "./dispatcher.js"; +import * as websocketActions from "./ducks/websocket" -function Connection(url) { +export default function Connection(url, dispatch) { if (url[0] === "/") { url = location.origin.replace("http", "ws") + url; } var ws = new WebSocket(url); ws.onopen = function () { + dispatch(websocketActions.connected()); ConnectionActions.open(); + //TODO: fetch stuff! }; - ws.onmessage = function (message) { - var m = JSON.parse(message.data); - AppDispatcher.dispatchServerAction(m); + ws.onmessage = function (m) { + var message = JSON.parse(m.data); + AppDispatcher.dispatchServerAction(message); + dispatch(message); }; ws.onerror = function () { ConnectionActions.error(); @@ -22,8 +25,7 @@ function Connection(url) { ws.onclose = function () { ConnectionActions.close(); EventLogActions.add_event("WebSocket connection closed."); + dispatch(websocketActions.disconnected()); }; return ws; -} - -export default Connection; \ No newline at end of file +} \ No newline at end of file diff --git a/web/src/js/ducks/README.md b/web/src/js/ducks/README.md new file mode 100644 index 000000000..9d005f35f --- /dev/null +++ b/web/src/js/ducks/README.md @@ -0,0 +1 @@ +https://github.com/erikras/ducks-modular-redux \ No newline at end of file diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js new file mode 100644 index 000000000..2040711cd --- /dev/null +++ b/web/src/js/ducks/eventLog.js @@ -0,0 +1,61 @@ +import getList, {ADD} from "./list" +const TOGGLE_FILTER = 'TOGGLE_EVENTLOG_FILTER' +const TOGGLE_VISIBILITY = 'TOGGLE_EVENTLOG_VISIBILITY' +const UPDATE_LIST = "UPDATE_EVENTLOG" + + +const defaultState = { + visible: false, + filter: { + "debug": false, + "info": true, + "web": true + }, + events: getList(), + filteredEvents: [], +} + +export default function reducer(state = defaultState, action) { + switch (action.type) { + case TOGGLE_FILTER: + const filter = { + ...state.filter, + [action.filter]: !state.filter[action.filter] + } + return { + ...state, + filter, + filteredEvents: state.events.list.filter(x => filter[x.level]) + } + case TOGGLE_VISIBILITY: + return { + ...state, + visible: !state.visible + } + case UPDATE_LIST: + const events = getList(state.events, action) + return { + ...state, + events, + filteredEvents: events.list.filter(x => state.filter[x.level]) + } + default: + return state + } +} + + +export function toggleEventLogFilter(filter) { + return {type: TOGGLE_FILTER, filter} +} +export function toggleEventLogVisibility() { + return {type: TOGGLE_VISIBILITY} +} +let id = 0; +export function addLogEntry(message, level = "web") { + return { + type: UPDATE_LIST, + cmd: ADD, + data: {message, level, id: `log-${id++}`} + } +} \ No newline at end of file diff --git a/web/src/js/ducks/index.js b/web/src/js/ducks/index.js new file mode 100644 index 000000000..3043344c8 --- /dev/null +++ b/web/src/js/ducks/index.js @@ -0,0 +1,10 @@ +import {combineReducers} from 'redux' +import eventLog from './eventLog.js' +import websocket from './websocket.js' + +const rootReducer = combineReducers({ + eventLog, + websocket, +}) + +export default rootReducer \ No newline at end of file diff --git a/web/src/js/ducks/list.js b/web/src/js/ducks/list.js new file mode 100644 index 000000000..0b3771e2c --- /dev/null +++ b/web/src/js/ducks/list.js @@ -0,0 +1,21 @@ +export const ADD = 'add' + +const defaultState = { + list: [], + //isFetching: false, + //updateBeforeFetch: [], + indexOf: {}, + //views: {} +}; + +export default function getList(state = defaultState, action = {}) { + switch (action.cmd) { + case ADD: + return { + list: [...state.list, action.data], + indexOf: {...state.indexOf, [action.data.id]: state.list.length}, + } + default: + return state + } +} \ No newline at end of file diff --git a/web/src/js/ducks/websocket.js b/web/src/js/ducks/websocket.js new file mode 100644 index 000000000..3999dbcf1 --- /dev/null +++ b/web/src/js/ducks/websocket.js @@ -0,0 +1,30 @@ +const CONNECTED = 'WEBSOCKET_CONNECTED' +const DISCONNECTED = 'WEBSOCKET_DISCONNECTED' + + +const defaultState = { + connected: true, + /* we may want to have an error message attribute here at some point */ +} +export default function reducer(state = defaultState, action) { + switch (action.type) { + case CONNECTED: + return { + connected: true + } + case DISCONNECTED: + return { + connected: false + } + default: + return state + } +} + + +export function connected() { + return {type: CONNECTED} +} +export function disconnected() { + return {type: DISCONNECTED} +} \ No newline at end of file