"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _immutable = require("immutable");

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

var _presenter = _interopRequireDefault(require("./presenter"));

var _ui = require("../../../actions/ui");

function mapStateToProps(state, props) {
  var pageData = state.getIn(['ui', props.stateKey], (0, _immutable.Map)());
  var totalPages = pageData.get('total', 0);
  var currentPage = pageData.get('current', 1);
  var contents = pageData.get('contents', (0, _immutable.Map)());
  return {
    totalPages: totalPages,
    currentPage: currentPage,
    contents: contents
  };
}

var _default = (0, _reactRedux.connect)(mapStateToProps, {
  merge: _ui.merge,
  set: _ui.set
})(_presenter.default);

exports.default = _default;