import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["type", "size", "color"];
import React, { forwardRef } from 'react';
import * as icons from '@ant-design/icons';
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 = _objectWithoutPropertiesLoose(props, _excluded);
  var IconComp = (icons || {})[type];
  var style = _extends({}, rest.style, {
    fontSize: size,
    color: color
  });
  if (!IconComp) {
    var IconFont = createFromIconfontCN();
    return /*#__PURE__*/React.createElement(IconFont, _extends({
      type: type
    }, rest, {
      style: style,
      ref: ref
    }));
  }
  return /*#__PURE__*/React.createElement(IconComp, _extends({}, rest, {
    style: style,
    twoToneColor: color,
    ref: ref
  }));
};
export default /*#__PURE__*/forwardRef(Icon);