"use strict";

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 _modal = require("../../../../../actions/modal");

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

var _constants = require("@instructure/quiz-common/lib/constants");

var mapStateToProps = function mapStateToProps(state) {
  var _state$getIn$toJS = state.getIn(['modal', _constants.OPEN_ADD_CONTENT_MODAL_DATA], (0, _immutable.Map)()).toJS(),
      allowStimulusCreation = _state$getIn$toJS.allowStimulusCreation,
      parentEntryId = _state$getIn$toJS.parentEntryId,
      position = _state$getIn$toJS.position,
      quizId = _state$getIn$toJS.quizId,
      stimulusId = _state$getIn$toJS.stimulusId;

  var modalOpen = state.getIn(['modal', 'isOpen']) === _constants.ADD_CONTENT_MODAL;

  return {
    allowStimulusCreation: allowStimulusCreation,
    modalOpen: modalOpen,
    parentEntryId: parentEntryId,
    position: position,
    quizId: quizId,
    stimulusId: stimulusId
  };
};

var mapDispatchToProps = {
  closeModal: _modal.closeModal
};

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

exports.default = _default;