'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = function () {
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
  var _ref = arguments[1];
  var type = _ref.type,
      payload = _ref.payload;

  var newState = void 0;
  switch (type) {
    case 'REQUEST_PRINT':
      newState = state.willPrint ? state : (0, _objectAssign2.default)({}, state, { willPrint: true });
      break;

    case 'CANCEL_PRINT':
      newState = !state.willPrint ? state : (0, _objectAssign2.default)({}, state, { willPrint: false });
      break;

    case 'CHANGE_PAPER_SIZE':
      newState = state.paperSize === payload ? state : (0, _objectAssign2.default)({}, state, { paperSize: payload });
      break;

    default:
      newState = state;
  }
  return newState;
};

var _objectAssign = require('object-assign');

var _objectAssign2 = _interopRequireDefault(_objectAssign);

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

// The current UI state of the app
var defaultState = {
  willPrint: false,
  paperSize: navigator.language === 'en-US' ? 'letter' : 'a4'
};
//# sourceMappingURL=print.js.map