import { h } from "vue";
import XEUtils from "xe-utils";
import { VxeCore } from "./core.mjs";
import { iconConfigStore } from "./iconStore.mjs";
import { getSlotVNs } from "./vm.mjs";
function setIcon(options) {
  if (options) {
    Object.assign(iconConfigStore, options);
  }
  return VxeCore;
}
function getIcon(key) {
  return arguments.length ? XEUtils.get(iconConfigStore, key) : iconConfigStore;
}
function renderGlobalIcon(name) {
  const icon = getIcon(name);
  return renderCustomIcon(icon, name);
}
function renderCustomIcon(icon, name) {
  if (XEUtils.isFunction(icon)) {
    return h("span", {}, getSlotVNs(icon({ name })));
  }
  return h("i", {
    class: icon
  });
}
export {
  getIcon,
  renderCustomIcon,
  renderGlobalIcon,
  setIcon
};
