"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

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

var _immutable = require("immutable");

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

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

var _makeEditable = _interopRequireDefault(require("../../../shared/functionality/makeEditable"));

var modificationActions = _interopRequireWildcard(require("../../../../actions/modifications"));

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

var _alerts = require("../../../../actions/alerts");

var _quizzes = require("../../../../../building/api/quizzes");

var _stateHelper = _interopRequireDefault(require("../../../../util/stateHelper"));

var _quizzes2 = require("../../../../selectors/quizzes");

function mapStateToProps(state, props) {
  var errorsShowing = state.get('errorsShowing', (0, _immutable.Map)());
  var errorsAreShowing = errorsShowing.get(props.guid);
  return {
    entry: props.quizEntry.getWorkingInstance().getItem(),
    errorsAreShowing: errorsAreShowing,
    oneQuestionAtATime: _stateHelper.default.isActiveQuizWorkingInstanceOneQuestionAtATime(),
    quizId: (0, _quizzes2.getActiveQuizId)(state)
  };
}

var mapDispatchToProps = {
  addError: _alerts.addError,
  changeQuizEntryProperties: modificationActions.changeQuizEntryProperties,
  interactionFileUpload: _quizzes.interactionFileUpload,
  occludeQuizEntries: _ui.occludeQuizEntries,
  screenreaderNotification: _alerts.screenreaderNotification,
  setOneQuestionAtATime: _quizzes.setOneAtATimeType
};

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

exports.default = _default;