"use strict";

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

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

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

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

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

function mapStateToProps(state, props) {
  var entry = props.entry,
      quizEntry = props.quizEntry,
      workingQuizEntry = props.workingQuizEntry;
  var workingEntry;

  if (quizEntry.isItem || quizEntry.isBankEntry) {
    workingEntry = workingQuizEntry.getItem();
  } else {
    // This component is repurposed in RegradingOverride where we're editing a
    // quiz entry that doesn't have a specific item. For that case we expect
    // Bank quizEntry with Item entry.
    workingEntry = entry.getWorkingInstance();
  }

  return {
    workingEntry: workingEntry
  };
}

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

exports.default = _default;