"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _reactRedux = require("react-redux");

var _component = _interopRequireDefault(require("./component"));

var _actions = require("./actions");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var mapStateToProps = function mapStateToProps(_ref) {
  var undosReducer = _ref.undos;
  var undos = undosReducer.undos;
  return {
    undos: undos
  };
};

var mergeProps = function mergeProps(state, _ref2) {
  var dispatch = _ref2.dispatch;
  return _objectSpread({}, state, {
    onRemove: function onRemove(_ref3) {
      var id = _ref3.id;
      dispatch((0, _actions.removeUndo)({
        id: id
      }));
    },
    onUndo: function onUndo(_ref4) {
      var undoCall = _ref4.undoCall,
          params = _ref4.params;
      dispatch(undoCall(_objectSpread({}, params)));
    }
  });
};

var _default = (0, _reactRedux.connect)(mapStateToProps, undefined, mergeProps)(_component.default);

exports.default = _default;