"use strict";

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

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

var _GroupConditionInput = _interopRequireDefault(require("../../../components/search/input/GroupConditionInput"));

var _configHelpers = require("../../../helpers/configHelpers");

var _optionList = require("../../../actions/optionList");

var _reducers = require("../../../reducers");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const mapStateToProps = (state, ownProps) => {
  const {
    condition,
    recordType
  } = ownProps;
  const path = condition && condition.get('path');
  const groupOptions = (0, _reducers.getOptionList)(state, (0, _configHelpers.getRecordGroupOptionListName)(recordType, path));
  return {
    hasChildGroups: groupOptions && groupOptions.length > 0
  };
};

const mapDispatchToProps = {
  buildRecordFieldOptionLists: _optionList.buildRecordFieldOptionLists,
  deleteOptionList: _optionList.deleteOptionList
};

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

exports.default = _default;