text: "use strict";
  
  exports.__esModule = true;
  exports.MultiSelect = undefined;
  
  var _class, _temp;
  
  var _react = require("react");
  
  var _react2 = _interopRequireDefault(_react);
  
  var _classnames = require("classnames");
  
  var _classnames2 = _interopRequireDefault(_classnames);
  
  var _propTypes = require("prop-types");
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _multi_select_state = require("./multi_select_state");
  
  var _multi_select_state2 = _interopRequireDefault(_multi_select_state);
  
  var _source_list = require("./source_list");
  
  var _source_list2 = _interopRequireDefault(_source_list);
  
  var _destination_list = require("./destination_list");
  
  var _destination_list2 = _interopRequireDefault(_destination_list);
  
  require("./multi_select.css");
  
  var _loader = require("./loader/loader");
  
  var _loader2 = _interopRequireDefault(_loader);
  
  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 MultiSelect = exports.MultiSelect = (_temp = _class = function (_PureComponent) {
    _inherits(MultiSelect, _PureComponent);
  
    function MultiSelect() {
      _classCallCheck(this, MultiSelect);
  
      return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments));
    }
  
    MultiSelect.prototype.calculateHeight = function calculateHeight() {
      var _props = this.props,
          height = _props.height,
          showSearch = _props.showSearch,
          showSelectAll = _props.showSelectAll,
          itemHeight = _props.itemHeight,
          selectAllHeight = _props.selectAllHeight,
          maxSelectedItems = _props.maxSelectedItems;
  
      height = showSearch && !maxSelectedItems ? height - 45 : height;
      height = showSelectAll ? height - (selectAllHeight ? selectAllHeight : itemHeight) : height;
      return height;
    };
  
    MultiSelect.prototype.render = function render() {
      var _props2 = this.props,
          wrapperClassName = _props2.wrapperClassName,
          showSearch = _props2.showSearch,
          height = _props2.height,
          itemHeight = _props2.itemHeight,
          selectAllHeight = _props2.selectAllHeight,
          showSelectAll = _props2.showSelectAll,
          showSelectedItems = _props2.showSelectedItems,
          itemRenderer = _props2.itemRenderer,
          selectedItemRenderer = _props2.selectedItemRenderer,
          filteredItems = _props2.filteredItems,
          selectedItems = _props2.selectedItems,
          getList = _props2.getList,
          filterItems = _props2.filterItems,
          selectAllItems = _props2.selectAllItems,
          isAllSelected = _props2.isAllSelected,
          clearAll = _props2.clearAll,
          selectItem = _props2.selectItem,
          unselectItems = _props2.unselectItems,
          searchIcon = _props2.searchIcon,
          searchRenderer = _props2.searchRenderer,
          selectAllRenderer = _props2.selectAllRenderer,
          selectionStatusRenderer = _props2.selectionStatusRenderer,
          noItemsRenderer = _props2.noItemsRenderer,
          loaderRenderer = _props2.loaderRenderer,
          messages = _props2.messages,
          loading = _props2.loading,
          maxSelectedItems = _props2.maxSelectedItems,
          searchValue = _props2.searchValue;
  
      var calculatedHeight = this.calculateHeight();
      var selectedIds = selectedItems.map(function (item) {
        return item.id;
      });
      var disabled = maxSelectedItems && maxSelectedItems <= selectedItems.length;
      var LoaderRenderer = loaderRenderer;
      return _react2.default.createElement(
        "div",
        {
          className: (0, _classnames2.default)("mss-wrapper", wrapperClassName),
          style: { height: height }
        },
        loading && _react2.default.createElement(LoaderRenderer, null),
        !loading && _react2.default.createElement(_source_list2.default, {
          searchValue: searchValue,
          searchRenderer: searchRenderer,
          selectAllRenderer: selectAllRenderer,
          showSearch: showSearch,
          filterItems: filterItems,
          searchIcon: searchIcon,
          messages: messages,
          showSelectAll: showSelectAll && !maxSelectedItems,
          itemHeight: itemHeight,
          selectAllItems: selectAllItems,
          isAllSelected: isAllSelected,
          selectedIds: selectedIds,
          itemRenderer: itemRenderer,
          getList: getList,
          filteredItems: filteredItems,
          calculatedHeight: calculatedHeight,
          selectItem: selectItem,
          noItemsRenderer: noItemsRenderer,
          disabled: disabled,
          selectAllHeight: selectAllHeight
        }),
        !loading && showSelectedItems && _react2.default.createElement(_destination_list2.default, {
          selectionStatusRenderer: selectionStatusRenderer,
          selectedIds: selectedIds,
          clearAll: clearAll,
          messages: messages,
          selectedItems: selectedItems,
          itemHeight: itemHeight,
          height: height,
          unselectItems: unselectItems,
          selectedItemRenderer: selectedItemRenderer,
          noItemsRenderer: noItemsRenderer
        })
      );
    };
  
    return MultiSelect;
  }(_react.PureComponent), _class.defaultProps = {
    selectedItems: [],
    filteredItems: [],
    messages: {},
    showSearch: true,
    showSelectAll: true,
    showSelectedItems: true,
    height: 400,
    itemHeight: 40,
    loaderRenderer: _loader2.default
  }, _temp);
  MultiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
    selectedItems: _propTypes2.default.array,
    filteredItems: _propTypes2.default.array,
    loading: _propTypes2.default.bool,
    messages: _propTypes2.default.object,
    onChange: _propTypes2.default.func,
    showSearch: _propTypes2.default.bool,
    showSelectAll: _propTypes2.default.bool,
    showSelectedItems: _propTypes2.default.bool,
    searchIcon: _propTypes2.default.string,
    deleteIcon: _propTypes2.default.string,
    searchRenderer: _propTypes2.default.func,
    selectedItemRenderer: _propTypes2.default.any,
    height: _propTypes2.default.number,
    itemHeight: _propTypes2.default.number,
    selectAllHeight: _propTypes2.default.number,
    loaderRenderer: _propTypes2.default.any,
    maxSelectedItems: _propTypes2.default.number
  } : {};
  exports.default = (0, _multi_select_state2.default)(MultiSelect);