"use strict";function n(n){return null==n}function t(n){throw new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function o(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function i(n){return"string"==typeof n||"symbol"==typeof n}function u(n){return!i(n)}function a(n){throw new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function c(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function s(r,o,i,a){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:o,meta:i,error:a}}function f(r,e){n(r)&&t(1),u(r)&&a(1);return Object.assign((function(){var n=null!=e?e.apply(void 0,arguments):void 0;return Object.assign({type:r},n)}),{getType:function(){return r},toString:function(){return r}})}function y(r,e,o){return n(r)&&t(1),u(r)&&a(1),function(){return f(r,(function(){var n=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1];return null==e&&null==o||(n=null!=e?e.apply(void 0,arguments):void 0,t=null!=o?o.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==t&&{meta:t})}))}}function l(o){return n(o)&&t(1),r(o)||e(1),o.getType()}function p(r,e){n(r)&&t(1),u(r)&&a(1);var o=null!=e?e(r):function(){return{type:r}};return Object.assign(o,{getType:function(){return r},toString:function(){return r}})}var d={createAction:function(n,t){var r=null==t?function(){return s(n)}:t(s.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})},createCustomAction:p,createStandardAction:function(r){return n(r)&&t(1),u(r)&&a(1),Object.assign((function(){return p(r,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(n){return p(r,(function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}}))}})}};exports.action=s,exports.createAction=y,exports.createAsyncAction=function(n,t,r,e){return function(){var o=[n,t,r,e].map((function(n,t){return Array.isArray(n)?y(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?y(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:o[0],success:o[1],failure:o[2],cancel:o[3]}}},exports.createCustomAction=f,exports.createReducer=function n(t,e){void 0===e&&(e={});var o=Object.assign({},e),u=function(e,u){var a=Array.isArray(e)?e:[e],c={};return a.map((function(n,t){return r(n)?l(n):i(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return c[n]=u})),n(t,Object.assign({},o,{},c))};return Object.assign((function(n,r){if(void 0===n&&(n=t),o.hasOwnProperty(r.type)){var e=o[r.type];if("function"!=typeof e)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return e(n,r)}return n}),{handlers:Object.assign({},o),handleAction:u,handleType:u})},exports.deprecated=d,exports.getType=l,exports.isActionOf=function(r,e){n(r)&&t(1);var i=Array.isArray(r)?r:[r];i.forEach(o);var u=function(n){return i.some((function(t){return n.type===t.getType()}))};return void 0===e?u:u(e)},exports.isOfType=function(r,e){n(r)&&t(1);var o=Array.isArray(r)?r:[r];o.forEach(c);var i=function(n){return o.includes(n.type)};return void 0===e?i:i(e)};
//# sourceMappingURL=typesafe-actions.cjs.production.js.map
