Socket
Socket
Sign inDemoInstall

@reduxjs/toolkit

Package Overview
Dependencies
Maintainers
4
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reduxjs/toolkit - npm Package Compare versions

Comparing version 1.3.6 to 1.4.0

305

dist/redux-toolkit.cjs.development.js

@@ -29,2 +29,92 @@ 'use strict';

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
/**

@@ -79,3 +169,44 @@ * @public

}
/**
* @public
*/
var MiddlewareArray =
/*#__PURE__*/
function (_Array) {
_inheritsLoose(MiddlewareArray, _Array);
function MiddlewareArray() {
return _Array.apply(this, arguments) || this;
}
var _proto = MiddlewareArray.prototype;
_proto.concat = function concat() {
var _Array$prototype$conc;
for (var _len = arguments.length, arr = new Array(_len), _key = 0; _key < _len; _key++) {
arr[_key] = arguments[_key];
}
return _construct(MiddlewareArray, (_Array$prototype$conc = _Array.prototype.concat).call.apply(_Array$prototype$conc, [this].concat(arr)));
};
_proto.prepend = function prepend() {
for (var _len2 = arguments.length, arr = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
arr[_key2] = arguments[_key2];
}
if (arr.length === 1 && Array.isArray(arr[0])) {
return _construct(MiddlewareArray, arr[0].concat(this));
}
return _construct(MiddlewareArray, arr.concat(this));
};
return MiddlewareArray;
}(
/*#__PURE__*/
_wrapNativeSuper(Array));
var prefix = 'Invariant failed'; // Throw an error if the condition fails

@@ -263,3 +394,3 @@ // Strip out error messages for production

tracker = track(state);
!!result.wasMutated ? invariant(false, "A state mutation was detected between dispatches, in the path '" + (result.path || []).join('.') + "'. This may cause incorrect behavior. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)") : void 0;
!!result.wasMutated ? invariant(false, "A state mutation was detected between dispatches, in the path '" + (result.path || []).join('.') + "'. This may cause incorrect behavior. (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)") : void 0;
});

@@ -272,3 +403,3 @@ var dispatchedAction = next(action);

tracker = track(state);
result.wasMutated && (!!result.wasMutated ? invariant(false, "A state mutation was detected inside a dispatch, in the path: " + (result.path || []).join('.') + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)") : void 0);
result.wasMutated && (!!result.wasMutated ? invariant(false, "A state mutation was detected inside a dispatch, in the path: " + (result.path || []).join('.') + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)") : void 0);
});

@@ -408,3 +539,3 @@ measureUtils.warnIfExceeded();

value = foundActionNonSerializableValue.value;
console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, '\nTake a look at the logic that dispatched this action: ', action, '\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)');
console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, '\nTake a look at the logic that dispatched this action: ', action, '\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)', '\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)');
}

@@ -433,2 +564,8 @@ });

}
function curryGetDefaultMiddleware() {
return function curriedGetDefaultMiddleware(options) {
return getDefaultMiddleware(options);
};
}
/**

@@ -444,3 +581,2 @@ * Returns any array containing the default middleware installed by

function getDefaultMiddleware(options) {

@@ -458,3 +594,3 @@ if (options === void 0) {

serializableCheck = _options$serializable === void 0 ? true : _options$serializable;
var middlewareArray = [];
var middlewareArray = new MiddlewareArray();

@@ -507,2 +643,4 @@ if (thunk) {

function configureStore(options) {
var curriedGetDefaultMiddleware = curryGetDefaultMiddleware();
var _ref = options || {},

@@ -512,3 +650,3 @@ _ref$reducer = _ref.reducer,

_ref$middleware = _ref.middleware,
middleware = _ref$middleware === void 0 ? getDefaultMiddleware() : _ref$middleware,
middleware = _ref$middleware === void 0 ? curriedGetDefaultMiddleware() : _ref$middleware,
_ref$devTools = _ref.devTools,

@@ -531,3 +669,3 @@ devTools = _ref$devTools === void 0 ? true : _ref$devTools,

var middlewareEnhancer = redux.applyMiddleware.apply(void 0, middleware);
var middlewareEnhancer = redux.applyMiddleware.apply(void 0, typeof middleware === 'function' ? middleware(curriedGetDefaultMiddleware) : middleware);
var finalCompose = redux.compose;

@@ -616,4 +754,21 @@

var actionsMap = {};
var actionMatchers = [];
var defaultCaseReducer;
var builder = {
addCase: function addCase(typeOrActionCreator, reducer) {
{
/*
to keep the definition by the user in line with actual behavior,
we enforce `addCase` to always be called before calling `addMatcher`
as matching cases take precedence over matchers
*/
if (actionMatchers.length > 0) {
throw new Error('`builder.addCase` should only be called before calling `builder.addMatcher`');
}
if (defaultCaseReducer) {
throw new Error('`builder.addCase` should only be called before calling `builder.addDefaultCase`');
}
}
var type = typeof typeOrActionCreator === 'string' ? typeOrActionCreator : typeOrActionCreator.type;

@@ -627,10 +782,41 @@

return builder;
},
addMatcher: function addMatcher(matcher, reducer) {
{
if (defaultCaseReducer) {
throw new Error('`builder.addMatcher` should only be called before calling `builder.addDefaultCase`');
}
}
actionMatchers.push({
matcher: matcher,
reducer: reducer
});
return builder;
},
addDefaultCase: function addDefaultCase(reducer) {
{
if (defaultCaseReducer) {
throw new Error('`builder.addDefaultCase` can only be called once');
}
}
defaultCaseReducer = reducer;
return builder;
}
};
builderCallback(builder);
return actionsMap;
return [actionsMap, actionMatchers, defaultCaseReducer];
}
function createReducer(initialState, mapOrBuilderCallback) {
var actionsMap = typeof mapOrBuilderCallback === 'function' ? executeReducerBuilderCallback(mapOrBuilderCallback) : mapOrBuilderCallback;
function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
if (actionMatchers === void 0) {
actionMatchers = [];
}
var _ref = typeof mapOrBuilderCallback === 'function' ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer],
actionsMap = _ref[0],
finalActionMatchers = _ref[1],
finalDefaultCaseReducer = _ref[2];
return function (state, action) {

@@ -641,23 +827,53 @@ if (state === void 0) {

var caseReducer = actionsMap[action.type];
var caseReducers = [actionsMap[action.type]].concat(finalActionMatchers.filter(function (_ref2) {
var matcher = _ref2.matcher;
return matcher(action);
}).map(function (_ref3) {
var reducer = _ref3.reducer;
return reducer;
}));
if (caseReducer) {
if (createNextState.isDraft(state)) {
// we must already be inside a `createNextState` call, likely because
// this is being wrapped in `createReducer`, `createSlice`, or nested
// inside an existing draft. It's safe to just pass the draft to the mutator.
var draft = state; // We can aassume this is already a draft
if (caseReducers.filter(function (cr) {
return !!cr;
}).length === 0) {
caseReducers = [finalDefaultCaseReducer];
}
return caseReducer(draft, action) || state;
} else {
// @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__default(state, function (draft) {
return caseReducer(draft, action);
});
return caseReducers.reduce(function (previousState, caseReducer) {
if (caseReducer) {
if (createNextState.isDraft(previousState)) {
// If it's already a draft, we must already be inside a `createNextState` call,
// likely because this is being wrapped in `createReducer`, `createSlice`, or nested
// inside an existing draft. It's safe to just pass the draft to the mutator.
var draft = previousState; // We can assume this is already a draft
var result = caseReducer(draft, action);
if (typeof result === 'undefined') {
return previousState;
}
return result;
} else if (!createNextState.isDraftable(previousState)) {
// If state is not draftable (ex: a primitive, such as 0), we want to directly
// return the caseReducer func and not wrap it with produce.
var _result = caseReducer(previousState, action);
if (typeof _result === 'undefined') {
throw Error('A case reducer on a non-draftable value must not return undefined');
}
return _result;
} else {
// @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__default(previousState, function (draft) {
return caseReducer(draft, action);
});
}
}
}
return state;
return previousState;
}, state);
};

@@ -690,3 +906,11 @@ }

var reducers = options.reducers || {};
var extraReducers = typeof options.extraReducers === 'undefined' ? {} : typeof options.extraReducers === 'function' ? executeReducerBuilderCallback(options.extraReducers) : options.extraReducers;
var _ref = typeof options.extraReducers === 'undefined' ? [] : typeof options.extraReducers === 'function' ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers],
_ref$ = _ref[0],
extraReducers = _ref$ === void 0 ? {} : _ref$,
_ref$2 = _ref[1],
actionMatchers = _ref$2 === void 0 ? [] : _ref$2,
_ref$3 = _ref[2],
defaultCaseReducer = _ref$3 === void 0 ? undefined : _ref$3;
var reducerNames = Object.keys(reducers);

@@ -716,3 +940,3 @@ var sliceCaseReducersByName = {};

var reducer = createReducer(initialState, finalCaseReducers);
var reducer = createReducer(initialState, finalCaseReducers, actionMatchers, defaultCaseReducer);
return {

@@ -944,3 +1168,8 @@ name: name,

// If there are multiple updates to one entity, merge them together
updatesPerEntity[update.id] = _extends({}, updatesPerEntity[update.id], {}, update);
updatesPerEntity[update.id] = {
id: update.id,
// Spreads ignore falsy values, so this works even if there isn't
// an existing update already at this key
changes: _extends({}, updatesPerEntity[update.id] ? updatesPerEntity[update.id].changes : null, {}, update.changes)
};
}

@@ -1365,6 +1594,9 @@ });

});
var started = false;
function abort(reason) {
abortReason = reason;
abortController.abort();
if (started) {
abortReason = reason;
abortController.abort();
}
}

@@ -1397,2 +1629,3 @@

}) === false) {
// eslint-disable-next-line no-throw-literal
throw {

@@ -1404,2 +1637,3 @@ name: 'ConditionError',

started = true;
dispatch(pending(requestId, arg));

@@ -1474,2 +1708,8 @@ return Promise.resolve(Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {

exports.createNextState = createNextState__default;
Object.defineProperty(exports, 'current', {
enumerable: true,
get: function () {
return createNextState.current;
}
});
Object.defineProperty(exports, 'createSelector', {

@@ -1481,2 +1721,3 @@ enumerable: true,

});
exports.MiddlewareArray = MiddlewareArray;
exports.configureStore = configureStore;

@@ -1483,0 +1724,0 @@ exports.createAction = createAction;

2

dist/redux-toolkit.cjs.production.min.js

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("immer"),r=e(t),n=require("redux"),i=require("reselect"),o=e(require("redux-thunk"));function a(){return(a=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)}var u="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?n.compose:n.compose.apply(null,arguments)};function c(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 f(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||c(e)}function s(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=[];return r&&n.push("boolean"==typeof r?o:o.withExtraArgument(r.extraArgument)),n}function l(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 a({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function d(e){return["type","payload","error","meta"].indexOf(e)>-1}function y(e){var t={},r={addCase:function(e,n){var i="string"==typeof e?e:e.type;if(i in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[i]=n,r}};return e(r),t}function p(e,n){var i="function"==typeof n?y(n):n;return function(n,o){void 0===n&&(n=e);var a=i[o.type];return a?t.isDraft(n)?a(n,o)||n:r(n,(function(e){return a(e,o)})):n}}function v(e){return function(n,i){var o=function(t){!function(e){return c(t=e)&&"string"==typeof t.type&&Object.keys(t).every(d);var t}(i)?e(i,t):e(i.payload,t)};return t.isDraft(n)?(o(n),n):r(n,o)}}function b(e,t){return t(e)}function m(e){function t(t,r){var n=b(t,e);n in r.entities||(r.ids.push(n),r.entities[n]=t)}function r(e,r){Array.isArray(e)||(e=Object.values(e));var n=e,i=Array.isArray(n),o=0;for(n=i?n:n[Symbol.iterator]();;){var a;if(i){if(o>=n.length)break;a=n[o++]}else{if((o=n.next()).done)break;a=o.value}t(a,r)}}function n(e,t){var r=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],r=!0)})),r&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function i(t,r){var n={},i={};t.forEach((function(e){e.id in r.entities&&(i[e.id]=a({},i[e.id],{},e))})),(t=Object.values(i)).length>0&&t.filter((function(t){return function(t,r,n){var i=Object.assign({},n.entities[r.id],r.changes),o=b(i,e),a=o!==r.id;return a&&(t[r.id]=o,delete n.entities[r.id]),n.entities[o]=i,a}(n,t,r)})).length>0&&(r.ids=r.ids.map((function(e){return n[e]||e})))}function o(t,n){Array.isArray(t)||(t=Object.values(t));var o=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=b(l,e);d in n.entities?a.push({id:d,changes:l}):o.push(l)}i(a,n),r(o,n)}return{removeAll:(u=function(e){Object.assign(e,{ids:[],entities:{}})},c=v((function(e,t){return u(t)})),function(e){return c(e,void 0)}),addOne:v(t),addMany:v(r),setAll:v((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},r(e,t)})),updateOne:v((function(e,t){return i([e],t)})),updateMany:v(i),upsertOne:v((function(e,t){return o([e],t)})),upsertMany:v(o),removeOne:v((function(e,t){return n([e],t)})),removeMany:v(n)};var u,c}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var h=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},g=["name","message","stack","code"],O=function(e){this.value=e},S=function(e){if("object"==typeof e&&null!==e){var t={},r=g,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var o;if(n){if(i>=r.length)break;o=r[i++]}else{if((i=r.next()).done)break;o=i.value}"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}};t.enableES5(),Object.keys(n).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})})),exports.createNextState=r,Object.defineProperty(exports,"createSelector",{enumerable:!0,get:function(){return i.createSelector}}),exports.configureStore=function(e){var t,r=e||{},i=r.reducer,o=void 0===i?void 0:i,f=r.middleware,l=void 0===f?s():f,d=r.devTools,y=void 0===d||d,p=r.preloadedState,v=void 0===p?void 0:p,b=r.enhancers,m=void 0===b?void 0:b;if("function"==typeof o)t=o;else{if(!c(o))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=n.combineReducers(o)}var h=n.applyMiddleware.apply(void 0,l),g=n.compose;y&&(g=u(a({trace:!1},"object"==typeof y&&y)));var O=[h];Array.isArray(m)?O=[h].concat(m):"function"==typeof m&&(O=m(O));var S=g.apply(void 0,O);return n.createStore(t,v,S)},exports.createAction=l,exports.createAsyncThunk=function(e,t,r){var n=l(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),i=l(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),o=l(e+"/rejected",(function(e,t,r,n){var i=!!e&&"AbortError"===e.name,o=!!e&&"ConditionError"===e.name;return{payload:n,error:S(e||"Rejected"),meta:{arg:r,requestId:t,aborted:i,condition:o}}})),a="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(u,c,f){var s,l=h(),d=new a,y=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:s||"Aborted"})}))})),p=function(){try{var a,s=function(e){return p?e:(r&&!r.dispatchConditionRejection&&o.match(a)&&a.meta.condition||u(a),a)},p=!1,v=function(s,p){try{var v=function(){if(r&&r.condition&&!1===r.condition(e,{getState:c,extra:f}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return u(i(l,e)),Promise.resolve(Promise.race([y,Promise.resolve(t(e,{dispatch:u,getState:c,extra:f,requestId:l,signal:d.signal,rejectWithValue:function(e){return new O(e)}})).then((function(t){return t instanceof O?o(null,l,e,t.value):n(t,l,e)}))])).then((function(e){a=e}))}()}catch(e){return p(e)}return v&&v.then?v.then(void 0,p):v}(0,(function(t){a=o(t,l,e)}));return Promise.resolve(v&&v.then?v.then(s):s(v))}catch(e){return Promise.reject(e)}}();return Object.assign(p,{abort:function(e){s=e,d.abort()}})}}),{pending:i,rejected:o,fulfilled:n,typePrefix:e})},exports.createEntityAdapter=function(e){void 0===e&&(e={});var t=a({sortComparer:!1,selectId:function(e){return e.id}},e),r=t.selectId,n=t.sortComparer;return a({selectId:r,sortComparer:n},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},r=function(e){return e.entities},n=i.createSelector(t,r,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},a=function(e,t){return e[t]},u=i.createSelector(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:r,selectAll:n,selectTotal:u,selectById:i.createSelector(r,o,a)};var c=i.createSelector(e,r);return{selectIds:i.createSelector(e,t),selectEntities:c,selectAll:i.createSelector(e,n),selectTotal:i.createSelector(e,u),selectById:i.createSelector(c,o,a)}}},{},n?function(e,t){var r=m(e);function n(t,r){Array.isArray(t)||(t=Object.values(t));var n=t.filter((function(t){return!(b(t,e)in r.entities)}));0!==n.length&&a(n,r)}function i(t,r){var n=[];t.forEach((function(t){return function(t,r,n){if(!(r.id in n.entities))return!1;var i=Object.assign({},n.entities[r.id],r.changes),o=b(i,e);return delete n.entities[r.id],t.push(i),o!==r.id}(n,t,r)})),0!==n.length&&a(n,r)}function o(t,r){Array.isArray(t)||(t=Object.values(t));var o=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=b(l,e);d in r.entities?a.push({id:d,changes:l}):o.push(l)}i(a,r),n(o,r)}function a(r,n){r.sort(t),r.forEach((function(t){n.entities[e(t)]=t}));var i=Object.values(n.entities);i.sort(t);var o=i.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(e[r]!==t[r])return!1;return!0})(n.ids,o)||(n.ids=o)}return{removeOne:r.removeOne,removeMany:r.removeMany,removeAll:r.removeAll,addOne:v((function(e,t){return n([e],t)})),updateOne:v((function(e,t){return i([e],t)})),upsertOne:v((function(e,t){return o([e],t)})),setAll:v((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],n(e,t)})),addMany:v(n),updateMany:v(i),upsertMany:v(o)}}(r,n):m(r))},exports.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.createReducer=p,exports.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.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||{},i=void 0===e.extraReducers?{}:"function"==typeof e.extraReducers?y(e.extraReducers):e.extraReducers,o=Object.keys(n),u={},c={},f={};o.forEach((function(e){var r,i,o=n[e],a=t+"/"+e;"reducer"in o?(r=o.reducer,i=o.prepare):r=o,u[e]=r,c[a]=r,f[e]=i?l(a,i):l(a)}));var s=p(r,a({},i,{},c));return{name:t,reducer:s,actions:f,caseReducers:u}},exports.findNonSerializableValue=function e(t,r,n,i,o){var a;if(void 0===r&&(r=[]),void 0===n&&(n=f),void 0===o&&(o=[]),!n(t))return{keyPath:r.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var u=null!=i?i(t):Object.entries(t),c=o.length>0,s=u,l=Array.isArray(s),d=0;for(s=l?s:s[Symbol.iterator]();;){var y;if(l){if(d>=s.length)break;y=s[d++]}else{if((d=s.next()).done)break;y=d.value}var p=y[1],v=r.concat(y[0]);if(!(c&&o.indexOf(v.join("."))>=0)){if(!n(p))return{keyPath:v.join("."),value:p};if("object"==typeof p&&(a=e(p,v,n,i,o)))return a}}return!1},exports.getDefaultMiddleware=s,exports.getType=function(e){return""+e},exports.isImmutableDefault=function(e){return"object"!=typeof e||null==e},exports.isPlain=f,exports.nanoid=h,exports.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("immer"),r=e(t),n=require("redux"),o=require("reselect"),i=e(require("redux-thunk"));function a(){return(a=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)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e,t,r){return(s=f()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&c(o,r.prototype),o}).apply(null,arguments)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,e)})(e)}var d="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?n.compose:n.compose.apply(null,arguments)};function p(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}var y=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o=n.prototype;return o.concat=function(){for(var t,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return s(n,(t=e.prototype.concat).call.apply(t,[this].concat(o)))},o.prepend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 1===t.length&&Array.isArray(t[0])?s(n,t[0].concat(this)):s(n,t.concat(this))},n}(l(Array));function v(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||p(e)}function b(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=new y;return r&&n.push("boolean"==typeof r?i:i.withExtraArgument(r.extraArgument)),n}function h(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 a({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function m(e){return["type","payload","error","meta"].indexOf(e)>-1}function g(e){var t,r={},n=[],o={addCase:function(e,t){var n="string"==typeof e?e:e.type;if(n in r)throw new Error("addCase cannot be called with two reducers for the same action type");return r[n]=t,o},addMatcher:function(e,t){return n.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[r,n,t]}function O(e,n,o,i){void 0===o&&(o=[]);var a="function"==typeof n?g(n):[n,o,i],u=a[0],c=a[1],f=a[2];return function(n,o){void 0===n&&(n=e);var i=[u[o.type]].concat(c.filter((function(e){return(0,e.matcher)(o)})).map((function(e){return e.reducer})));return 0===i.filter((function(e){return!!e})).length&&(i=[f]),i.reduce((function(e,n){if(n){if(t.isDraft(e)){var i=n(e,o);return void 0===i?e:i}if(t.isDraftable(e))return r(e,(function(e){return n(e,o)}));var a=n(e,o);if(void 0===a)throw Error("A case reducer on a non-draftable value must not return undefined");return a}return e}),n)}}function A(e){return function(n,o){var i=function(t){!function(e){return p(t=e)&&"string"==typeof t.type&&Object.keys(t).every(m);var t}(o)?e(o,t):e(o.payload,t)};return t.isDraft(n)?(i(n),n):r(n,i)}}function S(e,t){return t(e)}function j(e){function t(t,r){var n=S(t,e);n in r.entities||(r.ids.push(n),r.entities[n]=t)}function r(e,r){Array.isArray(e)||(e=Object.values(e));var n=e,o=Array.isArray(n),i=0;for(n=o?n:n[Symbol.iterator]();;){var a;if(o){if(i>=n.length)break;a=n[i++]}else{if((i=n.next()).done)break;a=i.value}t(a,r)}}function n(e,t){var r=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],r=!0)})),r&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function o(t,r){var n={},o={};t.forEach((function(e){e.id in r.entities&&(o[e.id]={id:e.id,changes:a({},o[e.id]?o[e.id].changes:null,{},e.changes)})})),(t=Object.values(o)).length>0&&t.filter((function(t){return function(t,r,n){var o=Object.assign({},n.entities[r.id],r.changes),i=S(o,e),a=i!==r.id;return a&&(t[r.id]=i,delete n.entities[r.id]),n.entities[i]=o,a}(n,t,r)})).length>0&&(r.ids=r.ids.map((function(e){return n[e]||e})))}function i(t,n){Array.isArray(t)||(t=Object.values(t));var i=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=S(l,e);d in n.entities?a.push({id:d,changes:l}):i.push(l)}o(a,n),r(i,n)}return{removeAll:(u=function(e){Object.assign(e,{ids:[],entities:{}})},c=A((function(e,t){return u(t)})),function(e){return c(e,void 0)}),addOne:A(t),addMany:A(r),setAll:A((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},r(e,t)})),updateOne:A((function(e,t){return o([e],t)})),updateMany:A(o),upsertOne:A((function(e,t){return i([e],t)})),upsertMany:A(i),removeOne:A((function(e,t){return n([e],t)})),removeMany:A(n)};var u,c}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var x=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},w=["name","message","stack","code"],E=function(e){this.value=e},_=function(e){if("object"==typeof e&&null!==e){var t={},r=w,n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var i;if(n){if(o>=r.length)break;i=r[o++]}else{if((o=r.next()).done)break;i=o.value}"string"==typeof e[i]&&(t[i]=e[i])}return t}return{message:String(e)}};t.enableES5(),Object.keys(n).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})})),exports.createNextState=r,Object.defineProperty(exports,"current",{enumerable:!0,get:function(){return t.current}}),Object.defineProperty(exports,"createSelector",{enumerable:!0,get:function(){return o.createSelector}}),exports.MiddlewareArray=y,exports.configureStore=function(e){var t,r=function(e){return b(e)},o=e||{},i=o.reducer,u=void 0===i?void 0:i,c=o.middleware,f=void 0===c?r():c,s=o.devTools,l=void 0===s||s,y=o.preloadedState,v=void 0===y?void 0:y,h=o.enhancers,m=void 0===h?void 0:h;if("function"==typeof u)t=u;else{if(!p(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');t=n.combineReducers(u)}var g=n.applyMiddleware.apply(void 0,"function"==typeof f?f(r):f),O=n.compose;l&&(O=d(a({trace:!1},"object"==typeof l&&l)));var A=[g];Array.isArray(m)?A=[g].concat(m):"function"==typeof m&&(A=m(A));var S=O.apply(void 0,A);return n.createStore(t,v,S)},exports.createAction=h,exports.createAsyncThunk=function(e,t,r){var n=h(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),o=h(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),i=h(e+"/rejected",(function(e,t,r,n){var o=!!e&&"AbortError"===e.name,i=!!e&&"ConditionError"===e.name;return{payload:n,error:_(e||"Rejected"),meta:{arg:r,requestId:t,aborted:o,condition:i}}})),a="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(u,c,f){var s,l=x(),d=new a,p=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:s||"Aborted"})}))})),y=!1,v=function(){try{var a,s=function(e){return v?e:(r&&!r.dispatchConditionRejection&&i.match(a)&&a.meta.condition||u(a),a)},v=!1,b=function(s,v){try{var b=function(){if(r&&r.condition&&!1===r.condition(e,{getState:c,extra:f}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=!0,u(o(l,e)),Promise.resolve(Promise.race([p,Promise.resolve(t(e,{dispatch:u,getState:c,extra:f,requestId:l,signal:d.signal,rejectWithValue:function(e){return new E(e)}})).then((function(t){return t instanceof E?i(null,l,e,t.value):n(t,l,e)}))])).then((function(e){a=e}))}()}catch(e){return v(e)}return b&&b.then?b.then(void 0,v):b}(0,(function(t){a=i(t,l,e)}));return Promise.resolve(b&&b.then?b.then(s):s(b))}catch(e){return Promise.reject(e)}}();return Object.assign(v,{abort:function(e){y&&(s=e,d.abort())}})}}),{pending:o,rejected:i,fulfilled:n,typePrefix:e})},exports.createEntityAdapter=function(e){void 0===e&&(e={});var t=a({sortComparer:!1,selectId:function(e){return e.id}},e),r=t.selectId,n=t.sortComparer;return a({selectId:r,sortComparer:n},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},r=function(e){return e.entities},n=o.createSelector(t,r,(function(e,t){return e.map((function(e){return t[e]}))})),i=function(e,t){return t},a=function(e,t){return e[t]},u=o.createSelector(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:r,selectAll:n,selectTotal:u,selectById:o.createSelector(r,i,a)};var c=o.createSelector(e,r);return{selectIds:o.createSelector(e,t),selectEntities:c,selectAll:o.createSelector(e,n),selectTotal:o.createSelector(e,u),selectById:o.createSelector(c,i,a)}}},{},n?function(e,t){var r=j(e);function n(t,r){Array.isArray(t)||(t=Object.values(t));var n=t.filter((function(t){return!(S(t,e)in r.entities)}));0!==n.length&&a(n,r)}function o(t,r){var n=[];t.forEach((function(t){return function(t,r,n){if(!(r.id in n.entities))return!1;var o=Object.assign({},n.entities[r.id],r.changes),i=S(o,e);return delete n.entities[r.id],t.push(o),i!==r.id}(n,t,r)})),0!==n.length&&a(n,r)}function i(t,r){Array.isArray(t)||(t=Object.values(t));var i=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=S(l,e);d in r.entities?a.push({id:d,changes:l}):i.push(l)}o(a,r),n(i,r)}function a(r,n){r.sort(t),r.forEach((function(t){n.entities[e(t)]=t}));var o=Object.values(n.entities);o.sort(t);var i=o.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(e[r]!==t[r])return!1;return!0})(n.ids,i)||(n.ids=i)}return{removeOne:r.removeOne,removeMany:r.removeMany,removeAll:r.removeAll,addOne:A((function(e,t){return n([e],t)})),updateOne:A((function(e,t){return o([e],t)})),upsertOne:A((function(e,t){return i([e],t)})),setAll:A((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],n(e,t)})),addMany:A(n),updateMany:A(o),upsertMany:A(i)}}(r,n):j(r))},exports.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.createReducer=O,exports.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.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=void 0===e.extraReducers?[]:"function"==typeof e.extraReducers?g(e.extraReducers):[e.extraReducers],i=o[0],u=void 0===i?{}:i,c=o[1],f=void 0===c?[]:c,s=o[2],l=void 0===s?void 0:s,d=Object.keys(n),p={},y={},v={};d.forEach((function(e){var r,o,i=n[e],a=t+"/"+e;"reducer"in i?(r=i.reducer,o=i.prepare):r=i,p[e]=r,y[a]=r,v[e]=o?h(a,o):h(a)}));var b=O(r,a({},u,{},y),f,l);return{name:t,reducer:b,actions:v,caseReducers:p}},exports.findNonSerializableValue=function e(t,r,n,o,i){var a;if(void 0===r&&(r=[]),void 0===n&&(n=v),void 0===i&&(i=[]),!n(t))return{keyPath:r.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var u=null!=o?o(t):Object.entries(t),c=i.length>0,f=u,s=Array.isArray(f),l=0;for(f=s?f:f[Symbol.iterator]();;){var d;if(s){if(l>=f.length)break;d=f[l++]}else{if((l=f.next()).done)break;d=l.value}var p=d[1],y=r.concat(d[0]);if(!(c&&i.indexOf(y.join("."))>=0)){if(!n(p))return{keyPath:y.join("."),value:p};if("object"==typeof p&&(a=e(p,y,n,o,i)))return a}}return!1},exports.getDefaultMiddleware=b,exports.getType=function(e){return""+e},exports.isImmutableDefault=function(e){return"object"!=typeof e||null==e},exports.isPlain=v,exports.nanoid=x,exports.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload};
//# sourceMappingURL=redux-toolkit.cjs.production.min.js.map

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

import createNextState, { isDraft, enableES5 } from 'immer';
export { default as createNextState } from 'immer';
import createNextState, { isDraft, isDraftable, enableES5 } from 'immer';
export { default as createNextState, current } from 'immer';
import { compose, combineReducers, applyMiddleware, createStore } from 'redux';

@@ -27,2 +27,92 @@ export * from 'redux';

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
/**

@@ -77,3 +167,44 @@ * @public

}
/**
* @public
*/
var MiddlewareArray =
/*#__PURE__*/
function (_Array) {
_inheritsLoose(MiddlewareArray, _Array);
function MiddlewareArray() {
return _Array.apply(this, arguments) || this;
}
var _proto = MiddlewareArray.prototype;
_proto.concat = function concat() {
var _Array$prototype$conc;
for (var _len = arguments.length, arr = new Array(_len), _key = 0; _key < _len; _key++) {
arr[_key] = arguments[_key];
}
return _construct(MiddlewareArray, (_Array$prototype$conc = _Array.prototype.concat).call.apply(_Array$prototype$conc, [this].concat(arr)));
};
_proto.prepend = function prepend() {
for (var _len2 = arguments.length, arr = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
arr[_key2] = arguments[_key2];
}
if (arr.length === 1 && Array.isArray(arr[0])) {
return _construct(MiddlewareArray, arr[0].concat(this));
}
return _construct(MiddlewareArray, arr.concat(this));
};
return MiddlewareArray;
}(
/*#__PURE__*/
_wrapNativeSuper(Array));
var isProduction = process.env.NODE_ENV === 'production';

@@ -278,3 +409,3 @@ var prefix = 'Invariant failed'; // Throw an error if the condition fails

tracker = track(state);
!!result.wasMutated ? process.env.NODE_ENV !== "production" ? invariant(false, "A state mutation was detected between dispatches, in the path '" + (result.path || []).join('.') + "'. This may cause incorrect behavior. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)") : invariant(false) : void 0;
!!result.wasMutated ? process.env.NODE_ENV !== "production" ? invariant(false, "A state mutation was detected between dispatches, in the path '" + (result.path || []).join('.') + "'. This may cause incorrect behavior. (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)") : invariant(false) : void 0;
});

@@ -287,3 +418,3 @@ var dispatchedAction = next(action);

tracker = track(state);
result.wasMutated && (!!result.wasMutated ? process.env.NODE_ENV !== "production" ? invariant(false, "A state mutation was detected inside a dispatch, in the path: " + (result.path || []).join('.') + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)") : invariant(false) : void 0);
result.wasMutated && (!!result.wasMutated ? process.env.NODE_ENV !== "production" ? invariant(false, "A state mutation was detected inside a dispatch, in the path: " + (result.path || []).join('.') + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)") : invariant(false) : void 0);
});

@@ -433,3 +564,3 @@ measureUtils.warnIfExceeded();

value = foundActionNonSerializableValue.value;
console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, '\nTake a look at the logic that dispatched this action: ', action, '\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)');
console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, '\nTake a look at the logic that dispatched this action: ', action, '\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)', '\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)');
}

@@ -458,2 +589,8 @@ });

}
function curryGetDefaultMiddleware() {
return function curriedGetDefaultMiddleware(options) {
return getDefaultMiddleware(options);
};
}
/**

@@ -469,3 +606,2 @@ * Returns any array containing the default middleware installed by

function getDefaultMiddleware(options) {

@@ -483,3 +619,3 @@ if (options === void 0) {

serializableCheck = _options$serializable === void 0 ? true : _options$serializable;
var middlewareArray = [];
var middlewareArray = new MiddlewareArray();

@@ -532,2 +668,4 @@ if (thunk) {

function configureStore(options) {
var curriedGetDefaultMiddleware = curryGetDefaultMiddleware();
var _ref = options || {},

@@ -537,3 +675,3 @@ _ref$reducer = _ref.reducer,

_ref$middleware = _ref.middleware,
middleware = _ref$middleware === void 0 ? getDefaultMiddleware() : _ref$middleware,
middleware = _ref$middleware === void 0 ? curriedGetDefaultMiddleware() : _ref$middleware,
_ref$devTools = _ref.devTools,

@@ -556,3 +694,3 @@ devTools = _ref$devTools === void 0 ? true : _ref$devTools,

var middlewareEnhancer = applyMiddleware.apply(void 0, middleware);
var middlewareEnhancer = applyMiddleware.apply(void 0, typeof middleware === 'function' ? middleware(curriedGetDefaultMiddleware) : middleware);
var finalCompose = compose;

@@ -641,4 +779,21 @@

var actionsMap = {};
var actionMatchers = [];
var defaultCaseReducer;
var builder = {
addCase: function addCase(typeOrActionCreator, reducer) {
if (process.env.NODE_ENV !== 'production') {
/*
to keep the definition by the user in line with actual behavior,
we enforce `addCase` to always be called before calling `addMatcher`
as matching cases take precedence over matchers
*/
if (actionMatchers.length > 0) {
throw new Error('`builder.addCase` should only be called before calling `builder.addMatcher`');
}
if (defaultCaseReducer) {
throw new Error('`builder.addCase` should only be called before calling `builder.addDefaultCase`');
}
}
var type = typeof typeOrActionCreator === 'string' ? typeOrActionCreator : typeOrActionCreator.type;

@@ -652,10 +807,41 @@

return builder;
},
addMatcher: function addMatcher(matcher, reducer) {
if (process.env.NODE_ENV !== 'production') {
if (defaultCaseReducer) {
throw new Error('`builder.addMatcher` should only be called before calling `builder.addDefaultCase`');
}
}
actionMatchers.push({
matcher: matcher,
reducer: reducer
});
return builder;
},
addDefaultCase: function addDefaultCase(reducer) {
if (process.env.NODE_ENV !== 'production') {
if (defaultCaseReducer) {
throw new Error('`builder.addDefaultCase` can only be called once');
}
}
defaultCaseReducer = reducer;
return builder;
}
};
builderCallback(builder);
return actionsMap;
return [actionsMap, actionMatchers, defaultCaseReducer];
}
function createReducer(initialState, mapOrBuilderCallback) {
var actionsMap = typeof mapOrBuilderCallback === 'function' ? executeReducerBuilderCallback(mapOrBuilderCallback) : mapOrBuilderCallback;
function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
if (actionMatchers === void 0) {
actionMatchers = [];
}
var _ref = typeof mapOrBuilderCallback === 'function' ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer],
actionsMap = _ref[0],
finalActionMatchers = _ref[1],
finalDefaultCaseReducer = _ref[2];
return function (state, action) {

@@ -666,23 +852,53 @@ if (state === void 0) {

var caseReducer = actionsMap[action.type];
var caseReducers = [actionsMap[action.type]].concat(finalActionMatchers.filter(function (_ref2) {
var matcher = _ref2.matcher;
return matcher(action);
}).map(function (_ref3) {
var reducer = _ref3.reducer;
return reducer;
}));
if (caseReducer) {
if (isDraft(state)) {
// we must already be inside a `createNextState` call, likely because
// this is being wrapped in `createReducer`, `createSlice`, or nested
// inside an existing draft. It's safe to just pass the draft to the mutator.
var draft = state; // We can aassume this is already a draft
if (caseReducers.filter(function (cr) {
return !!cr;
}).length === 0) {
caseReducers = [finalDefaultCaseReducer];
}
return caseReducer(draft, action) || state;
} else {
// @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) {
return caseReducer(draft, action);
});
return caseReducers.reduce(function (previousState, caseReducer) {
if (caseReducer) {
if (isDraft(previousState)) {
// If it's already a draft, we must already be inside a `createNextState` call,
// likely because this is being wrapped in `createReducer`, `createSlice`, or nested
// inside an existing draft. It's safe to just pass the draft to the mutator.
var draft = previousState; // We can assume this is already a draft
var result = caseReducer(draft, action);
if (typeof result === 'undefined') {
return previousState;
}
return result;
} else if (!isDraftable(previousState)) {
// If state is not draftable (ex: a primitive, such as 0), we want to directly
// return the caseReducer func and not wrap it with produce.
var _result = caseReducer(previousState, action);
if (typeof _result === 'undefined') {
throw Error('A case reducer on a non-draftable value must not return undefined');
}
return _result;
} else {
// @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(previousState, function (draft) {
return caseReducer(draft, action);
});
}
}
}
return state;
return previousState;
}, state);
};

@@ -715,3 +931,11 @@ }

var reducers = options.reducers || {};
var extraReducers = typeof options.extraReducers === 'undefined' ? {} : typeof options.extraReducers === 'function' ? executeReducerBuilderCallback(options.extraReducers) : options.extraReducers;
var _ref = typeof options.extraReducers === 'undefined' ? [] : typeof options.extraReducers === 'function' ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers],
_ref$ = _ref[0],
extraReducers = _ref$ === void 0 ? {} : _ref$,
_ref$2 = _ref[1],
actionMatchers = _ref$2 === void 0 ? [] : _ref$2,
_ref$3 = _ref[2],
defaultCaseReducer = _ref$3 === void 0 ? undefined : _ref$3;
var reducerNames = Object.keys(reducers);

@@ -741,3 +965,3 @@ var sliceCaseReducersByName = {};

var reducer = createReducer(initialState, finalCaseReducers);
var reducer = createReducer(initialState, finalCaseReducers, actionMatchers, defaultCaseReducer);
return {

@@ -969,3 +1193,8 @@ name: name,

// If there are multiple updates to one entity, merge them together
updatesPerEntity[update.id] = _extends({}, updatesPerEntity[update.id], {}, update);
updatesPerEntity[update.id] = {
id: update.id,
// Spreads ignore falsy values, so this works even if there isn't
// an existing update already at this key
changes: _extends({}, updatesPerEntity[update.id] ? updatesPerEntity[update.id].changes : null, {}, update.changes)
};
}

@@ -1390,6 +1619,9 @@ });

});
var started = false;
function abort(reason) {
abortReason = reason;
abortController.abort();
if (started) {
abortReason = reason;
abortController.abort();
}
}

@@ -1422,2 +1654,3 @@

}) === false) {
// eslint-disable-next-line no-throw-literal
throw {

@@ -1429,2 +1662,3 @@ name: 'ConditionError',

started = true;
dispatch(pending(requestId, arg));

@@ -1490,3 +1724,3 @@ return Promise.resolve(Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {

export { configureStore, createAction, createAsyncThunk, createEntityAdapter, createImmutableStateInvariantMiddleware, createReducer, createSerializableStateInvariantMiddleware, createSlice, findNonSerializableValue, getDefaultMiddleware, getType, isImmutableDefault, isPlain, nanoid, unwrapResult };
export { MiddlewareArray, configureStore, createAction, createAsyncThunk, createEntityAdapter, createImmutableStateInvariantMiddleware, createReducer, createSerializableStateInvariantMiddleware, createSlice, findNonSerializableValue, getDefaultMiddleware, getType, isImmutableDefault, isPlain, nanoid, unwrapResult };
//# sourceMappingURL=redux-toolkit.esm.js.map

@@ -1,2 +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).RTK={})}(this,(function(e){"use strict";function t(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.join(","):"")+". Find the full error at: https://bit.ly/38PiBHb")}function n(e){return!!e&&!!e[B]}function r(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype}(e)||Array.isArray(e)||!!e[M]||!!e.constructor[M]||c(e)||f(e))}function o(e,t){0===i(e)?z(e).forEach((function(n){return t(n,e[n],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function i(e){var t=e[B];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:c(e)?2:f(e)?3:0}function u(e,t){return 2===i(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e){return N&&e instanceof Map}function f(e){return D&&e instanceof Set}function s(e){return e.o||e.t}function l(e,n){if(void 0===n&&(n=!1),Array.isArray(e))return e.slice();var r=Object.create(Object.getPrototypeOf(e));return o(e,(function(o){if(o!==B){var i=Object.getOwnPropertyDescriptor(e,o),u=i.value;i.get&&(n||t(1),u=i.get.call(e)),i.enumerable?r[o]=u:Object.defineProperty(r,o,{value:u,writable:!0,configurable:!0})}})),r}function d(e,t){n(e)||Object.isFrozen(e)||!r(e)||(i(e)>1&&(e.set=e.add=e.clear=e.delete=p),Object.freeze(e),t&&o(e,(function(e,t){return d(t,!0)})))}function p(){t(2)}function y(e){var n=F[e];return n||t(19,e),n}function v(){return _}function h(e,t){t&&(y("Patches"),e.u=[],e.s=[],e.v=t)}function b(e){g(e),e.p.forEach(O),e.p=null}function g(e){e===_&&(_=e.l)}function m(e){return _={p:[],l:_,h:e,m:!0,_:0}}function O(e){var t=e[B];0===t.i||1===t.i?t.j():t.O=!0}function w(e,n){n._=n.p.length;var o=n.p[0],i=void 0!==e&&e!==o;return n.h.g||y("ES5").P(n,e,i),i?(o[B].S&&(b(n),t(4)),r(e)&&(e=A(n,e),n.l||S(n,e)),n.u&&y("Patches").M(o[B],e,n.u,n.s)):e=A(n,o,[]),b(n),n.u&&n.v(n.u,n.s),e!==C?e:void 0}function A(e,t,n){if(Object.isFrozen(t))return t;var r=t[B];if(!r)return o(t,(function(o,i){return j(e,r,t,o,i,n)})),t;if(r.A!==e)return t;if(!r.S)return S(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=l(r.k,!0):r.o;o(i,(function(t,o){return j(e,r,i,t,o,n)})),S(e,i,!1),n&&e.u&&y("Patches").R(r,n,e.u,e.s)}return r.o}function j(e,t,o,c,f,s){if(n(f)){var l=A(e,f,s&&t&&3!==t.i&&!u(t.D,c)?s.concat(c):void 0);if(p=c,y=l,2===(v=i(d=o))?d.set(p,y):3===v?(d.delete(p),d.add(y)):d[p]=y,!n(l))return;e.m=!1}var d,p,y,v;if((!t||!a(f,function(e,t){return 2===i(e)?e.get(t):e[t]}(t.t,c)))&&r(f)){if(!e.h.N&&e._<1)return;A(e,f),t&&t.A.l||S(e,f)}}function S(e,t,n){void 0===n&&(n=!1),e.h.N&&e.m&&d(t,n)}function P(e,t){var n=e[B],r=Reflect.getOwnPropertyDescriptor(n?s(n):e,t);return r&&r.value}function E(e){if(!e.S){if(e.S=!0,0===e.i||1===e.i){var t=e.o=l(e.t);o(e.p,(function(e,n){t[e]=n})),e.p=void 0}e.l&&E(e.l)}}function x(e){e.o||(e.o=l(e.t))}function I(e,t,n){var r=c(t)?y("MapSet").T(t,n):f(t)?y("MapSet").F(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:v(),S:!1,I:!1,D:{},l:t,t:e,k:null,p:{},o:null,j:null,C:!1},o=r,i=U;n&&(o=[r],i=W);var u=Proxy.revocable(o,i),a=u.revoke,c=u.proxy;return r.k=c,r.j=a,c}(t,n):y("ES5").J(t,n);return(n?n.A:v()).p.push(r),r}var k,_,R="undefined"!=typeof Symbol,N="undefined"!=typeof Map,D="undefined"!=typeof Set,T="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,C=R?Symbol("immer-nothing"):((k={})["immer-nothing"]=!0,k),M=R?Symbol("immer-draftable"):"__$immer_draftable",B=R?Symbol("immer-state"):"__$immer_state",z="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,F={},U={get:function(e,t){if(t===B)return e;var n=e.p;if(!e.S&&u(n,t))return n[t];var o=s(e)[t];if(e.I||!r(o))return o;if(e.S){if(o!==P(e.t,t))return o;n=e.o}return n[t]=I(e.A.h,o,e)},has:function(e,t){return t in s(e)},ownKeys:function(e){return Reflect.ownKeys(s(e))},set:function(e,t,n){if(!e.S){var r=P(e.t,t);if(n?a(r,n)||n===e.p[t]:a(r,n)&&t in e.t)return!0;x(e),E(e)}return e.D[t]=!0,e.o[t]=n,!0},deleteProperty:function(e,t){return void 0!==P(e.t,t)||t in e.t?(e.D[t]=!1,x(e),E(e)):e.D[t]&&delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=s(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&(r.writable=!0,r.configurable=1!==e.i||"length"!==t),r},defineProperty:function(){t(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){t(12)}},W={};o(U,(function(e,t){W[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),W.deleteProperty=function(e,t){return U.deleteProperty.call(this,e[0],t)},W.set=function(e,t,n){return U.set.call(this,e[0],t,n,e[0])};var K=new(function(){function e(e){this.g=T,this.N=!1,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var o=e.prototype;return o.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var u=this;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,o=Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return u.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(o))}))}}var a;if("function"!=typeof n&&t(6),void 0!==o&&"function"!=typeof o&&t(7),r(e)){var c=m(this),f=I(this,e,void 0),s=!0;try{a=n(f),s=!1}finally{s?b(c):g(c)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return h(c,o),w(e,c)}),(function(e){throw b(c),e})):(h(c,o),w(a,c))}if((a=n(e))!==C)return void 0===a&&(a=e),this.N&&d(a,!0),a},o.produceWithPatches=function(e,t){var n,r,o=this;return"function"==typeof e?function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return o.produceWithPatches(t,(function(t){return e.apply(void 0,[t].concat(r))}))}:[this.produce(e,t,(function(e,t){n=e,r=t})),n,r]},o.createDraft=function(e){r(e)||t(8);var n=m(this),o=I(this,e,void 0);return o[B].C=!0,g(n),o},o.finishDraft=function(e,t){var n=(e&&e[B]).A;return h(n,t),w(void 0,n)},o.setAutoFreeze=function(e){this.N=e},o.setUseProxies=function(e){T||t(20),this.g=e},o.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var o=t[r];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}var i=y("Patches").H;return n(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(r+1))}))},e}()),L=K.produce;K.produceWithPatches.bind(K),K.setAutoFreeze.bind(K),K.setUseProxies.bind(K),K.applyPatches.bind(K),K.createDraft.bind(K),K.finishDraft.bind(K);var q=function(e){var t,n=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()).Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}(),V=function(){return Math.random().toString(36).substring(7).split("").join(".")},X={INIT:"@@redux/INIT"+V(),REPLACE:"@@redux/REPLACE"+V(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+V()}};function H(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 J(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"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 t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(J)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,u=[],a=u,c=!1;function f(){a===u&&(a=u.slice())}function s(){if(c)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 i}function l(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)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 f(),a.push(e),function(){if(t){if(c)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,f();var n=a.indexOf(e);a.splice(n,1)}}}function d(e){if(!H(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(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=u=a,n=0;n<t.length;n++)(0,t[n])();return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,d({type:X.REPLACE})}function y(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(s())}return n(),{unsubscribe:t(n)}}})[q]=function(){return this},e}return d({type:X.INIT}),(r={dispatch:d,subscribe:l,getState:s,replaceReducer:p})[q]=y,r}function Y(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+String(n)+'"'||"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 $(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,u=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:X.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===n(void 0,{type:X.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+X.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.')}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},a=0;a<u.length;a++){var c=u[a],f=e[c],s=(0,n[c])(f,t);if(void 0===s){var l=Y(c,t);throw new Error(l)}o[c]=s,r=r||s!==f}return r?o:e}}function G(e,t){return function(){return t(e.apply(this,arguments))}}function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Q(e,t,n[t])}))}return e}function ee(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];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 te(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return Z({},n,{dispatch:r=ee.apply(void 0,i)(n.dispatch)})}}}function ne(e,t){return e===t}function re(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function oe(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=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: ["+n+"]")}return t}var ie=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=0,u=r.pop(),a=oe(r),c=e.apply(void 0,[function(){return i++,u.apply(null,arguments)}].concat(n)),f=e((function(){for(var e=[],t=a.length,n=0;n<t;n++)e.push(a[n].apply(null,arguments));return c.apply(null,e)}));return f.resultFunc=u,f.dependencies=a,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]:ne,n=null,r=null;return function(){return re(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}));function ue(){return(ue=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ae="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ee:ee.apply(null,arguments)};function ce(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 fe(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var se=fe();function le(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||ce(e)}function de(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=[];return n&&(function(e){return"boolean"==typeof e}(n)?r.push(se):r.push(se.withExtraArgument(n.extraArgument))),r}function pe(e,t){function n(){if(t){var n=t.apply(void 0,arguments);if(!n)throw new Error("prepareAction did not return an object");return ue({type:e,payload:n.payload},"meta"in n&&{meta:n.meta},{},"error"in n&&{error:n.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ye(e){return["type","payload","error","meta"].indexOf(e)>-1}function ve(e){var t={},n={addCase:function(e,r){var o="string"==typeof e?e:e.type;if(o in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[o]=r,n}};return e(n),t}function he(e,t){var r="function"==typeof t?ve(t):t;return function(t,o){void 0===t&&(t=e);var i=r[o.type];return i?n(t)?i(t,o)||t:L(t,(function(e){return i(e,o)})):t}}function be(e){return function(t,r){var o=function(t){!function(e){return ce(t=e)&&"string"==typeof t.type&&Object.keys(t).every(ye);var t}(r)?e(r,t):e(r.payload,t)};return n(t)?(o(t),t):L(t,o)}}function ge(e,t){return t(e)}function me(e){function t(t,n){var r=ge(t,e);r in n.entities||(n.ids.push(r),n.entities[r]=t)}function n(e,n){Array.isArray(e)||(e=Object.values(e));var r=e,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var u;if(o){if(i>=r.length)break;u=r[i++]}else{if((i=r.next()).done)break;u=i.value}t(u,n)}}function r(e,t){var n=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],n=!0)})),n&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function o(t,n){var r={},o={};t.forEach((function(e){e.id in n.entities&&(o[e.id]=ue({},o[e.id],{},e))})),(t=Object.values(o)).length>0&&t.filter((function(t){return function(t,n,r){var o=Object.assign({},r.entities[n.id],n.changes),i=ge(o,e),u=i!==n.id;return u&&(t[n.id]=i,delete r.entities[n.id]),r.entities[i]=o,u}(r,t,n)})).length>0&&(n.ids=n.ids.map((function(e){return r[e]||e})))}function i(t,r){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=ge(l,e);d in r.entities?u.push({id:d,changes:l}):i.push(l)}o(u,r),n(i,r)}return{removeAll:(u=function(e){Object.assign(e,{ids:[],entities:{}})},a=be((function(e,t){return u(t)})),function(e){return a(e,void 0)}),addOne:be(t),addMany:be(n),setAll:be((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},n(e,t)})),updateOne:be((function(e,t){return o([e],t)})),updateMany:be(o),upsertOne:be((function(e,t){return i([e],t)})),upsertMany:be(i),removeOne:be((function(e,t){return r([e],t)})),removeMany:be(r)};var u,a}se.withExtraArgument=fe,"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var Oe=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},we=["name","message","stack","code"],Ae=function(e){this.value=e},je=function(e){if("object"==typeof e&&null!==e){var t={},n=we,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var i;if(r){if(o>=n.length)break;i=n[o++]}else{if((o=n.next()).done)break;i=o.value}"string"==typeof e[i]&&(t[i]=e[i])}return t}return{message:String(e)}};!function(){function e(e,t){var n=e[B];if(n&&!n.B){n.B=!0;var r=e[t];return n.B=!1,r}return e[t]}function i(e){e.S||(e.S=!0,e.l&&i(e.l))}function c(e){e.o||(e.o=f(e.t))}function f(e){var t=e&&e[B];if(t){t.B=!0;var n=l(t.k,!0);return t.B=!1,n}return l(e)}function d(e){for(var t=e.length-1;t>=0;t--){var n=e[t][B];if(!n.S)switch(n.i){case 5:y(n)&&i(n);break;case 4:p(n)&&i(n)}}}function p(e){for(var t=e.t,n=e.k,r=Object.keys(n),o=r.length-1;o>=0;o--){var i=r[o],c=t[i];if(void 0===c&&!u(t,i))return!0;var f=n[i],s=f&&f[B];if(s?s.t!==c:!a(f,c))return!0}return r.length!==Object.keys(t).length}function y(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!n||n.get)}function h(e){e.O&&t(3,JSON.stringify(s(e)))}var b={};!function(e,t){F.ES5=t}(0,{J:function(t,n){var u=Array.isArray(t),l=f(t);o(l,(function(n){!function(t,n,o){var u=b[n];u?u.enumerable=o:b[n]=u={enumerable:o,get:function(){return function(t,n){h(t);var o=e(s(t),n);return t.B?o:o===e(t.t,n)&&r(o)?(c(t),t.o[n]=I(t.A.h,o,t)):o}(this[B],n)},set:function(t){!function(t,n,r){if(h(t),t.D[n]=!0,!t.S){if(a(r,e(s(t),n)))return;i(t),c(t)}t.o[n]=r}(this[B],n,t)}},Object.defineProperty(t,n,u)}(l,n,u||function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!(!n||!n.enumerable)}(t,n))}));var d={i:u?5:4,A:n?n.A:v(),S:!1,B:!1,I:!1,D:{},l:n,t:t,k:l,o:null,O:!1,C:!1};return Object.defineProperty(l,B,{value:d,writable:!0}),l},$:i,P:function(e,t,r){e.p.forEach((function(e){e[B].B=!0})),r?n(t)&&t[B].A===e&&d(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[B];if(n){var r=n.t,a=n.k,c=n.D,f=n.i;if(4===f)o(a,(function(t){t!==B&&(void 0!==r[t]||u(r,t)?c[t]||e(a[t]):(c[t]=!0,i(n)))})),o(r,(function(e){void 0!==a[e]||u(a,e)||(c[e]=!1,i(n))}));else if(5===f){if(y(n)&&(i(n),c.length=!0),a.length<r.length)for(var s=a.length;s<r.length;s++)c[s]=!1;else for(var l=r.length;l<a.length;l++)c[l]=!0;for(var d=Math.min(a.length,r.length),p=0;p<d;p++)void 0===c[p]&&e(a[p])}}}}(e.p[0]),d(e.p))}})}(),e.__DO_NOT_USE__ActionTypes=X,e.applyMiddleware=te,e.bindActionCreators=function(e,t){if("function"==typeof e)return G(e,t);if("object"!=typeof e||null===e)throw new 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 n=Object.keys(e),r={},o=0;o<n.length;o++){var i=n[o],u=e[i];"function"==typeof u&&(r[i]=G(u,t))}return r},e.combineReducers=$,e.compose=ee,e.configureStore=function(e){var t,n=e||{},r=n.reducer,o=void 0===r?void 0:r,i=n.middleware,u=void 0===i?de():i,a=n.devTools,c=void 0===a||a,f=n.preloadedState,s=void 0===f?void 0:f,l=n.enhancers,d=void 0===l?void 0:l;if("function"==typeof o)t=o;else{if(!ce(o))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=$(o)}var p=te.apply(void 0,u),y=ee;c&&(y=ae(ue({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(d)?v=[p].concat(d):"function"==typeof d&&(v=d(v)),J(t,s,y.apply(void 0,v))},e.createAction=pe,e.createAsyncThunk=function(e,t,n){var r=pe(e+"/fulfilled",(function(e,t,n){return{payload:e,meta:{arg:n,requestId:t}}})),o=pe(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),i=pe(e+"/rejected",(function(e,t,n,r){var o=!!e&&"AbortError"===e.name,i=!!e&&"ConditionError"===e.name;return{payload:r,error:je(e||"Rejected"),meta:{arg:n,requestId:t,aborted:o,condition:i}}})),u="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,c,f){var s,l=Oe(),d=new u,p=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:s||"Aborted"})}))})),y=function(){try{var u,s=function(e){return y?e:(n&&!n.dispatchConditionRejection&&i.match(u)&&u.meta.condition||a(u),u)},y=!1,v=function(s,y){try{var v=function(){if(n&&n.condition&&!1===n.condition(e,{getState:c,extra:f}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return a(o(l,e)),Promise.resolve(Promise.race([p,Promise.resolve(t(e,{dispatch:a,getState:c,extra:f,requestId:l,signal:d.signal,rejectWithValue:function(e){return new Ae(e)}})).then((function(t){return t instanceof Ae?i(null,l,e,t.value):r(t,l,e)}))])).then((function(e){u=e}))}()}catch(e){return y(e)}return v&&v.then?v.then(void 0,y):v}(0,(function(t){u=i(t,l,e)}));return Promise.resolve(v&&v.then?v.then(s):s(v))}catch(e){return Promise.reject(e)}}();return Object.assign(y,{abort:function(e){s=e,d.abort()}})}}),{pending:o,rejected:i,fulfilled:r,typePrefix:e})},e.createEntityAdapter=function(e){void 0===e&&(e={});var t=ue({sortComparer:!1,selectId:function(e){return e.id}},e),n=t.selectId,r=t.sortComparer;return ue({selectId:n,sortComparer:r},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},n=function(e){return e.entities},r=ie(t,n,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},i=function(e,t){return e[t]},u=ie(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:n,selectAll:r,selectTotal:u,selectById:ie(n,o,i)};var a=ie(e,n);return{selectIds:ie(e,t),selectEntities:a,selectAll:ie(e,r),selectTotal:ie(e,u),selectById:ie(a,o,i)}}},{},r?function(e,t){var n=me(e);function r(t,n){Array.isArray(t)||(t=Object.values(t));var r=t.filter((function(t){return!(ge(t,e)in n.entities)}));0!==r.length&&u(r,n)}function o(t,n){var r=[];t.forEach((function(t){return function(t,n,r){if(!(n.id in r.entities))return!1;var o=Object.assign({},r.entities[n.id],n.changes),i=ge(o,e);return delete r.entities[n.id],t.push(o),i!==n.id}(r,t,n)})),0!==r.length&&u(r,n)}function i(t,n){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=ge(l,e);d in n.entities?u.push({id:d,changes:l}):i.push(l)}o(u,n),r(i,n)}function u(n,r){n.sort(t),n.forEach((function(t){r.entities[e(t)]=t}));var o=Object.values(r.entities);o.sort(t);var i=o.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(e[n]!==t[n])return!1;return!0})(r.ids,i)||(r.ids=i)}return{removeOne:n.removeOne,removeMany:n.removeMany,removeAll:n.removeAll,addOne:be((function(e,t){return r([e],t)})),updateOne:be((function(e,t){return o([e],t)})),upsertOne:be((function(e,t){return i([e],t)})),setAll:be((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],r(e,t)})),addMany:be(r),updateMany:be(o),upsertMany:be(i)}}(n,r):me(n))},e.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createNextState=L,e.createReducer=he,e.createSelector=ie,e.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createSlice=function(e){var t=e.name,n=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var r=e.reducers||{},o=void 0===e.extraReducers?{}:"function"==typeof e.extraReducers?ve(e.extraReducers):e.extraReducers,i=Object.keys(r),u={},a={},c={};i.forEach((function(e){var n,o,i=r[e],f=t+"/"+e;"reducer"in i?(n=i.reducer,o=i.prepare):n=i,u[e]=n,a[f]=n,c[e]=o?pe(f,o):pe(f)}));var f=he(n,ue({},o,{},a));return{name:t,reducer:f,actions:c,caseReducers:u}},e.createStore=J,e.findNonSerializableValue=function e(t,n,r,o,i){var u;if(void 0===n&&(n=[]),void 0===r&&(r=le),void 0===i&&(i=[]),!r(t))return{keyPath:n.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var a=null!=o?o(t):Object.entries(t),c=i.length>0,f=a,s=Array.isArray(f),l=0;for(f=s?f:f[Symbol.iterator]();;){var d;if(s){if(l>=f.length)break;d=f[l++]}else{if((l=f.next()).done)break;d=l.value}var p=d[1],y=n.concat(d[0]);if(!(c&&i.indexOf(y.join("."))>=0)){if(!r(p))return{keyPath:y.join("."),value:p};if("object"==typeof p&&(u=e(p,y,r,o,i)))return u}}return!1},e.getDefaultMiddleware=de,e.getType=function(e){return""+e},e.isImmutableDefault=function(e){return"object"!=typeof e||null==e},e.isPlain=le,e.nanoid=Oe,e.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).RTK={})}(this,(function(e){"use strict";function t(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(e){return!!e&&!!e[U]}function n(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype}(e)||Array.isArray(e)||!!e[K]||!!e.constructor[K]||f(e)||s(e))}function o(e,t,r){void 0===r&&(r=!1),0===i(e)?(r?Object.keys:W)(e).forEach((function(n){r&&"symbol"==typeof n||t(n,e[n],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function i(e){var t=e[U];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:f(e)?2:s(e)?3:0}function u(e,t){return 2===i(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function a(e,t,r){var n=i(e);2===n?e.set(t,r):3===n?(e.delete(t),e.add(r)):e[t]=r}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e){return M&&e instanceof Map}function s(e){return C&&e instanceof Set}function l(e){return e.o||e.t}function d(e){if(Array.isArray(e))return e.slice();var t=L(e);delete t[U];for(var r=W(t),n=0;n<r.length;n++){var o=r[n],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function p(e,t){Object.isFrozen(e)||r(e)||!n(e)||(i(e)>1&&(e.set=e.add=e.clear=e.delete=y),Object.freeze(e),t&&o(e,(function(e,t){return p(t,!0)}),!0))}function y(){t(2)}function v(e){var r=q[e];return r||t(19,e),r}function h(){return N}function b(e,t){t&&(v("Patches"),e.u=[],e.s=[],e.v=t)}function g(e){m(e),e.p.forEach(w),e.p=null}function m(e){e===N&&(N=e.l)}function O(e){return N={p:[],l:N,h:e,m:!0,_:0}}function w(e){var t=e[U];0===t.i||1===t.i?t.j():t.O=!0}function j(e,r){r._=r.p.length;var o=r.p[0],i=void 0!==e&&e!==o;return r.h.g||v("ES5").S(r,e,i),i?(o[U].P&&(g(r),t(4)),n(e)&&(e=A(r,e),r.l||E(r,e)),r.u&&v("Patches").M(o[U],e,r.u,r.s)):e=A(r,o,[]),g(r),r.u&&r.v(r.u,r.s),e!==z?e:void 0}function A(e,t,r){if(null==(n=t)||"object"!=typeof n||Object.isFrozen(n))return t;var n,i=t[U];if(!i)return o(t,(function(n,o){return P(e,i,t,n,o,r)}),!0),t;if(i.A!==e)return t;if(!i.P)return E(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var u=4===i.i||5===i.i?i.o=d(i.k):i.o;o(u,(function(t,n){return P(e,i,u,t,n,r)})),E(e,u,!1),r&&e.u&&v("Patches").R(i,r,e.u,e.s)}return i.o}function P(e,t,o,i,c,f){if(r(c)){var s=A(e,c,f&&t&&3!==t.i&&!u(t.D,i)?f.concat(i):void 0);if(a(o,i,s),!r(s))return;e.m=!1}if(n(c)&&!Object.isFrozen(c)){if(!e.h.N&&e._<1)return;A(e,c),t&&t.A.l||E(e,c)}}function E(e,t,r){void 0===r&&(r=!1),e.h.N&&e.m&&p(t,r)}function S(e,t){var r=e[U];return(r?l(r):e)[t]}function x(e){e.P||(e.P=!0,e.l&&x(e.l))}function I(e){e.o||(e.o=d(e.t))}function _(e,t,r){var n=f(t)?v("MapSet").T(t,r):s(t)?v("MapSet").F(t,r):e.g?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:h(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=n,i=B;r&&(o=[n],i=X);var u=Proxy.revocable(o,i),a=u.revoke,c=u.proxy;return n.k=c,n.j=a,c}(t,r):v("ES5").J(t,r);return(r?r.A:h()).p.push(n),n}function k(e){return r(e)||t(22,e),function e(t){if(!n(t))return t;var r,u=t[U],c=i(t);if(u){if(!u.P&&(u.i<4||!v("ES5").K(u)))return u.t;u.I=!0,r=R(t,c),u.I=!1}else r=R(t,c);return o(r,(function(t,n){u&&function(e,t){return 2===i(e)?e.get(t):e[t]}(u.t,t)===n||a(r,t,e(n))})),3===c?new Set(r):r}(e)}function R(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return d(e)}var D,N,T="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),M="undefined"!=typeof Map,C="undefined"!=typeof Set,F="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,z=T?Symbol("immer-nothing"):((D={})["immer-nothing"]=!0,D),K=T?Symbol("immer-draftable"):"__$immer_draftable",U=T?Symbol("immer-state"):"__$immer_state",W="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,L=Object.getOwnPropertyDescriptors||function(e){var t={};return W(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},q={},B={get:function(e,t){if(t===U)return e;var r=l(e);if(!u(r,t))return function(e,t,r){if(r in t)for(var n=Object.getPrototypeOf(t);n;){var o,i=Object.getOwnPropertyDescriptor(n,r);if(i)return"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k);n=Object.getPrototypeOf(n)}}(e,r,t);var o=r[t];return e.I||!n(o)?o:o===S(e.t,t)?(I(e),e.o[t]=_(e.A.h,o,e)):o},has:function(e,t){return t in l(e)},ownKeys:function(e){return Reflect.ownKeys(l(e))},set:function(e,t,r){if(e.D[t]=!0,!e.P){if(c(r,S(l(e),t))&&void 0!==r)return!0;I(e),x(e)}return e.o[t]=r,!0},deleteProperty:function(e,t){return void 0!==S(e.t,t)||t in e.t?(e.D[t]=!1,I(e),x(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=l(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){t(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){t(12)}},X={};o(B,(function(e,t){X[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),X.deleteProperty=function(e,t){return B.deleteProperty.call(this,e[0],t)},X.set=function(e,t,r){return B.set.call(this,e[0],t,r,e[0])};var V=new(function(){function e(e){this.g=F,this.N=!1,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var o=e.prototype;return o.produce=function(e,r,o){if("function"==typeof e&&"function"!=typeof r){var i=r;r=e;var u=this;return function(e){var t=this;void 0===e&&(e=i);for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return u.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(o))}))}}var a;if("function"!=typeof r&&t(6),void 0!==o&&"function"!=typeof o&&t(7),n(e)){var c=O(this),f=_(this,e,void 0),s=!0;try{a=r(f),s=!1}finally{s?g(c):m(c)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return b(c,o),j(e,c)}),(function(e){throw g(c),e})):(b(c,o),j(a,c))}if(!e||"object"!=typeof e){if((a=r(e))===z)return;return void 0===a&&(a=e),this.N&&p(a,!0),a}t(21,e)},o.produceWithPatches=function(e,t){var r,n,o=this;return"function"==typeof e?function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return o.produceWithPatches(t,(function(t){return e.apply(void 0,[t].concat(n))}))}:[this.produce(e,t,(function(e,t){r=e,n=t})),r,n]},o.createDraft=function(e){n(e)||t(8),r(e)&&(e=k(e));var o=O(this),i=_(this,e,void 0);return i[U].C=!0,m(o),i},o.finishDraft=function(e,t){var r=(e&&e[U]).A;return b(r,t),j(void 0,r)},o.setAutoFreeze=function(e){this.N=e},o.setUseProxies=function(e){e&&!F&&t(20),this.g=e},o.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}var i=v("Patches").$;return r(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),Y=V.produce;V.produceWithPatches.bind(V),V.setAutoFreeze.bind(V),V.setUseProxies.bind(V),V.applyPatches.bind(V),V.createDraft.bind(V),V.finishDraft.bind(V);var J=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}(),$=function(){return Math.random().toString(36).substring(7).split("").join(".")},G={INIT:"@@redux/INIT"+$(),REPLACE:"@@redux/REPLACE"+$(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$()}};function H(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 Q(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"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 t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(Q)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,u=[],a=u,c=!1;function f(){a===u&&(a=u.slice())}function s(){if(c)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 i}function l(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)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 f(),a.push(e),function(){if(t){if(c)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,f();var r=a.indexOf(e);a.splice(r,1)}}}function d(e){if(!H(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(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=u=a,r=0;r<t.length;r++)(0,t[r])();return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,d({type:G.REPLACE})}function y(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(s())}return r(),{unsubscribe:t(r)}}})[J]=function(){return this},e}return d({type:G.INIT}),(n={dispatch:d,subscribe:l,getState:s,replaceReducer:p})[J]=y,n}function Z(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 ee(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,u=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:G.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:G.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+G.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){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},a=0;a<u.length;a++){var c=u[a],f=e[c],s=(0,r[c])(f,t);if(void 0===s){var l=Z(c,t);throw new Error(l)}o[c]=s,n=n||s!==f}return n?o:e}}function te(e,t){return function(){return t(e.apply(this,arguments))}}function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(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){re(e,t,r[t])}))}return e}function oe(){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))}}))}function ie(){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 ne({},r,{dispatch:n=oe.apply(void 0,i)(r.dispatch)})}}}function ue(e,t){return e===t}function ae(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}function ce(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}var fe=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,u=n.pop(),a=ce(n),c=e.apply(void 0,[function(){return i++,u.apply(null,arguments)}].concat(r)),f=e((function(){for(var e=[],t=a.length,r=0;r<t;r++)e.push(a[r].apply(null,arguments));return c.apply(null,e)}));return f.resultFunc=u,f.dependencies=a,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]:ue,r=null,n=null;return function(){return ae(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}}));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)}function le(e){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function de(e,t){return(de=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function ye(e,t,r){return(ye=pe()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&de(o,r.prototype),o}).apply(null,arguments)}function ve(e){var t="function"==typeof Map?new Map:void 0;return(ve=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ye(e,arguments,le(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),de(r,e)})(e)}var he="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?oe:oe.apply(null,arguments)};function be(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 ge(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 me=ge();me.withExtraArgument=ge;var Oe=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o=n.prototype;return o.concat=function(){for(var t,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return ye(n,(t=e.prototype.concat).call.apply(t,[this].concat(o)))},o.prepend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 1===t.length&&Array.isArray(t[0])?ye(n,t[0].concat(this)):ye(n,t.concat(this))},n}(ve(Array));function we(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||be(e)}function je(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=new Oe;return r&&(function(e){return"boolean"==typeof e}(r)?n.push(me):n.push(me.withExtraArgument(r.extraArgument))),n}function Ae(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 se({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function Pe(e){return["type","payload","error","meta"].indexOf(e)>-1}function Ee(e){var t,r={},n=[],o={addCase:function(e,t){var n="string"==typeof e?e:e.type;if(n in r)throw new Error("addCase cannot be called with two reducers for the same action type");return r[n]=t,o},addMatcher:function(e,t){return n.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[r,n,t]}function Se(e,t,o,i){void 0===o&&(o=[]);var u="function"==typeof t?Ee(t):[t,o,i],a=u[0],c=u[1],f=u[2];return function(t,o){void 0===t&&(t=e);var i=[a[o.type]].concat(c.filter((function(e){return(0,e.matcher)(o)})).map((function(e){return e.reducer})));return 0===i.filter((function(e){return!!e})).length&&(i=[f]),i.reduce((function(e,t){if(t){if(r(e)){var i=t(e,o);return void 0===i?e:i}if(n(e))return Y(e,(function(e){return t(e,o)}));var u=t(e,o);if(void 0===u)throw Error("A case reducer on a non-draftable value must not return undefined");return u}return e}),t)}}function xe(e){return function(t,n){var o=function(t){!function(e){return be(t=e)&&"string"==typeof t.type&&Object.keys(t).every(Pe);var t}(n)?e(n,t):e(n.payload,t)};return r(t)?(o(t),t):Y(t,o)}}function Ie(e,t){return t(e)}function _e(e){function t(t,r){var n=Ie(t,e);n in r.entities||(r.ids.push(n),r.entities[n]=t)}function r(e,r){Array.isArray(e)||(e=Object.values(e));var n=e,o=Array.isArray(n),i=0;for(n=o?n:n[Symbol.iterator]();;){var u;if(o){if(i>=n.length)break;u=n[i++]}else{if((i=n.next()).done)break;u=i.value}t(u,r)}}function n(e,t){var r=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],r=!0)})),r&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function o(t,r){var n={},o={};t.forEach((function(e){e.id in r.entities&&(o[e.id]={id:e.id,changes:se({},o[e.id]?o[e.id].changes:null,{},e.changes)})})),(t=Object.values(o)).length>0&&t.filter((function(t){return function(t,r,n){var o=Object.assign({},n.entities[r.id],r.changes),i=Ie(o,e),u=i!==r.id;return u&&(t[r.id]=i,delete n.entities[r.id]),n.entities[i]=o,u}(n,t,r)})).length>0&&(r.ids=r.ids.map((function(e){return n[e]||e})))}function i(t,n){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=Ie(l,e);d in n.entities?u.push({id:d,changes:l}):i.push(l)}o(u,n),r(i,n)}return{removeAll:(u=function(e){Object.assign(e,{ids:[],entities:{}})},a=xe((function(e,t){return u(t)})),function(e){return a(e,void 0)}),addOne:xe(t),addMany:xe(r),setAll:xe((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},r(e,t)})),updateOne:xe((function(e,t){return o([e],t)})),updateMany:xe(o),upsertOne:xe((function(e,t){return i([e],t)})),upsertMany:xe(i),removeOne:xe((function(e,t){return n([e],t)})),removeMany:xe(n)};var u,a}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var ke=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},Re=["name","message","stack","code"],De=function(e){this.value=e},Ne=function(e){if("object"==typeof e&&null!==e){var t={},r=Re,n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var i;if(n){if(o>=r.length)break;i=r[o++]}else{if((o=r.next()).done)break;i=o.value}"string"==typeof e[i]&&(t[i]=e[i])}return t}return{message:String(e)}};!function(){function e(e,t){var r=a[e];return r?r.enumerable=t:a[e]=r={configurable:!0,enumerable:t,get:function(){return B.get(this[U],e)},set:function(t){B.set(this[U],e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var r=e[t][U];if(!r.P)switch(r.i){case 5:i(r)&&x(r);break;case 4:n(r)&&x(r)}}}function n(e){for(var t=e.t,r=e.k,n=W(r),o=n.length-1;o>=0;o--){var i=n[o];if(i!==U){var a=t[i];if(void 0===a&&!u(t,i))return!0;var f=r[i],s=f&&f[U];if(s?s.t!==a:!c(f,a))return!0}}var l=!!t[U];return n.length!==W(t).length+(l?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}var a={};!function(e,t){q.ES5=t}(0,{J:function(t,r){var n=Array.isArray(t),o=function(t,r){var n=L(r);t&&delete n.length,delete n[U];for(var o=W(n),i=0;i<o.length;i++){var u=o[i];n[u]=e(u,t||!!n[u].enumerable)}if(t){var a=Array(r.length);return Object.defineProperties(a,n),a}return Object.create(Object.getPrototypeOf(r),n)}(n,t),i={i:n?5:4,A:r?r.A:h(),P:!1,I:!1,D:{},l:r,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,U,{value:i,writable:!0}),o},S:function(e,n,a){a?r(n)&&n[U].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[U];if(r){var n=r.t,a=r.k,c=r.D,f=r.i;if(4===f)o(a,(function(t){t!==U&&(void 0!==n[t]||u(n,t)?c[t]||e(a[t]):(c[t]=!0,x(r)))})),o(n,(function(e){void 0!==a[e]||u(a,e)||(c[e]=!1,x(r))}));else if(5===f){if(i(r)&&(x(r),c.length=!0),a.length<n.length)for(var s=a.length;s<n.length;s++)c[s]=!1;else for(var l=n.length;l<a.length;l++)c[l]=!0;for(var d=Math.min(a.length,n.length),p=0;p<d;p++)void 0===c[p]&&e(a[p])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}(),e.MiddlewareArray=Oe,e.__DO_NOT_USE__ActionTypes=G,e.applyMiddleware=ie,e.bindActionCreators=function(e,t){if("function"==typeof e)return te(e,t);if("object"!=typeof e||null===e)throw new 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;o<r.length;o++){var i=r[o],u=e[i];"function"==typeof u&&(n[i]=te(u,t))}return n},e.combineReducers=ee,e.compose=oe,e.configureStore=function(e){var t,r=function(e){return je(e)},n=e||{},o=n.reducer,i=void 0===o?void 0:o,u=n.middleware,a=void 0===u?r():u,c=n.devTools,f=void 0===c||c,s=n.preloadedState,l=void 0===s?void 0:s,d=n.enhancers,p=void 0===d?void 0:d;if("function"==typeof i)t=i;else{if(!be(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=ee(i)}var y=ie.apply(void 0,"function"==typeof a?a(r):a),v=oe;f&&(v=he(se({trace:!1},"object"==typeof f&&f)));var h=[y];return Array.isArray(p)?h=[y].concat(p):"function"==typeof p&&(h=p(h)),Q(t,l,v.apply(void 0,h))},e.createAction=Ae,e.createAsyncThunk=function(e,t,r){var n=Ae(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),o=Ae(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),i=Ae(e+"/rejected",(function(e,t,r,n){var o=!!e&&"AbortError"===e.name,i=!!e&&"ConditionError"===e.name;return{payload:n,error:Ne(e||"Rejected"),meta:{arg:r,requestId:t,aborted:o,condition:i}}})),u="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,c,f){var s,l=ke(),d=new u,p=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:s||"Aborted"})}))})),y=!1,v=function(){try{var u,s=function(e){return v?e:(r&&!r.dispatchConditionRejection&&i.match(u)&&u.meta.condition||a(u),u)},v=!1,h=function(s,v){try{var h=function(){if(r&&r.condition&&!1===r.condition(e,{getState:c,extra:f}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=!0,a(o(l,e)),Promise.resolve(Promise.race([p,Promise.resolve(t(e,{dispatch:a,getState:c,extra:f,requestId:l,signal:d.signal,rejectWithValue:function(e){return new De(e)}})).then((function(t){return t instanceof De?i(null,l,e,t.value):n(t,l,e)}))])).then((function(e){u=e}))}()}catch(e){return v(e)}return h&&h.then?h.then(void 0,v):h}(0,(function(t){u=i(t,l,e)}));return Promise.resolve(h&&h.then?h.then(s):s(h))}catch(e){return Promise.reject(e)}}();return Object.assign(v,{abort:function(e){y&&(s=e,d.abort())}})}}),{pending:o,rejected:i,fulfilled:n,typePrefix:e})},e.createEntityAdapter=function(e){void 0===e&&(e={});var t=se({sortComparer:!1,selectId:function(e){return e.id}},e),r=t.selectId,n=t.sortComparer;return se({selectId:r,sortComparer:n},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},r=function(e){return e.entities},n=fe(t,r,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},i=function(e,t){return e[t]},u=fe(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:r,selectAll:n,selectTotal:u,selectById:fe(r,o,i)};var a=fe(e,r);return{selectIds:fe(e,t),selectEntities:a,selectAll:fe(e,n),selectTotal:fe(e,u),selectById:fe(a,o,i)}}},{},n?function(e,t){var r=_e(e);function n(t,r){Array.isArray(t)||(t=Object.values(t));var n=t.filter((function(t){return!(Ie(t,e)in r.entities)}));0!==n.length&&u(n,r)}function o(t,r){var n=[];t.forEach((function(t){return function(t,r,n){if(!(r.id in n.entities))return!1;var o=Object.assign({},n.entities[r.id],r.changes),i=Ie(o,e);return delete n.entities[r.id],t.push(o),i!==r.id}(n,t,r)})),0!==n.length&&u(n,r)}function i(t,r){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=Ie(l,e);d in r.entities?u.push({id:d,changes:l}):i.push(l)}o(u,r),n(i,r)}function u(r,n){r.sort(t),r.forEach((function(t){n.entities[e(t)]=t}));var o=Object.values(n.entities);o.sort(t);var i=o.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(e[r]!==t[r])return!1;return!0})(n.ids,i)||(n.ids=i)}return{removeOne:r.removeOne,removeMany:r.removeMany,removeAll:r.removeAll,addOne:xe((function(e,t){return n([e],t)})),updateOne:xe((function(e,t){return o([e],t)})),upsertOne:xe((function(e,t){return i([e],t)})),setAll:xe((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],n(e,t)})),addMany:xe(n),updateMany:xe(o),upsertMany:xe(i)}}(r,n):_e(r))},e.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createNextState=Y,e.createReducer=Se,e.createSelector=fe,e.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},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=void 0===e.extraReducers?[]:"function"==typeof e.extraReducers?Ee(e.extraReducers):[e.extraReducers],i=o[0],u=void 0===i?{}:i,a=o[1],c=void 0===a?[]:a,f=o[2],s=void 0===f?void 0:f,l=Object.keys(n),d={},p={},y={};l.forEach((function(e){var r,o,i=n[e],u=t+"/"+e;"reducer"in i?(r=i.reducer,o=i.prepare):r=i,d[e]=r,p[u]=r,y[e]=o?Ae(u,o):Ae(u)}));var v=Se(r,se({},u,{},p),c,s);return{name:t,reducer:v,actions:y,caseReducers:d}},e.createStore=Q,e.current=k,e.findNonSerializableValue=function e(t,r,n,o,i){var u;if(void 0===r&&(r=[]),void 0===n&&(n=we),void 0===i&&(i=[]),!n(t))return{keyPath:r.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var a=null!=o?o(t):Object.entries(t),c=i.length>0,f=a,s=Array.isArray(f),l=0;for(f=s?f:f[Symbol.iterator]();;){var d;if(s){if(l>=f.length)break;d=f[l++]}else{if((l=f.next()).done)break;d=l.value}var p=d[1],y=r.concat(d[0]);if(!(c&&i.indexOf(y.join("."))>=0)){if(!n(p))return{keyPath:y.join("."),value:p};if("object"==typeof p&&(u=e(p,y,n,o,i)))return u}}return!1},e.getDefaultMiddleware=je,e.getType=function(e){return""+e},e.isImmutableDefault=function(e){return"object"!=typeof e||null==e},e.isPlain=we,e.nanoid=ke,e.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload}}));
//# sourceMappingURL=redux-toolkit.umd.min.js.map

@@ -6,2 +6,3 @@ import { Action } from 'redux';

import { createSelector } from 'reselect';
import { current } from 'immer';
import { DeepPartial } from 'redux';

@@ -136,2 +137,13 @@ import { Dispatch } from 'redux';

declare interface ActionMatcher<A extends AnyAction> {
(action: AnyAction): action is A;
}
declare type ActionMatcherDescription<S, A extends AnyAction> = {
matcher: ActionMatcher<A>;
reducer: CaseReducer<S, NoInfer<A>>;
};
declare type ActionMatcherDescriptionCollection<S> = Array<ActionMatcherDescription<S, any>>;
/**

@@ -155,2 +167,17 @@ * A builder for an action <-> reducer map.

addCase<Type extends string, A extends Action<Type>>(type: Type, reducer: CaseReducer<State, A>): ActionReducerMapBuilder<State>;
/**
* Adds a reducer for all actions, using `matcher` as a filter function.
* If multiple matcher reducers match, all of them will be executed in the order
* they were defined if - even if a case reducer already matched.
* @param matcher A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates)
* function
* @param reducer
*/
addMatcher<A extends AnyAction>(matcher: ActionMatcher<A>, reducer: CaseReducer<State, A>): Omit<ActionReducerMapBuilder<State>, 'addCase'>;
/**
* Adds a "default case" reducer that is executed if no case reducer and no matcher
* reducer was executed for this action.
* @param reducer
*/
addDefaultCase(reducer: CaseReducer<State, AnyAction>): {};
}

@@ -176,2 +203,15 @@

/**
* A type describing the return value of `createAsyncThunk`.
* Might be useful for wrapping `createAsyncThunk` in custom abstractions.
*
* @public
*/
export declare type AsyncThunk<Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig> = AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & {
pending: AsyncThunkPendingActionCreator<ThunkArg>;
rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>;
fulfilled: AsyncThunkFulfilledActionCreator<Returned, ThunkArg>;
typePrefix: string;
};
/**
* A ThunkAction created by `createAsyncThunk`.

@@ -197,2 +237,4 @@ * Dispatching it returns a Promise for either a

declare type AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig> = IsAny<ThunkArg, (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>, unknown extends ThunkArg ? (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [ThunkArg] extends [void] | [undefined] ? () => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [void] extends [ThunkArg] ? (arg?: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [undefined] extends [ThunkArg] ? WithStrictNullChecks<(arg?: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>, (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>> : (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>>;
declare type AsyncThunkConfig = {

@@ -205,2 +247,7 @@ state?: unknown;

declare type AsyncThunkFulfilledActionCreator<Returned, ThunkArg> = ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg], Returned, string, never, {
arg: ThunkArg;
requestId: string;
}>;
declare interface AsyncThunkOptions<ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> {

@@ -211,5 +258,5 @@ /**

*
* @returns `true` if the asyncThunk should be executed, `false` if it should be skipped
* @returns `false` if it should be skipped
*/
condition?(arg: ThunkArg, api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>): boolean;
condition?(arg: ThunkArg, api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>): boolean | undefined;
/**

@@ -241,2 +288,14 @@ * If `condition` returns `false`, the asyncThunk will be skipped.

declare type AsyncThunkPendingActionCreator<ThunkArg> = ActionCreatorWithPreparedPayload<[string, ThunkArg], undefined, string, never, {
arg: ThunkArg;
requestId: string;
}>;
declare type AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig> = ActionCreatorWithPreparedPayload<[Error | null, string, ThunkArg, (GetRejectValue<ThunkApiConfig> | undefined)?], GetRejectValue<ThunkApiConfig> | undefined, string, SerializedError, {
arg: ThunkArg;
requestId: string;
aborted: boolean;
condition: boolean;
}>;
/**

@@ -360,3 +419,3 @@ * returns True if TS version is above 3.5, False if below.

*/
middleware?: M;
middleware?: ((getDefaultMiddleware: CurriedGetDefaultMiddleware<S>) => M) | M;
/**

@@ -383,3 +442,3 @@ * Whether to enable Redux DevTools integration. Defaults to `true`.

* and should return a new array (such as `[applyMiddleware, offline]`).
* If you only need to add middleware, you can use the `middleware` parameter instaead.
* If you only need to add middleware, you can use the `middleware` parameter instead.
*/

@@ -427,19 +486,3 @@ enhancers?: StoreEnhancer[] | ConfigureEnhancersCallback;

*/
export declare function createAsyncThunk<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}>(typePrefix: string, payloadCreator: (arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => Promise<Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>> | Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>, options?: AsyncThunkOptions<ThunkArg, ThunkApiConfig>): IsAny<ThunkArg, (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>, unknown extends ThunkArg ? (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [ThunkArg] extends [void] | [undefined] ? () => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [void] extends [ThunkArg] ? (arg?: ThunkArg | undefined) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [undefined] extends [ThunkArg] ? (arg?: ThunkArg | undefined) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>> & {
pending: ActionCreatorWithPreparedPayload<[string, ThunkArg], undefined, string, never, {
arg: ThunkArg;
requestId: string;
}>;
rejected: ActionCreatorWithPreparedPayload<[Error | null, string, ThunkArg, (GetRejectValue<ThunkApiConfig> | undefined)?], GetRejectValue<ThunkApiConfig> | undefined, string, SerializedError, {
arg: ThunkArg;
requestId: string;
aborted: boolean;
condition: boolean;
}>;
fulfilled: ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg], Returned, string, never, {
arg: ThunkArg;
requestId: string;
}>;
typePrefix: string;
};
export declare function createAsyncThunk<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}>(typePrefix: string, payloadCreator: AsyncThunkPayloadCreator<Returned, ThunkArg, ThunkApiConfig>, options?: AsyncThunkOptions<ThunkArg, ThunkApiConfig>): AsyncThunk<Returned, ThunkArg, ThunkApiConfig>;

@@ -484,6 +527,10 @@ /**

* case reducers.
* @param actionMatchers An array of matcher definitions in the form `{matcher, reducer}`.
* All matching reducers will be executed in order, independently if a case reducer matched or not.
* @param defaultCaseReducer A "default case" reducer that is executed if no case reducer and no matcher
* reducer was executed for this action.
*
* @public
*/
export declare function createReducer<S, CR extends CaseReducers<S, any> = CaseReducers<S, any>>(initialState: S, actionsMap: CR): Reducer<S>;
export declare function createReducer<S, CR extends CaseReducers<S, any> = CaseReducers<S, any>>(initialState: S, actionsMap: CR, actionMatchers?: ActionMatcherDescriptionCollection<S>, defaultCaseReducer?: CaseReducer<S>): Reducer<S>;

@@ -562,3 +609,10 @@ /**

}
export { current }
declare type CurriedGetDefaultMiddleware<S = any> = <O extends Partial<GetDefaultMiddlewareOptions> = {
thunk: true;
immutableCheck: true;
serializableCheck: true;
}>(options?: O) => MiddlewareArray<Middleware<{}, S> | ThunkMiddlewareFor<S, O>>;
/**

@@ -851,3 +905,3 @@ * @public

serializableCheck: true;
}>(options?: O): Array<Middleware<{}, S> | ThunkMiddlewareFor<S, O>>;
}>(options?: O): MiddlewareArray<Middleware<{}, S> | ThunkMiddlewareFor<S, O>>;

@@ -913,4 +967,16 @@ declare interface GetDefaultMiddlewareOptions {

export declare interface ImmutableStateInvariantMiddlewareOptions {
/**
Callback function to check if a value is considered to be immutable.
This function is applied recursively to every value contained in the state.
The default implementation will return true for primitive types
(like numbers, strings, booleans, null and undefined).
*/
isImmutable?: IsImmutableFunc;
/**
An array of dot-separated path strings that match named nodes from
the root state to ignore when checking for immutability.
Defaults to undefined
*/
ignoredPaths?: string[];
/** Print a warning if checks take longer than N ms. Default: 32ms */
warnAfter?: number;

@@ -966,2 +1032,12 @@ ignore?: string[];

/**
* @public
*/
export declare class MiddlewareArray<Middlewares extends Middleware<any, any>> extends Array<Middlewares> {
concat<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(items: AdditionalMiddlewares): MiddlewareArray<Middlewares | AdditionalMiddlewares[number]>;
concat<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(...items: AdditionalMiddlewares): MiddlewareArray<Middlewares | AdditionalMiddlewares[number]>;
prepend<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(items: AdditionalMiddlewares): MiddlewareArray<AdditionalMiddlewares[number] | Middlewares>;
prepend<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(...items: AdditionalMiddlewares): MiddlewareArray<AdditionalMiddlewares[number] | Middlewares>;
}
declare type Middlewares<S> = ReadonlyArray<Middleware<{}, S>>;

@@ -1079,15 +1155,20 @@

/**
* An array of action types to ignore when checking for serializability, Defaults to []
* An array of action types to ignore when checking for serializability.
* Defaults to []
*/
ignoredActions?: string[];
/**
* An array of dot-separated path strings to ignore when checking for serializability, Defaults to ['meta.arg']
* An array of dot-separated path strings to ignore when checking
* for serializability, Defaults to ['meta.arg']
*/
ignoredActionPaths?: string[];
/**
* An array of dot-separated path strings to ignore when checking for serializability, Defaults to []
* An array of dot-separated path strings to ignore when checking
* for serializability, Defaults to []
*/
ignoredPaths?: string[];
/**
* Execution time warning threshold. If the middleware takes longer than `warnAfter` ms, a warning will be displayed in the console. Defaults to 32
* Execution time warning threshold. If the middleware takes longer
* than `warnAfter` ms, a warning will be displayed in the console.
* Defaults to 32ms.
*/

@@ -1220,4 +1301,6 @@ warnAfter?: number;

declare type WithStrictNullChecks<True, False> = undefined extends boolean ? False : True;
export * from "redux";
export { }
{
"name": "@reduxjs/toolkit",
"version": "1.3.6",
"version": "1.4.0",
"description": "The official, opinionated, batteries-included toolset for efficient Redux development",

@@ -61,3 +61,3 @@ "repository": "https://github.com/reduxjs/redux-toolkit",

"dependencies": {
"immer": "^6.0.1",
"immer": "^7.0.3",
"redux": "^4.0.0",

@@ -64,0 +64,0 @@ "redux-thunk": "^2.3.0",

@@ -87,2 +87,22 @@ import { configureStore } from './configureStore'

describe('middleware builder notation', () => {
it('calls builder, passes getDefaultMiddleware and uses returned middlewares', () => {
const thank = jest.fn((_store => next => action =>
'foobar') as redux.Middleware)
const builder = jest.fn(getDefaultMiddleware => {
expect(getDefaultMiddleware).toEqual(expect.any(Function))
expect(getDefaultMiddleware()).toEqual(expect.any(Array))
return [thank]
})
const store = configureStore({ middleware: builder, reducer })
expect(builder).toHaveBeenCalled()
expect(store.dispatch({ type: 'test' })).toBe('foobar')
})
})
describe('with devTools disabled', () => {

@@ -89,0 +109,0 @@ it('calls createStore without devTools enhancer', () => {

@@ -23,4 +23,5 @@ import {

import {
getDefaultMiddleware,
ThunkMiddlewareFor
ThunkMiddlewareFor,
curryGetDefaultMiddleware,
CurriedGetDefaultMiddleware
} from './getDefaultMiddleware'

@@ -60,3 +61,3 @@ import { DispatchForMiddlewares } from './tsHelpers'

*/
middleware?: M
middleware?: ((getDefaultMiddleware: CurriedGetDefaultMiddleware<S>) => M) | M

@@ -90,3 +91,3 @@ /**

* and should return a new array (such as `[applyMiddleware, offline]`).
* If you only need to add middleware, you can use the `middleware` parameter instaead.
* If you only need to add middleware, you can use the `middleware` parameter instead.
*/

@@ -130,5 +131,7 @@ enhancers?: StoreEnhancer[] | ConfigureEnhancersCallback

>(options: ConfigureStoreOptions<S, A, M>): EnhancedStore<S, A, M> {
const curriedGetDefaultMiddleware = curryGetDefaultMiddleware<S>()
const {
reducer = undefined,
middleware = getDefaultMiddleware(),
middleware = curriedGetDefaultMiddleware(),
devTools = true,

@@ -151,3 +154,7 @@ preloadedState = undefined,

const middlewareEnhancer = applyMiddleware(...middleware)
const middlewareEnhancer = applyMiddleware(
...(typeof middleware === 'function'
? middleware(curriedGetDefaultMiddleware)
: middleware)
)

@@ -154,0 +161,0 @@ let finalCompose = compose

@@ -552,2 +552,17 @@ import {

test('does not fail when attempting to abort a canceled promise', async () => {
const asyncPayloadCreator = jest.fn(async (x: typeof arg) => {
await new Promise(resolve => setTimeout(resolve, 2000))
return 10
})
const asyncThunk = createAsyncThunk('test', asyncPayloadCreator, {
condition
})
const promise = asyncThunk(arg)(dispatch, getState, extra)
promise.abort(
`If the promise was 1. somehow canceled, 2. in a 'started' state and 3. we attempted to abort, this would crash the tests`
)
})
test('rejected action can be dispatched via option', async () => {

@@ -554,0 +569,0 @@ const asyncThunk = createAsyncThunk('test', payloadCreator, {

@@ -202,3 +202,3 @@ import { Dispatch, AnyAction } from 'redux'

*
* @returns `true` if the asyncThunk should be executed, `false` if it should be skipped
* @returns `false` if it should be skipped
*/

@@ -208,3 +208,3 @@ condition?(

api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>
): boolean
): boolean | undefined
/**

@@ -220,4 +220,69 @@ * If `condition` returns `false`, the asyncThunk will be skipped.

type AsyncThunkPendingActionCreator<
ThunkArg
> = ActionCreatorWithPreparedPayload<
[string, ThunkArg],
undefined,
string,
never,
{
arg: ThunkArg
requestId: string
}
>
type AsyncThunkRejectedActionCreator<
ThunkArg,
ThunkApiConfig
> = ActionCreatorWithPreparedPayload<
[
Error | null,
string,
ThunkArg,
(GetRejectValue<ThunkApiConfig> | undefined)?
],
GetRejectValue<ThunkApiConfig> | undefined,
string,
SerializedError,
{
arg: ThunkArg
requestId: string
aborted: boolean
condition: boolean
}
>
type AsyncThunkFulfilledActionCreator<
Returned,
ThunkArg
> = ActionCreatorWithPreparedPayload<
[Returned, string, ThunkArg],
Returned,
string,
never,
{
arg: ThunkArg
requestId: string
}
>
/**
* A type describing the return value of `createAsyncThunk`.
* Might be useful for wrapping `createAsyncThunk` in custom abstractions.
*
* @public
*/
export type AsyncThunk<
Returned,
ThunkArg,
ThunkApiConfig extends AsyncThunkConfig
> = AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & {
pending: AsyncThunkPendingActionCreator<ThunkArg>
rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>
fulfilled: AsyncThunkFulfilledActionCreator<Returned, ThunkArg>
typePrefix: string
}
/**
*
* @param typePrefix

@@ -235,11 +300,5 @@ * @param payloadCreator

typePrefix: string,
payloadCreator: (
arg: ThunkArg,
thunkAPI: GetThunkAPI<ThunkApiConfig>
) =>
| Promise<Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>>
| Returned
| RejectWithValue<GetRejectValue<ThunkApiConfig>>,
payloadCreator: AsyncThunkPayloadCreator<Returned, ThunkArg, ThunkApiConfig>,
options?: AsyncThunkOptions<ThunkArg, ThunkApiConfig>
) {
): AsyncThunk<Returned, ThunkArg, ThunkApiConfig> {
type RejectedValue = GetRejectValue<ThunkApiConfig>

@@ -333,5 +392,8 @@

let started = false
function abort(reason?: string) {
abortReason = reason
abortController.abort()
if (started) {
abortReason = reason
abortController.abort()
}
}

@@ -347,2 +409,3 @@

) {
// eslint-disable-next-line no-throw-literal
throw {

@@ -353,2 +416,3 @@ name: 'ConditionError',

}
started = true
dispatch(pending(requestId, arg))

@@ -355,0 +419,0 @@ finalAction = await Promise.race([

import { createReducer, CaseReducer } from './createReducer'
import { PayloadAction, createAction } from './createAction'
import { createNextState, Draft } from './'
import { Reducer } from 'redux'
import { Reducer, AnyAction } from 'redux'

@@ -109,2 +109,116 @@ interface Todo {

describe('actionMatchers argument', () => {
const prepareNumberAction = (payload: number) => ({
payload,
meta: { type: 'number_action' }
})
const prepareStringAction = (payload: string) => ({
payload,
meta: { type: 'string_action' }
})
const numberActionMatcher = (a: AnyAction): a is PayloadAction<number> =>
a.meta && a.meta.type === 'number_action'
const stringActionMatcher = (a: AnyAction): a is PayloadAction<string> =>
a.meta && a.meta.type === 'string_action'
const incrementBy = createAction('increment', prepareNumberAction)
const decrementBy = createAction('decrement', prepareNumberAction)
const concatWith = createAction('concat', prepareStringAction)
const initialState = { numberActions: 0, stringActions: 0 }
const numberActionsCounter = {
matcher: numberActionMatcher,
reducer(state: typeof initialState) {
state.numberActions = state.numberActions * 10 + 1
}
}
const stringActionsCounter = {
matcher: stringActionMatcher,
reducer(state: typeof initialState) {
state.stringActions = state.stringActions * 10 + 1
}
}
test('uses the reducer of matching actionMatchers', () => {
const reducer = createReducer(initialState, {}, [
numberActionsCounter,
stringActionsCounter
])
expect(reducer(undefined, incrementBy(1))).toEqual({
numberActions: 1,
stringActions: 0
})
expect(reducer(undefined, decrementBy(1))).toEqual({
numberActions: 1,
stringActions: 0
})
expect(reducer(undefined, concatWith('foo'))).toEqual({
numberActions: 0,
stringActions: 1
})
})
test('fallback to default case', () => {
const reducer = createReducer(
initialState,
{},
[numberActionsCounter, stringActionsCounter],
state => {
state.numberActions = -1
state.stringActions = -1
}
)
expect(reducer(undefined, { type: 'somethingElse' })).toEqual({
numberActions: -1,
stringActions: -1
})
})
test('runs reducer cases followed by all matching actionMatchers', () => {
const reducer = createReducer(
initialState,
{
[incrementBy.type](state) {
state.numberActions = state.numberActions * 10 + 2
}
},
[
{
matcher: numberActionMatcher,
reducer(state) {
state.numberActions = state.numberActions * 10 + 3
}
},
numberActionsCounter,
stringActionsCounter
]
)
expect(reducer(undefined, incrementBy(1))).toEqual({
numberActions: 231,
stringActions: 0
})
expect(reducer(undefined, decrementBy(1))).toEqual({
numberActions: 31,
stringActions: 0
})
expect(reducer(undefined, concatWith('foo'))).toEqual({
numberActions: 0,
stringActions: 1
})
})
test('works with `actionCreator.match`', () => {
const reducer = createReducer(initialState, {}, [
{
matcher: incrementBy.match,
reducer(state) {
state.numberActions += 100
}
}
])
expect(reducer(undefined, incrementBy(1))).toEqual({
numberActions: 100,
stringActions: 0
})
})
})
describe('alternative builder callback for actionMap', () => {

@@ -153,2 +267,34 @@ const increment = createAction<number, 'increment'>('increment')

})
test('will throw an error when returning undefined from a non-draftable state', () => {
const reducer = createReducer(0, builder =>
builder.addCase(
'decrement',
(state, action: { type: 'decrement'; payload: number }) => {}
)
)
expect(() => reducer(5, decrement(5))).toThrowErrorMatchingInlineSnapshot(
`"A case reducer on a non-draftable value must not return undefined"`
)
})
test('allows you to return null', () => {
const reducer = createReducer(0 as number | null, builder =>
builder.addCase(
'decrement',
(state, action: { type: 'decrement'; payload: number }) => {
return null
}
)
)
expect(reducer(5, decrement(5))).toBe(null)
})
test('allows you to return 0', () => {
const reducer = createReducer(0, builder =>
builder.addCase(
'decrement',
(state, action: { type: 'decrement'; payload: number }) =>
state - action.payload
)
)
expect(reducer(5, decrement(5))).toBe(0)
})
test('will throw if the same type is used twice', () => {

@@ -177,2 +323,141 @@ expect(() =>

})
describe('builder "addMatcher" method', () => {
const prepareNumberAction = (payload: number) => ({
payload,
meta: { type: 'number_action' }
})
const prepareStringAction = (payload: string) => ({
payload,
meta: { type: 'string_action' }
})
const numberActionMatcher = (a: AnyAction): a is PayloadAction<number> =>
a.meta && a.meta.type === 'number_action'
const stringActionMatcher = (a: AnyAction): a is PayloadAction<string> =>
a.meta && a.meta.type === 'string_action'
const incrementBy = createAction('increment', prepareNumberAction)
const decrementBy = createAction('decrement', prepareNumberAction)
const concatWith = createAction('concat', prepareStringAction)
const initialState = { numberActions: 0, stringActions: 0 }
test('uses the reducer of matching actionMatchers', () => {
const reducer = createReducer(initialState, builder =>
builder
.addMatcher(numberActionMatcher, state => {
state.numberActions += 1
})
.addMatcher(stringActionMatcher, state => {
state.stringActions += 1
})
)
expect(reducer(undefined, incrementBy(1))).toEqual({
numberActions: 1,
stringActions: 0
})
expect(reducer(undefined, decrementBy(1))).toEqual({
numberActions: 1,
stringActions: 0
})
expect(reducer(undefined, concatWith('foo'))).toEqual({
numberActions: 0,
stringActions: 1
})
})
test('falls back to defaultCase', () => {
const reducer = createReducer(initialState, builder =>
builder
.addCase(concatWith, state => {
state.stringActions += 1
})
.addMatcher(numberActionMatcher, state => {
state.numberActions += 1
})
.addDefaultCase(state => {
state.numberActions = -1
state.stringActions = -1
})
)
expect(reducer(undefined, { type: 'somethingElse' })).toEqual({
numberActions: -1,
stringActions: -1
})
})
test('runs reducer cases followed by all matching actionMatchers', () => {
const reducer = createReducer(initialState, builder =>
builder
.addCase(incrementBy, state => {
state.numberActions = state.numberActions * 10 + 1
})
.addMatcher(numberActionMatcher, state => {
state.numberActions = state.numberActions * 10 + 2
})
.addMatcher(stringActionMatcher, state => {
state.stringActions = state.stringActions * 10 + 1
})
.addMatcher(numberActionMatcher, state => {
state.numberActions = state.numberActions * 10 + 3
})
)
expect(reducer(undefined, incrementBy(1))).toEqual({
numberActions: 123,
stringActions: 0
})
expect(reducer(undefined, decrementBy(1))).toEqual({
numberActions: 23,
stringActions: 0
})
expect(reducer(undefined, concatWith('foo'))).toEqual({
numberActions: 0,
stringActions: 1
})
})
test('works with `actionCreator.match`', () => {
const reducer = createReducer(initialState, builder =>
builder.addMatcher(incrementBy.match, state => {
state.numberActions += 100
})
)
expect(reducer(undefined, incrementBy(1))).toEqual({
numberActions: 100,
stringActions: 0
})
})
test('calling addCase, addMatcher and addDefaultCase in a nonsensical order should result in an error in development mode', () => {
expect(() =>
createReducer(initialState, (builder: any) =>
builder
.addMatcher(numberActionMatcher, () => {})
.addCase(incrementBy, () => {})
)
).toThrowErrorMatchingInlineSnapshot(
`"\`builder.addCase\` should only be called before calling \`builder.addMatcher\`"`
)
expect(() =>
createReducer(initialState, (builder: any) =>
builder.addDefaultCase(() => {}).addCase(incrementBy, () => {})
)
).toThrowErrorMatchingInlineSnapshot(
`"\`builder.addCase\` should only be called before calling \`builder.addDefaultCase\`"`
)
expect(() =>
createReducer(initialState, (builder: any) =>
builder
.addDefaultCase(() => {})
.addMatcher(numberActionMatcher, () => {})
)
).toThrowErrorMatchingInlineSnapshot(
`"\`builder.addMatcher\` should only be called before calling \`builder.addDefaultCase\`"`
)
expect(() =>
createReducer(initialState, (builder: any) =>
builder.addDefaultCase(() => {}).addDefaultCase(() => {})
)
).toThrowErrorMatchingInlineSnapshot(
`"\`builder.addDefaultCase\` can only be called once"`
)
})
})
})

@@ -179,0 +464,0 @@

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

import createNextState, { Draft, isDraft } from 'immer'
import createNextState, { Draft, isDraft, isDraftable } from 'immer'
import { AnyAction, Action, Reducer } from 'redux'

@@ -7,2 +7,3 @@ import {

} from './mapBuilders'
import { NoInfer } from './tsHelpers'

@@ -19,2 +20,15 @@ /**

export interface ActionMatcher<A extends AnyAction> {
(action: AnyAction): action is A
}
export type ActionMatcherDescription<S, A extends AnyAction> = {
matcher: ActionMatcher<A>
reducer: CaseReducer<S, NoInfer<A>>
}
export type ActionMatcherDescriptionCollection<S> = Array<
ActionMatcherDescription<S, any>
>
/**

@@ -69,2 +83,6 @@ * An *case reducer* is a reducer function for a specific action type. Case

* case reducers.
* @param actionMatchers An array of matcher definitions in the form `{matcher, reducer}`.
* All matching reducers will be executed in order, independently if a case reducer matched or not.
* @param defaultCaseReducer A "default case" reducer that is executed if no case reducer and no matcher
* reducer was executed for this action.
*

@@ -76,3 +94,8 @@ * @public

CR extends CaseReducers<S, any> = CaseReducers<S, any>
>(initialState: S, actionsMap: CR): Reducer<S>
>(
initialState: S,
actionsMap: CR,
actionMatchers?: ActionMatcherDescriptionCollection<S>,
defaultCaseReducer?: CaseReducer<S>
): Reducer<S>
/**

@@ -104,30 +127,61 @@ * A utility function that allows defining a reducer as a mapping from action

| CaseReducers<S, any>
| ((builder: ActionReducerMapBuilder<S>) => void)
| ((builder: ActionReducerMapBuilder<S>) => void),
actionMatchers: ActionMatcherDescriptionCollection<S> = [],
defaultCaseReducer?: CaseReducer<S>
): Reducer<S> {
let actionsMap =
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] =
typeof mapOrBuilderCallback === 'function'
? executeReducerBuilderCallback(mapOrBuilderCallback)
: mapOrBuilderCallback
: [mapOrBuilderCallback, actionMatchers, defaultCaseReducer]
return function(state = initialState, action): S {
const caseReducer = actionsMap[action.type]
if (caseReducer) {
if (isDraft(state)) {
// we must already be inside a `createNextState` call, likely because
// this is being wrapped in `createReducer`, `createSlice`, or nested
// inside an existing draft. It's safe to just pass the draft to the mutator.
const draft = state as Draft<S> // We can aassume this is already a draft
return caseReducer(draft, action) || state
} else {
// @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, (draft: Draft<S>) => {
return caseReducer(draft, action)
})
}
let caseReducers = [
actionsMap[action.type],
...finalActionMatchers
.filter(({ matcher }) => matcher(action))
.map(({ reducer }) => reducer)
]
if (caseReducers.filter(cr => !!cr).length === 0) {
caseReducers = [finalDefaultCaseReducer]
}
return state
return caseReducers.reduce((previousState, caseReducer): S => {
if (caseReducer) {
if (isDraft(previousState)) {
// If it's already a draft, we must already be inside a `createNextState` call,
// likely because this is being wrapped in `createReducer`, `createSlice`, or nested
// inside an existing draft. It's safe to just pass the draft to the mutator.
const draft = previousState as Draft<S> // We can assume this is already a draft
const result = caseReducer(draft, action)
if (typeof result === 'undefined') {
return previousState
}
return result
} else if (!isDraftable(previousState)) {
// If state is not draftable (ex: a primitive, such as 0), we want to directly
// return the caseReducer func and not wrap it with produce.
const result = caseReducer(previousState as any, action)
if (typeof result === 'undefined') {
throw Error(
'A case reducer on a non-draftable value must not return undefined'
)
}
return result
} else {
// @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(previousState, (draft: Draft<S>) => {
return caseReducer(draft, action)
})
}
}
return previousState
}, state)
}
}

@@ -157,2 +157,28 @@ import { createSlice } from './createSlice'

test('can be used with addMatcher and type guard functions', () => {
const slice = createSlice({
name: 'counter',
initialState: 0,
reducers: {},
extraReducers: builder =>
builder.addMatcher(
increment.match,
(state, action: { type: 'increment'; payload: number }) =>
state + action.payload
)
})
expect(slice.reducer(0, increment(5))).toBe(5)
})
test('can be used with addDefaultCase', () => {
const slice = createSlice({
name: 'counter',
initialState: 0,
reducers: {},
extraReducers: builder =>
builder.addDefaultCase((state, action) => state + action.payload)
})
expect(slice.reducer(0, increment(5))).toBe(5)
})
// for further tests, see the test of createReducer that goes way more into depth on this

@@ -185,3 +211,3 @@ })

it('should call the reducer function', () => {
const reducer = jest.fn()
const reducer = jest.fn(() => 5)

@@ -188,0 +214,0 @@ const testSlice = createSlice({

@@ -15,3 +15,3 @@ import { Reducer } from 'redux'

} from './mapBuilders'
import { Omit } from './tsHelpers'
import { Omit, NoInfer } from './tsHelpers'

@@ -169,11 +169,2 @@ /**

/**
* Helper type. Passes T out again, but boxes it in a way that it cannot
* "widen" the type by accident if it is a generic that should be inferred
* from elsewhere.
*
* @internal
*/
type NoInfer<T> = [T][T extends any ? 0 : never]
/**
* Used on a SliceCaseReducers object.

@@ -230,8 +221,12 @@ * Ensures that if a CaseReducer is a `CaseReducerWithPrepare`, that

const reducers = options.reducers || {}
const extraReducers =
const [
extraReducers = {},
actionMatchers = [],
defaultCaseReducer = undefined
] =
typeof options.extraReducers === 'undefined'
? {}
? []
: typeof options.extraReducers === 'function'
? executeReducerBuilderCallback(options.extraReducers)
: options.extraReducers
: [options.extraReducers]

@@ -266,3 +261,8 @@ const reducerNames = Object.keys(reducers)

const finalCaseReducers = { ...extraReducers, ...sliceCaseReducersByType }
const reducer = createReducer(initialState, finalCaseReducers as any)
const reducer = createReducer(
initialState,
finalCaseReducers as any,
actionMatchers,
defaultCaseReducer
)

@@ -269,0 +269,0 @@ return {

export interface BookModel {
id: string
title: string
author?: string
}

@@ -20,1 +21,7 @@

})
export const TheHobbit: BookModel = Object.freeze({
id: 'th',
title: 'The Hobbit',
author: 'J. R. R. Tolkien'
})

@@ -7,3 +7,4 @@ import { EntityStateAdapter, EntityState } from './models'

AClockworkOrange,
AnimalFarm
AnimalFarm,
TheHobbit
} from './fixtures/book'

@@ -470,8 +471,16 @@ import { createNextState } from '..'

const secondChange = { title: 'Second Change' }
const withMany = adapter.setAll(state, [TheGreatGatsby, AClockworkOrange])
const thirdChange = { title: 'Third Change' }
const fourthChange = { author: 'Fourth Change' }
const withMany = adapter.setAll(state, [
TheGreatGatsby,
AClockworkOrange,
TheHobbit
])
const result = createNextState(withMany, draft => {
adapter.updateMany(draft, [
{ id: TheGreatGatsby.id, changes: firstChange },
{ id: AClockworkOrange.id, changes: secondChange }
{ id: TheHobbit.id, changes: firstChange },
{ id: TheGreatGatsby.id, changes: secondChange },
{ id: AClockworkOrange.id, changes: thirdChange },
{ id: TheHobbit.id, changes: fourthChange }
])

@@ -485,6 +494,11 @@ })

"id": "aco",
"title": "Second Change",
"title": "Third Change",
},
"tgg": Object {
"id": "tgg",
"title": "Second Change",
},
"th": Object {
"author": "Fourth Change",
"id": "th",
"title": "First Change",

@@ -496,2 +510,3 @@ },

"aco",
"th",
],

@@ -498,0 +513,0 @@ }

@@ -19,3 +19,3 @@ import {

function addOneMutably(entity: T, state: EntityState<T>): void {
function addOneMutably(entity: T, state: R): void {
const key = selectIdValue(entity, selectId)

@@ -112,6 +112,11 @@

updatesPerEntity[update.id] = {
id: update.id,
// Spreads ignore falsy values, so this works even if there isn't
// an existing update already at this key
...updatesPerEntity[update.id],
...update
changes: {
...(updatesPerEntity[update.id]
? updatesPerEntity[update.id].changes
: null),
...update.changes
}
}

@@ -118,0 +123,0 @@ }

@@ -1,4 +0,3 @@

import { AnyAction } from 'redux'
import { getDefaultMiddleware } from './getDefaultMiddleware'
import { configureStore } from './configureStore'
import { AnyAction, Middleware } from 'redux'
import { getDefaultMiddleware, MiddlewareArray, configureStore } from '.'
import thunk, { ThunkAction } from 'redux-thunk'

@@ -119,1 +118,118 @@

})
describe('MiddlewareArray functionality', () => {
const middleware1: Middleware = () => next => action => next(action)
const middleware2: Middleware = () => next => action => next(action)
const defaultMiddleware = getDefaultMiddleware()
const originalDefaultMiddleware = [...defaultMiddleware]
test('allows to prepend a single value', () => {
const prepended = defaultMiddleware.prepend(middleware1)
// value is prepended
expect(prepended).toEqual([middleware1, ...defaultMiddleware])
// returned value is of correct type
expect(prepended).toBeInstanceOf(MiddlewareArray)
// prepended is a new array
expect(prepended).not.toEqual(defaultMiddleware)
// defaultMiddleware is not modified
expect(defaultMiddleware).toEqual(originalDefaultMiddleware)
})
test('allows to prepend multiple values (array as first argument)', () => {
const prepended = defaultMiddleware.prepend([middleware1, middleware2])
// value is prepended
expect(prepended).toEqual([middleware1, middleware2, ...defaultMiddleware])
// returned value is of correct type
expect(prepended).toBeInstanceOf(MiddlewareArray)
// prepended is a new array
expect(prepended).not.toEqual(defaultMiddleware)
// defaultMiddleware is not modified
expect(defaultMiddleware).toEqual(originalDefaultMiddleware)
})
test('allows to prepend multiple values (rest)', () => {
const prepended = defaultMiddleware.prepend(middleware1, middleware2)
// value is prepended
expect(prepended).toEqual([middleware1, middleware2, ...defaultMiddleware])
// returned value is of correct type
expect(prepended).toBeInstanceOf(MiddlewareArray)
// prepended is a new array
expect(prepended).not.toEqual(defaultMiddleware)
// defaultMiddleware is not modified
expect(defaultMiddleware).toEqual(originalDefaultMiddleware)
})
test('allows to concat a single value', () => {
const concatenated = defaultMiddleware.concat(middleware1)
// value is concatenated
expect(concatenated).toEqual([...defaultMiddleware, middleware1])
// returned value is of correct type
expect(concatenated).toBeInstanceOf(MiddlewareArray)
// concatenated is a new array
expect(concatenated).not.toEqual(defaultMiddleware)
// defaultMiddleware is not modified
expect(defaultMiddleware).toEqual(originalDefaultMiddleware)
})
test('allows to concat multiple values (array as first argument)', () => {
const concatenated = defaultMiddleware.concat([middleware1, middleware2])
// value is concatenated
expect(concatenated).toEqual([
...defaultMiddleware,
middleware1,
middleware2
])
// returned value is of correct type
expect(concatenated).toBeInstanceOf(MiddlewareArray)
// concatenated is a new array
expect(concatenated).not.toEqual(defaultMiddleware)
// defaultMiddleware is not modified
expect(defaultMiddleware).toEqual(originalDefaultMiddleware)
})
test('allows to concat multiple values (rest)', () => {
const concatenated = defaultMiddleware.concat(middleware1, middleware2)
// value is concatenated
expect(concatenated).toEqual([
...defaultMiddleware,
middleware1,
middleware2
])
// returned value is of correct type
expect(concatenated).toBeInstanceOf(MiddlewareArray)
// concatenated is a new array
expect(concatenated).not.toEqual(defaultMiddleware)
// defaultMiddleware is not modified
expect(defaultMiddleware).toEqual(originalDefaultMiddleware)
})
test('allows to concat and then prepend', () => {
const concatenated = defaultMiddleware
.concat(middleware1)
.prepend(middleware2)
expect(concatenated).toEqual([
middleware2,
...defaultMiddleware,
middleware1
])
})
test('allows to prepend and then concat', () => {
const concatenated = defaultMiddleware
.prepend(middleware2)
.concat(middleware1)
expect(concatenated).toEqual([
middleware2,
...defaultMiddleware,
middleware1
])
})
})

@@ -14,2 +14,3 @@ import { Middleware, AnyAction } from 'redux'

} from './serializableStateInvariantMiddleware'
import { MiddlewareArray } from './utils'

@@ -43,2 +44,20 @@ function isBoolean(x: any): x is boolean {

export type CurriedGetDefaultMiddleware<S = any> = <
O extends Partial<GetDefaultMiddlewareOptions> = {
thunk: true
immutableCheck: true
serializableCheck: true
}
>(
options?: O
) => MiddlewareArray<Middleware<{}, S> | ThunkMiddlewareFor<S, O>>
export function curryGetDefaultMiddleware<
S = any
>(): CurriedGetDefaultMiddleware<S> {
return function curriedGetDefaultMiddleware(options) {
return getDefaultMiddleware(options)
}
}
/**

@@ -60,3 +79,5 @@ * Returns any array containing the default middleware installed by

}
>(options: O = {} as O): Array<Middleware<{}, S> | ThunkMiddlewareFor<S, O>> {
>(
options: O = {} as O
): MiddlewareArray<Middleware<{}, S> | ThunkMiddlewareFor<S, O>> {
const {

@@ -68,3 +89,3 @@ thunk = true,

let middlewareArray: Middleware<{}, S>[] = []
let middlewareArray: Middleware<{}, S>[] = new MiddlewareArray()

@@ -71,0 +92,0 @@ if (thunk) {

@@ -187,6 +187,19 @@ import { Middleware } from 'redux'

export interface ImmutableStateInvariantMiddlewareOptions {
/**
Callback function to check if a value is considered to be immutable.
This function is applied recursively to every value contained in the state.
The default implementation will return true for primitive types
(like numbers, strings, booleans, null and undefined).
*/
isImmutable?: IsImmutableFunc
/**
An array of dot-separated path strings that match named nodes from
the root state to ignore when checking for immutability.
Defaults to undefined
*/
ignoredPaths?: string[]
/** Print a warning if checks take longer than N ms. Default: 32ms */
warnAfter?: number
ignore?: string[] // @deprecated. Use ignoredPaths
// @deprecated. Use ignoredPaths
ignore?: string[]
}

@@ -246,3 +259,3 @@

'.'
)}'. This may cause incorrect behavior. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)`
)}'. This may cause incorrect behavior. (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)`
)

@@ -269,3 +282,3 @@ })

action
)}. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)`
)}. (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)`
)

@@ -272,0 +285,0 @@ })

import { enableES5 } from 'immer'
export * from 'redux'
export { default as createNextState, Draft } from 'immer'
export { default as createNextState, Draft, current } from 'immer'
export {

@@ -84,2 +84,3 @@ createSelector,

} from './mapBuilders'
export { MiddlewareArray } from './utils'

@@ -100,2 +101,3 @@ export { createEntityAdapter } from './entities/create_adapter'

export {
AsyncThunk,
AsyncThunkAction,

@@ -102,0 +104,0 @@ AsyncThunkPayloadCreatorReturnValue,

@@ -1,3 +0,8 @@

import { Action } from 'redux'
import { CaseReducer, CaseReducers } from './createReducer'
import { Action, AnyAction } from 'redux'
import {
CaseReducer,
CaseReducers,
ActionMatcher,
ActionMatcherDescriptionCollection
} from './createReducer'

@@ -33,2 +38,22 @@ export interface TypedActionCreator<Type extends string> {

): ActionReducerMapBuilder<State>
/**
* Adds a reducer for all actions, using `matcher` as a filter function.
* If multiple matcher reducers match, all of them will be executed in the order
* they were defined if - even if a case reducer already matched.
* @param matcher A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates)
* function
* @param reducer
*/
addMatcher<A extends AnyAction>(
matcher: ActionMatcher<A>,
reducer: CaseReducer<State, A>
): Omit<ActionReducerMapBuilder<State>, 'addCase'>
/**
* Adds a "default case" reducer that is executed if no case reducer and no matcher
* reducer was executed for this action.
* @param reducer
*/
addDefaultCase(reducer: CaseReducer<State, AnyAction>): {}
}

@@ -38,4 +63,10 @@

builderCallback: (builder: ActionReducerMapBuilder<S>) => void
): CaseReducers<S, any> {
): [
CaseReducers<S, any>,
ActionMatcherDescriptionCollection<S>,
CaseReducer<S, AnyAction> | undefined
] {
const actionsMap: CaseReducers<S, any> = {}
const actionMatchers: ActionMatcherDescriptionCollection<S> = []
let defaultCaseReducer: CaseReducer<S, AnyAction> | undefined
const builder = {

@@ -46,2 +77,19 @@ addCase(

) {
if (process.env.NODE_ENV !== 'production') {
/*
to keep the definition by the user in line with actual behavior,
we enforce `addCase` to always be called before calling `addMatcher`
as matching cases take precedence over matchers
*/
if (actionMatchers.length > 0) {
throw new Error(
'`builder.addCase` should only be called before calling `builder.addMatcher`'
)
}
if (defaultCaseReducer) {
throw new Error(
'`builder.addCase` should only be called before calling `builder.addDefaultCase`'
)
}
}
const type =

@@ -58,6 +106,29 @@ typeof typeOrActionCreator === 'string'

return builder
},
addMatcher<A extends AnyAction>(
matcher: ActionMatcher<A>,
reducer: CaseReducer<S, A>
) {
if (process.env.NODE_ENV !== 'production') {
if (defaultCaseReducer) {
throw new Error(
'`builder.addMatcher` should only be called before calling `builder.addDefaultCase`'
)
}
}
actionMatchers.push({ matcher, reducer })
return builder
},
addDefaultCase(reducer: CaseReducer<S, AnyAction>) {
if (process.env.NODE_ENV !== 'production') {
if (defaultCaseReducer) {
throw new Error('`builder.addDefaultCase` can only be called once')
}
}
defaultCaseReducer = reducer
return builder
}
}
builderCallback(builder)
return actionsMap
return [actionsMap, actionMatchers, defaultCaseReducer]
}

@@ -114,3 +114,4 @@ import { Reducer } from 'redux'

}
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)"
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)"
`)

@@ -367,3 +368,4 @@ })

}
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)"
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)"
`)

@@ -370,0 +372,0 @@ })

@@ -110,3 +110,4 @@ import isPlainObject from './isPlainObject'

/**
* An array of action types to ignore when checking for serializability, Defaults to []
* An array of action types to ignore when checking for serializability.
* Defaults to []
*/

@@ -116,3 +117,4 @@ ignoredActions?: string[]

/**
* An array of dot-separated path strings to ignore when checking for serializability, Defaults to ['meta.arg']
* An array of dot-separated path strings to ignore when checking
* for serializability, Defaults to ['meta.arg']
*/

@@ -122,7 +124,10 @@ ignoredActionPaths?: string[]

/**
* An array of dot-separated path strings to ignore when checking for serializability, Defaults to []
* An array of dot-separated path strings to ignore when checking
* for serializability, Defaults to []
*/
ignoredPaths?: string[]
/**
* Execution time warning threshold. If the middleware takes longer than `warnAfter` ms, a warning will be displayed in the console. Defaults to 32
* Execution time warning threshold. If the middleware takes longer
* than `warnAfter` ms, a warning will be displayed in the console.
* Defaults to 32ms.
*/

@@ -182,3 +187,4 @@ warnAfter?: number

action,
'\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)'
'\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)',
'\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)'
)

@@ -185,0 +191,0 @@ }

@@ -93,2 +93,11 @@ import { Middleware } from 'redux'

/**
* Helper type. Passes T out again, but boxes it in a way that it cannot
* "widen" the type by accident if it is a generic that should be inferred
* from elsewhere.
*
* @internal
*/
export type NoInfer<T> = [T][T extends any ? 0 : never]
export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>

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

import { Middleware } from 'redux'
export function getTimeMeasureUtils(maxDelay: number, fnName: string) {

@@ -22,1 +24,35 @@ let elapsed = 0

}
/**
* @public
*/
export class MiddlewareArray<
Middlewares extends Middleware<any, any>
> extends Array<Middlewares> {
concat<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(
items: AdditionalMiddlewares
): MiddlewareArray<Middlewares | AdditionalMiddlewares[number]>
concat<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(
...items: AdditionalMiddlewares
): MiddlewareArray<Middlewares | AdditionalMiddlewares[number]>
concat(...arr: any[]) {
return new MiddlewareArray(...super.concat(...arr))
}
prepend<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(
items: AdditionalMiddlewares
): MiddlewareArray<AdditionalMiddlewares[number] | Middlewares>
prepend<AdditionalMiddlewares extends ReadonlyArray<Middleware<any, any>>>(
...items: AdditionalMiddlewares
): MiddlewareArray<AdditionalMiddlewares[number] | Middlewares>
prepend(...arr: any[]) {
if (arr.length === 1 && Array.isArray(arr[0])) {
return new MiddlewareArray(...arr[0].concat(this))
}
return new MiddlewareArray(...arr.concat(this))
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc