"use strict";

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

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

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

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

var _isString = _interopRequireDefault(require("lodash/isString"));

var _classnames = _interopRequireDefault(require("classnames"));

var RenderIcon = function RenderIcon(props) {
  var prefixCls = props.prefixCls,
      progressDot = props.progressDot,
      stepNumber = props.stepNumber,
      status = props.status;

  if (progressDot) {
    var iconDot = /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(prefixCls, "-icon-dot")
    });

    if (typeof progressDot === 'function') {
      var title = props.title,
          description = props.description;
      return /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(prefixCls, "-icon")
      }, progressDot(iconDot, {
        index: stepNumber - 1,
        status: status,
        title: title,
        description: description
      }));
    }

    return /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(prefixCls, "-icon")
    }, iconDot);
  }

  var icon = props.icon;

  if (icon && !(0, _isString["default"])(icon)) {
    return /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(prefixCls, "-icon")
    }, icon);
  }

  if (icon || status === 'finish' || status === 'error') {
    var _classNames;

    var iconPrefix = props.iconPrefix;
    var iconClassName = (0, _classnames["default"])("".concat(prefixCls, "-icon"), "".concat(iconPrefix), (_classNames = {}, (0, _defineProperty2["default"])(_classNames, "".concat(iconPrefix, "-").concat(icon), icon && (0, _isString["default"])(icon)), (0, _defineProperty2["default"])(_classNames, "".concat(iconPrefix, "-check"), !icon && status === 'finish'), (0, _defineProperty2["default"])(_classNames, "".concat(iconPrefix, "-close"), !icon && status === 'error'), _classNames));
    return /*#__PURE__*/_react["default"].createElement("span", {
      className: iconClassName
    });
  }

  return /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(prefixCls, "-icon")
  }, stepNumber);
};

RenderIcon.displayName = 'RcRenderIcon';
var _default = RenderIcon;
exports["default"] = _default;
//# sourceMappingURL=RenderIcon.js.map
