var _createReducer;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
//./selectionLayer.js
import { createReducer } from "redux-act";
import createAction from "./utils/createMetaAction";

// ------------------------------------
// Actions
// ------------------------------------
export var addToUndoStack = createAction("ADD_TO_UNDO_STACK");
export var veUndo = createAction("VE_UNDO_META");
export var veRedo = createAction("VE_REDO_META");

// ------------------------------------
// Reducer
// ------------------------------------
export default createReducer((_createReducer = {}, _createReducer[addToUndoStack] = function (state, payload) {
  return _extends({}, state, {
    future: [],
    past: [].concat(state.past || [], [payload])
  });
}, _createReducer[veUndo] = function (state, presentState) {
  return _extends({}, state, {
    past: (state.past || []).slice(0, -1),
    future: (state.future || []).concat(presentState)
  });
}, _createReducer[veRedo] = function (state, presentState) {
  return _extends({}, state, {
    future: (state.future || []).slice(0, -1),
    past: (state.past || []).concat(presentState)
  });
}, _createReducer), {
  past: [],
  future: []
});