redux-starter-kit
Advanced tools
Comparing version 0.8.1 to 0.9.0-alpha.0
@@ -1,562 +0,2 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var redux = require('redux'); | ||
var createNextState = _interopDefault(require('immer')); | ||
var reselect = require('reselect'); | ||
var reduxDevtoolsExtension = require('redux-devtools-extension'); | ||
var thunkMiddleware = _interopDefault(require('redux-thunk')); | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(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; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
/** | ||
* Returns true if the passed value is "plain" object, i.e. an object whose | ||
* protoype is the root `Object.prototype`. This includes objects created | ||
* using object literals, but not for instance for class instances. | ||
* | ||
* @param {any} value The value to inspect. | ||
* @returns {boolean} True if the argument appears to be a plain object. | ||
*/ | ||
function isPlainObject(value) { | ||
if (_typeof(value) !== 'object' || value === null) return false; | ||
var proto = value; | ||
while (Object.getPrototypeOf(proto) !== null) { | ||
proto = Object.getPrototypeOf(proto); | ||
} | ||
return Object.getPrototypeOf(value) === proto; | ||
} | ||
/** | ||
* Returns true if the passed value is "plain", i.e. a value that is either | ||
* directly JSON-serializable (boolean, number, string, array, plain object) | ||
* or `undefined`. | ||
* | ||
* @param val The value to check. | ||
*/ | ||
function isPlain(val) { | ||
return typeof val === 'undefined' || val === null || typeof val === 'string' || typeof val === 'boolean' || typeof val === 'number' || Array.isArray(val) || isPlainObject(val); | ||
} | ||
var NON_SERIALIZABLE_STATE_MESSAGE = ['A non-serializable value was detected in the state, in the path: `%s`. Value: %o', 'Take a look at the reducer(s) handling this action type: %s.', '(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)'].join('\n'); | ||
var NON_SERIALIZABLE_ACTION_MESSAGE = ['A non-serializable value was detected in an action, in the path: `%s`. Value: %o', 'Take a look at the logic that dispatched this action: %o.', '(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)'].join('\n'); | ||
function findNonSerializableValue(value) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var isSerializable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isPlain; | ||
var getEntries = arguments.length > 3 ? arguments[3] : undefined; | ||
var foundNestedSerializable; | ||
if (!isSerializable(value)) { | ||
return { | ||
keyPath: path.join('.') || '<root>', | ||
value: value | ||
}; | ||
} | ||
if (_typeof(value) !== 'object' || value === null) { | ||
return false; | ||
} | ||
var entries = getEntries != null ? getEntries(value) : Object.entries(value); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _step$value = _slicedToArray(_step.value, 2), | ||
property = _step$value[0], | ||
nestedValue = _step$value[1]; | ||
var nestedPath = path.concat(property); | ||
if (!isSerializable(nestedValue)) { | ||
return { | ||
keyPath: nestedPath.join('.'), | ||
value: nestedValue | ||
}; | ||
} | ||
if (_typeof(nestedValue) === 'object') { | ||
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries); | ||
if (foundNestedSerializable) { | ||
return foundNestedSerializable; | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* Options for `createSerializableStateInvariantMiddleware()`. | ||
*/ | ||
/** | ||
* Creates a middleware that, after every state change, checks if the new | ||
* state is serializable. If a non-serializable value is found within the | ||
* state, an error is printed to the console. | ||
* | ||
* @param options Middleware options. | ||
*/ | ||
function createSerializableStateInvariantMiddleware() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _options$isSerializab = options.isSerializable, | ||
isSerializable = _options$isSerializab === void 0 ? isPlain : _options$isSerializab, | ||
getEntries = options.getEntries, | ||
_options$ignoredActio = options.ignoredActions, | ||
ignoredActions = _options$ignoredActio === void 0 ? [] : _options$ignoredActio; | ||
return function (storeAPI) { | ||
return function (next) { | ||
return function (action) { | ||
if (ignoredActions.length && ignoredActions.indexOf(action.type) !== -1) { | ||
return next(action); | ||
} | ||
var foundActionNonSerializableValue = findNonSerializableValue(action, [], isSerializable, getEntries); | ||
if (foundActionNonSerializableValue) { | ||
var keyPath = foundActionNonSerializableValue.keyPath, | ||
_value = foundActionNonSerializableValue.value; | ||
console.error(NON_SERIALIZABLE_ACTION_MESSAGE, keyPath, _value, action); | ||
} | ||
var result = next(action); | ||
var state = storeAPI.getState(); | ||
var foundStateNonSerializableValue = findNonSerializableValue(state, [], isSerializable, getEntries); | ||
if (foundStateNonSerializableValue) { | ||
var _keyPath = foundStateNonSerializableValue.keyPath, | ||
_value2 = foundStateNonSerializableValue.value; | ||
console.error(NON_SERIALIZABLE_STATE_MESSAGE, _keyPath, _value2, action.type); | ||
} | ||
return result; | ||
}; | ||
}; | ||
}; | ||
} | ||
function isBoolean(x) { | ||
return typeof x === 'boolean'; | ||
} | ||
/** | ||
* Returns any array containing the default middleware installed by | ||
* `configureStore()`. Useful if you want to configure your store with a custom | ||
* `middleware` array but still keep the default set. | ||
* | ||
* @return The default middleware used by `configureStore()`. | ||
*/ | ||
function getDefaultMiddleware() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _options$thunk = options.thunk, | ||
thunk = _options$thunk === void 0 ? true : _options$thunk, | ||
_options$immutableChe = options.immutableCheck, | ||
immutableCheck = _options$immutableChe === void 0 ? true : _options$immutableChe, | ||
_options$serializable = options.serializableCheck, | ||
serializableCheck = _options$serializable === void 0 ? true : _options$serializable; | ||
var middlewareArray = []; | ||
if (thunk) { | ||
if (isBoolean(thunk)) { | ||
middlewareArray.push(thunkMiddleware); | ||
} else { | ||
middlewareArray.push(thunkMiddleware.withExtraArgument(thunk.extraArgument)); | ||
} | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
/* START_REMOVE_UMD */ | ||
if (immutableCheck) { | ||
var createImmutableStateInvariantMiddleware = require('redux-immutable-state-invariant')["default"]; | ||
var immutableOptions = {}; | ||
if (!isBoolean(immutableCheck)) { | ||
immutableOptions = immutableCheck; | ||
} | ||
middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions)); | ||
} | ||
/* STOP_REMOVE_UMD */ | ||
if (serializableCheck) { | ||
var serializableOptions = {}; | ||
if (!isBoolean(serializableCheck)) { | ||
serializableOptions = serializableCheck; | ||
} | ||
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions)); | ||
} | ||
} | ||
return middlewareArray; | ||
} | ||
var IS_PRODUCTION = process.env.NODE_ENV === 'production'; | ||
/** | ||
* A friendly abstraction over the standard Redux `createStore()` function. | ||
* | ||
* @param config The store configuration. | ||
* @returns A configured Redux store. | ||
*/ | ||
function configureStore(options) { | ||
var _ref = options || {}, | ||
_ref$reducer = _ref.reducer, | ||
reducer = _ref$reducer === void 0 ? undefined : _ref$reducer, | ||
_ref$middleware = _ref.middleware, | ||
middleware = _ref$middleware === void 0 ? getDefaultMiddleware() : _ref$middleware, | ||
_ref$devTools = _ref.devTools, | ||
devTools = _ref$devTools === void 0 ? true : _ref$devTools, | ||
_ref$preloadedState = _ref.preloadedState, | ||
preloadedState = _ref$preloadedState === void 0 ? undefined : _ref$preloadedState, | ||
_ref$enhancers = _ref.enhancers, | ||
enhancers = _ref$enhancers === void 0 ? undefined : _ref$enhancers; | ||
var rootReducer; | ||
if (typeof reducer === 'function') { | ||
rootReducer = reducer; | ||
} else if (isPlainObject(reducer)) { | ||
rootReducer = redux.combineReducers(reducer); | ||
} else { | ||
throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'); | ||
} | ||
var middlewareEnhancer = redux.applyMiddleware.apply(void 0, _toConsumableArray(middleware)); | ||
var finalCompose = redux.compose; | ||
if (devTools) { | ||
finalCompose = reduxDevtoolsExtension.composeWithDevTools(_objectSpread({ | ||
// Enable capture of stack traces for dispatched Redux actions | ||
trace: !IS_PRODUCTION | ||
}, _typeof(devTools) === 'object' && devTools)); | ||
} | ||
var storeEnhancers = [middlewareEnhancer]; | ||
if (Array.isArray(enhancers)) { | ||
storeEnhancers = [middlewareEnhancer].concat(_toConsumableArray(enhancers)); | ||
} else if (typeof enhancers === 'function') { | ||
storeEnhancers = enhancers(storeEnhancers); | ||
} | ||
var composedEnhancer = finalCompose.apply(void 0, _toConsumableArray(storeEnhancers)); | ||
return redux.createStore(rootReducer, preloadedState, composedEnhancer); | ||
} | ||
/** | ||
* An action with a string type and an associated payload. This is the | ||
* type of action returned by `createAction()` action creators. | ||
* | ||
* @template P The type of the action's payload. | ||
* @template T the type used for the action type. | ||
* @template M The type of the action's meta (optional) | ||
*/ | ||
/** | ||
* An action creator that produces actions with a `payload` attribute. | ||
*/ | ||
/** | ||
* A utility function to create an action creator for the given action type | ||
* string. The action creator accepts a single argument, which will be included | ||
* in the action object as a field called payload. The action creator function | ||
* will also have its toString() overriden so that it returns the action type, | ||
* allowing it to be used in reducer logic that is looking for that action type. | ||
* | ||
* @param type The action type to use for created actions. | ||
* @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }. | ||
* If this is given, the resulting action creator will pass it's arguments to this method to calculate payload & meta. | ||
*/ | ||
function createAction(type, prepareAction) { | ||
function actionCreator() { | ||
if (prepareAction) { | ||
var prepared = prepareAction.apply(void 0, arguments); | ||
if (!prepared) { | ||
throw new Error('prepareAction did not return an object'); | ||
} | ||
return 'meta' in prepared ? { | ||
type: type, | ||
payload: prepared.payload, | ||
meta: prepared.meta | ||
} : { | ||
type: type, | ||
payload: prepared.payload | ||
}; | ||
} | ||
return { | ||
type: type, | ||
payload: arguments.length <= 0 ? undefined : arguments[0] | ||
}; | ||
} | ||
actionCreator.toString = function () { | ||
return "".concat(type); | ||
}; | ||
actionCreator.type = type; | ||
return actionCreator; | ||
} | ||
/** | ||
* Returns the action type of the actions created by the passed | ||
* `createAction()`-generated action creator (arbitrary action creators | ||
* are not supported). | ||
* | ||
* @param action The action creator whose action type to get. | ||
* @returns The action type used by the action creator. | ||
*/ | ||
function getType(actionCreator) { | ||
return "".concat(actionCreator); | ||
} // helper types for more readable typings | ||
/** | ||
* A utility function that allows defining a reducer as a mapping from action | ||
* type to *case reducer* functions that handle these action types. The | ||
* reducer's initial state is passed as the first argument. | ||
* | ||
* The body of every case reducer is implicitly wrapped with a call to | ||
* `produce()` from the [immer](https://github.com/mweststrate/immer) library. | ||
* This means that rather than returning a new state object, you can also | ||
* mutate the passed-in state object directly; these mutations will then be | ||
* automatically and efficiently translated into copies, giving you both | ||
* convenience and immutability. | ||
* | ||
* @param initialState The initial state to be returned by the reducer. | ||
* @param actionsMap A mapping from action types to action-type-specific | ||
* case redeucers. | ||
*/ | ||
function createReducer(initialState, actionsMap) { | ||
return function () { | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var action = arguments.length > 1 ? arguments[1] : undefined; | ||
// @ts-ignore createNextState() produces an Immutable<Draft<S>> rather | ||
// than an Immutable<S>, and TypeScript cannot find out how to reconcile | ||
// these two types. | ||
return createNextState(state, function (draft) { | ||
var caseReducer = actionsMap[action.type]; | ||
return caseReducer ? caseReducer(draft, action) : undefined; | ||
}); | ||
}; | ||
} | ||
/** | ||
* An action creator atttached to a slice. | ||
* | ||
* @deprecated please use PayloadActionCreator directly | ||
*/ | ||
function getType$1(slice, actionKey) { | ||
return "".concat(slice, "/").concat(actionKey); | ||
} | ||
/** | ||
* A function that accepts an initial state, an object full of reducer | ||
* functions, and a "slice name", and automatically generates | ||
* action creators and action types that correspond to the | ||
* reducers and state. | ||
* | ||
* The `reducer` argument is passed to `createReducer()`. | ||
*/ | ||
// internal definition is a little less restrictive | ||
function createSlice(options) { | ||
var name = options.name, | ||
initialState = options.initialState; | ||
if (!name) { | ||
throw new Error('`name` is a required option for createSlice'); | ||
} | ||
var reducers = options.reducers || {}; | ||
var extraReducers = options.extraReducers || {}; | ||
var reducerNames = Object.keys(reducers); | ||
var sliceCaseReducersByName = {}; | ||
var sliceCaseReducersByType = {}; | ||
var actionCreators = {}; | ||
reducerNames.forEach(function (reducerName) { | ||
var maybeReducerWithPrepare = reducers[reducerName]; | ||
var type = getType$1(name, reducerName); | ||
var caseReducer; | ||
var prepareCallback; | ||
if (typeof maybeReducerWithPrepare === 'function') { | ||
caseReducer = maybeReducerWithPrepare; | ||
} else { | ||
caseReducer = maybeReducerWithPrepare.reducer; | ||
prepareCallback = maybeReducerWithPrepare.prepare; | ||
} | ||
sliceCaseReducersByName[reducerName] = caseReducer; | ||
sliceCaseReducersByType[type] = caseReducer; | ||
actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type); | ||
}); | ||
var finalCaseReducers = _objectSpread({}, extraReducers, sliceCaseReducersByType); | ||
var reducer = createReducer(initialState, finalCaseReducers); | ||
return { | ||
name: name, | ||
reducer: reducer, | ||
actions: actionCreators, | ||
caseReducers: sliceCaseReducersByName | ||
}; | ||
} | ||
Object.defineProperty(exports, 'combineReducers', { | ||
enumerable: true, | ||
get: function () { | ||
return redux.combineReducers; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'compose', { | ||
enumerable: true, | ||
get: function () { | ||
return redux.compose; | ||
} | ||
}); | ||
exports.createNextState = createNextState; | ||
Object.defineProperty(exports, 'createSelector', { | ||
enumerable: true, | ||
get: function () { | ||
return reselect.createSelector; | ||
} | ||
}); | ||
exports.configureStore = configureStore; | ||
exports.createAction = createAction; | ||
exports.createReducer = createReducer; | ||
exports.createSerializableStateInvariantMiddleware = createSerializableStateInvariantMiddleware; | ||
exports.createSlice = createSlice; | ||
exports.findNonSerializableValue = findNonSerializableValue; | ||
exports.getDefaultMiddleware = getDefaultMiddleware; | ||
exports.getType = getType; | ||
exports.isPlain = isPlain; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("redux"),r=e(require("immer")),o=require("reselect"),n=require("redux-devtools-extension"),a=e(require("redux-thunk"));function i(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function u(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||i(e)}var c=["A non-serializable value was detected in the state, in the path: `%s`. Value: %o","Take a look at the reducer(s) handling this action type: %s.","(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)"].join("\n"),s=["A non-serializable value was detected in an action, in the path: `%s`. Value: %o","Take a look at the logic that dispatched this action: %o.","(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)"].join("\n");function l(e,t,r,o){var n;if(void 0===t&&(t=[]),void 0===r&&(r=u),!r(e))return{keyPath:t.join(".")||"<root>",value:e};if("object"!=typeof e||null===e)return!1;var a=null!=o?o(e):Object.entries(e),i=Array.isArray(a),c=0;for(a=i?a:a[Symbol.iterator]();;){var s;if(i){if(c>=a.length)break;s=a[c++]}else{if((c=a.next()).done)break;s=c.value}var d=s[1],p=t.concat(s[0]);if(!r(d))return{keyPath:p.join("."),value:d};if("object"==typeof d&&(n=l(d,p,r,o)))return n}return!1}function d(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,o=[];return r&&o.push("boolean"==typeof r?a:a.withExtraArgument(r.extraArgument)),o}function p(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw new Error("prepareAction did not return an object");return"meta"in r?{type:e,payload:r.payload,meta:r.meta}:{type:e,payload:r.payload}}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r}function f(e,t){return function(o,n){return void 0===o&&(o=e),r(o,function(e){var r=t[n.type];return r?r(e,n):void 0})}}function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}Object.defineProperty(exports,"combineReducers",{enumerable:!0,get:function(){return t.combineReducers}}),Object.defineProperty(exports,"compose",{enumerable:!0,get:function(){return t.compose}}),exports.createNextState=r,Object.defineProperty(exports,"createSelector",{enumerable:!0,get:function(){return o.createSelector}}),exports.configureStore=function(e){var r,o=e||{},a=o.reducer,u=void 0===a?void 0:a,c=o.middleware,s=void 0===c?d():c,l=o.devTools,p=void 0===l||l,f=o.preloadedState,v=void 0===f?void 0:f,y=o.enhancers,b=void 0===y?void 0:y;if("function"==typeof u)r=u;else{if(!i(u))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');r=t.combineReducers(u)}var h=t.applyMiddleware.apply(void 0,s),g=t.compose;if(p){var m=Object.assign({trace:!1},"object"==typeof p?p:{});g=n.composeWithDevTools(m)}var x=[h];Array.isArray(b)?x=[h].concat(b):"function"==typeof b&&(x=b(x));var j=g.apply(void 0,x);return t.createStore(r,v,j)},exports.createAction=p,exports.createReducer=f,exports.createSerializableStateInvariantMiddleware=function(e){void 0===e&&(e={});var t=e.isSerializable,r=void 0===t?u:t,o=e.getEntries,n=e.ignoredActions,a=void 0===n?[]:n;return function(e){return function(t){return function(n){if(a.length&&-1!==a.indexOf(n.type))return t(n);var i=l(n,[],r,o);i&&console.error(s,i.keyPath,i.value,n);var u=t(n),d=l(e.getState(),[],r,o);return d&&console.error(c,d.keyPath,d.value,n.type),u}}}},exports.createSlice=function(e){var t=e.name,r=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var o=e.reducers||{},n=e.extraReducers||{},a=Object.keys(o),i={},u={},c={};a.forEach(function(e){var r,n,a=o[e],s=t+"/"+e;"function"==typeof a?r=a:(r=a.reducer,n=a.prepare),i[e]=r,u[s]=r,c[e]=n?p(s,n):p(s)});var s=f(r,v({},n,u));return{name:t,reducer:s,actions:c,caseReducers:i}},exports.findNonSerializableValue=l,exports.getDefaultMiddleware=d,exports.getType=function(e){return""+e},exports.isPlain=u; | ||
//# sourceMappingURL=redux-starter-kit.cjs.js.map |
@@ -9,108 +9,2 @@ import { combineReducers, applyMiddleware, createStore, compose } from 'redux'; | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(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; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
/** | ||
@@ -125,3 +19,3 @@ * Returns true if the passed value is "plain" object, i.e. an object whose | ||
function isPlainObject(value) { | ||
if (_typeof(value) !== 'object' || value === null) return false; | ||
if (typeof value !== 'object' || value === null) return false; | ||
var proto = value; | ||
@@ -143,11 +37,21 @@ | ||
*/ | ||
function isPlain(val) { | ||
return typeof val === 'undefined' || val === null || typeof val === 'string' || typeof val === 'boolean' || typeof val === 'number' || Array.isArray(val) || isPlainObject(val); | ||
} | ||
var NON_SERIALIZABLE_STATE_MESSAGE = ['A non-serializable value was detected in the state, in the path: `%s`. Value: %o', 'Take a look at the reducer(s) handling this action type: %s.', '(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)'].join('\n'); | ||
var NON_SERIALIZABLE_ACTION_MESSAGE = ['A non-serializable value was detected in an action, in the path: `%s`. Value: %o', 'Take a look at the logic that dispatched this action: %o.', '(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)'].join('\n'); | ||
function findNonSerializableValue(value) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var isSerializable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isPlain; | ||
var getEntries = arguments.length > 3 ? arguments[3] : undefined; | ||
var NON_SERIALIZABLE_STATE_MESSAGE = | ||
/*#__PURE__*/ | ||
['A non-serializable value was detected in the state, in the path: `%s`. Value: %o', 'Take a look at the reducer(s) handling this action type: %s.', '(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)'].join('\n'); | ||
var NON_SERIALIZABLE_ACTION_MESSAGE = | ||
/*#__PURE__*/ | ||
['A non-serializable value was detected in an action, in the path: `%s`. Value: %o', 'Take a look at the logic that dispatched this action: %o.', '(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)'].join('\n'); | ||
function findNonSerializableValue(value, path, isSerializable, getEntries) { | ||
if (path === void 0) { | ||
path = []; | ||
} | ||
if (isSerializable === void 0) { | ||
isSerializable = isPlain; | ||
} | ||
var foundNestedSerializable; | ||
@@ -162,3 +66,3 @@ | ||
if (_typeof(value) !== 'object' || value === null) { | ||
if (typeof value !== 'object' || value === null) { | ||
return false; | ||
@@ -168,42 +72,34 @@ } | ||
var entries = getEntries != null ? getEntries(value) : Object.entries(value); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _step$value = _slicedToArray(_step.value, 2), | ||
property = _step$value[0], | ||
nestedValue = _step$value[1]; | ||
for (var _iterator = entries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
var nestedPath = path.concat(property); | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
if (!isSerializable(nestedValue)) { | ||
return { | ||
keyPath: nestedPath.join('.'), | ||
value: nestedValue | ||
}; | ||
} | ||
var _ref2 = _ref, | ||
property = _ref2[0], | ||
nestedValue = _ref2[1]; | ||
var nestedPath = path.concat(property); | ||
if (_typeof(nestedValue) === 'object') { | ||
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries); | ||
if (!isSerializable(nestedValue)) { | ||
return { | ||
keyPath: nestedPath.join('.'), | ||
value: nestedValue | ||
}; | ||
} | ||
if (foundNestedSerializable) { | ||
return foundNestedSerializable; | ||
} | ||
if (typeof nestedValue === 'object') { | ||
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries); | ||
if (foundNestedSerializable) { | ||
return foundNestedSerializable; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -214,6 +110,2 @@ | ||
/** | ||
* Options for `createSerializableStateInvariantMiddleware()`. | ||
*/ | ||
/** | ||
* Creates a middleware that, after every state change, checks if the new | ||
@@ -225,8 +117,13 @@ * state is serializable. If a non-serializable value is found within the | ||
*/ | ||
function createSerializableStateInvariantMiddleware() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _options$isSerializab = options.isSerializable, | ||
function createSerializableStateInvariantMiddleware(options) { | ||
if (options === void 0) { | ||
options = {}; | ||
} | ||
var _options = options, | ||
_options$isSerializab = _options.isSerializable, | ||
isSerializable = _options$isSerializab === void 0 ? isPlain : _options$isSerializab, | ||
getEntries = options.getEntries, | ||
_options$ignoredActio = options.ignoredActions, | ||
getEntries = _options.getEntries, | ||
_options$ignoredActio = _options.ignoredActions, | ||
ignoredActions = _options$ignoredActio === void 0 ? [] : _options$ignoredActio; | ||
@@ -244,4 +141,4 @@ return function (storeAPI) { | ||
var keyPath = foundActionNonSerializableValue.keyPath, | ||
_value = foundActionNonSerializableValue.value; | ||
console.error(NON_SERIALIZABLE_ACTION_MESSAGE, keyPath, _value, action); | ||
value = foundActionNonSerializableValue.value; | ||
console.error(NON_SERIALIZABLE_ACTION_MESSAGE, keyPath, value, action); | ||
} | ||
@@ -255,4 +152,4 @@ | ||
var _keyPath = foundStateNonSerializableValue.keyPath, | ||
_value2 = foundStateNonSerializableValue.value; | ||
console.error(NON_SERIALIZABLE_STATE_MESSAGE, _keyPath, _value2, action.type); | ||
_value = foundStateNonSerializableValue.value; | ||
console.error(NON_SERIALIZABLE_STATE_MESSAGE, _keyPath, _value, action.type); | ||
} | ||
@@ -269,3 +166,2 @@ | ||
} | ||
/** | ||
@@ -278,9 +174,15 @@ * Returns any array containing the default middleware installed by | ||
*/ | ||
function getDefaultMiddleware() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _options$thunk = options.thunk, | ||
function getDefaultMiddleware(options) { | ||
if (options === void 0) { | ||
options = {}; | ||
} | ||
var _options = options, | ||
_options$thunk = _options.thunk, | ||
thunk = _options$thunk === void 0 ? true : _options$thunk, | ||
_options$immutableChe = options.immutableCheck, | ||
_options$immutableChe = _options.immutableCheck, | ||
immutableCheck = _options$immutableChe === void 0 ? true : _options$immutableChe, | ||
_options$serializable = options.serializableCheck, | ||
_options$serializable = _options.serializableCheck, | ||
serializableCheck = _options$serializable === void 0 ? true : _options$serializable; | ||
@@ -328,3 +230,2 @@ var middlewareArray = []; | ||
var IS_PRODUCTION = process.env.NODE_ENV === 'production'; | ||
/** | ||
@@ -336,2 +237,3 @@ * A friendly abstraction over the standard Redux `createStore()` function. | ||
*/ | ||
function configureStore(options) { | ||
@@ -360,10 +262,11 @@ var _ref = options || {}, | ||
var middlewareEnhancer = applyMiddleware.apply(void 0, _toConsumableArray(middleware)); | ||
var middlewareEnhancer = applyMiddleware.apply(void 0, middleware); | ||
var finalCompose = compose; | ||
if (devTools) { | ||
finalCompose = composeWithDevTools(_objectSpread({ | ||
var devToolsOptions = Object.assign({ | ||
// Enable capture of stack traces for dispatched Redux actions | ||
trace: !IS_PRODUCTION | ||
}, _typeof(devTools) === 'object' && devTools)); | ||
}, typeof devTools === 'object' ? devTools : {}); | ||
finalCompose = composeWithDevTools(devToolsOptions); | ||
} | ||
@@ -374,3 +277,3 @@ | ||
if (Array.isArray(enhancers)) { | ||
storeEnhancers = [middlewareEnhancer].concat(_toConsumableArray(enhancers)); | ||
storeEnhancers = [middlewareEnhancer].concat(enhancers); | ||
} else if (typeof enhancers === 'function') { | ||
@@ -380,30 +283,6 @@ storeEnhancers = enhancers(storeEnhancers); | ||
var composedEnhancer = finalCompose.apply(void 0, _toConsumableArray(storeEnhancers)); | ||
var composedEnhancer = finalCompose.apply(void 0, storeEnhancers); | ||
return createStore(rootReducer, preloadedState, composedEnhancer); | ||
} | ||
/** | ||
* An action with a string type and an associated payload. This is the | ||
* type of action returned by `createAction()` action creators. | ||
* | ||
* @template P The type of the action's payload. | ||
* @template T the type used for the action type. | ||
* @template M The type of the action's meta (optional) | ||
*/ | ||
/** | ||
* An action creator that produces actions with a `payload` attribute. | ||
*/ | ||
/** | ||
* A utility function to create an action creator for the given action type | ||
* string. The action creator accepts a single argument, which will be included | ||
* in the action object as a field called payload. The action creator function | ||
* will also have its toString() overriden so that it returns the action type, | ||
* allowing it to be used in reducer logic that is looking for that action type. | ||
* | ||
* @param type The action type to use for created actions. | ||
* @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }. | ||
* If this is given, the resulting action creator will pass it's arguments to this method to calculate payload & meta. | ||
*/ | ||
function createAction(type, prepareAction) { | ||
@@ -435,3 +314,3 @@ function actionCreator() { | ||
actionCreator.toString = function () { | ||
return "".concat(type); | ||
return "" + type; | ||
}; | ||
@@ -452,4 +331,4 @@ | ||
function getType(actionCreator) { | ||
return "".concat(actionCreator); | ||
} // helper types for more readable typings | ||
return "" + actionCreator; | ||
} | ||
@@ -472,6 +351,9 @@ /** | ||
*/ | ||
function createReducer(initialState, actionsMap) { | ||
return function () { | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var action = arguments.length > 1 ? arguments[1] : undefined; | ||
return function (state, action) { | ||
if (state === void 0) { | ||
state = initialState; | ||
} | ||
// @ts-ignore createNextState() produces an Immutable<Draft<S>> rather | ||
@@ -487,22 +369,25 @@ // than an Immutable<S>, and TypeScript cannot find out how to reconcile | ||
/** | ||
* An action creator atttached to a slice. | ||
* | ||
* @deprecated please use PayloadActionCreator directly | ||
*/ | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
function getType$1(slice, actionKey) { | ||
return "".concat(slice, "/").concat(actionKey); | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
/** | ||
* A function that accepts an initial state, an object full of reducer | ||
* functions, and a "slice name", and automatically generates | ||
* action creators and action types that correspond to the | ||
* reducers and state. | ||
* | ||
* The `reducer` argument is passed to `createReducer()`. | ||
*/ | ||
function getType$1(slice, actionKey) { | ||
return slice + "/" + actionKey; | ||
} // internal definition is a little less restrictive | ||
// internal definition is a little less restrictive | ||
function createSlice(options) { | ||
@@ -540,3 +425,3 @@ var name = options.name, | ||
var finalCaseReducers = _objectSpread({}, extraReducers, sliceCaseReducersByType); | ||
var finalCaseReducers = _extends({}, extraReducers, sliceCaseReducersByType); | ||
@@ -553,1 +438,2 @@ var reducer = createReducer(initialState, finalCaseReducers); | ||
export { configureStore, createAction, createReducer, createSerializableStateInvariantMiddleware, createSlice, findNonSerializableValue, getDefaultMiddleware, getType, isPlain }; | ||
//# sourceMappingURL=redux-starter-kit.esm.js.map |
@@ -1,1 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).RSK={})}(this,function(e){"use strict";var t=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),r=function(){return Math.random().toString(36).substring(7).split("").join(".")},n={INIT:"@@redux/INIT"+r(),REPLACE:"@@redux/REPLACE"+r(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+r()}};function o(e,r,i){var a;if("function"==typeof r&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof r&&void 0===i&&(i=r,r=void 0),void 0!==i){if("function"!=typeof i)throw Error("Expected the enhancer to be a function.");return i(o)(e,r)}if("function"!=typeof e)throw Error("Expected the reducer to be a function.");var u=e,c=r,f=[],s=f,l=!1;function p(){s===f&&(s=f.slice())}function d(){if(l)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return c}function y(e){if("function"!=typeof e)throw Error("Expected the listener to be a function.");if(l)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return p(),s.push(e),function(){if(t){if(l)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,p();var r=s.indexOf(e);s.splice(r,1)}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw Error("Reducers may not dispatch actions.");try{l=!0,c=u(c,e)}finally{l=!1}for(var t=f=s,r=0;t.length>r;r++){(0,t[r])()}return e}return h({type:n.INIT}),(a={dispatch:h,subscribe:y,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");u=e,h({type:n.REPLACE})}})[t]=function(){var e,r=y;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function t(){e.next&&e.next(d())}return t(),{unsubscribe:r(t)}}})[t]=function(){return this},e},a}function i(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+r+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function a(e){for(var t=Object.keys(e),r={},o=0;t.length>o;o++){var a=t[o];"function"==typeof e[a]&&(r[a]=e[a])}var u,c=Object.keys(r);try{!function(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:n.INIT}))throw Error('Reducer "'+t+"\" 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. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:n.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+n.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, but can be null.')})}(r)}catch(e){u=e}return function(e,t){if(void 0===e&&(e={}),u)throw u;for(var n=!1,o={},a=0;c.length>a;a++){var f=c[a],s=e[f],l=(0,r[f])(s,t);if(void 0===l){var p=i(f,t);throw Error(p)}o[f]=l,n=n||l!==s}return n?o:e}}function u(e,t){return function(){return t(e.apply(this,arguments))}}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){c(e,t,r[t])})}return e}function s(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}function l(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map(function(e){return e(o)});return f({},r,{dispatch:n=s.apply(void 0,i)(r.dispatch)})}}}var p,d=Object.freeze({createStore:o,combineReducers:a,bindActionCreators:function(e,t){if("function"==typeof e)return u(e,t);if("object"!=typeof e||null===e)throw Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(e),n={},o=0;r.length>o;o++){var i=r[o],a=e[i];"function"==typeof a&&(n[i]=u(a,t))}return n},applyMiddleware:l,compose:s,__DO_NOT_USE__ActionTypes:n}),y="undefined"!=typeof Symbol?Symbol("immer-nothing"):((p={})["immer-nothing"]=!0,p),h="undefined"!=typeof Symbol?Symbol.for("immer-draftable"):"__$immer_draftable",v="undefined"!=typeof Symbol?Symbol.for("immer-state"):"__$immer_state";function b(e){return!!e&&!!e[v]}function g(e){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype||(!!e[h]||!!e.constructor[h])}var m=Object.assign||function(e,t){for(var r in t)P(t,r)&&(e[r]=t[r]);return e},w="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function O(e,t){if(void 0===t&&(t=!1),Array.isArray(e))return e.slice();var r=Object.create(Object.getPrototypeOf(e));return w(e).forEach(function(n){if(n!==v){var o=Object.getOwnPropertyDescriptor(e,n),i=o.value;if(o.get){if(!t)throw Error("Immer drafts cannot have computed properties");i=o.get.call(e)}o.enumerable?r[n]=i:Object.defineProperty(r,n,{value:i,writable:!0,configurable:!0})}}),r}function j(e,t){if(Array.isArray(e))for(var r=0;e.length>r;r++)t(r,e[r],e);else w(e).forEach(function(r){return t(r,e[r],e)})}function E(e,t){return Object.getOwnPropertyDescriptor(e,t).enumerable}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function A(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}var S=function(e){this.drafts=[],this.parent=e,this.canAutoFreeze=!0,this.patches=null};function x(e){e[v].revoke()}S.prototype.usePatches=function(e){e&&(this.patches=[],this.inversePatches=[],this.patchListener=e)},S.prototype.revoke=function(){this.leave(),this.drafts.forEach(x),this.drafts=null},S.prototype.leave=function(){this===S.current&&(S.current=this.parent)},S.current=null,S.enter=function(){return this.current=new S(this.current)};var _={};function z(e,t){var r=Array.isArray(e),n=R(e);j(n,function(t){!function(e,t,r){var n=_[t];n?n.enumerable=r:_[t]=n={configurable:!0,enumerable:r,get:function(){return function(e,t){C(e);var r=D(T(e),t);if(e.finalizing)return r;if(r===D(e.base,t)&&g(r))return N(e),e.copy[t]=z(r,e);return r}(this[v],t)},set:function(e){!function(e,t,r){if(C(e),e.assigned[t]=!0,!e.modified){if(A(r,D(T(e),t)))return;I(e),N(e)}e.copy[t]=r}(this[v],t,e)}};Object.defineProperty(e,t,n)}(n,t,r||E(e,t))});var o=t?t.scope:S.current;return Object.defineProperty(n,v,{value:{scope:o,modified:!1,finalizing:!1,finalized:!1,assigned:{},parent:t,base:e,draft:n,copy:null,revoke:k,revoked:!1},enumerable:!1,writable:!0}),o.drafts.push(n),n}function k(){this.revoked=!0}function T(e){return e.copy||e.base}function D(e,t){var r=e[v];if(r&&!r.finalizing){r.finalizing=!0;var n=e[t];return r.finalizing=!1,n}return e[t]}function I(e){e.modified||(e.modified=!0,e.parent&&I(e.parent))}function N(e){e.copy||(e.copy=R(e.base))}function R(e){var t=e&&e[v];if(t){t.finalizing=!0;var r=O(t.draft,!0);return t.finalizing=!1,r}return O(e)}function C(e){if(!0===e.revoked)throw Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+JSON.stringify(T(e)))}function F(e){for(var t=e.length-1;t>=0;t--){var r=e[t][v];r.modified||(Array.isArray(r.base)?M(r)&&I(r):U(r)&&I(r))}}function U(e){for(var t=e.base,r=e.draft,n=Object.keys(r),o=n.length-1;o>=0;o--){var i=n[o],a=t[i];if(void 0===a&&!P(t,i))return!0;var u=r[i],c=u&&u[v];if(c?c.base!==a:!A(u,a))return!0}return n.length!==Object.keys(t).length}function M(e){var t=e.draft;if(t.length!==e.base.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}var L=Object.freeze({willFinalize:function(e,t,r){e.drafts.forEach(function(e){e[v].finalizing=!0}),r?b(t)&&t[v].scope===e&&F(e.drafts):(e.patches&&function e(t){if(t&&"object"==typeof t){var r=t[v];if(r){var n=r.base,o=r.draft,i=r.assigned;if(Array.isArray(t)){if(M(r)){if(I(r),i.length=!0,n.length>o.length)for(var a=o.length;n.length>a;a++)i[a]=!1;else for(var u=n.length;o.length>u;u++)i[u]=!0;for(var c=0;o.length>c;c++)void 0===i[c]&&e(o[c])}}else Object.keys(o).forEach(function(t){void 0!==n[t]||P(n,t)?i[t]||e(o[t]):(i[t]=!0,I(r))}),Object.keys(n).forEach(function(e){void 0!==o[e]||P(o,e)||(i[e]=!1,I(r))})}}}(e.drafts[0]),F(e.drafts))},createProxy:z});function K(e,t){var r=t?t.scope:S.current,n={scope:r,modified:!1,finalized:!1,assigned:{},parent:t,base:e,draft:null,drafts:{},copy:null,revoke:null},o=Array.isArray(e)?Proxy.revocable([n],V):Proxy.revocable(n,X),i=o.revoke,a=o.proxy;return n.draft=a,n.revoke=i,r.drafts.push(a),a}var X={get:function(e,t){if(t===v)return e;var r=e.drafts;if(!e.modified&&P(r,t))return r[t];var n=W(e)[t];if(e.finalized||!g(n))return n;if(e.modified){if(n!==q(e.base,t))return n;r=e.copy}return r[t]=K(n,e)},has:function(e,t){return t in W(e)},ownKeys:function(e){return Reflect.ownKeys(W(e))},set:function(e,t,r){if(!e.modified){var n=q(e.base,t),o=r?A(n,r)||r===e.drafts[t]:A(n,r)&&t in e.base;if(o)return!0;B(e)}return e.assigned[t]=!0,e.copy[t]=r,!0},deleteProperty:function(e,t){(void 0!==q(e.base,t)||t in e.base)&&(e.assigned[t]=!1,B(e));e.copy&&delete e.copy[t];return!0},getOwnPropertyDescriptor:function(e,t){var r=W(e),n=Reflect.getOwnPropertyDescriptor(r,t);n&&(n.writable=!0,n.configurable=!Array.isArray(r)||"length"!==t);return n},defineProperty:function(){throw Error("Object.defineProperty() cannot be used on an Immer draft")},getPrototypeOf:function(e){return Object.getPrototypeOf(e.base)},setPrototypeOf:function(){throw Error("Object.setPrototypeOf() cannot be used on an Immer draft")}},V={};function W(e){return e.copy||e.base}function q(e,t){var r=e[v],n=Reflect.getOwnPropertyDescriptor(r?W(r):e,t);return n&&n.value}function B(e){e.modified||(e.modified=!0,e.copy=m(O(e.base),e.drafts),e.drafts=null,e.parent&&B(e.parent))}j(X,function(e,t){V[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),V.deleteProperty=function(e,t){if(isNaN(parseInt(t)))throw Error("Immer only supports deleting array indices");return X.deleteProperty.call(this,e[0],t)},V.set=function(e,t,r){if("length"!==t&&isNaN(parseInt(t)))throw Error("Immer only supports setting array indices and the 'length' property");return X.set.call(this,e[0],t,r)};var Y=Object.freeze({willFinalize:function(){},createProxy:K});function $(e,t,r,n){Array.isArray(e.base)?function(e,t,r,n){var o,i,a=e.base,u=e.copy,c=e.assigned;a.length>u.length&&(a=(o=[u,a])[0],u=o[1],r=(i=[n,r])[0],n=i[1]);var f=u.length-a.length,s=0;for(;a[s]===u[s]&&a.length>s;)++s;var l=a.length;for(;l>s&&a[l-1]===u[l+f-1];)--l;for(var p=s;l>p;++p)if(c[p]&&u[p]!==a[p]){var d=t.concat([p]);r.push({op:"replace",path:d,value:u[p]}),n.push({op:"replace",path:d,value:a[p]})}for(var y=l!=a.length,h=r.length,v=l+f-1;v>=l;--v){var b=t.concat([v]);r[h+v-l]={op:"add",path:b,value:u[v]},y&&n.push({op:"remove",path:b})}y||n.push({op:"replace",path:t.concat(["length"]),value:a.length})}(e,t,r,n):function(e,t,r,n){var o=e.base,i=e.copy;j(e.assigned,function(e,a){var u=o[e],c=i[e],f=a?e in o?"replace":"add":"remove";if(u!==c||"replace"!==f){var s=t.concat(e);r.push("remove"===f?{op:f,path:s}:{op:f,path:s,value:c}),n.push("add"===f?{op:"remove",path:s}:"remove"===f?{op:"add",path:s,value:u}:{op:"replace",path:s,value:u})}})}(e,t,r,n)}function G(e,t){for(var r=0;t.length>r;r++){var n=t[r],o=n.path;if(0===o.length&&"replace"===n.op)e=n.value;else{for(var i=e,a=0;o.length-1>a;a++)if(!(i=i[o[a]])||"object"!=typeof i)throw Error("Cannot apply patch, path doesn't resolve: "+o.join("/"));var u=o[o.length-1];switch(n.op){case"replace":i[u]=n.value;break;case"add":Array.isArray(i)?i.splice(u,0,n.value):i[u]=n.value;break;case"remove":Array.isArray(i)?i.splice(u,1):delete i[u];break;default:throw Error("Unsupported patch operation: "+n.op)}}}return e}var H={useProxies:"undefined"!=typeof Proxy&&"undefined"!=typeof Reflect,autoFreeze:!1,onAssign:null,onDelete:null,onCopy:null},J=function(e){m(this,H,e),this.setUseProxies(this.useProxies),this.produce=this.produce.bind(this)};J.prototype.produce=function(e,t,r){var n,o=this;if("function"==typeof e&&"function"!=typeof t){var i=t;return t=e,function(e){void 0===e&&(e=i);for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];return o.produce(e,function(e){return t.call.apply(t,[e,e].concat(r))})}}if("function"!=typeof t)throw Error("The first or second argument to `produce` must be a function");if(void 0!==r&&"function"!=typeof r)throw Error("The third argument to `produce` must be a function or undefined");if(g(e)){var a=S.enter(),u=this.createProxy(e),c=!0;try{n=t.call(u,u),c=!1}finally{c?a.revoke():a.leave()}return n instanceof Promise?n.then(function(e){return a.usePatches(r),o.processResult(e,a)},function(e){throw a.revoke(),e}):(a.usePatches(r),this.processResult(n,a))}return void 0===(n=t(e))?e:n!==y?n:void 0},J.prototype.createDraft=function(e){if(!g(e))throw Error("First argument to `createDraft` must be a plain object, an array, or an immerable object");var t=S.enter(),r=this.createProxy(e);return r[v].isManual=!0,t.leave(),r},J.prototype.finishDraft=function(e,t){var r=e&&e[v];if(!r||!r.isManual)throw Error("First argument to `finishDraft` must be a draft returned by `createDraft`");if(r.finalized)throw Error("The given draft is already finalized");var n=r.scope;return n.usePatches(t),this.processResult(void 0,n)},J.prototype.setAutoFreeze=function(e){this.autoFreeze=e},J.prototype.setUseProxies=function(e){this.useProxies=e,m(this,e?Y:L)},J.prototype.applyPatches=function(e,t){return b(e)?G(e,t):this.produce(e,function(e){return G(e,t)})},J.prototype.processResult=function(e,t){var r=t.drafts[0],n=void 0!==e&&e!==r;if(this.willFinalize(t,e,n),n){if(r[v].modified)throw t.revoke(),Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");g(e)&&(e=this.finalize(e,null,t)),t.patches&&(t.patches.push({op:"replace",path:[],value:e}),t.inversePatches.push({op:"replace",path:[],value:r[v].base}))}else e=this.finalize(r,[],t);return t.revoke(),t.patches&&t.patchListener(t.patches,t.inversePatches),e!==y?e:void 0},J.prototype.finalize=function(e,t,r){var n=this,o=e[v];if(!o)return Object.isFrozen(e)?e:this.finalizeTree(e,null,r);if(o.scope!==r)return e;if(!o.modified)return o.base;if(!o.finalized){if(o.finalized=!0,this.finalizeTree(o.draft,t,r),this.onDelete)if(this.useProxies){var i=o.assigned;for(var a in i)i[a]||this.onDelete(o,a)}else{var u=o.copy;j(o.base,function(e){P(u,e)||n.onDelete(o,e)})}this.onCopy&&this.onCopy(o),this.autoFreeze&&r.canAutoFreeze&&Object.freeze(o.copy),t&&r.patches&&$(o,t,r.patches,r.inversePatches)}return o.copy},J.prototype.finalizeTree=function(e,t,r){var n=this,o=e[v];o&&(this.useProxies||(o.copy=O(o.draft,!0)),e=o.copy);var i=!!t&&!!r.patches,a=function(u,c,f){if(c===f)throw Error("Immer forbids circular references");var s=!!o&&f===e;if(b(c)){var l=s&&i&&!o.assigned[u]?t.concat(u):null;if(b(c=n.finalize(c,l,r))&&(r.canAutoFreeze=!1),Array.isArray(f)||E(f,u)?f[u]=c:Object.defineProperty(f,u,{value:c}),s&&c===o.base[u])return}else{if(s&&A(c,o.base[u]))return;g(c)&&!Object.isFrozen(c)&&j(c,a)}s&&n.onAssign&&n.onAssign(o,u,c)};return j(e,a),e};var Q=new J,Z=Q.produce;Q.setAutoFreeze.bind(Q),Q.setUseProxies.bind(Q),Q.applyPatches.bind(Q),Q.createDraft.bind(Q),Q.finishDraft.bind(Q);function ee(e,t){return e===t}function te(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;n>o;o++)if(!e(t[o],r[o]))return!1;return!0}function re(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every(function(e){return"function"==typeof e})){var r=t.map(function(e){return typeof e}).join(", ");throw Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}var ne=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;t>o;o++)n[o]=arguments[o];var i=0,a=n.pop(),u=re(n),c=e.apply(void 0,[function(){return i++,a.apply(null,arguments)}].concat(r)),f=e(function(){for(var e=[],t=u.length,r=0;t>r;r++)e.push(u[r].apply(null,arguments));return c.apply(null,e)});return f.resultFunc=a,f.dependencies=u,f.recomputations=function(){return i},f.resetRecomputations=function(){return i=0},f}}(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ee,r=null,n=null;return function(){return te(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}});function oe(e){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ie(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ae(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){ie(e,t,r[t])})}return e}function ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ce(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var fe,se=function(e,t){return e(t={exports:{}},t.exports),t.exports}(function(e,t){var r=d.compose;t.__esModule=!0,t.composeWithDevTools="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?r:r.apply(null,arguments)},t.devToolsEnhancer="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}}});(fe=se)&&fe.__esModule&&Object.prototype.hasOwnProperty.call(fe,"default");var le=se.composeWithDevTools;function pe(e){if("object"!==oe(e)||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function de(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var ye=de();function he(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||pe(e)}ye.withExtraArgument=de;var ve="A non-serializable value was detected in the state, in the path: `%s`. Value: %o\nTake a look at the reducer(s) handling this action type: %s.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)",be="A non-serializable value was detected in an action, in the path: `%s`. Value: %o\nTake a look at the logic that dispatched this action: %o.\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)";function ge(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he,o=arguments.length>3?arguments[3]:void 0;if(!n(e))return{keyPath:r.join(".")||"<root>",value:e};if("object"!==oe(e)||null===e)return!1;var i=null!=o?o(e):Object.entries(e),a=!0,u=!1,c=void 0;try{for(var f,s=i[Symbol.iterator]();!(a=(f=s.next()).done);a=!0){var l=ue(f.value,2),p=l[1],d=r.concat(l[0]);if(!n(p))return{keyPath:d.join("."),value:p};if("object"===oe(p)&&(t=ge(p,d,n,o)))return t}}catch(e){u=!0,c=e}finally{try{a||null==s.return||s.return()}finally{if(u)throw c}}return!1}function me(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.thunk,r=void 0===t||t,n=[];return r&&(!function(e){return"boolean"==typeof e}(r)?n.push(ye.withExtraArgument(r.extraArgument)):n.push(ye)),n}var we=!0;function Oe(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw Error("prepareAction did not return an object");return"meta"in r?{type:e,payload:r.payload,meta:r.meta}:{type:e,payload:r.payload}}return{type:e,payload:arguments.length>0?arguments[0]:void 0}}return r.toString=function(){return"".concat(e)},r.type=e,r}function je(e,t){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;return Z(r,function(e){var r=t[n.type];return r?r(e,n):void 0})}}e.combineReducers=a,e.compose=s,e.configureStore=function(e){var t,r=e||{},n=r.reducer,i=void 0===n?void 0:n,u=r.middleware,c=void 0===u?me():u,f=r.devTools,p=void 0===f||f,d=r.preloadedState,y=void 0===d?void 0:d,h=r.enhancers,v=void 0===h?void 0:h;if("function"==typeof i)t=i;else{if(!pe(i))throw Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=a(i)}var b=l.apply(void 0,ce(c)),g=s;p&&(g=le(ae({trace:!we},"object"===oe(p)&&p)));var m=[b];return Array.isArray(v)?m=[b].concat(ce(v)):"function"==typeof v&&(m=v(m)),o(t,y,g.apply(void 0,ce(m)))},e.createAction=Oe,e.createNextState=Z,e.createReducer=je,e.createSelector=ne,e.createSerializableStateInvariantMiddleware=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isSerializable,r=void 0===t?he:t,n=e.getEntries,o=e.ignoredActions,i=void 0===o?[]:o;return function(e){return function(t){return function(o){if(i.length&&-1!==i.indexOf(o.type))return t(o);var a=ge(o,[],r,n);a&&console.error(be,a.keyPath,a.value,o);var u=t(o),c=ge(e.getState(),[],r,n);return c&&console.error(ve,c.keyPath,c.value,o.type),u}}}},e.createSlice=function(e){var t=e.name,r=e.initialState;if(!t)throw Error("`name` is a required option for createSlice");var n=e.reducers||{},o=e.extraReducers||{},i={},a={},u={};Object.keys(n).forEach(function(e){var r,o,c,f=n[e],s=(r=e,"".concat(t,"/").concat(r));"function"==typeof f?o=f:(o=f.reducer,c=f.prepare),i[e]=o,a[s]=o,u[e]=c?Oe(s,c):Oe(s)});var c=je(r,ae({},o,a));return{name:t,reducer:c,actions:u,caseReducers:i}},e.findNonSerializableValue=ge,e.getDefaultMiddleware=me,e.getType=function(e){return"".concat(e)},e.isPlain=he,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).RSK={})}(this,function(e){"use strict";var t=function(e){var t,r=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()).Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}(),r=function(){return Math.random().toString(36).substring(7).split("").join(".")},n={INIT:"@@redux/INIT"+r(),REPLACE:"@@redux/REPLACE"+r(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+r()}};function o(e,r,i){var a;if("function"==typeof r&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof r&&void 0===i&&(i=r,r=void 0),void 0!==i){if("function"!=typeof i)throw new Error("Expected the enhancer to be a function.");return i(o)(e,r)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var u=e,c=r,f=[],s=f,l=!1;function p(){s===f&&(s=f.slice())}function d(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return c}function h(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return p(),s.push(e),function(){if(t){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,p();var r=s.indexOf(e);s.splice(r,1)}}}function y(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,c=u(c,e)}finally{l=!1}for(var t=f=s,r=0;r<t.length;r++)(0,t[r])();return e}return y({type:n.INIT}),(a={dispatch:y,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");u=e,y({type:n.REPLACE})}})[t]=function(){var e,r=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function t(){e.next&&e.next(d())}return t(),{unsubscribe:r(t)}}})[t]=function(){return this},e},a}function i(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+String(r)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function a(e){for(var t=Object.keys(e),r={},o=0;o<t.length;o++){var a=t[o];"function"==typeof e[a]&&(r[a]=e[a])}var u,c=Object.keys(r);try{!function(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:n.INIT}))throw new Error('Reducer "'+t+"\" 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. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:n.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+n.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, but can be null.')})}(r)}catch(e){u=e}return function(e,t){if(void 0===e&&(e={}),u)throw u;for(var n=!1,o={},a=0;a<c.length;a++){var f=c[a],s=e[f],l=(0,r[f])(s,t);if(void 0===l){var p=i(f,t);throw new Error(p)}o[f]=l,n=n||l!==s}return n?o:e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}var f,s=c,l="undefined"!=typeof Symbol?Symbol("immer-nothing"):((f={})["immer-nothing"]=!0,f),p="undefined"!=typeof Symbol?Symbol.for("immer-draftable"):"__$immer_draftable",d="undefined"!=typeof Symbol?Symbol.for("immer-state"):"__$immer_state";function h(e){return!!e&&!!e[d]}function y(e){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype||!!e[p]||!!e.constructor[p]}var v=Object.assign||function(e,t){for(var r in t)O(t,r)&&(e[r]=t[r]);return e},b="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function g(e,t){if(void 0===t&&(t=!1),Array.isArray(e))return e.slice();var r=Object.create(Object.getPrototypeOf(e));return b(e).forEach(function(n){if(n!==d){var o=Object.getOwnPropertyDescriptor(e,n),i=o.value;if(o.get){if(!t)throw new Error("Immer drafts cannot have computed properties");i=o.get.call(e)}o.enumerable?r[n]=i:Object.defineProperty(r,n,{value:i,writable:!0,configurable:!0})}}),r}function w(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)t(r,e[r],e);else b(e).forEach(function(r){return t(r,e[r],e)})}function m(e,t){return Object.getOwnPropertyDescriptor(e,t).enumerable}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function E(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}var j=function(e){this.drafts=[],this.parent=e,this.canAutoFreeze=!0,this.patches=null};function P(e){e[d].revoke()}j.prototype.usePatches=function(e){e&&(this.patches=[],this.inversePatches=[],this.patchListener=e)},j.prototype.revoke=function(){this.leave(),this.drafts.forEach(P),this.drafts=null},j.prototype.leave=function(){this===j.current&&(j.current=this.parent)},j.current=null,j.enter=function(){return this.current=new j(this.current)};var A={};function x(){this.revoked=!0}function S(e){return e.copy||e.base}function z(e,t){var r=e[d];if(r&&!r.finalizing){r.finalizing=!0;var n=e[t];return r.finalizing=!1,n}return e[t]}function k(e){e.modified||(e.modified=!0,e.parent&&k(e.parent))}function _(e){e.copy||(e.copy=T(e.base))}function T(e){var t=e&&e[d];if(t){t.finalizing=!0;var r=g(t.draft,!0);return t.finalizing=!1,r}return g(e)}function N(e){if(!0===e.revoked)throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+JSON.stringify(S(e)))}function I(e){for(var t=e.length-1;t>=0;t--){var r=e[t][d];r.modified||(Array.isArray(r.base)?D(r)&&k(r):R(r)&&k(r))}}function R(e){for(var t=e.base,r=e.draft,n=Object.keys(r),o=n.length-1;o>=0;o--){var i=n[o],a=t[i];if(void 0===a&&!O(t,i))return!0;var u=r[i],c=u&&u[d];if(c?c.base!==a:!E(u,a))return!0}return n.length!==Object.keys(t).length}function D(e){var t=e.draft;if(t.length!==e.base.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}var F=Object.freeze({willFinalize:function(e,t,r){e.drafts.forEach(function(e){e[d].finalizing=!0}),r?h(t)&&t[d].scope===e&&I(e.drafts):(e.patches&&function e(t){if(t&&"object"==typeof t){var r=t[d];if(r){var n=r.base,o=r.draft,i=r.assigned;if(Array.isArray(t)){if(D(r)){if(k(r),i.length=!0,o.length<n.length)for(var a=o.length;a<n.length;a++)i[a]=!1;else for(var u=n.length;u<o.length;u++)i[u]=!0;for(var c=0;c<o.length;c++)void 0===i[c]&&e(o[c])}}else Object.keys(o).forEach(function(t){void 0!==n[t]||O(n,t)?i[t]||e(o[t]):(i[t]=!0,k(r))}),Object.keys(n).forEach(function(e){void 0!==o[e]||O(o,e)||(i[e]=!1,k(r))})}}}(e.drafts[0]),I(e.drafts))},createProxy:function e(t,r){var n=Array.isArray(t),o=T(t);w(o,function(r){!function(t,r,n){var o=A[r];o?o.enumerable=n:A[r]=o={configurable:!0,enumerable:n,get:function(){return function(t,r){N(t);var n=z(S(t),r);return t.finalizing?n:n===z(t.base,r)&&y(n)?(_(t),t.copy[r]=e(n,t)):n}(this[d],r)},set:function(e){!function(e,t,r){if(N(e),e.assigned[t]=!0,!e.modified){if(E(r,z(S(e),t)))return;k(e),_(e)}e.copy[t]=r}(this[d],r,e)}},Object.defineProperty(t,r,o)}(o,r,n||m(t,r))});var i=r?r.scope:j.current;return Object.defineProperty(o,d,{value:{scope:i,modified:!1,finalizing:!1,finalized:!1,assigned:{},parent:r,base:t,draft:o,copy:null,revoke:x,revoked:!1},enumerable:!1,writable:!0}),i.drafts.push(o),o}});function C(e,t){var r=t?t.scope:j.current,n={scope:r,modified:!1,finalized:!1,assigned:{},parent:t,base:e,draft:null,drafts:{},copy:null,revoke:null},o=Array.isArray(e)?Proxy.revocable([n],M):Proxy.revocable(n,U),i=o.revoke,a=o.proxy;return n.draft=a,n.revoke=i,r.drafts.push(a),a}var U={get:function(e,t){if(t===d)return e;var r=e.drafts;if(!e.modified&&O(r,t))return r[t];var n=L(e)[t];if(e.finalized||!y(n))return n;if(e.modified){if(n!==K(e.base,t))return n;r=e.copy}return r[t]=C(n,e)},has:function(e,t){return t in L(e)},ownKeys:function(e){return Reflect.ownKeys(L(e))},set:function(e,t,r){if(!e.modified){var n=K(e.base,t);if(r?E(n,r)||r===e.drafts[t]:E(n,r)&&t in e.base)return!0;X(e)}return e.assigned[t]=!0,e.copy[t]=r,!0},deleteProperty:function(e,t){return(void 0!==K(e.base,t)||t in e.base)&&(e.assigned[t]=!1,X(e)),e.copy&&delete e.copy[t],!0},getOwnPropertyDescriptor:function(e,t){var r=L(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&(n.writable=!0,n.configurable=!Array.isArray(r)||"length"!==t),n},defineProperty:function(){throw new Error("Object.defineProperty() cannot be used on an Immer draft")},getPrototypeOf:function(e){return Object.getPrototypeOf(e.base)},setPrototypeOf:function(){throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft")}},M={};function L(e){return e.copy||e.base}function K(e,t){var r=e[d],n=Reflect.getOwnPropertyDescriptor(r?L(r):e,t);return n&&n.value}function X(e){e.modified||(e.modified=!0,e.copy=v(g(e.base),e.drafts),e.drafts=null,e.parent&&X(e.parent))}w(U,function(e,t){M[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),M.deleteProperty=function(e,t){if(isNaN(parseInt(t)))throw new Error("Immer only supports deleting array indices");return U.deleteProperty.call(this,e[0],t)},M.set=function(e,t,r){if("length"!==t&&isNaN(parseInt(t)))throw new Error("Immer only supports setting array indices and the 'length' property");return U.set.call(this,e[0],t,r)};var V=Object.freeze({willFinalize:function(){},createProxy:C});function W(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.path;if(0===o.length&&"replace"===n.op)e=n.value;else{for(var i=e,a=0;a<o.length-1;a++)if(!(i=i[o[a]])||"object"!=typeof i)throw new Error("Cannot apply patch, path doesn't resolve: "+o.join("/"));var u=o[o.length-1];switch(n.op){case"replace":i[u]=n.value;break;case"add":Array.isArray(i)?i.splice(u,0,n.value):i[u]=n.value;break;case"remove":Array.isArray(i)?i.splice(u,1):delete i[u];break;default:throw new Error("Unsupported patch operation: "+n.op)}}}return e}var q={useProxies:"undefined"!=typeof Proxy&&"undefined"!=typeof Reflect,autoFreeze:"undefined"==typeof process&&"verifyMinified"===function(){}.name,onAssign:null,onDelete:null,onCopy:null},B=function(e){v(this,q,e),this.setUseProxies(this.useProxies),this.produce=this.produce.bind(this)};B.prototype.produce=function(e,t,r){var n,o=this;if("function"==typeof e&&"function"!=typeof t){var i=t;return t=e,function(e){void 0===e&&(e=i);for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];return o.produce(e,function(e){return t.call.apply(t,[e,e].concat(r))})}}if("function"!=typeof t)throw new Error("The first or second argument to `produce` must be a function");if(void 0!==r&&"function"!=typeof r)throw new Error("The third argument to `produce` must be a function or undefined");if(y(e)){var a=j.enter(),u=this.createProxy(e),c=!0;try{n=t.call(u,u),c=!1}finally{c?a.revoke():a.leave()}return n instanceof Promise?n.then(function(e){return a.usePatches(r),o.processResult(e,a)},function(e){throw a.revoke(),e}):(a.usePatches(r),this.processResult(n,a))}return void 0===(n=t(e))?e:n!==l?n:void 0},B.prototype.createDraft=function(e){if(!y(e))throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object");var t=j.enter(),r=this.createProxy(e);return r[d].isManual=!0,t.leave(),r},B.prototype.finishDraft=function(e,t){var r=e&&e[d];if(!r||!r.isManual)throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`");if(r.finalized)throw new Error("The given draft is already finalized");var n=r.scope;return n.usePatches(t),this.processResult(void 0,n)},B.prototype.setAutoFreeze=function(e){this.autoFreeze=e},B.prototype.setUseProxies=function(e){this.useProxies=e,v(this,e?V:F)},B.prototype.applyPatches=function(e,t){return h(e)?W(e,t):this.produce(e,function(e){return W(e,t)})},B.prototype.processResult=function(e,t){var r=t.drafts[0],n=void 0!==e&&e!==r;if(this.willFinalize(t,e,n),n){if(r[d].modified)throw t.revoke(),new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");y(e)&&(e=this.finalize(e,null,t)),t.patches&&(t.patches.push({op:"replace",path:[],value:e}),t.inversePatches.push({op:"replace",path:[],value:r[d].base}))}else e=this.finalize(r,[],t);return t.revoke(),t.patches&&t.patchListener(t.patches,t.inversePatches),e!==l?e:void 0},B.prototype.finalize=function(e,t,r){var n=this,o=e[d];if(!o)return Object.isFrozen(e)?e:this.finalizeTree(e,null,r);if(o.scope!==r)return e;if(!o.modified)return o.base;if(!o.finalized){if(o.finalized=!0,this.finalizeTree(o.draft,t,r),this.onDelete)if(this.useProxies){var i=o.assigned;for(var a in i)i[a]||this.onDelete(o,a)}else{var u=o.copy;w(o.base,function(e){O(u,e)||n.onDelete(o,e)})}this.onCopy&&this.onCopy(o),this.autoFreeze&&r.canAutoFreeze&&Object.freeze(o.copy),t&&r.patches&&function(e,t,r,n){Array.isArray(e.base)?function(e,t,r,n){var o,i,a=e.base,u=e.copy,c=e.assigned;u.length<a.length&&(a=(o=[u,a])[0],u=o[1],r=(i=[n,r])[0],n=i[1]);for(var f=u.length-a.length,s=0;a[s]===u[s]&&s<a.length;)++s;for(var l=a.length;l>s&&a[l-1]===u[l+f-1];)--l;for(var p=s;p<l;++p)if(c[p]&&u[p]!==a[p]){var d=t.concat([p]);r.push({op:"replace",path:d,value:u[p]}),n.push({op:"replace",path:d,value:a[p]})}for(var h=l!=a.length,y=r.length,v=l+f-1;v>=l;--v){var b=t.concat([v]);r[y+v-l]={op:"add",path:b,value:u[v]},h&&n.push({op:"remove",path:b})}h||n.push({op:"replace",path:t.concat(["length"]),value:a.length})}(e,t,r,n):function(e,t,r,n){var o=e.base,i=e.copy;w(e.assigned,function(e,a){var u=o[e],c=i[e],f=a?e in o?"replace":"add":"remove";if(u!==c||"replace"!==f){var s=t.concat(e);r.push("remove"===f?{op:f,path:s}:{op:f,path:s,value:c}),n.push("add"===f?{op:"remove",path:s}:"remove"===f?{op:"add",path:s,value:u}:{op:"replace",path:s,value:u})}})}(e,t,r,n)}(o,t,r.patches,r.inversePatches)}return o.copy},B.prototype.finalizeTree=function(e,t,r){var n=this,o=e[d];o&&(this.useProxies||(o.copy=g(o.draft,!0)),e=o.copy);var i=!!t&&!!r.patches,a=function(u,c,f){if(c===f)throw Error("Immer forbids circular references");var s=!!o&&f===e;if(h(c)){var l=s&&i&&!o.assigned[u]?t.concat(u):null;if(h(c=n.finalize(c,l,r))&&(r.canAutoFreeze=!1),Array.isArray(f)||m(f,u)?f[u]=c:Object.defineProperty(f,u,{value:c}),s&&c===o.base[u])return}else{if(s&&E(c,o.base[u]))return;y(c)&&!Object.isFrozen(c)&&w(c,a)}s&&n.onAssign&&n.onAssign(o,u,c)};return w(e,a),e};var Y=new B,$=Y.produce;function G(e,t){return e===t}Y.setAutoFreeze.bind(Y),Y.setUseProxies.bind(Y),Y.applyPatches.bind(Y),Y.createDraft.bind(Y),Y.finishDraft.bind(Y);var H,J=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=0,a=n.pop(),u=function(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every(function(e){return"function"==typeof e})){var r=t.map(function(e){return typeof e}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}(n),c=e.apply(void 0,[function(){return i++,a.apply(null,arguments)}].concat(r)),f=e(function(){for(var e=[],t=u.length,r=0;r<t;r++)e.push(u[r].apply(null,arguments));return c.apply(null,e)});return f.resultFunc=a,f.dependencies=u,f.recomputations=function(){return i},f.resetRecomputations=function(){return i=0},f}}(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G,r=null,n=null;return function(){return function(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}}),Q=function(e,t){return n=s,(r=(t={exports:{}}).exports).__esModule=!0,r.composeWithDevTools="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?n:n.apply(null,arguments)},r.devToolsEnhancer="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},t.exports;var r,n}();(H=Q)&&H.__esModule&&Object.prototype.hasOwnProperty.call(H,"default");var Z=Q.composeWithDevTools;function ee(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function te(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var re=te();function ne(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||ee(e)}re.withExtraArgument=te;var oe=["A non-serializable value was detected in the state, in the path: `%s`. Value: %o","Take a look at the reducer(s) handling this action type: %s.","(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)"].join("\n"),ie=["A non-serializable value was detected in an action, in the path: `%s`. Value: %o","Take a look at the logic that dispatched this action: %o.","(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)"].join("\n");function ae(e,t,r,n){var o;if(void 0===t&&(t=[]),void 0===r&&(r=ne),!r(e))return{keyPath:t.join(".")||"<root>",value:e};if("object"!=typeof e||null===e)return!1;var i=null!=n?n(e):Object.entries(e),a=Array.isArray(i),u=0;for(i=a?i:i[Symbol.iterator]();;){var c;if(a){if(u>=i.length)break;c=i[u++]}else{if((u=i.next()).done)break;c=u.value}var f=c[1],s=t.concat(c[0]);if(!r(f))return{keyPath:s.join("."),value:f};if("object"==typeof f&&(o=ae(f,s,r,n)))return o}return!1}function ue(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=[];return r&&n.push("boolean"==typeof r?re:re.withExtraArgument(r.extraArgument)),n}function ce(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw new Error("prepareAction did not return an object");return"meta"in r?{type:e,payload:r.payload,meta:r.meta}:{type:e,payload:r.payload}}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r}function fe(e,t){return function(r,n){return void 0===r&&(r=e),$(r,function(e){var r=t[n.type];return r?r(e,n):void 0})}}function se(){return(se=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}e.combineReducers=a,e.compose=c,e.configureStore=function(e){var t,r=e||{},n=r.reducer,i=void 0===n?void 0:n,f=r.middleware,s=void 0===f?ue():f,l=r.devTools,p=void 0===l||l,d=r.preloadedState,h=void 0===d?void 0:d,y=r.enhancers,v=void 0===y?void 0:y;if("function"==typeof i)t=i;else{if(!ee(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=a(i)}var b=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map(function(e){return e(o)});return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){u(e,t,r[t])})}return e}({},r,{dispatch:n=c.apply(void 0,i)(r.dispatch)})}}}.apply(void 0,s),g=c;if(p){var w=Object.assign({trace:!1},"object"==typeof p?p:{});g=Z(w)}var m=[b];return Array.isArray(v)?m=[b].concat(v):"function"==typeof v&&(m=v(m)),o(t,h,g.apply(void 0,m))},e.createAction=ce,e.createNextState=$,e.createReducer=fe,e.createSelector=J,e.createSerializableStateInvariantMiddleware=function(e){void 0===e&&(e={});var t=e.isSerializable,r=void 0===t?ne:t,n=e.getEntries,o=e.ignoredActions,i=void 0===o?[]:o;return function(e){return function(t){return function(o){if(i.length&&-1!==i.indexOf(o.type))return t(o);var a=ae(o,[],r,n);a&&console.error(ie,a.keyPath,a.value,o);var u=t(o),c=ae(e.getState(),[],r,n);return c&&console.error(oe,c.keyPath,c.value,o.type),u}}}},e.createSlice=function(e){var t=e.name,r=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var n=e.reducers||{},o=e.extraReducers||{},i=Object.keys(n),a={},u={},c={};i.forEach(function(e){var r,o,i=n[e],f=t+"/"+e;"function"==typeof i?r=i:(r=i.reducer,o=i.prepare),a[e]=r,u[f]=r,c[e]=o?ce(f,o):ce(f)});var f=fe(r,se({},o,u));return{name:t,reducer:f,actions:c,caseReducers:a}},e.findNonSerializableValue=ae,e.getDefaultMiddleware=ue,e.getType=function(e){return""+e},e.isPlain=ne}); | ||
//# sourceMappingURL=redux-starter-kit.umd.min.js.map |
{ | ||
"name": "redux-starter-kit", | ||
"version": "0.8.1", | ||
"version": "0.9.0-alpha.0", | ||
"description": "A simple set of tools to make using Redux easier", | ||
@@ -13,38 +13,22 @@ "repository": "https://github.com/reduxjs/redux-starter-kit", | ||
"devDependencies": { | ||
"@babel/core": "^7.4.3", | ||
"@babel/preset-env": "^7.4.3", | ||
"@babel/preset-typescript": "^7.3.3", | ||
"@types/jest": "^24.0.11", | ||
"@types/node": "^10.14.4", | ||
"@types/redux-immutable-state-invariant": "^2.1.1", | ||
"@typescript-eslint/parser": "^1.6.0", | ||
"babel-eslint": "^10.0.1", | ||
"eslint": "^5.16.0", | ||
"eslint-config-react-app": "^3.0.8", | ||
"eslint-plugin-flowtype": "^3.5.1", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"jest": "^24.7.1", | ||
"eslint-config-react-app": "^5.0.1", | ||
"prettier": "^1.18.2", | ||
"react": "^16.8.6", | ||
"rollup": "^1.9.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-plugin-strip-code": "^0.2.6", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"typescript": "^3.4.3", | ||
"tsdx": "^0.9.3", | ||
"tslib": "^1.10.0", | ||
"typescript": "^3.6.3", | ||
"typings-tester": "^0.3.2" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"build": "tsdx build --format cjs,esm,umd", | ||
"dev": "tsdx watch --format cjs,esm,umd", | ||
"format": "prettier --write \"src/*.ts\" \"**/*.md\"", | ||
"format:check": "prettier --list-different \"src/*.ts\" \"**/*.md\"", | ||
"lint": "eslint \"src/**/*.ts\"", | ||
"prepare": "npm run tsc && npm run lint && npm run format:check && npm test && npm run build", | ||
"test": "jest", | ||
"tsc": "tsc" | ||
"lint": "tsdx lint src", | ||
"prepare": "npm run lint && npm run format:check && npm test && npm run build", | ||
"test": "tsdx test" | ||
}, | ||
@@ -63,15 +47,14 @@ "files": [ | ||
}, | ||
"sideEffects": false, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js", | ||
"json" | ||
], | ||
"testRegex": "^.+\\.test\\.(ts|js)$", | ||
"transform": { | ||
"^.+\\.(ts|js)$": "babel-jest" | ||
"globals": { | ||
"ts-jest": { | ||
"diagnostics": { | ||
"ignoreCodes": [ | ||
6133 | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"sideEffects": false | ||
} | ||
} |
@@ -121,7 +121,11 @@ import { | ||
if (devTools) { | ||
finalCompose = composeWithDevTools({ | ||
// Enable capture of stack traces for dispatched Redux actions | ||
trace: !IS_PRODUCTION, | ||
...(typeof devTools === 'object' && devTools) | ||
}) | ||
const devToolsOptions: DevToolsOptions = Object.assign( | ||
{ | ||
// Enable capture of stack traces for dispatched Redux actions | ||
trace: !IS_PRODUCTION | ||
}, | ||
typeof devTools === 'object' ? devTools : {} | ||
) | ||
finalCompose = composeWithDevTools(devToolsOptions) | ||
} | ||
@@ -128,0 +132,0 @@ |
@@ -5,3 +5,3 @@ import { createAction, getType } from './createAction' | ||
it('should create an action', () => { | ||
const actionCreator = createAction('A_TYPE') | ||
const actionCreator = createAction<string>('A_TYPE') | ||
expect(actionCreator('something')).toEqual({ | ||
@@ -8,0 +8,0 @@ type: 'A_TYPE', |
@@ -7,12 +7,25 @@ import { createReducer, CaseReducer } from './createReducer' | ||
text: string | ||
completed: boolean | ||
completed?: boolean | ||
} | ||
interface AddTodoPayload { | ||
newTodo: Todo | ||
} | ||
interface ToggleTodoPayload { | ||
index: number | ||
} | ||
type TodoState = Todo[] | ||
type TodosReducer = Reducer<TodoState, PayloadAction> | ||
type TodosCaseReducer = CaseReducer<TodoState, PayloadAction> | ||
type TodosReducer = Reducer<TodoState, PayloadAction<any>> | ||
type AddTodoReducer = CaseReducer<TodoState, PayloadAction<AddTodoPayload>> | ||
type ToggleTodoReducer = CaseReducer< | ||
TodoState, | ||
PayloadAction<ToggleTodoPayload> | ||
> | ||
describe('createReducer', () => { | ||
describe('given impure reducers with immer', () => { | ||
const addTodo: TodosCaseReducer = (state, action) => { | ||
const addTodo: AddTodoReducer = (state, action) => { | ||
const { newTodo } = action.payload | ||
@@ -24,3 +37,3 @@ | ||
const toggleTodo: TodosCaseReducer = (state, action) => { | ||
const toggleTodo: ToggleTodoReducer = (state, action) => { | ||
const { index } = action.payload | ||
@@ -42,3 +55,3 @@ | ||
describe('given pure reducers with immutable updates', () => { | ||
const addTodo: TodosCaseReducer = (state, action) => { | ||
const addTodo: AddTodoReducer = (state, action) => { | ||
const { newTodo } = action.payload | ||
@@ -50,3 +63,3 @@ | ||
const toggleTodo: TodosCaseReducer = (state, action) => { | ||
const toggleTodo: ToggleTodoReducer = (state, action) => { | ||
const { index } = action.payload | ||
@@ -53,0 +66,0 @@ |
@@ -89,3 +89,3 @@ import { createSlice } from './createSlice' | ||
describe('when passing extra reducers', () => { | ||
const addMore = createAction('ADD_MORE') | ||
const addMore = createAction<{ amount: number }>('ADD_MORE') | ||
@@ -92,0 +92,0 @@ const { reducer } = createSlice({ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
535454
11
39
0
4
4492
3