UNPKG

17.9 kBJavaScriptView Raw
1var e,t=this&&this.__extends||(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=this&&this.__generator||function(e,t){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!((i=(i=u.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=t.call(e,u)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},r=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},i=Object.create,o=Object.defineProperty,u=Object.defineProperties,a=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,s=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,v=function(e,t,n){return t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},y=function(e,t){for(var n in t||(t={}))d.call(t,n)&&v(e,n,t[n]);if(l)for(var r=0,i=l(t);r<i.length;r++)p.call(t,n=i[r])&&v(e,n,t[n]);return e},h=function(e,t){return u(e,c(t))},g=function(e){return o(e,"__esModule",{value:!0})},m=function(e,t,n){if(t&&"object"==typeof t||"function"==typeof t)for(var r=function(r){d.call(e,r)||"default"===r||o(e,r,{get:function(){return t[r]},enumerable:!(n=a(t,r))||n.enumerable})},i=0,u=f(t);i<u.length;i++)r(u[i]);return e},b=function(e){return m(g(o(null!=e?i(s(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};g(exports),function(e,t){for(var n in t)o(e,n,{get:t[n],enumerable:!0})}(exports,{MiddlewareArray:function(){return M},configureStore:function(){return N},createAction:function(){return z},createAsyncThunk:function(){return ie},createDraftSafeSelector:function(){return _},createEntityAdapter:function(){return Z},createImmutableStateInvariantMiddleware:function(){return R},createNextState:function(){return w.default},createReducer:function(){return B},createSelector:function(){return j.createSelector},createSerializableStateInvariantMiddleware:function(){return T},createSlice:function(){return F},current:function(){return w.current},findNonSerializableValue:function(){return C},freeze:function(){return w.freeze},getDefaultMiddleware:function(){return V},getType:function(){return W},isAllOf:function(){return ce},isAnyOf:function(){return ae},isAsyncThunkAction:function(){return ye},isDraft:function(){return w.isDraft},isFulfilled:function(){return ve},isImmutableDefault:function(){return D},isPending:function(){return se},isPlain:function(){return k},isPlainObject:function(){return q},isRejected:function(){return de},isRejectedWithValue:function(){return pe},miniSerializeError:function(){return re},nanoid:function(){return $},original:function(){return w.original},unwrapResult:function(){return oe}});var O=b(require("immer"));m(exports,b(require("redux")));var w=b(require("immer")),j=b(require("reselect")),E=b(require("immer")),S=b(require("reselect")),_=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=S.createSelector.apply(void 0,e),i=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return n.apply(void 0,r([(0,E.isDraft)(e)?(0,E.current)(e):e],t))};return i},A=b(require("redux")),P=b(require("redux")),x="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?P.compose:P.compose.apply(null,arguments)};function q(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}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window;var I=b(require("redux-thunk")),M=function(e){function n(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=e.apply(this,t)||this;return Object.setPrototypeOf(i,n.prototype),i}return t(n,e),Object.defineProperty(n,Symbol.species,{get:function(){return n},enumerable:!1,configurable:!0}),n.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},n.prototype.prepend=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length&&Array.isArray(e[0])?new(n.bind.apply(n,r([void 0],e[0].concat(this)))):new(n.bind.apply(n,r([void 0],e.concat(this))))},n}(Array);function D(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function R(e){return void 0===e&&(e={}),function(){return function(e){return function(t){return e(t)}}}}function k(e){var t=typeof e;return"undefined"===t||null===e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||q(e)}function C(e,t,n,r,i){var o;if(void 0===t&&(t=""),void 0===n&&(n=k),void 0===i&&(i=[]),!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;for(var u=null!=r?r(e):Object.entries(e),a=i.length>0,c=0,f=u;c<f.length;c++){var l=f[c],s=l[0],d=l[1],p=t?t+"."+s:s;if(!(a&&i.indexOf(p)>=0)){if(!n(d))return{keyPath:p,value:d};if("object"==typeof d&&(o=C(d,p,n,r,i)))return o}}return!1}function T(e){return void 0===e&&(e={}),function(){return function(e){return function(t){return e(t)}}}}function V(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=new M;return n&&r.push("boolean"==typeof n?I.default:I.default.withExtraArgument(n.extraArgument)),r}function N(e){var t,n=function(e){return V(e)},i=e||{},o=i.reducer,u=void 0===o?void 0:o,a=i.middleware,c=void 0===a?n():a,f=i.devTools,l=void 0===f||f,s=i.preloadedState,d=void 0===s?void 0:s,p=i.enhancers,v=void 0===p?void 0:p;if("function"==typeof u)t=u;else{if(!q(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=(0,A.combineReducers)(u)}var h=c;"function"==typeof h&&(h=h(n));var g=A.applyMiddleware.apply(void 0,h),m=A.compose;l&&(m=x(y({trace:!1},"object"==typeof l&&l)));var b=[g];Array.isArray(v)?b=r([g],v):"function"==typeof v&&(b=v(b));var O=m.apply(void 0,b);return(0,A.createStore)(t,d,O)}function z(e,t){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return y(y({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function L(e){return["type","payload","error","meta"].indexOf(e)>-1}function W(e){return""+e}var X=b(require("immer"));function U(e){var t,n={},r=[],i={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(r in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[r]=t,i},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,r,t]}function B(e,t,n,i){void 0===n&&(n=[]);var o="function"==typeof t?U(t):[t,n,i],u=o[0],a=o[1],c=o[2],f=(0,X.default)(e,(function(){}));return function(e,t){void 0===e&&(e=f);var n=r([u[t.type]],a.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){var r;if((0,X.isDraft)(e))return void 0===(r=n(e,t))?e:r;if((0,X.isDraftable)(e))return(0,X.default)(e,(function(e){return n(e,t)}));if(void 0===(r=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e}),e)}}function F(e){var t=e.name,n=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var r=e.reducers||{},i="function"==typeof e.extraReducers?U(e.extraReducers):[e.extraReducers],o=i[0],u=void 0===o?{}:o,a=i[1],c=void 0===a?[]:a,f=i[2],l=void 0===f?void 0:f,s=Object.keys(r),d={},p={},v={};s.forEach((function(e){var n,i,o=r[e],u=t+"/"+e;"reducer"in o?(n=o.reducer,i=o.prepare):n=o,d[e]=n,p[u]=n,v[e]=i?z(u,i):z(u)}));var h=B(n,y(y({},u),p),c,l);return{name:t,reducer:h,actions:v,caseReducers:d}}var G=b(require("immer"));function H(e){return function(t,n){var r=function(t){var r;q(r=n)&&"string"==typeof r.type&&Object.keys(r).every(L)?e(n.payload,t):e(n,t)};return(0,G.isDraft)(t)?(r(t),t):(0,G.default)(t,r)}}function J(e,t){return t(e)}function K(e){return Array.isArray(e)||(e=Object.values(e)),e}function Q(e,t,n){for(var r=[],i=[],o=0,u=e=K(e);o<u.length;o++){var a=u[o],c=J(a,t);c in n.entities?i.push({id:c,changes:a}):r.push(a)}return[r,i]}function Y(e){function t(t,n){var r=J(t,e);r in n.entities||(n.ids.push(r),n.entities[r]=t)}function n(e,n){for(var r=0,i=e=K(e);r<i.length;r++)t(i[r],n)}function r(t,n){var r=J(t,e);r in n.entities||n.ids.push(r),n.entities[r]=t}function i(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={},i={};t.forEach((function(e){e.id in n.entities&&(i[e.id]={id:e.id,changes:y(y({},i[e.id]?i[e.id].changes:null),e.changes)})})),(t=Object.values(i)).length>0&&t.filter((function(t){return function(t,n,r){var i=Object.assign({},r.entities[n.id],n.changes),o=J(i,e),u=o!==n.id;return u&&(t[n.id]=o,delete r.entities[n.id]),r.entities[o]=i,u}(r,t,n)})).length>0&&(n.ids=n.ids.map((function(e){return r[e]||e})))}function u(t,r){var i=Q(t,e,r),u=i[0];o(i[1],r),n(u,r)}return{removeAll:(a=function(e){Object.assign(e,{ids:[],entities:{}})},c=H((function(e,t){return a(t)})),function(e){return c(e,void 0)}),addOne:H(t),addMany:H(n),setOne:H(r),setMany:H((function(e,t){for(var n=0,i=e=K(e);n<i.length;n++)r(i[n],t)})),setAll:H((function(e,t){e=K(e),t.ids=[],t.entities={},n(e,t)})),updateOne:H((function(e,t){return o([e],t)})),updateMany:H(o),upsertOne:H((function(e,t){return u([e],t)})),upsertMany:H(u),removeOne:H((function(e,t){return i([e],t)})),removeMany:H(i)};var a,c}function Z(e){void 0===e&&(e={});var t=y({sortComparer:!1,selectId:function(e){return e.id}},e),n=t.selectId,r=t.sortComparer,i={getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},o={getSelectors:function(e){var t=function(e){return e.ids},n=function(e){return e.entities},r=_(t,n,(function(e,t){return e.map((function(e){return t[e]}))})),i=function(e,t){return t},o=function(e,t){return e[t]},u=_(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:n,selectAll:r,selectTotal:u,selectById:_(n,i,o)};var a=_(e,n);return{selectIds:_(e,t),selectEntities:a,selectAll:_(e,r),selectTotal:_(e,u),selectById:_(a,i,o)}}},u=r?function(e,t){var n=Y(e);function r(t,n){var r=(t=K(t)).filter((function(t){return!(J(t,e)in n.entities)}));0!==r.length&&a(r,n)}function i(e,t){0!==(e=K(e)).length&&a(e,t)}function o(t,n){var r=[];t.forEach((function(t){return function(t,n,r){if(!(n.id in r.entities))return!1;var i=Object.assign({},r.entities[n.id],n.changes),o=J(i,e);return delete r.entities[n.id],t.push(i),o!==n.id}(r,t,n)})),0!==r.length&&a(r,n)}function u(t,n){var i=Q(t,e,n),u=i[0];o(i[1],n),r(u,n)}function a(n,r){n.forEach((function(t){r.entities[e(t)]=t}));var i=Object.values(r.entities);i.sort(t);var o=i.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,o)||(r.ids=o)}return{removeOne:n.removeOne,removeMany:n.removeMany,removeAll:n.removeAll,addOne:H((function(e,t){return r([e],t)})),updateOne:H((function(e,t){return o([e],t)})),upsertOne:H((function(e,t){return u([e],t)})),setOne:H((function(e,t){return i([e],t)})),setMany:H(i),setAll:H((function(e,t){e=K(e),t.entities={},t.ids=[],r(e,t)})),addMany:H(r),updateMany:H(o),upsertMany:H(u)}}(n,r):Y(n);return y(y(y({selectId:n,sortComparer:r},i),o),u)}var $=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},ee=["name","message","stack","code"],te=function(e,t){this.payload=e,this.meta=t},ne=function(e,t){this.payload=e,this.meta=t},re=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,r=ee;n<r.length;n++){var i=r[n];"string"==typeof e[i]&&(t[i]=e[i])}return t}return{message:String(e)}};function ie(e,t,r){var i=z(e+"/fulfilled",(function(e,t,n,r){return{payload:e,meta:h(y({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}})),o=z(e+"/pending",(function(e,t,n){return{payload:void 0,meta:h(y({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),u=z(e+"/rejected",(function(e,t,n,i,o){return{payload:i,error:(r&&r.serializeError||re)(e||"Rejected"),meta:h(y({},o||{}),{arg:n,requestId:t,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),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(c,f,l){var s,d,p=(null!=(s=null==r?void 0:r.idGenerator)?s:$)(),v=new a,y=new Promise((function(e,t){return v.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:d||"Aborted"})}))})),h=!1,g=function(){return a=this,s=function(){var a,s,d;return n(this,(function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),r&&r.condition&&!1===r.condition(e,{getState:f,extra:l}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return h=!0,c(o(p,e,null==(a=null==r?void 0:r.getPendingMeta)?void 0:a.call(r,{requestId:p,arg:e},{getState:f,extra:l}))),[4,Promise.race([y,Promise.resolve(t(e,{dispatch:c,getState:f,extra:l,requestId:p,signal:v.signal,rejectWithValue:function(e,t){return new te(e,t)},fulfillWithValue:function(e,t){return new ne(e,t)}})).then((function(t){if(t instanceof te)throw t;return t instanceof ne?i(t.payload,p,e,t.meta):i(t,p,e)}))])];case 1:return s=n.sent(),[3,3];case 2:return d=n.sent(),s=d instanceof te?u(null,p,e,d.payload,d.meta):u(d,p,e),[3,3];case 3:return r&&!r.dispatchConditionRejection&&u.match(s)&&s.meta.condition||c(s),[2,s]}}))},new Promise((function(e,t){var n=function(e){try{i(s.next(e))}catch(e){t(e)}},r=function(e){try{i(s.throw(e))}catch(e){t(e)}},i=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,r)};i((s=s.apply(a,null)).next())}));var a,s}();return Object.assign(g,{abort:function(e){h&&(d=e,v.abort())},requestId:p,arg:e,unwrap:function(){return g.then(oe)}})}}),{pending:o,rejected:u,fulfilled:i,typePrefix:e})}function oe(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var ue=function(e,t){return(n=e)&&"function"==typeof n.match?e.match(t):e(t);var n};function ae(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return e.some((function(e){return ue(e,t)}))}}function ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return e.every((function(e){return ue(e,t)}))}}function fe(e,t){if(!e||!e.meta)return!1;var n="string"==typeof e.meta.requestId,r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function le(e){return"function"==typeof e[0]&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function se(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?function(e){return fe(e,["pending"])}:le(e)?function(t){var n=e.map((function(e){return e.pending}));return ae.apply(void 0,n)(t)}:se()(e[0])}function de(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?function(e){return fe(e,["rejected"])}:le(e)?function(t){var n=e.map((function(e){return e.rejected}));return ae.apply(void 0,n)(t)}:de()(e[0])}function pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return e&&e.meta&&e.meta.rejectedWithValue};return 0===e.length||le(e)?function(t){return ce(de.apply(void 0,e),n)(t)}:pe()(e[0])}function ve(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?function(e){return fe(e,["fulfilled"])}:le(e)?function(t){var n=e.map((function(e){return e.fulfilled}));return ae.apply(void 0,n)(t)}:ve()(e[0])}function ye(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?function(e){return fe(e,["pending","fulfilled","rejected"])}:le(e)?function(t){for(var n=[],r=0,i=e;r<i.length;r++){var o=i[r];n.push(o.pending,o.rejected,o.fulfilled)}return ae.apply(void 0,n)(t)}:ye()(e[0])}(0,O.enableES5)();
2//# sourceMappingURL=redux-toolkit.cjs.production.min.js.map
\No newline at end of file