"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireWildcard(require("react"));
var icons = _interopRequireWildcard(require("@ant-design/icons"));
var _excluded = ["type", "size", "color"];
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var createFromIconfontCN = icons.createFromIconfontCN;
var Icon = function Icon(props, ref) {
  var _props$type = props.type,
    type = _props$type === void 0 ? '' : _props$type,
    size = props.size,
    color = props.color,
    rest = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
  var IconComp = (icons || {})[type];
  var style = (0, _extends2["default"])({}, rest.style, {
    fontSize: size,
    color: color
  });
  if (!IconComp) {
    var IconFont = createFromIconfontCN();
    return /*#__PURE__*/_react["default"].createElement(IconFont, (0, _extends2["default"])({
      type: type
    }, rest, {
      style: style,
      ref: ref
    }));
  }
  return /*#__PURE__*/_react["default"].createElement(IconComp, (0, _extends2["default"])({}, rest, {
    style: style,
    twoToneColor: color,
    ref: ref
  }));
};
var _default = exports["default"] = /*#__PURE__*/(0, _react.forwardRef)(Icon);