Socket
Socket
Sign inDemoInstall

react-redux

Package Overview
Dependencies
7
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.2 to 5.0.3

es/utils/PropTypes.js

434

dist/react-redux.js

@@ -62,3 +62,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _Provider = __webpack_require__(9);
var _Provider = __webpack_require__(8);

@@ -71,3 +71,3 @@ var _Provider2 = _interopRequireDefault(_Provider);

var _connect = __webpack_require__(10);
var _connect = __webpack_require__(9);

@@ -140,10 +140,8 @@ var _connect2 = _interopRequireDefault(_connect);

var _Subscription = __webpack_require__(5);
var _Subscription = __webpack_require__(15);
var _Subscription2 = _interopRequireDefault(_Subscription);
var _storeShape = __webpack_require__(6);
var _PropTypes = __webpack_require__(5);
var _storeShape2 = _interopRequireDefault(_storeShape);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -160,2 +158,25 @@

var hotReloadingVersion = 0;
var dummyState = {};
function noop() {}
function makeSelectorStateful(sourceSelector, store) {
// wrap the selector in an object that tracks its results between runs.
var selector = {
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(store.getState(), props);
if (nextProps !== selector.props || selector.error) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
}
}
};
return selector;
}
function connectAdvanced(

@@ -199,7 +220,7 @@ /*

var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _storeShape2.default, _contextTypes[subscriptionKey] = _react.PropTypes.instanceOf(_Subscription2.default), _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _react.PropTypes.instanceOf(_Subscription2.default), _childContextTypes);
var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes);
return function wrapWithConnect(WrappedComponent) {
(0, _invariant2.default)(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + WrappedComponent));
(0, _invariant2.default)(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + JSON.stringify(WrappedComponent)));

@@ -233,13 +254,8 @@ var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';

_this.renderCount = 0;
_this.store = _this.props[storeKey] || _this.context[storeKey];
_this.parentSub = props[subscriptionKey] || context[subscriptionKey];
_this.store = props[storeKey] || context[storeKey];
_this.propsMode = Boolean(props[storeKey]);
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
(0, _invariant2.default)(_this.store, 'Could not find "' + storeKey + '" in either the context or ' + ('props of "' + displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
(0, _invariant2.default)(_this.store, 'Could not find "' + storeKey + '" in either the context or props of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
// make sure `getState` is properly bound in order to avoid breaking
// custom store implementations that rely on the store's context
_this.getState = _this.store.getState.bind(_this.store);
_this.initSelector();

@@ -253,3 +269,8 @@ _this.initSubscription();

return _ref2 = {}, _ref2[subscriptionKey] = this.subscription || this.parentSub, _ref2;
// If this component received store from props, its subscription should be transparent
// to any descendants receiving store+subscription from context; it passes along
// subscription passed to it. Otherwise, it shadows the parent subscription, which allows
// Connect to control ordering of notifications to flow top-down.
var subscription = this.propsMode ? null : this.subscription;
return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2;
};

@@ -281,8 +302,7 @@

if (this.subscription) this.subscription.tryUnsubscribe();
// these are just to guard against extra memory leakage if a parent element doesn't
// dereference this instance properly, such as an async callback that never finishes
this.subscription = null;
this.notifyNestedSubs = noop;
this.store = null;
this.parentSub = null;
this.selector.run = function () {};
this.selector.run = noop;
this.selector.shouldComponentUpdate = false;
};

@@ -300,53 +320,45 @@

Connect.prototype.initSelector = function initSelector() {
var dispatch = this.store.dispatch;
var getState = this.getState;
var sourceSelector = selectorFactory(dispatch, selectorFactoryOptions);
// wrap the selector in an object that tracks its results between runs
var selector = this.selector = {
shouldComponentUpdate: true,
props: sourceSelector(getState(), this.props),
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(getState(), props);
if (selector.error || nextProps !== selector.props) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
}
}
};
var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
this.selector = makeSelectorStateful(sourceSelector, this.store);
this.selector.run(this.props);
};
Connect.prototype.initSubscription = function initSubscription() {
var _this2 = this;
if (!shouldHandleStateChanges) return;
if (shouldHandleStateChanges) {
(function () {
var subscription = _this2.subscription = new _Subscription2.default(_this2.store, _this2.parentSub);
var dummyState = {};
// parentSub's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
this.subscription = new _Subscription2.default(this.store, parentSub, this.onStateChange.bind(this));
subscription.onStateChange = function onStateChange() {
this.selector.run(this.props);
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `this.subscription` will then be null. An
// extra null check every change can be avoided by copying the method onto `this` and then
// replacing it with a no-op on unmount. This can probably be avoided if Subscription's
// listeners logic is changed to not call listeners that have been unsubscribed in the
// middle of the notification loop.
this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
};
if (!this.selector.shouldComponentUpdate) {
subscription.notifyNestedSubs();
} else {
this.componentDidUpdate = function componentDidUpdate() {
this.componentDidUpdate = undefined;
subscription.notifyNestedSubs();
};
Connect.prototype.onStateChange = function onStateChange() {
this.selector.run(this.props);
this.setState(dummyState);
}
}.bind(_this2);
})();
if (!this.selector.shouldComponentUpdate) {
this.notifyNestedSubs();
} else {
this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
this.setState(dummyState);
}
};
Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
// `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
// needs to notify nested subs. Once called, it unimplements itself until further state
// changes occur. Doing it this way vs having a permanent `componentDidMount` that does
// a boolean check every time avoids an extra method call most of the time, resulting
// in some perf boost.
this.componentDidUpdate = undefined;
this.notifyNestedSubs();
};
Connect.prototype.isSubscribed = function isSubscribed() {

@@ -357,3 +369,3 @@ return Boolean(this.subscription) && this.subscription.isSubscribed();

Connect.prototype.addExtraProps = function addExtraProps(props) {
if (!withRef && !renderCountProp) return props;
if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props;
// make a shallow copy so that fields added don't leak to the original selector.

@@ -366,2 +378,3 @@ // this is especially important for 'ref' since that's a reference back to the component

if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
return withExtras;

@@ -419,3 +432,3 @@ };

var _verifyPlainObject = __webpack_require__(7);
var _verifyPlainObject = __webpack_require__(6);

@@ -469,6 +482,8 @@ var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject);

proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
// allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps;
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
var props = proxy(stateOrDispatch, ownProps);

@@ -493,100 +508,2 @@

/* 5 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// encapsulates the subscription logic for connecting a component to the redux store, as
// well as nesting subscriptions of descendant components, so that we can ensure the
// ancestor components re-render before descendants
var CLEARED = null;
var nullListeners = {
notify: function notify() {}
};
function createListenerCollection() {
// the current/next pattern is copied from redux's createStore code.
// TODO: refactor+expose that code to be reusable here?
var current = [];
var next = [];
return {
clear: function clear() {
next = CLEARED;
current = CLEARED;
},
notify: function notify() {
var listeners = current = next;
for (var i = 0; i < listeners.length; i++) {
listeners[i]();
}
},
subscribe: function subscribe(listener) {
var isSubscribed = true;
if (next === current) next = current.slice();
next.push(listener);
return function unsubscribe() {
if (!isSubscribed || current === CLEARED) return;
isSubscribed = false;
if (next === current) next = current.slice();
next.splice(next.indexOf(listener), 1);
};
}
};
}
var Subscription = function () {
function Subscription(store, parentSub) {
_classCallCheck(this, Subscription);
this.store = store;
this.parentSub = parentSub;
this.unsubscribe = null;
this.listeners = nullListeners;
}
Subscription.prototype.addNestedSub = function addNestedSub(listener) {
this.trySubscribe();
return this.listeners.subscribe(listener);
};
Subscription.prototype.notifyNestedSubs = function notifyNestedSubs() {
this.listeners.notify();
};
Subscription.prototype.isSubscribed = function isSubscribed() {
return Boolean(this.unsubscribe);
};
Subscription.prototype.trySubscribe = function trySubscribe() {
if (!this.unsubscribe) {
// this.onStateChange is set by connectAdvanced.initSubscription()
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
this.listeners = createListenerCollection();
}
};
Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
this.listeners.clear();
this.listeners = nullListeners;
}
};
return Subscription;
}();
exports.default = Subscription;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {

@@ -597,6 +514,14 @@

exports.__esModule = true;
exports.storeShape = exports.subscriptionShape = undefined;
var _react = __webpack_require__(2);
exports.default = _react.PropTypes.shape({
var subscriptionShape = exports.subscriptionShape = _react.PropTypes.shape({
trySubscribe: _react.PropTypes.func.isRequired,
tryUnsubscribe: _react.PropTypes.func.isRequired,
notifyNestedSubs: _react.PropTypes.func.isRequired,
isSubscribed: _react.PropTypes.func.isRequired
});
var storeShape = exports.storeShape = _react.PropTypes.shape({
subscribe: _react.PropTypes.func.isRequired,

@@ -608,3 +533,3 @@ dispatch: _react.PropTypes.func.isRequired,

/***/ },
/* 7 */
/* 6 */
/***/ function(module, exports, __webpack_require__) {

@@ -634,3 +559,3 @@

/***/ },
/* 8 */
/* 7 */
/***/ function(module, exports, __webpack_require__) {

@@ -647,3 +572,3 @@

/***/ },
/* 9 */
/* 8 */
/***/ function(module, exports, __webpack_require__) {

@@ -658,10 +583,4 @@

var _Subscription = __webpack_require__(5);
var _PropTypes = __webpack_require__(5);
var _Subscription2 = _interopRequireDefault(_Subscription);
var _storeShape = __webpack_require__(6);
var _storeShape2 = _interopRequireDefault(_storeShape);
var _warning = __webpack_require__(1);

@@ -728,8 +647,8 @@

Provider.propTypes = {
store: _storeShape2.default.isRequired,
store: _PropTypes.storeShape.isRequired,
children: _react.PropTypes.element.isRequired
};
Provider.childContextTypes = {
store: _storeShape2.default.isRequired,
storeSubscription: _react.PropTypes.instanceOf(_Subscription2.default)
store: _PropTypes.storeShape.isRequired,
storeSubscription: _PropTypes.subscriptionShape
};

@@ -739,3 +658,3 @@ Provider.displayName = 'Provider';

/***/ },
/* 10 */
/* 9 */
/***/ function(module, exports, __webpack_require__) {

@@ -759,15 +678,15 @@

var _mapDispatchToProps = __webpack_require__(11);
var _mapDispatchToProps = __webpack_require__(10);
var _mapDispatchToProps2 = _interopRequireDefault(_mapDispatchToProps);
var _mapStateToProps = __webpack_require__(12);
var _mapStateToProps = __webpack_require__(11);
var _mapStateToProps2 = _interopRequireDefault(_mapStateToProps);
var _mergeProps = __webpack_require__(13);
var _mergeProps = __webpack_require__(12);
var _mergeProps2 = _interopRequireDefault(_mergeProps);
var _selectorFactory = __webpack_require__(14);
var _selectorFactory = __webpack_require__(13);

@@ -874,3 +793,3 @@ var _selectorFactory2 = _interopRequireDefault(_selectorFactory);

/***/ },
/* 11 */
/* 10 */
/***/ function(module, exports, __webpack_require__) {

@@ -908,3 +827,3 @@

/***/ },
/* 12 */
/* 11 */
/***/ function(module, exports, __webpack_require__) {

@@ -933,3 +852,3 @@

/***/ },
/* 13 */
/* 12 */
/***/ function(module, exports, __webpack_require__) {

@@ -948,3 +867,3 @@

var _verifyPlainObject = __webpack_require__(7);
var _verifyPlainObject = __webpack_require__(6);

@@ -998,3 +917,3 @@ var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject);

/***/ },
/* 14 */
/* 13 */
/***/ function(module, exports, __webpack_require__) {

@@ -1009,3 +928,3 @@

var _verifySubselectors = __webpack_require__(15);
var _verifySubselectors = __webpack_require__(14);

@@ -1118,3 +1037,3 @@ var _verifySubselectors2 = _interopRequireDefault(_verifySubselectors);

/***/ },
/* 15 */
/* 14 */
/***/ function(module, exports, __webpack_require__) {

@@ -1150,3 +1069,3 @@

/***/ },
/* 16 */
/* 15 */
/***/ function(module, exports) {

@@ -1157,21 +1076,130 @@

exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// encapsulates the subscription logic for connecting a component to the redux store, as
// well as nesting subscriptions of descendant components, so that we can ensure the
// ancestor components re-render before descendants
var CLEARED = null;
var nullListeners = {
notify: function notify() {}
};
function createListenerCollection() {
// the current/next pattern is copied from redux's createStore code.
// TODO: refactor+expose that code to be reusable here?
var current = [];
var next = [];
return {
clear: function clear() {
next = CLEARED;
current = CLEARED;
},
notify: function notify() {
var listeners = current = next;
for (var i = 0; i < listeners.length; i++) {
listeners[i]();
}
},
subscribe: function subscribe(listener) {
var isSubscribed = true;
if (next === current) next = current.slice();
next.push(listener);
return function unsubscribe() {
if (!isSubscribed || current === CLEARED) return;
isSubscribed = false;
if (next === current) next = current.slice();
next.splice(next.indexOf(listener), 1);
};
}
};
}
var Subscription = function () {
function Subscription(store, parentSub, onStateChange) {
_classCallCheck(this, Subscription);
this.store = store;
this.parentSub = parentSub;
this.onStateChange = onStateChange;
this.unsubscribe = null;
this.listeners = nullListeners;
}
Subscription.prototype.addNestedSub = function addNestedSub(listener) {
this.trySubscribe();
return this.listeners.subscribe(listener);
};
Subscription.prototype.notifyNestedSubs = function notifyNestedSubs() {
this.listeners.notify();
};
Subscription.prototype.isSubscribed = function isSubscribed() {
return Boolean(this.unsubscribe);
};
Subscription.prototype.trySubscribe = function trySubscribe() {
if (!this.unsubscribe) {
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
this.listeners = createListenerCollection();
}
};
Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
this.listeners.clear();
this.listeners = nullListeners;
}
};
return Subscription;
}();
exports.default = Subscription;
/***/ },
/* 16 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = shallowEqual;
var hasOwn = Object.prototype.hasOwnProperty;
function shallowEqual(a, b) {
if (a === b) return true;
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
var countA = 0;
var countB = 0;
function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
for (var key in a) {
if (hasOwn.call(a, key) && a[key] !== b[key]) return false;
countA++;
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
for (var _key in b) {
if (hasOwn.call(b, _key)) countB++;
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return countA === countB;
return true;
}

@@ -1296,3 +1324,3 @@

var Symbol = __webpack_require__(8),
var Symbol = __webpack_require__(7),
getRawTag = __webpack_require__(22),

@@ -1354,3 +1382,3 @@ objectToString = __webpack_require__(23);

var Symbol = __webpack_require__(8);
var Symbol = __webpack_require__(7);

@@ -1357,0 +1385,0 @@ /** Used for built-in method references. */

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.connect=e.connectAdvanced=e.Provider=void 0;var o=n(9),i=r(o),s=n(3),u=r(s),a=n(10),p=r(a);e.Provider=i.default,e.connectAdvanced=u.default,e.connect=p.default},function(t,e){"use strict";function n(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw Error(t)}catch(t){}}e.__esModule=!0,e.default=n},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n={};for(var r in t)e.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function a(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.getDisplayName,c=void 0===a?function(t){return"ConnectAdvanced("+t+")"}:a,d=r.methodName,v=void 0===d?"connectAdvanced":d,b=r.renderCountProp,O=void 0===b?void 0:b,w=r.shouldHandleStateChanges,g=void 0===w||w,S=r.storeKey,T=void 0===S?"store":S,M=r.withRef,_=void 0!==M&&M,x=u(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),C=T+"Subscription",j=m++,E=(e={},e[T]=P.default,e[C]=h.PropTypes.instanceOf(y.default),e),q=(n={},n[C]=h.PropTypes.instanceOf(y.default),n);return function(e){(0,l.default)("function"==typeof e,"You must pass a component to the function returned by connect. Instead received "+e);var n=e.displayName||e.name||"Component",r=c(n),u=p({},x,{getDisplayName:c,methodName:v,renderCountProp:O,shouldHandleStateChanges:g,storeKey:T,withRef:_,displayName:r,wrappedComponentName:n,WrappedComponent:e}),a=function(n){function a(t,e){o(this,a);var s=i(this,n.call(this,t,e));return s.version=j,s.state={},s.renderCount=0,s.store=s.props[T]||s.context[T],s.parentSub=t[C]||e[C],s.setWrappedInstance=s.setWrappedInstance.bind(s),(0,l.default)(s.store,'Could not find "'+T+'" in either the context or '+('props of "'+r+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "'+T+'" as a prop to "'+r+'".')),s.getState=s.store.getState.bind(s.store),s.initSelector(),s.initSubscription(),s}return s(a,n),a.prototype.getChildContext=function(){var t;return t={},t[C]=this.subscription||this.parentSub,t},a.prototype.componentDidMount=function(){g&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},a.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},a.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},a.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.store=null,this.parentSub=null,this.selector.run=function(){}},a.prototype.getWrappedInstance=function(){return(0,l.default)(_,"To access the wrapped instance, you need to specify "+("{ withRef: true } in the options argument of the "+v+"() call.")),this.wrappedInstance},a.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},a.prototype.initSelector=function(){var e=this.store.dispatch,n=this.getState,r=t(e,u),o=this.selector={shouldComponentUpdate:!0,props:r(n(),this.props),run:function(t){try{var e=r(n(),t);(o.error||e!==o.props)&&(o.shouldComponentUpdate=!0,o.props=e,o.error=null)}catch(t){o.shouldComponentUpdate=!0,o.error=t}}}},a.prototype.initSubscription=function(){var t=this;g&&!function(){var e=t.subscription=new y.default(t.store,t.parentSub),n={};e.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=function(){this.componentDidUpdate=void 0,e.notifyNestedSubs()},this.setState(n)):e.notifyNestedSubs()}.bind(t)}()},a.prototype.isSubscribed=function(){return!!this.subscription&&this.subscription.isSubscribed()},a.prototype.addExtraProps=function(t){if(!_&&!O)return t;var e=p({},t);return _&&(e.ref=this.setWrappedInstance),O&&(e[O]=this.renderCount++),e},a.prototype.render=function(){var t=this.selector;if(t.shouldComponentUpdate=!1,t.error)throw t.error;return(0,h.createElement)(e,this.addExtraProps(t.props))},a}(h.Component);return a.WrappedComponent=e,a.displayName=r,a.childContextTypes=q,a.contextTypes=E,a.propTypes=E,(0,f.default)(a,e)}}e.__esModule=!0;var p=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=a;var c=n(17),f=r(c),d=n(18),l=r(d),h=n(2),v=n(5),y=r(v),b=n(6),P=r(b),m=0},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return function(e,n){function r(){return o}var o=t(e,n);return r.dependsOnOwnProps=!1,r}}function i(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?!!t.dependsOnOwnProps:1!==t.length}function s(t,e){return function(e,n){var r=function(t,e){return r.dependsOnOwnProps?r.mapToProps(t,e):r.mapToProps(t)};return r.dependsOnOwnProps=i(t),r.mapToProps=function(e,n){r.mapToProps=t;var o=r(e,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=i(o),o=r(e,n)),o},r}}e.__esModule=!0,e.wrapMapToPropsConstant=o,e.getDependsOnOwnProps=i,e.wrapMapToPropsFunc=s;var u=n(7);r(u)},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(){var t=[],e=[];return{clear:function(){e=o,t=o},notify:function(){for(var n=t=e,r=0;n.length>r;r++)n[r]()},subscribe:function(n){var r=!0;return e===t&&(e=t.slice()),e.push(n),function(){r&&t!==o&&(r=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(n),1))}}}}e.__esModule=!0;var o=null,i={notify:function(){}},s=function(){function t(e,r){n(this,t),this.store=e,this.parentSub=r,this.unsubscribe=null,this.listeners=i}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return!!this.unsubscribe},t.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=r())},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=i)},t}();e.default=s},function(t,e,n){"use strict";e.__esModule=!0;var r=n(2);e.default=r.PropTypes.shape({subscribe:r.PropTypes.func.isRequired,dispatch:r.PropTypes.func.isRequired,getState:r.PropTypes.func.isRequired})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){(0,s.default)(t)||(0,a.default)(n+"() in "+e+" must return a plain object. Instead received "+t+".")}e.__esModule=!0,e.default=o;var i=n(27),s=r(i),u=n(1),a=r(u)},function(t,e,n){var r=n(25),o=r.Symbol;t.exports=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0,e.default=void 0;var u=n(2),a=n(5),p=r(a),c=n(6),f=r(c),d=n(1),l=(r(d),function(t){function e(n,r){o(this,e);var s=i(this,t.call(this,n,r));return s.store=n.store,s}return s(e,t),e.prototype.getChildContext=function(){return{store:this.store,storeSubscription:null}},e.prototype.render=function(){return u.Children.only(this.props.children)},e}(u.Component));e.default=l,l.propTypes={store:f.default.isRequired,children:u.PropTypes.element.isRequired},l.childContextTypes={store:f.default.isRequired,storeSubscription:u.PropTypes.instanceOf(p.default)},l.displayName="Provider"},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e,n){for(var r=e.length-1;r>=0;r--){var o=e[r](t);if(o)return o}return function(e,r){throw Error("Invalid value of type "+typeof t+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function s(t,e){return t===e}function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?c.default:e,r=t.mapStateToPropsFactories,u=void 0===r?y.default:r,p=t.mapDispatchToPropsFactories,f=void 0===p?h.default:p,l=t.mergePropsFactories,v=void 0===l?P.default:l,b=t.selectorFactory,m=void 0===b?O.default:b;return function(t,e,r){var p=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=p.pure,l=void 0===c||c,h=p.areStatesEqual,y=void 0===h?s:h,b=p.areOwnPropsEqual,P=void 0===b?d.default:b,O=p.areStatePropsEqual,w=void 0===O?d.default:O,g=p.areMergedPropsEqual,S=void 0===g?d.default:g,T=o(p,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),M=i(t,u,"mapStateToProps"),_=i(e,f,"mapDispatchToProps"),x=i(r,v,"mergeProps");return n(m,a({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:!!t,initMapStateToProps:M,initMapDispatchToProps:_,initMergeProps:x,pure:l,areStatesEqual:y,areOwnPropsEqual:P,areStatePropsEqual:w,areMergedPropsEqual:S},T))}}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.createConnect=u;var p=n(3),c=r(p),f=n(16),d=r(f),l=n(11),h=r(l),v=n(12),y=r(v),b=n(13),P=r(b),m=n(14),O=r(m);e.default=u()},function(t,e,n){"use strict";function r(t){return"function"==typeof t?(0,u.wrapMapToPropsFunc)(t,"mapDispatchToProps"):void 0}function o(t){return t?void 0:(0,u.wrapMapToPropsConstant)(function(t){return{dispatch:t}})}function i(t){return t&&"object"==typeof t?(0,u.wrapMapToPropsConstant)(function(e){return(0,s.bindActionCreators)(t,e)}):void 0}e.__esModule=!0,e.whenMapDispatchToPropsIsFunction=r,e.whenMapDispatchToPropsIsMissing=o,e.whenMapDispatchToPropsIsObject=i;var s=n(28),u=n(4);e.default=[r,o,i]},function(t,e,n){"use strict";function r(t){return"function"==typeof t?(0,i.wrapMapToPropsFunc)(t,"mapStateToProps"):void 0}function o(t){return t?void 0:(0,i.wrapMapToPropsConstant)(function(){return{}})}e.__esModule=!0,e.whenMapStateToPropsIsFunction=r,e.whenMapStateToPropsIsMissing=o;var i=n(4);e.default=[r,o]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return a({},n,t,e)}function i(t){return function(e,n){var r=n.pure,o=n.areMergedPropsEqual,i=!1,s=void 0;return function(e,n,u){var a=t(e,n,u);return i?r&&o(a,s)||(s=a):(i=!0,s=a),s}}}function s(t){return"function"==typeof t?i(t):void 0}function u(t){return t?void 0:function(){return o}}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.defaultMergeProps=o,e.wrapMergePropsFunc=i,e.whenMergePropsIsFunction=s,e.whenMergePropsIsOmitted=u;var p=n(7);r(p);e.default=[s,u]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e,n,r){return function(o,i){return n(t(o,i),e(r,i),i)}}function s(t,e,n,r,o){function i(o,i){return h=o,v=i,y=t(h,v),b=e(r,v),P=n(y,b,v),l=!0,P}function s(){return y=t(h,v),e.dependsOnOwnProps&&(b=e(r,v)),P=n(y,b,v)}function u(){return t.dependsOnOwnProps&&(y=t(h,v)),e.dependsOnOwnProps&&(b=e(r,v)),P=n(y,b,v)}function a(){var e=t(h,v),r=!d(e,y);return y=e,r&&(P=n(y,b,v)),P}function p(t,e){var n=!f(e,v),r=!c(t,h);return h=t,v=e,n&&r?s():n?u():r?a():P}var c=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1,h=void 0,v=void 0,y=void 0,b=void 0,P=void 0;return function(t,e){return l?p(t,e):i(t,e)}}function u(t,e){var n=e.initMapStateToProps,r=e.initMapDispatchToProps,u=e.initMergeProps,a=o(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),p=n(t,a),c=r(t,a),f=u(t,a),d=a.pure?s:i;return d(p,c,f,t,a)}e.__esModule=!0,e.impureFinalPropsSelectorFactory=i,e.pureFinalPropsSelectorFactory=s,e.default=u;var a=n(15);r(a)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){if(!t)throw Error("Unexpected value for "+e+" in "+n+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||t.hasOwnProperty("dependsOnOwnProps")||(0,u.default)("The selector for "+e+" of "+n+" did not specify a value for dependsOnOwnProps.")}function i(t,e,n,r){o(t,"mapStateToProps",r),o(e,"mapDispatchToProps",r),o(n,"mergeProps",r)}e.__esModule=!0,e.default=i;var s=n(1),u=r(s)},function(t,e){"use strict";function n(t,e){if(t===e)return!0;var n=0,o=0;for(var i in t){if(r.call(t,i)&&t[i]!==e[i])return!1;n++}for(var s in e)r.call(e,s)&&o++;return n===o}e.__esModule=!0,e.default=n;var r=Object.prototype.hasOwnProperty},function(t,e){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},o="function"==typeof Object.getOwnPropertySymbols;t.exports=function(t,e,i){if("string"!=typeof e){var s=Object.getOwnPropertyNames(e);o&&(s=s.concat(Object.getOwnPropertySymbols(e)));for(var u=0;s.length>u;++u)if(!(n[s[u]]||r[s[u]]||i&&i[s[u]]))try{t[s[u]]=e[s[u]]}catch(t){}}return t}},function(t,e,n){"use strict";var r=function(t,e,n,r,o,i,s,u){if(!t){var a;if(void 0===e)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,o,i,s,u],c=0;a=Error(e.replace(/%s/g,function(){return p[c++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}};t.exports=r},function(t,e,n){function r(t){return null==t?void 0===t?a:u:p&&p in Object(t)?i(t):s(t)}var o=n(8),i=n(22),s=n(23),u="[object Null]",a="[object Undefined]",p=o?o.toStringTag:void 0;t.exports=r},function(t,e){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,function(){return this}()||Function("return this")())},function(t,e,n){var r=n(24),o=r(Object.getPrototypeOf,Object);t.exports=o},function(t,e,n){function r(t){var e=s.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[a]=n:delete t[a]),o}var o=n(8),i=Object.prototype,s=i.hasOwnProperty,u=i.toString,a=o?o.toStringTag:void 0;t.exports=r},function(t,e){function n(t){return o.call(t)}var r=Object.prototype,o=r.toString;t.exports=n},function(t,e){function n(t,e){return function(n){return t(e(n))}}t.exports=n},function(t,e,n){var r=n(20),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},function(t,e,n){function r(t){if(!s(t)||o(t)!=u)return!1;var e=i(t);if(null===e)return!0;var n=f.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==d}var o=n(19),i=n(21),s=n(26),u="[object Object]",a=Function.prototype,p=Object.prototype,c=a.toString,f=p.hasOwnProperty,d=c.call(Object);t.exports=r},function(t,n){t.exports=e}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.connect=e.connectAdvanced=e.Provider=void 0;var o=n(8),i=r(o),s=n(3),u=r(s),p=n(9),a=r(p);e.Provider=i.default,e.connectAdvanced=u.default,e.connect=a.default},function(t,e){"use strict";function n(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw Error(t)}catch(t){}}e.__esModule=!0,e.default=n},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n={};for(var r in t)e.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function p(){}function a(t,e){var n={run:function(r){try{var o=t(e.getState(),r);(o!==n.props||n.error)&&(n.shouldComponentUpdate=!0,n.props=o,n.error=null)}catch(t){n.shouldComponentUpdate=!0,n.error=t}}};return n}function c(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=r.getDisplayName,d=void 0===c?function(t){return"ConnectAdvanced("+t+")"}:c,h=r.methodName,v=void 0===h?"connectAdvanced":h,w=r.renderCountProp,g=void 0===w?void 0:w,M=r.shouldHandleStateChanges,T=void 0===M||M,_=r.storeKey,C=void 0===_?"store":_,x=r.withRef,j=void 0!==x&&x,E=u(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),q=C+"Subscription",N=m++,R=(e={},e[C]=O.storeShape,e[q]=O.subscriptionShape,e),D=(n={},n[q]=O.subscriptionShape,n);return function(e){(0,y.default)("function"==typeof e,"You must pass a component to the function returned by connect. Instead received "+JSON.stringify(e));var n=e.displayName||e.name||"Component",r=d(n),u=f({},E,{getDisplayName:d,methodName:v,renderCountProp:g,shouldHandleStateChanges:T,storeKey:C,withRef:j,displayName:r,wrappedComponentName:n,WrappedComponent:e}),c=function(n){function c(t,e){o(this,c);var s=i(this,n.call(this,t,e));return s.version=N,s.state={},s.renderCount=0,s.store=t[C]||e[C],s.propsMode=!!t[C],s.setWrappedInstance=s.setWrappedInstance.bind(s),(0,y.default)(s.store,'Could not find "'+C+'" in either the context or props of '+('"'+r+'". Either wrap the root component in a <Provider>, ')+('or explicitly pass "'+C+'" as a prop to "'+r+'".')),s.initSelector(),s.initSubscription(),s}return s(c,n),c.prototype.getChildContext=function(){var t,e=this.propsMode?null:this.subscription;return t={},t[q]=e||this.context[q],t},c.prototype.componentDidMount=function(){T&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},c.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},c.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},c.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=p,this.store=null,this.selector.run=p,this.selector.shouldComponentUpdate=!1},c.prototype.getWrappedInstance=function(){return(0,y.default)(j,"To access the wrapped instance, you need to specify "+("{ withRef: true } in the options argument of the "+v+"() call.")),this.wrappedInstance},c.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},c.prototype.initSelector=function(){var e=t(this.store.dispatch,u);this.selector=a(e,this.store),this.selector.run(this.props)},c.prototype.initSubscription=function(){if(T){var t=(this.propsMode?this.props:this.context)[q];this.subscription=new P.default(this.store,t,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},c.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(S)):this.notifyNestedSubs()},c.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},c.prototype.isSubscribed=function(){return!!this.subscription&&this.subscription.isSubscribed()},c.prototype.addExtraProps=function(t){if(!(j||g||this.propsMode&&this.subscription))return t;var e=f({},t);return j&&(e.ref=this.setWrappedInstance),g&&(e[g]=this.renderCount++),this.propsMode&&this.subscription&&(e[q]=this.subscription),e},c.prototype.render=function(){var t=this.selector;if(t.shouldComponentUpdate=!1,t.error)throw t.error;return(0,b.createElement)(e,this.addExtraProps(t.props))},c}(b.Component);return c.WrappedComponent=e,c.displayName=r,c.childContextTypes=D,c.contextTypes=R,c.propTypes=R,(0,l.default)(c,e)}}e.__esModule=!0;var f=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=c;var d=n(17),l=r(d),h=n(18),y=r(h),b=n(2),v=n(15),P=r(v),O=n(5),m=0,S={}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return function(e,n){function r(){return o}var o=t(e,n);return r.dependsOnOwnProps=!1,r}}function i(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?!!t.dependsOnOwnProps:1!==t.length}function s(t,e){return function(e,n){var r=function(t,e){return r.dependsOnOwnProps?r.mapToProps(t,e):r.mapToProps(t)};return r.dependsOnOwnProps=!0,r.mapToProps=function(e,n){r.mapToProps=t,r.dependsOnOwnProps=i(t);var o=r(e,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=i(o),o=r(e,n)),o},r}}e.__esModule=!0,e.wrapMapToPropsConstant=o,e.getDependsOnOwnProps=i,e.wrapMapToPropsFunc=s;var u=n(6);r(u)},function(t,e,n){"use strict";e.__esModule=!0,e.storeShape=e.subscriptionShape=void 0;var r=n(2);e.subscriptionShape=r.PropTypes.shape({trySubscribe:r.PropTypes.func.isRequired,tryUnsubscribe:r.PropTypes.func.isRequired,notifyNestedSubs:r.PropTypes.func.isRequired,isSubscribed:r.PropTypes.func.isRequired}),e.storeShape=r.PropTypes.shape({subscribe:r.PropTypes.func.isRequired,dispatch:r.PropTypes.func.isRequired,getState:r.PropTypes.func.isRequired})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){(0,s.default)(t)||(0,p.default)(n+"() in "+e+" must return a plain object. Instead received "+t+".")}e.__esModule=!0,e.default=o;var i=n(27),s=r(i),u=n(1),p=r(u)},function(t,e,n){var r=n(25),o=r.Symbol;t.exports=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0,e.default=void 0;var u=n(2),p=n(5),a=n(1),c=(r(a),function(t){function e(n,r){o(this,e);var s=i(this,t.call(this,n,r));return s.store=n.store,s}return s(e,t),e.prototype.getChildContext=function(){return{store:this.store,storeSubscription:null}},e.prototype.render=function(){return u.Children.only(this.props.children)},e}(u.Component));e.default=c,c.propTypes={store:p.storeShape.isRequired,children:u.PropTypes.element.isRequired},c.childContextTypes={store:p.storeShape.isRequired,storeSubscription:p.subscriptionShape},c.displayName="Provider"},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e,n){for(var r=e.length-1;r>=0;r--){var o=e[r](t);if(o)return o}return function(e,r){throw Error("Invalid value of type "+typeof t+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function s(t,e){return t===e}function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?c.default:e,r=t.mapStateToPropsFactories,u=void 0===r?b.default:r,a=t.mapDispatchToPropsFactories,f=void 0===a?h.default:a,l=t.mergePropsFactories,y=void 0===l?P.default:l,v=t.selectorFactory,O=void 0===v?m.default:v;return function(t,e,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=a.pure,l=void 0===c||c,h=a.areStatesEqual,b=void 0===h?s:h,v=a.areOwnPropsEqual,P=void 0===v?d.default:v,m=a.areStatePropsEqual,S=void 0===m?d.default:m,w=a.areMergedPropsEqual,g=void 0===w?d.default:w,M=o(a,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),T=i(t,u,"mapStateToProps"),_=i(e,f,"mapDispatchToProps"),C=i(r,y,"mergeProps");return n(O,p({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:!!t,initMapStateToProps:T,initMapDispatchToProps:_,initMergeProps:C,pure:l,areStatesEqual:b,areOwnPropsEqual:P,areStatePropsEqual:S,areMergedPropsEqual:g},M))}}e.__esModule=!0;var p=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.createConnect=u;var a=n(3),c=r(a),f=n(16),d=r(f),l=n(10),h=r(l),y=n(11),b=r(y),v=n(12),P=r(v),O=n(13),m=r(O);e.default=u()},function(t,e,n){"use strict";function r(t){return"function"==typeof t?(0,u.wrapMapToPropsFunc)(t,"mapDispatchToProps"):void 0}function o(t){return t?void 0:(0,u.wrapMapToPropsConstant)(function(t){return{dispatch:t}})}function i(t){return t&&"object"==typeof t?(0,u.wrapMapToPropsConstant)(function(e){return(0,s.bindActionCreators)(t,e)}):void 0}e.__esModule=!0,e.whenMapDispatchToPropsIsFunction=r,e.whenMapDispatchToPropsIsMissing=o,e.whenMapDispatchToPropsIsObject=i;var s=n(28),u=n(4);e.default=[r,o,i]},function(t,e,n){"use strict";function r(t){return"function"==typeof t?(0,i.wrapMapToPropsFunc)(t,"mapStateToProps"):void 0}function o(t){return t?void 0:(0,i.wrapMapToPropsConstant)(function(){return{}})}e.__esModule=!0,e.whenMapStateToPropsIsFunction=r,e.whenMapStateToPropsIsMissing=o;var i=n(4);e.default=[r,o]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return p({},n,t,e)}function i(t){return function(e,n){var r=n.pure,o=n.areMergedPropsEqual,i=!1,s=void 0;return function(e,n,u){var p=t(e,n,u);return i?r&&o(p,s)||(s=p):(i=!0,s=p),s}}}function s(t){return"function"==typeof t?i(t):void 0}function u(t){return t?void 0:function(){return o}}e.__esModule=!0;var p=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.defaultMergeProps=o,e.wrapMergePropsFunc=i,e.whenMergePropsIsFunction=s,e.whenMergePropsIsOmitted=u;var a=n(6);r(a);e.default=[s,u]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e,n,r){return function(o,i){return n(t(o,i),e(r,i),i)}}function s(t,e,n,r,o){function i(o,i){return h=o,y=i,b=t(h,y),v=e(r,y),P=n(b,v,y),l=!0,P}function s(){return b=t(h,y),e.dependsOnOwnProps&&(v=e(r,y)),P=n(b,v,y)}function u(){return t.dependsOnOwnProps&&(b=t(h,y)),e.dependsOnOwnProps&&(v=e(r,y)),P=n(b,v,y)}function p(){var e=t(h,y),r=!d(e,b);return b=e,r&&(P=n(b,v,y)),P}function a(t,e){var n=!f(e,y),r=!c(t,h);return h=t,y=e,n&&r?s():n?u():r?p():P}var c=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1,h=void 0,y=void 0,b=void 0,v=void 0,P=void 0;return function(t,e){return l?a(t,e):i(t,e)}}function u(t,e){var n=e.initMapStateToProps,r=e.initMapDispatchToProps,u=e.initMergeProps,p=o(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(t,p),c=r(t,p),f=u(t,p),d=p.pure?s:i;return d(a,c,f,t,p)}e.__esModule=!0,e.impureFinalPropsSelectorFactory=i,e.pureFinalPropsSelectorFactory=s,e.default=u;var p=n(14);r(p)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){if(!t)throw Error("Unexpected value for "+e+" in "+n+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||t.hasOwnProperty("dependsOnOwnProps")||(0,u.default)("The selector for "+e+" of "+n+" did not specify a value for dependsOnOwnProps.")}function i(t,e,n,r){o(t,"mapStateToProps",r),o(e,"mapDispatchToProps",r),o(n,"mergeProps",r)}e.__esModule=!0,e.default=i;var s=n(1),u=r(s)},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(){var t=[],e=[];return{clear:function(){e=o,t=o},notify:function(){for(var n=t=e,r=0;n.length>r;r++)n[r]()},subscribe:function(n){var r=!0;return e===t&&(e=t.slice()),e.push(n),function(){r&&t!==o&&(r=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(n),1))}}}}e.__esModule=!0;var o=null,i={notify:function(){}},s=function(){function t(e,r,o){n(this,t),this.store=e,this.parentSub=r,this.onStateChange=o,this.unsubscribe=null,this.listeners=i}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return!!this.unsubscribe},t.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=r())},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=i)},t}();e.default=s},function(t,e){"use strict";function n(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t&&e!==e}function r(t,e){if(n(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(var s=0;r.length>s;s++)if(!o.call(e,r[s])||!n(t[r[s]],e[r[s]]))return!1;return!0}e.__esModule=!0,e.default=r;var o=Object.prototype.hasOwnProperty},function(t,e){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},o="function"==typeof Object.getOwnPropertySymbols;t.exports=function(t,e,i){if("string"!=typeof e){var s=Object.getOwnPropertyNames(e);o&&(s=s.concat(Object.getOwnPropertySymbols(e)));for(var u=0;s.length>u;++u)if(!(n[s[u]]||r[s[u]]||i&&i[s[u]]))try{t[s[u]]=e[s[u]]}catch(t){}}return t}},function(t,e,n){"use strict";var r=function(t,e,n,r,o,i,s,u){if(!t){var p;if(void 0===e)p=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=[n,r,o,i,s,u],c=0;p=Error(e.replace(/%s/g,function(){return a[c++]})),p.name="Invariant Violation"}throw p.framesToPop=1,p}};t.exports=r},function(t,e,n){function r(t){return null==t?void 0===t?p:u:a&&a in Object(t)?i(t):s(t)}var o=n(7),i=n(22),s=n(23),u="[object Null]",p="[object Undefined]",a=o?o.toStringTag:void 0;t.exports=r},function(t,e){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,function(){return this}()||Function("return this")())},function(t,e,n){var r=n(24),o=r(Object.getPrototypeOf,Object);t.exports=o},function(t,e,n){function r(t){var e=s.call(t,p),n=t[p];try{t[p]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[p]=n:delete t[p]),o}var o=n(7),i=Object.prototype,s=i.hasOwnProperty,u=i.toString,p=o?o.toStringTag:void 0;t.exports=r},function(t,e){function n(t){return o.call(t)}var r=Object.prototype,o=r.toString;t.exports=n},function(t,e){function n(t,e){return function(n){return t(e(n))}}t.exports=n},function(t,e,n){var r=n(20),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},function(t,e,n){function r(t){if(!s(t)||o(t)!=u)return!1;var e=i(t);if(null===e)return!0;var n=f.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==d}var o=n(19),i=n(21),s=n(26),u="[object Object]",p=Function.prototype,a=Object.prototype,c=p.toString,f=a.hasOwnProperty,d=c.call(Object);t.exports=r},function(t,n){t.exports=e}])});

@@ -13,8 +13,31 @@ 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; };

import invariant from 'invariant';
import { Component, PropTypes, createElement } from 'react';
import { Component, createElement } from 'react';
import Subscription from '../utils/Subscription';
import storeShape from '../utils/storeShape';
import { storeShape, subscriptionShape } from '../utils/PropTypes';
var hotReloadingVersion = 0;
var dummyState = {};
function noop() {}
function makeSelectorStateful(sourceSelector, store) {
// wrap the selector in an object that tracks its results between runs.
var selector = {
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(store.getState(), props);
if (nextProps !== selector.props || selector.error) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
}
}
};
return selector;
}
export default function connectAdvanced(

@@ -58,7 +81,7 @@ /*

var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = storeShape, _contextTypes[subscriptionKey] = PropTypes.instanceOf(Subscription), _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = PropTypes.instanceOf(Subscription), _childContextTypes);
var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = storeShape, _contextTypes[subscriptionKey] = subscriptionShape, _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = subscriptionShape, _childContextTypes);
return function wrapWithConnect(WrappedComponent) {
invariant(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + WrappedComponent));
invariant(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + JSON.stringify(WrappedComponent)));

@@ -92,13 +115,8 @@ var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';

_this.renderCount = 0;
_this.store = _this.props[storeKey] || _this.context[storeKey];
_this.parentSub = props[subscriptionKey] || context[subscriptionKey];
_this.store = props[storeKey] || context[storeKey];
_this.propsMode = Boolean(props[storeKey]);
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
invariant(_this.store, 'Could not find "' + storeKey + '" in either the context or ' + ('props of "' + displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
invariant(_this.store, 'Could not find "' + storeKey + '" in either the context or props of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
// make sure `getState` is properly bound in order to avoid breaking
// custom store implementations that rely on the store's context
_this.getState = _this.store.getState.bind(_this.store);
_this.initSelector();

@@ -112,3 +130,8 @@ _this.initSubscription();

return _ref2 = {}, _ref2[subscriptionKey] = this.subscription || this.parentSub, _ref2;
// If this component received store from props, its subscription should be transparent
// to any descendants receiving store+subscription from context; it passes along
// subscription passed to it. Otherwise, it shadows the parent subscription, which allows
// Connect to control ordering of notifications to flow top-down.
var subscription = this.propsMode ? null : this.subscription;
return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2;
};

@@ -140,8 +163,7 @@

if (this.subscription) this.subscription.tryUnsubscribe();
// these are just to guard against extra memory leakage if a parent element doesn't
// dereference this instance properly, such as an async callback that never finishes
this.subscription = null;
this.notifyNestedSubs = noop;
this.store = null;
this.parentSub = null;
this.selector.run = function () {};
this.selector.run = noop;
this.selector.shouldComponentUpdate = false;
};

@@ -159,53 +181,45 @@

Connect.prototype.initSelector = function initSelector() {
var dispatch = this.store.dispatch;
var getState = this.getState;
var sourceSelector = selectorFactory(dispatch, selectorFactoryOptions);
// wrap the selector in an object that tracks its results between runs
var selector = this.selector = {
shouldComponentUpdate: true,
props: sourceSelector(getState(), this.props),
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(getState(), props);
if (selector.error || nextProps !== selector.props) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
}
}
};
var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
this.selector = makeSelectorStateful(sourceSelector, this.store);
this.selector.run(this.props);
};
Connect.prototype.initSubscription = function initSubscription() {
var _this2 = this;
if (!shouldHandleStateChanges) return;
if (shouldHandleStateChanges) {
(function () {
var subscription = _this2.subscription = new Subscription(_this2.store, _this2.parentSub);
var dummyState = {};
// parentSub's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
this.subscription = new Subscription(this.store, parentSub, this.onStateChange.bind(this));
subscription.onStateChange = function onStateChange() {
this.selector.run(this.props);
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `this.subscription` will then be null. An
// extra null check every change can be avoided by copying the method onto `this` and then
// replacing it with a no-op on unmount. This can probably be avoided if Subscription's
// listeners logic is changed to not call listeners that have been unsubscribed in the
// middle of the notification loop.
this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
};
if (!this.selector.shouldComponentUpdate) {
subscription.notifyNestedSubs();
} else {
this.componentDidUpdate = function componentDidUpdate() {
this.componentDidUpdate = undefined;
subscription.notifyNestedSubs();
};
Connect.prototype.onStateChange = function onStateChange() {
this.selector.run(this.props);
this.setState(dummyState);
}
}.bind(_this2);
})();
if (!this.selector.shouldComponentUpdate) {
this.notifyNestedSubs();
} else {
this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
this.setState(dummyState);
}
};
Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
// `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
// needs to notify nested subs. Once called, it unimplements itself until further state
// changes occur. Doing it this way vs having a permanent `componentDidMount` that does
// a boolean check every time avoids an extra method call most of the time, resulting
// in some perf boost.
this.componentDidUpdate = undefined;
this.notifyNestedSubs();
};
Connect.prototype.isSubscribed = function isSubscribed() {

@@ -216,3 +230,3 @@ return Boolean(this.subscription) && this.subscription.isSubscribed();

Connect.prototype.addExtraProps = function addExtraProps(props) {
if (!withRef && !renderCountProp) return props;
if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props;
// make a shallow copy so that fields added don't leak to the original selector.

@@ -225,2 +239,3 @@ // this is especially important for 'ref' since that's a reference back to the component

if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
return withExtras;

@@ -227,0 +242,0 @@ };

@@ -8,4 +8,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

import { Component, PropTypes, Children } from 'react';
import Subscription from '../utils/Subscription';
import storeShape from '../utils/storeShape';
import { storeShape, subscriptionShape } from '../utils/PropTypes';
import warning from '../utils/warning';

@@ -67,4 +66,4 @@

store: storeShape.isRequired,
storeSubscription: PropTypes.instanceOf(Subscription)
storeSubscription: subscriptionShape
};
Provider.displayName = 'Provider';

@@ -46,6 +46,8 @@ import verifyPlainObject from '../utils/verifyPlainObject';

proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
// allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps;
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
var props = proxy(stateOrDispatch, ownProps);

@@ -52,0 +54,0 @@

var hasOwn = Object.prototype.hasOwnProperty;
export default function shallowEqual(a, b) {
if (a === b) return true;
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
var countA = 0;
var countB = 0;
export default function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
for (var key in a) {
if (hasOwn.call(a, key) && a[key] !== b[key]) return false;
countA++;
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
for (var _key in b) {
if (hasOwn.call(b, _key)) countB++;
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return countA === countB;
return true;
}

@@ -46,3 +46,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Subscription = function () {
function Subscription(store, parentSub) {
function Subscription(store, parentSub, onStateChange) {
_classCallCheck(this, Subscription);

@@ -52,2 +52,3 @@

this.parentSub = parentSub;
this.onStateChange = onStateChange;
this.unsubscribe = null;

@@ -72,3 +73,2 @@ this.listeners = nullListeners;

if (!this.unsubscribe) {
// this.onStateChange is set by connectAdvanced.initSubscription()
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);

@@ -75,0 +75,0 @@

@@ -23,6 +23,4 @@ 'use strict';

var _storeShape = require('../utils/storeShape');
var _PropTypes = require('../utils/PropTypes');
var _storeShape2 = _interopRequireDefault(_storeShape);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -39,2 +37,25 @@

var hotReloadingVersion = 0;
var dummyState = {};
function noop() {}
function makeSelectorStateful(sourceSelector, store) {
// wrap the selector in an object that tracks its results between runs.
var selector = {
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(store.getState(), props);
if (nextProps !== selector.props || selector.error) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
}
}
};
return selector;
}
function connectAdvanced(

@@ -78,7 +99,7 @@ /*

var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _storeShape2.default, _contextTypes[subscriptionKey] = _react.PropTypes.instanceOf(_Subscription2.default), _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _react.PropTypes.instanceOf(_Subscription2.default), _childContextTypes);
var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes);
return function wrapWithConnect(WrappedComponent) {
(0, _invariant2.default)(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + WrappedComponent));
(0, _invariant2.default)(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + JSON.stringify(WrappedComponent)));

@@ -112,13 +133,8 @@ var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';

_this.renderCount = 0;
_this.store = _this.props[storeKey] || _this.context[storeKey];
_this.parentSub = props[subscriptionKey] || context[subscriptionKey];
_this.store = props[storeKey] || context[storeKey];
_this.propsMode = Boolean(props[storeKey]);
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
(0, _invariant2.default)(_this.store, 'Could not find "' + storeKey + '" in either the context or ' + ('props of "' + displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
(0, _invariant2.default)(_this.store, 'Could not find "' + storeKey + '" in either the context or props of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
// make sure `getState` is properly bound in order to avoid breaking
// custom store implementations that rely on the store's context
_this.getState = _this.store.getState.bind(_this.store);
_this.initSelector();

@@ -132,3 +148,8 @@ _this.initSubscription();

return _ref2 = {}, _ref2[subscriptionKey] = this.subscription || this.parentSub, _ref2;
// If this component received store from props, its subscription should be transparent
// to any descendants receiving store+subscription from context; it passes along
// subscription passed to it. Otherwise, it shadows the parent subscription, which allows
// Connect to control ordering of notifications to flow top-down.
var subscription = this.propsMode ? null : this.subscription;
return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2;
};

@@ -160,8 +181,7 @@

if (this.subscription) this.subscription.tryUnsubscribe();
// these are just to guard against extra memory leakage if a parent element doesn't
// dereference this instance properly, such as an async callback that never finishes
this.subscription = null;
this.notifyNestedSubs = noop;
this.store = null;
this.parentSub = null;
this.selector.run = function () {};
this.selector.run = noop;
this.selector.shouldComponentUpdate = false;
};

@@ -179,53 +199,45 @@

Connect.prototype.initSelector = function initSelector() {
var dispatch = this.store.dispatch;
var getState = this.getState;
var sourceSelector = selectorFactory(dispatch, selectorFactoryOptions);
// wrap the selector in an object that tracks its results between runs
var selector = this.selector = {
shouldComponentUpdate: true,
props: sourceSelector(getState(), this.props),
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(getState(), props);
if (selector.error || nextProps !== selector.props) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
}
}
};
var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
this.selector = makeSelectorStateful(sourceSelector, this.store);
this.selector.run(this.props);
};
Connect.prototype.initSubscription = function initSubscription() {
var _this2 = this;
if (!shouldHandleStateChanges) return;
if (shouldHandleStateChanges) {
(function () {
var subscription = _this2.subscription = new _Subscription2.default(_this2.store, _this2.parentSub);
var dummyState = {};
// parentSub's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
this.subscription = new _Subscription2.default(this.store, parentSub, this.onStateChange.bind(this));
subscription.onStateChange = function onStateChange() {
this.selector.run(this.props);
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `this.subscription` will then be null. An
// extra null check every change can be avoided by copying the method onto `this` and then
// replacing it with a no-op on unmount. This can probably be avoided if Subscription's
// listeners logic is changed to not call listeners that have been unsubscribed in the
// middle of the notification loop.
this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
};
if (!this.selector.shouldComponentUpdate) {
subscription.notifyNestedSubs();
} else {
this.componentDidUpdate = function componentDidUpdate() {
this.componentDidUpdate = undefined;
subscription.notifyNestedSubs();
};
Connect.prototype.onStateChange = function onStateChange() {
this.selector.run(this.props);
this.setState(dummyState);
}
}.bind(_this2);
})();
if (!this.selector.shouldComponentUpdate) {
this.notifyNestedSubs();
} else {
this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
this.setState(dummyState);
}
};
Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
// `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
// needs to notify nested subs. Once called, it unimplements itself until further state
// changes occur. Doing it this way vs having a permanent `componentDidMount` that does
// a boolean check every time avoids an extra method call most of the time, resulting
// in some perf boost.
this.componentDidUpdate = undefined;
this.notifyNestedSubs();
};
Connect.prototype.isSubscribed = function isSubscribed() {

@@ -236,3 +248,3 @@ return Boolean(this.subscription) && this.subscription.isSubscribed();

Connect.prototype.addExtraProps = function addExtraProps(props) {
if (!withRef && !renderCountProp) return props;
if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props;
// make a shallow copy so that fields added don't leak to the original selector.

@@ -245,2 +257,3 @@ // this is especially important for 'ref' since that's a reference back to the component

if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
return withExtras;

@@ -247,0 +260,0 @@ };

@@ -8,10 +8,4 @@ 'use strict';

var _Subscription = require('../utils/Subscription');
var _PropTypes = require('../utils/PropTypes');
var _Subscription2 = _interopRequireDefault(_Subscription);
var _storeShape = require('../utils/storeShape');
var _storeShape2 = _interopRequireDefault(_storeShape);
var _warning = require('../utils/warning');

@@ -78,9 +72,9 @@

Provider.propTypes = {
store: _storeShape2.default.isRequired,
store: _PropTypes.storeShape.isRequired,
children: _react.PropTypes.element.isRequired
};
Provider.childContextTypes = {
store: _storeShape2.default.isRequired,
storeSubscription: _react.PropTypes.instanceOf(_Subscription2.default)
store: _PropTypes.storeShape.isRequired,
storeSubscription: _PropTypes.subscriptionShape
};
Provider.displayName = 'Provider';

@@ -57,6 +57,8 @@ 'use strict';

proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
// allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps;
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
var props = proxy(stateOrDispatch, ownProps);

@@ -63,0 +65,0 @@

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -7,18 +7,29 @@ exports.__esModule = true;

function shallowEqual(a, b) {
if (a === b) return true;
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
var countA = 0;
var countB = 0;
function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
for (var key in a) {
if (hasOwn.call(a, key) && a[key] !== b[key]) return false;
countA++;
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
for (var _key in b) {
if (hasOwn.call(b, _key)) countB++;
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return countA === countB;
return true;
}

@@ -50,3 +50,3 @@ "use strict";

var Subscription = function () {
function Subscription(store, parentSub) {
function Subscription(store, parentSub, onStateChange) {
_classCallCheck(this, Subscription);

@@ -56,2 +56,3 @@

this.parentSub = parentSub;
this.onStateChange = onStateChange;
this.unsubscribe = null;

@@ -76,3 +77,2 @@ this.listeners = nullListeners;

if (!this.unsubscribe) {
// this.onStateChange is set by connectAdvanced.initSubscription()
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);

@@ -79,0 +79,0 @@

{
"name": "react-redux",
"version": "5.0.2",
"version": "5.0.3",
"description": "Official React bindings for Redux",

@@ -55,3 +55,3 @@ "main": "./lib/index.js",

"babel-plugin-check-es2015-constants": "^6.3.13",
"babel-plugin-istanbul": "^3.0.0",
"babel-plugin-istanbul": "^4.0.0",
"babel-plugin-syntax-jsx": "^6.3.13",

@@ -107,3 +107,3 @@ "babel-plugin-transform-decorators-legacy": "^1.2.0",

"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0",
"react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0",
"redux": "^2.0.0 || ^3.0.0"

@@ -110,0 +110,0 @@ },

import hoistStatics from 'hoist-non-react-statics'
import invariant from 'invariant'
import { Component, PropTypes, createElement } from 'react'
import { Component, createElement } from 'react'
import Subscription from '../utils/Subscription'
import storeShape from '../utils/storeShape'
import { storeShape, subscriptionShape } from '../utils/PropTypes'
let hotReloadingVersion = 0
const dummyState = {}
function noop() {}
function makeSelectorStateful(sourceSelector, store) {
// wrap the selector in an object that tracks its results between runs.
const selector = {
run: function runComponentSelector(props) {
try {
const nextProps = sourceSelector(store.getState(), props)
if (nextProps !== selector.props || selector.error) {
selector.shouldComponentUpdate = true
selector.props = nextProps
selector.error = null
}
} catch (error) {
selector.shouldComponentUpdate = true
selector.error = error
}
}
}
return selector
}
export default function connectAdvanced(

@@ -60,6 +83,6 @@ /*

[storeKey]: storeShape,
[subscriptionKey]: PropTypes.instanceOf(Subscription),
[subscriptionKey]: subscriptionShape,
}
const childContextTypes = {
[subscriptionKey]: PropTypes.instanceOf(Subscription)
[subscriptionKey]: subscriptionShape,
}

@@ -71,3 +94,3 @@

`You must pass a component to the function returned by ` +
`connect. Instead received ${WrappedComponent}`
`connect. Instead received ${JSON.stringify(WrappedComponent)}`
)

@@ -101,18 +124,12 @@

this.renderCount = 0
this.store = this.props[storeKey] || this.context[storeKey]
this.parentSub = props[subscriptionKey] || context[subscriptionKey]
this.store = props[storeKey] || context[storeKey]
this.propsMode = Boolean(props[storeKey])
this.setWrappedInstance = this.setWrappedInstance.bind(this)
invariant(this.store,
`Could not find "${storeKey}" in either the context or ` +
`props of "${displayName}". ` +
`Either wrap the root component in a <Provider>, ` +
`Could not find "${storeKey}" in either the context or props of ` +
`"${displayName}". Either wrap the root component in a <Provider>, ` +
`or explicitly pass "${storeKey}" as a prop to "${displayName}".`
)
// make sure `getState` is properly bound in order to avoid breaking
// custom store implementations that rely on the store's context
this.getState = this.store.getState.bind(this.store);
this.initSelector()

@@ -123,3 +140,8 @@ this.initSubscription()

getChildContext() {
return { [subscriptionKey]: this.subscription || this.parentSub }
// If this component received store from props, its subscription should be transparent
// to any descendants receiving store+subscription from context; it passes along
// subscription passed to it. Otherwise, it shadows the parent subscription, which allows
// Connect to control ordering of notifications to flow top-down.
const subscription = this.propsMode ? null : this.subscription
return { [subscriptionKey]: subscription || this.context[subscriptionKey] }
}

@@ -151,8 +173,7 @@

if (this.subscription) this.subscription.tryUnsubscribe()
// these are just to guard against extra memory leakage if a parent element doesn't
// dereference this instance properly, such as an async callback that never finishes
this.subscription = null
this.notifyNestedSubs = noop
this.store = null
this.parentSub = null
this.selector.run = () => {}
this.selector.run = noop
this.selector.shouldComponentUpdate = false
}

@@ -173,48 +194,45 @@

initSelector() {
const { dispatch } = this.store
const { getState } = this;
const sourceSelector = selectorFactory(dispatch, selectorFactoryOptions)
// wrap the selector in an object that tracks its results between runs
const selector = this.selector = {
shouldComponentUpdate: true,
props: sourceSelector(getState(), this.props),
run: function runComponentSelector(props) {
try {
const nextProps = sourceSelector(getState(), props)
if (selector.error || nextProps !== selector.props) {
selector.shouldComponentUpdate = true
selector.props = nextProps
selector.error = null
}
} catch (error) {
selector.shouldComponentUpdate = true
selector.error = error
}
}
}
const sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions)
this.selector = makeSelectorStateful(sourceSelector, this.store)
this.selector.run(this.props)
}
initSubscription() {
if (shouldHandleStateChanges) {
const subscription = this.subscription = new Subscription(this.store, this.parentSub)
const dummyState = {}
if (!shouldHandleStateChanges) return
subscription.onStateChange = function onStateChange() {
this.selector.run(this.props)
// parentSub's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
const parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey]
this.subscription = new Subscription(this.store, parentSub, this.onStateChange.bind(this))
if (!this.selector.shouldComponentUpdate) {
subscription.notifyNestedSubs()
} else {
this.componentDidUpdate = function componentDidUpdate() {
this.componentDidUpdate = undefined
subscription.notifyNestedSubs()
}
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `this.subscription` will then be null. An
// extra null check every change can be avoided by copying the method onto `this` and then
// replacing it with a no-op on unmount. This can probably be avoided if Subscription's
// listeners logic is changed to not call listeners that have been unsubscribed in the
// middle of the notification loop.
this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription)
}
this.setState(dummyState)
}
}.bind(this)
onStateChange() {
this.selector.run(this.props)
if (!this.selector.shouldComponentUpdate) {
this.notifyNestedSubs()
} else {
this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate
this.setState(dummyState)
}
}
notifyNestedSubsOnComponentDidUpdate() {
// `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
// needs to notify nested subs. Once called, it unimplements itself until further state
// changes occur. Doing it this way vs having a permanent `componentDidMount` that does
// a boolean check every time avoids an extra method call most of the time, resulting
// in some perf boost.
this.componentDidUpdate = undefined
this.notifyNestedSubs()
}
isSubscribed() {

@@ -225,3 +243,3 @@ return Boolean(this.subscription) && this.subscription.isSubscribed()

addExtraProps(props) {
if (!withRef && !renderCountProp) return props
if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props
// make a shallow copy so that fields added don't leak to the original selector.

@@ -234,2 +252,3 @@ // this is especially important for 'ref' since that's a reference back to the component

if (renderCountProp) withExtras[renderCountProp] = this.renderCount++
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription
return withExtras

@@ -236,0 +255,0 @@ }

import { Component, PropTypes, Children } from 'react'
import Subscription from '../utils/Subscription'
import storeShape from '../utils/storeShape'
import { storeShape, subscriptionShape } from '../utils/PropTypes'
import warning from '../utils/warning'

@@ -54,4 +53,4 @@

store: storeShape.isRequired,
storeSubscription: PropTypes.instanceOf(Subscription)
storeSubscription: subscriptionShape
}
Provider.displayName = 'Provider'

@@ -46,6 +46,8 @@ import verifyPlainObject from '../utils/verifyPlainObject'

proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps)
// allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps)
let props = proxy(stateOrDispatch, ownProps)

@@ -52,0 +54,0 @@

const hasOwn = Object.prototype.hasOwnProperty
export default function shallowEqual(a, b) {
if (a === b) return true
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y
} else {
return x !== x && y !== y
}
}
let countA = 0
let countB = 0
for (let key in a) {
if (hasOwn.call(a, key) && a[key] !== b[key]) return false
countA++
export default function shallowEqual(objA, objB) {
if (is(objA, objB)) return true
if (typeof objA !== 'object' || objA === null ||
typeof objB !== 'object' || objB === null) {
return false
}
for (let key in b) {
if (hasOwn.call(b, key)) countB++
const keysA = Object.keys(objA)
const keysB = Object.keys(objB)
if (keysA.length !== keysB.length) return false
for (let i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) ||
!is(objA[keysA[i]], objB[keysA[i]])) {
return false
}
}
return countA === countB
return true
}

@@ -44,5 +44,6 @@ // encapsulates the subscription logic for connecting a component to the redux store, as

export default class Subscription {
constructor(store, parentSub) {
constructor(store, parentSub, onStateChange) {
this.store = store
this.parentSub = parentSub
this.onStateChange = onStateChange
this.unsubscribe = null

@@ -67,3 +68,2 @@ this.listeners = nullListeners

if (!this.unsubscribe) {
// this.onStateChange is set by connectAdvanced.initSubscription()
this.unsubscribe = this.parentSub

@@ -70,0 +70,0 @@ ? this.parentSub.addNestedSub(this.onStateChange)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc