"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getResponseByPosition = exports.getIsTaking = exports.getTimerData = exports.getBrowserSessionId = exports.getCurrentSessionItemPosition = void 0;

var _immutable = require("immutable");

var path = 'taking';

var getCurrentSessionItemPosition = function getCurrentSessionItemPosition(state) {
  return state.getIn([path, 'currentSessionItemPosition'], 1);
};

exports.getCurrentSessionItemPosition = getCurrentSessionItemPosition;

var getBrowserSessionId = function getBrowserSessionId(state) {
  return state.getIn([path, 'browserSessionId']);
};

exports.getBrowserSessionId = getBrowserSessionId;

var getTimerData = function getTimerData(state) {
  return state.getIn([path, 'timerData'], (0, _immutable.Map)());
};

exports.getTimerData = getTimerData;

var getIsTaking = function getIsTaking(state) {
  return state.getIn([path, 'isTaking']);
};

exports.getIsTaking = getIsTaking;

var getResponseByPosition = function getResponseByPosition(state, position) {
  return getResponses(state).find(function (response) {
    return response.get('position') === position;
  }) || (0, _immutable.Map)();
}; // Helpers


exports.getResponseByPosition = getResponseByPosition;

var getResponses = function getResponses(state) {
  return state.getIn([path, 'responses'], (0, _immutable.List)());
};