var __assign = this && this.__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

var __rest = this && this.__rest || function (s, e) {
  var t = {};

  for (var p in s) {
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  }

  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  }
  return t;
};

import { jsx as _jsx } from "react/jsx-runtime";
import IconRender from "./icon-render";
import { ThemeEnum } from "../style/context";
import { getTheme } from "../style"; // /**
//  *
//  * @param Icons
//  */

var createIcon = function createIcon(Icons) {
  return function (props) {
    var theme = getTheme();

    if (Array.isArray(Icons)) {
      var Icon_1;

      switch (theme) {
        case ThemeEnum.dark:
          Icon_1 = Icons[0];
          break;

        case ThemeEnum.light:
          Icon_1 = Icons[1];
          break;

        default:
          Icon_1 = Icons[0];
          break;
      }

      return _jsx(IconRender, __assign({}, props, {
        children: function children(_a) {
          var color = _a.color,
              size = _a.size,
              others = __rest(_a, ["color", "size"]);

          return _jsx(Icon_1, __assign({
            color: color,
            width: size,
            height: size
          }, others), void 0);
        }
      }), void 0);
    }

    var Icon = Icons;
    return _jsx(IconRender, __assign({}, props, {
      children: function children(_a) {
        var color = _a.color,
            size = _a.size,
            others = __rest(_a, ["color", "size"]);

        return _jsx(Icon, __assign({
          color: color,
          width: size,
          height: size
        }, others), void 0);
      }
    }), void 0);
  };
};

export default createIcon;

