"use strict";

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

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

var _redux = require("redux");

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

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

var _scrolling = require("../../../../actions/scrolling");

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-common/lib/format-message"));

var _default_de_number = Intl.NumberFormat("de", { style: "decimal" }).format;

var mapStateToProps = function mapStateToProps(state, props) {
  var displayPosition = props.quizEntry ? props.quizEntry.positionToDisplay(props.position) : _default_de_number(props.position);
  return {
    displayPosition: displayPosition
  };
};

exports.mapStateToProps = mapStateToProps;

var mapDispatchToProps = function mapDispatchToProps(dispatch, props) {
  return {
    scrollToItem: props.scrollToItem || (0, _redux.bindActionCreators)(_scrolling.scrollToItem, dispatch)
  };
};

exports.mapDispatchToProps = mapDispatchToProps;

var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.default);

exports.default = _default;