"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 _presenter = _interopRequireDefault(require("./presenter"));

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

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

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

var _itemAnalyses = require("../../../../reporting/api/itemAnalyses");

var _quizAnalyses = require("../../../../reporting/api/quizAnalyses");

var _reporting = require("../../../../common/actions/reporting");

function mapStateToProps(state, props) {
  var helper = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _stateHelper.default;
  return {
    openRows: state.getIn(['reporting', 'item_analysis_row_open'], (0, _immutable.Map)()).toJS(),
    quizAnalysisNotFound: state.getIn(['reporting', 'quiz_analysis', props.activeQuizId, 'notFound'], false),
    quiz: helper.activeQuiz(),
    quizAnalysis: helper.activeQuiz().getQuizAnalysis(),
    outcomesEndpoint: state.getIn(['outcomes', 'outcomesEndpoint']),
    outcomesToken: state.getIn(['outcomes', 'outcomesToken'])
  };
}

var _default = (0, _reactRedux.connect)(mapStateToProps, {
  getExistingQuiz: _quizzes.getExistingQuiz,
  getItemAnalyses: _itemAnalyses.getItemAnalyses,
  getQuizAnalysis: _quizAnalyses.getQuizAnalysis,
  toggleItemAnalysisRowExpanded: _reporting.toggleItemAnalysisRowExpanded
})(_presenter.default);

exports.default = _default;