"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _react = _interopRequireDefault(require("react"));

var _icon = _interopRequireDefault(require("../../icon"));

var _loadingBasicGray = _interopRequireDefault(require("../../spin/gif/loading-basic-gray.gif"));

// @ts-ignore
var DownLine = _icon.default.DownLine,
    LoadingLine = _icon.default.LoadingLine,
    ChooseLine = _icon.default.ChooseLine,
    CloseLine = _icon.default.CloseLine,
    CloseFill = _icon.default.CloseFill,
    SearchLine = _icon.default.SearchLine;

var GetIcons = function GetIcons(props) {
  var suffixIcon = props.suffixIcon,
      clearIcon = props.clearIcon,
      menuItemSelectedIcon = props.menuItemSelectedIcon,
      loading = props.loading,
      multiple = props.multiple,
      removeIcon = props.removeIcon,
      preCls = props.preCls,
      size = props.size,
      removeOptions = props.removeOptions; // replace clearIcon

  var mergedClearIcon = clearIcon;

  if (!clearIcon) {
    mergedClearIcon = /*#__PURE__*/_react.default.createElement(CloseFill, null);
  } // replace suffixIcon


  var mergedSuffixIcon = null;

  if (suffixIcon !== undefined) {
    mergedSuffixIcon = suffixIcon;
  } else if (loading) {
    // mergedSuffixIcon = React.createElement(LoadingLine, {
    //   // spin: true,
    // });
    var sizeSty = '16px';
    mergedSuffixIcon = /*#__PURE__*/_react.default.createElement("img", {
      src: _loadingBasicGray.default,
      style: {
        width: sizeSty,
        marginTop: -3,
        verticalAlign: 'middle'
      },
      alt: "\u52A0\u8F7D\u4E2D\u3002\u3002\u3002\u3002"
    });
  } else {
    var iconCls = ''.concat(preCls, '-suffix');

    mergedSuffixIcon = function mergedSuffixIcon(ref) {
      var open = ref.open,
          showSearch = ref.showSearch;

      if (open && showSearch) {
        return /*#__PURE__*/_react.default.createElement(SearchLine, {
          className: iconCls
        });
      }

      return /*#__PURE__*/_react.default.createElement(DownLine, {
        className: iconCls
      });
    };
  }

  var mergedItemIcon = null; // if (menuItemSelectedIcon !== undefined) {
  //   mergedItemIcon = menuItemSelectedIcon;
  // } else if (multiple) {
  //   mergedItemIcon = React.createElement(ChooseLine, null);
  // } else {
  //   mergedItemIcon = null;
  // }

  if (menuItemSelectedIcon !== undefined) {
    mergedItemIcon = menuItemSelectedIcon;
  } else {
    mergedItemIcon = /*#__PURE__*/_react.default.createElement(ChooseLine, null);
  } // replace removeIcon


  var mergedRemoveIcon = null;

  if (removeIcon !== undefined) {
    mergedRemoveIcon = removeIcon;
  } else {
    mergedRemoveIcon = /*#__PURE__*/_react.default.createElement(CloseLine, null);
  }

  return {
    clearIcon: mergedClearIcon,
    suffixIcon: mergedSuffixIcon,
    itemIcon: mergedItemIcon,
    removeIcon: mergedRemoveIcon
  };
};

var _default = GetIcons;
exports.default = _default;