'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BaseSearchToRelateModal = exports.searchName = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactIntl = require('react-intl');

var _immutable = require('immutable');

var _immutable2 = _interopRequireDefault(_immutable);

var _get = require('lodash/get');

var _get2 = _interopRequireDefault(_get);

var _isEqual = require('lodash/isEqual');

var _isEqual2 = _interopRequireDefault(_isEqual);

var _cspaceLayout = require('cspace-layout');

var _CheckboxInput = require('cspace-input/lib/components/CheckboxInput');

var _CheckboxInput2 = _interopRequireDefault(_CheckboxInput);

var _SearchForm = require('./SearchForm');

var _SearchForm2 = _interopRequireDefault(_SearchForm);

var _Pager = require('./Pager');

var _Pager2 = _interopRequireDefault(_Pager);

var _BackButton = require('../navigation/BackButton');

var _BackButton2 = _interopRequireDefault(_BackButton);

var _CancelButton = require('../navigation/CancelButton');

var _CancelButton2 = _interopRequireDefault(_CancelButton);

var _RelateButton = require('../record/RelateButton');

var _RelateButton2 = _interopRequireDefault(_RelateButton);

var _SearchButton = require('./SearchButton');

var _SearchButton2 = _interopRequireDefault(_SearchButton);

var _SearchResultSummary = require('./SearchResultSummary');

var _SearchResultSummary2 = _interopRequireDefault(_SearchResultSummary);

var _SearchToRelateTitleBar = require('./SearchToRelateTitleBar');

var _SearchToRelateTitleBar2 = _interopRequireDefault(_SearchToRelateTitleBar);

var _SelectBar = require('./SelectBar');

var _SelectBar2 = _interopRequireDefault(_SelectBar);

var _SearchResultTableContainer = require('../../containers/search/SearchResultTableContainer');

var _SearchResultTableContainer2 = _interopRequireDefault(_SearchResultTableContainer);

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

var _permissionHelpers = require('../../helpers/permissionHelpers');

var _searchHelpers = require('../../helpers/searchHelpers');

var _SearchToRelateModal = require('../../../styles/cspace-ui/SearchToRelateModal.css');

var _SearchToRelateModal2 = _interopRequireDefault(_SearchToRelateModal);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var messages = (0, _reactIntl.defineMessages)({
  editSearch: {
    'id': 'searchToRelateModal.editSearch',
    'defaultMessage': 'Revise search'
  },
  label: {
    'id': 'searchToRelateModal.label',
    'defaultMessage': 'Relate'
  },
  relate: {
    'id': 'searchToRelateModal.relate',
    'defaultMessage': 'Relate selected'
  },
  relating: {
    'id': 'searchToRelateModal.relating',
    'defaultMessage': 'Relating...'
  }
});

var searchName = exports.searchName = 'searchToRelate';

var listType = 'common';
// FIXME: Make default page size configurable
var defaultPageSize = 20;

var isSingleSubject = function isSingleSubject(subjects) {
  return Array.isArray(subjects) && subjects.length === 1;
};

var propTypes = {
  allowedServiceTypes: _propTypes2.default.arrayOf(_propTypes2.default.string),
  config: _propTypes2.default.object,
  intl: _reactIntl.intlShape,
  isOpen: _propTypes2.default.bool,
  keywordValue: _propTypes2.default.string,
  defaultRecordTypeValue: _propTypes2.default.string,
  recordTypeValue: _propTypes2.default.string,
  vocabularyValue: _propTypes2.default.string,
  advancedSearchCondition: _propTypes2.default.object,
  preferredPageSize: _propTypes2.default.number,
  perms: _propTypes2.default.instanceOf(_immutable2.default.Map),
  selectedItems: _propTypes2.default.instanceOf(_immutable2.default.Map),
  subjects: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.shape({
    /* eslint-disable react/no-unused-prop-types */
    csid: _propTypes2.default.string,
    recordType: _propTypes2.default.string
    /* eslint-enable react/no-unused-prop-types */
  })), _propTypes2.default.func]),
  onAdvancedSearchConditionCommit: _propTypes2.default.func,
  onKeywordCommit: _propTypes2.default.func,
  onRecordTypeCommit: _propTypes2.default.func,
  onVocabularyCommit: _propTypes2.default.func,
  onCloseButtonClick: _propTypes2.default.func,
  onCancelButtonClick: _propTypes2.default.func,
  onItemSelectChange: _propTypes2.default.func,
  onRelationsCreated: _propTypes2.default.func,
  clearSearchResults: _propTypes2.default.func,
  createRelations: _propTypes2.default.func,
  parentSelector: _propTypes2.default.func,
  search: _propTypes2.default.func,
  setAllItemsSelected: _propTypes2.default.func,
  setPreferredPageSize: _propTypes2.default.func
};

var defaultProps = {
  selectedItems: _immutable2.default.Map()
};

var BaseSearchToRelateModal = exports.BaseSearchToRelateModal = function (_Component) {
  _inherits(BaseSearchToRelateModal, _Component);

  function BaseSearchToRelateModal() {
    _classCallCheck(this, BaseSearchToRelateModal);

    var _this = _possibleConstructorReturn(this, (BaseSearchToRelateModal.__proto__ || Object.getPrototypeOf(BaseSearchToRelateModal)).call(this));

    _this.shouldShowCheckbox = _this.shouldShowCheckbox.bind(_this);
    _this.handleAcceptButtonClick = _this.handleAcceptButtonClick.bind(_this);
    _this.handleCancelButtonClick = _this.handleCancelButtonClick.bind(_this);
    _this.handleCheckboxCommit = _this.handleCheckboxCommit.bind(_this);
    _this.handleCloseButtonClick = _this.handleCloseButtonClick.bind(_this);
    _this.handleEditSearchLinkClick = _this.handleEditSearchLinkClick.bind(_this);
    _this.handleFormSearch = _this.handleFormSearch.bind(_this);
    _this.handlePageChange = _this.handlePageChange.bind(_this);
    _this.handlePageSizeChange = _this.handlePageSizeChange.bind(_this);
    _this.handleSortChange = _this.handleSortChange.bind(_this);
    _this.renderCheckbox = _this.renderCheckbox.bind(_this);
    _this.renderEditSearchLink = _this.renderEditSearchLink.bind(_this);
    _this.renderModalButtonBar = _this.renderModalButtonBar.bind(_this);
    _this.renderSearchResultTableHeader = _this.renderSearchResultTableHeader.bind(_this);
    _this.renderSearchResultTableFooter = _this.renderSearchResultTableFooter.bind(_this);

    _this.state = {
      isSearchInitiated: false,
      pageNum: 0,
      sort: null
    };
    return _this;
  }

  _createClass(BaseSearchToRelateModal, [{
    key: 'componentWillReceiveProps',
    value: function componentWillReceiveProps(nextProps) {
      var isOpen = this.props.isOpen;
      var nextIsOpen = nextProps.isOpen;


      if (isOpen && !nextIsOpen) {
        // Closing.

        this.setState({
          isRelating: false,
          isSearchInitiated: false,
          pageNum: 0,
          sort: null
        });
      }
    }
  }, {
    key: 'componentDidUpdate',
    value: function componentDidUpdate(prevProps, prevState) {
      var isOpen = this.props.isOpen;
      var prevIsOpen = prevProps.isOpen;


      if (prevIsOpen && !isOpen) {
        // Closed.

        var _props = this.props,
            clearSearchResults = _props.clearSearchResults,
            onRecordTypeCommit = _props.onRecordTypeCommit;


        if (clearSearchResults) {
          clearSearchResults(searchName);
        }

        if (onRecordTypeCommit) {
          onRecordTypeCommit('');
        }
      } else if (!prevIsOpen && isOpen) {
        // Opened.

        var _props2 = this.props,
            defaultRecordTypeValue = _props2.defaultRecordTypeValue,
            _onRecordTypeCommit = _props2.onRecordTypeCommit;


        if (_onRecordTypeCommit) {
          _onRecordTypeCommit(defaultRecordTypeValue);

          // TODO: If search to relate is ever used on authorities, need to set the default vocabulary
          // if this is an authority record type, and vocabularyValue is not provided.
        }
      }

      var _state = this.state,
          isSearchInitiated = _state.isSearchInitiated,
          pageNum = _state.pageNum,
          sort = _state.sort;


      if (isSearchInitiated) {
        var _props3 = this.props,
            recordTypeValue = _props3.recordTypeValue,
            vocabularyValue = _props3.vocabularyValue,
            advancedSearchCondition = _props3.advancedSearchCondition,
            preferredPageSize = _props3.preferredPageSize;
        var prevRecordTypeValue = prevProps.recordTypeValue,
            prevVocabularyValue = prevProps.vocabularyValue,
            prevAdvancedSearchCondition = prevProps.advancedSearchCondition,
            prevPreferredPageSize = prevProps.preferredPageSize;
        var prevPageNum = prevState.pageNum,
            prevSort = prevState.sort;


        if (recordTypeValue !== prevRecordTypeValue || vocabularyValue !== prevVocabularyValue || !(0, _isEqual2.default)(advancedSearchCondition, prevAdvancedSearchCondition) || preferredPageSize !== prevPreferredPageSize || pageNum !== prevPageNum || sort !== prevSort) {
          this.search();
        }
      }
    }
  }, {
    key: 'getSearchDescriptor',
    value: function getSearchDescriptor() {
      var _props4 = this.props,
          config = _props4.config,
          recordType = _props4.recordTypeValue,
          vocabulary = _props4.vocabularyValue,
          keyword = _props4.keywordValue,
          advancedSearchCondition = _props4.advancedSearchCondition,
          preferredPageSize = _props4.preferredPageSize,
          subjects = _props4.subjects;
      var _state2 = this.state,
          pageNum = _state2.pageNum,
          sort = _state2.sort;


      var pageSize = preferredPageSize || defaultPageSize;

      var searchQuery = {
        p: pageNum,
        size: pageSize
      };

      if (isSingleSubject(subjects)) {
        searchQuery.mkRtSbj = subjects[0].csid;
      }

      if (sort) {
        searchQuery.sort = sort;
      }

      var kw = keyword ? keyword.trim() : '';

      if (kw) {
        searchQuery.kw = kw;
      }

      var fields = (0, _get2.default)(config, ['recordTypes', recordType, 'fields']);
      var condition = (0, _searchHelpers.normalizeCondition)(fields, advancedSearchCondition);

      if (condition) {
        searchQuery.as = condition;
      }

      return _immutable2.default.fromJS({
        recordType: recordType,
        vocabulary: vocabulary,
        searchQuery: searchQuery
      });
    }
  }, {
    key: 'relate',
    value: function relate() {
      var _props5 = this.props,
          selectedItems = _props5.selectedItems,
          createRelations = _props5.createRelations,
          onRelationsCreated = _props5.onRelationsCreated;


      if (createRelations) {
        var subjects = this.props.subjects;


        if (typeof subjects === 'function') {
          subjects = subjects();
        }

        if (subjects && subjects.length > 0) {
          var searchDescriptor = this.getSearchDescriptor();

          this.setState({
            isRelating: true,
            isSearchInitiated: false
          });

          var objects = selectedItems.valueSeq().map(function (item) {
            return {
              csid: item.get('csid'),
              recordType: searchDescriptor.get('recordType')
            };
          }).toJS();

          Promise.all(subjects.map(function (subject) {
            return createRelations(subject, objects, 'affects');
          })).then(function () {
            if (onRelationsCreated) {
              onRelationsCreated();
            }
          });
        }
      }
    }
  }, {
    key: 'search',
    value: function search() {
      var _props6 = this.props,
          config = _props6.config,
          search = _props6.search;


      if (search) {
        var searchDescriptor = this.getSearchDescriptor();

        search(config, searchName, searchDescriptor);

        this.setState({
          isSearchInitiated: true
        });
      }
    }
  }, {
    key: 'handleAcceptButtonClick',
    value: function handleAcceptButtonClick() {
      var isSearchInitiated = this.state.isSearchInitiated;


      if (isSearchInitiated) {
        this.relate();
      } else {
        this.search();
      }
    }
  }, {
    key: 'handleCancelButtonClick',
    value: function handleCancelButtonClick(event) {
      var onCancelButtonClick = this.props.onCancelButtonClick;


      if (onCancelButtonClick) {
        onCancelButtonClick(event);
      }
    }
  }, {
    key: 'handleCloseButtonClick',
    value: function handleCloseButtonClick(event) {
      var onCloseButtonClick = this.props.onCloseButtonClick;


      if (onCloseButtonClick) {
        onCloseButtonClick(event);
      }
    }
  }, {
    key: 'handleEditSearchLinkClick',
    value: function handleEditSearchLinkClick() {
      var clearSearchResults = this.props.clearSearchResults;


      if (clearSearchResults) {
        clearSearchResults(searchName);
      }

      this.setState({
        isSearchInitiated: false
      });
    }
  }, {
    key: 'handleFormSearch',
    value: function handleFormSearch() {
      this.search();
    }
  }, {
    key: 'handleCheckboxCommit',
    value: function handleCheckboxCommit(path, value) {
      var index = parseInt(path[0], 10);
      var checked = value;

      var _props7 = this.props,
          config = _props7.config,
          onItemSelectChange = _props7.onItemSelectChange;


      if (onItemSelectChange) {
        var searchDescriptor = this.getSearchDescriptor();

        onItemSelectChange(config, searchName, searchDescriptor, listType, index, checked);
      }
    }
  }, {
    key: 'handlePageChange',
    value: function handlePageChange(pageNum) {
      this.setState({
        pageNum: pageNum
      });
    }
  }, {
    key: 'handlePageSizeChange',
    value: function handlePageSizeChange(pageSize) {
      var setPreferredPageSize = this.props.setPreferredPageSize;


      var normalizedPageSize = void 0;

      if (isNaN(pageSize) || pageSize < 1) {
        normalizedPageSize = 0;
      } else if (pageSize > 2500) {
        normalizedPageSize = 2500;
      } else {
        normalizedPageSize = pageSize;
      }

      if (setPreferredPageSize) {
        this.setState({
          pageNum: 0
        });

        setPreferredPageSize(normalizedPageSize);
      }
    }
  }, {
    key: 'handleSortChange',
    value: function handleSortChange(sort) {
      this.setState({
        sort: sort
      });
    }
  }, {
    key: 'shouldShowCheckbox',
    value: function shouldShowCheckbox(item) {
      if (item.get('workflowState') === 'locked') {
        return false;
      }

      if (item.get('related') === 'true') {
        return false;
      }

      var _props8 = this.props,
          config = _props8.config,
          perms = _props8.perms,
          subjects = _props8.subjects;


      if (isSingleSubject(subjects) && item.get('csid') === subjects[0].csid) {
        return false;
      }

      return (0, _permissionHelpers.canRelate)((0, _configHelpers.getRecordTypeNameByUri)(config, item.get('uri')), perms);
    }
  }, {
    key: 'renderCheckbox',
    value: function renderCheckbox(_ref) {
      var rowData = _ref.rowData,
          rowIndex = _ref.rowIndex;

      if (this.shouldShowCheckbox(rowData)) {
        var selectedItems = this.props.selectedItems;


        var itemCsid = rowData.get('csid');
        var selected = selectedItems ? selectedItems.has(itemCsid) : false;

        return _react2.default.createElement(_CheckboxInput2.default, {
          embedded: true,
          name: '' + rowIndex,
          value: selected,
          onCommit: this.handleCheckboxCommit
        });
      }

      return null;
    }
  }, {
    key: 'renderSearchForm',
    value: function renderSearchForm() {
      var _props9 = this.props,
          allowedServiceTypes = _props9.allowedServiceTypes,
          config = _props9.config,
          intl = _props9.intl,
          keywordValue = _props9.keywordValue,
          recordTypeValue = _props9.recordTypeValue,
          vocabularyValue = _props9.vocabularyValue,
          perms = _props9.perms,
          advancedSearchCondition = _props9.advancedSearchCondition,
          onAdvancedSearchConditionCommit = _props9.onAdvancedSearchConditionCommit,
          onKeywordCommit = _props9.onKeywordCommit,
          onRecordTypeCommit = _props9.onRecordTypeCommit,
          onVocabularyCommit = _props9.onVocabularyCommit;


      var recordTypeInputReadOnly = true;
      var recordTypeInputRootType = void 0;

      if (allowedServiceTypes) {
        // Allow the record type to be changed.

        recordTypeInputReadOnly = false;

        // Don't show the All Records option.

        recordTypeInputRootType = '';
      }

      return _react2.default.createElement(_SearchForm2.default, {
        config: config,
        intl: intl,
        recordTypeValue: recordTypeValue,
        vocabularyValue: vocabularyValue,
        keywordValue: keywordValue,
        advancedSearchCondition: advancedSearchCondition,
        perms: perms,
        recordTypeInputReadOnly: recordTypeInputReadOnly,
        recordTypeInputRootType: recordTypeInputRootType,
        recordTypeInputServiceTypes: allowedServiceTypes,
        onAdvancedSearchConditionCommit: onAdvancedSearchConditionCommit,
        onKeywordCommit: onKeywordCommit,
        onRecordTypeCommit: onRecordTypeCommit,
        onVocabularyCommit: onVocabularyCommit,
        onSearch: this.handleFormSearch
      });
    }
  }, {
    key: 'renderEditSearchLink',
    value: function renderEditSearchLink() {
      return _react2.default.createElement(
        'button',
        { onClick: this.handleEditSearchLinkClick },
        _react2.default.createElement(_reactIntl.FormattedMessage, messages.editSearch)
      );
    }
  }, {
    key: 'renderSearchResultTableHeader',
    value: function renderSearchResultTableHeader(_ref2) {
      var searchError = _ref2.searchError,
          searchResult = _ref2.searchResult;
      var _props10 = this.props,
          config = _props10.config,
          selectedItems = _props10.selectedItems,
          setAllItemsSelected = _props10.setAllItemsSelected;


      if (searchError) {
        return null;
      }

      var searchDescriptor = this.getSearchDescriptor();

      return _react2.default.createElement(
        'header',
        null,
        _react2.default.createElement(_SearchResultSummary2.default, {
          config: config,
          listType: listType,
          searchDescriptor: searchDescriptor,
          searchError: searchError,
          searchResult: searchResult,
          renderEditLink: this.renderEditSearchLink,
          onPageSizeChange: this.handlePageSizeChange
        }),
        _react2.default.createElement(_SelectBar2.default, {
          config: config,
          listType: listType,
          searchDescriptor: searchDescriptor,
          searchName: searchName,
          searchResult: searchResult,
          selectedItems: selectedItems,
          setAllItemsSelected: setAllItemsSelected,
          showCheckboxFilter: this.shouldShowCheckbox
        })
      );
    }
  }, {
    key: 'renderSearchResultTableFooter',
    value: function renderSearchResultTableFooter(_ref3) {
      var searchResult = _ref3.searchResult;
      var config = this.props.config;


      if (searchResult) {
        var listTypeConfig = config.listTypes[listType];
        var list = searchResult.get(listTypeConfig.listNodeName);

        var totalItems = parseInt(list.get('totalItems'), 10);
        var pageSize = parseInt(list.get('pageSize'), 10);
        var pageNum = parseInt(list.get('pageNum'), 10);
        var lastPage = Math.max(0, isNaN(totalItems) ? 0 : Math.ceil(totalItems / pageSize) - 1);

        return _react2.default.createElement(
          'footer',
          null,
          _react2.default.createElement(_Pager2.default, {
            currentPage: pageNum,
            lastPage: lastPage,
            pageSize: pageSize,
            onPageChange: this.handlePageChange,
            onPageSizeChange: this.handlePageSizeChange
          })
        );
      }

      return null;
    }
  }, {
    key: 'renderSearchResultTable',
    value: function renderSearchResultTable() {
      var _props11 = this.props,
          config = _props11.config,
          recordTypeValue = _props11.recordTypeValue;


      var searchDescriptor = this.getSearchDescriptor();

      return _react2.default.createElement(_SearchResultTableContainer2.default, {
        config: config,
        linkItems: false,
        listType: listType,
        recordType: recordTypeValue,
        searchName: searchName,
        searchDescriptor: searchDescriptor,
        showCheckboxColumn: true,
        renderCheckbox: this.renderCheckbox,
        renderHeader: this.renderSearchResultTableHeader,
        renderFooter: this.renderSearchResultTableFooter,
        onSortChange: this.handleSortChange
      });
    }
  }, {
    key: 'renderModalButtonBar',
    value: function renderModalButtonBar() {
      var selectedItems = this.props.selectedItems;
      var _state3 = this.state,
          isRelating = _state3.isRelating,
          isSearchInitiated = _state3.isSearchInitiated;


      var cancelButton = _react2.default.createElement(_CancelButton2.default, {
        disabled: isRelating,
        onClick: this.handleCancelButtonClick
      });

      var acceptButton = void 0;
      var backButton = void 0;

      if (isSearchInitiated) {
        acceptButton = _react2.default.createElement(_RelateButton2.default, {
          disabled: isRelating || !selectedItems || selectedItems.size < 1,
          label: _react2.default.createElement(_reactIntl.FormattedMessage, messages.relate),
          onClick: this.handleAcceptButtonClick
        });

        backButton = _react2.default.createElement(_BackButton2.default, {
          disabled: isRelating,
          label: _react2.default.createElement(_reactIntl.FormattedMessage, messages.editSearch),
          onClick: this.handleEditSearchLinkClick
        });
      } else {
        acceptButton = _react2.default.createElement(_SearchButton2.default, {
          disabled: isRelating,
          type: 'button',
          onClick: this.handleAcceptButtonClick
        });
      }

      return _react2.default.createElement(
        'div',
        null,
        cancelButton,
        backButton,
        acceptButton
      );
    }
  }, {
    key: 'render',
    value: function render() {
      var _props12 = this.props,
          config = _props12.config,
          intl = _props12.intl,
          isOpen = _props12.isOpen,
          recordTypeValue = _props12.recordTypeValue,
          parentSelector = _props12.parentSelector;
      var _state4 = this.state,
          isRelating = _state4.isRelating,
          isSearchInitiated = _state4.isSearchInitiated;


      var content = void 0;

      if (isRelating) {
        content = _react2.default.createElement(
          'p',
          null,
          _react2.default.createElement(_reactIntl.FormattedMessage, messages.relating)
        );
      } else if (isSearchInitiated) {
        content = this.renderSearchResultTable();
      } else {
        content = this.renderSearchForm();
      }

      var searchDescriptor = this.getSearchDescriptor();

      var title = _react2.default.createElement(_SearchToRelateTitleBar2.default, {
        config: config,
        isSearchInitiated: isSearchInitiated,
        recordType: recordTypeValue,
        searchDescriptor: searchDescriptor
      });

      return _react2.default.createElement(
        _cspaceLayout.Modal,
        {
          className: _SearchToRelateModal2.default.common,
          contentLabel: intl.formatMessage(messages.label),
          title: title,
          isOpen: isOpen,
          showCloseButton: !isRelating,
          closeButtonClassName: 'material-icons',
          closeButtonLabel: 'close',
          parentSelector: parentSelector,
          renderButtonBar: this.renderModalButtonBar,
          onCloseButtonClick: this.handleCloseButtonClick
        },
        content
      );
    }
  }]);

  return BaseSearchToRelateModal;
}(_react.Component);

BaseSearchToRelateModal.propTypes = propTypes;
BaseSearchToRelateModal.defaultProps = defaultProps;

exports.default = (0, _reactIntl.injectIntl)(BaseSearchToRelateModal);