import { keys, isEmpty } from 'ramda';

var setWithoutModifyingActions = function setWithoutModifyingActions(set) {
  return function (partial) {
    return set(function (previous) {
      if (typeof partial === "function") partial = partial(previous);
      var overwrittenActions = keys(partial).filter(function (key) {
        return typeof (previous === null || previous === void 0 ? void 0 : previous[key]) === "function" && partial[key] !== previous[key];
      });
      if (!isEmpty(overwrittenActions)) {
        throw new Error("Actions should not be modified. Touched action(s): ".concat(overwrittenActions.join(", ")));
      }
      return partial;
    }, false);
  };
};
var withImmutableActions = function withImmutableActions(config) {
  return function (set, get, api) {
    return config(setWithoutModifyingActions(set), get, api);
  };
};

export { withImmutableActions as default };
//# sourceMappingURL=withImmutableActions.js.map
