import { VxeCore } from "./src/core.mjs";
import { coreVersion } from "./src/core.mjs";
import { createCommentVNode } from "vue";
import { getConfig, setConfig } from "./src/config.mjs";
import { globalStore } from "./src/dataStore.mjs";
import { renderCustomIcon, renderGlobalIcon, getIcon, setIcon } from "./src/icon.mjs";
import { getTheme, setTheme } from "./src/theme.mjs";
import { createEvent, GLOBAL_EVENT_KEYS, globalEvents } from "./src/event.mjs";
import { globalResize } from "./src/resize.mjs";
import { getI18n, setI18n, getLanguage, hasLanguage, setLanguage } from "./src/i18n.mjs";
import { renderer } from "./src/renderer.mjs";
import { validators } from "./src/validators.mjs";
import { menus } from "./src/menus.mjs";
import { formats } from "./src/formats.mjs";
import { commands } from "./src/commands.mjs";
import { interceptor } from "./src/interceptor.mjs";
import { clipboard } from "./src/clipboard.mjs";
import { permission } from "./src/permission.mjs";
import { handleCheckInfo } from "./src/permission.mjs";
import { log } from "./src/log.mjs";
import { hooks } from "./src/hooks.mjs";
import { useFns } from "./src/useFns.mjs";
import { usePermission, useSize } from "./src/useFns.mjs";
import { getSlotVNs } from "./src/vm.mjs";
import XEUtils from "xe-utils";
const installedPlugins = [];
function use(Plugin, options) {
  if (Plugin && Plugin.install) {
    if (installedPlugins.indexOf(Plugin) === -1) {
      Plugin.install(VxeUI, options);
      installedPlugins.push(Plugin);
    }
  }
  return VxeUI;
}
const components = {};
function getComponent(name) {
  return components[name] || null;
}
function hasComponent(name) {
  return !!components[name];
}
function component(comp) {
  if (comp && comp.name) {
    components[comp.name] = comp;
    components[XEUtils.kebabCase(comp.name)] = comp;
  }
}
function renderEmptyElement() {
  return createCommentVNode();
}
function checkVersion(version, pVersion, sVersion) {
  if (version) {
    const vRest = `${version}`.match(/(\d+).(\d+).(\d+)/);
    if (vRest) {
      const pV = XEUtils.toNumber(vRest[1]);
      if (sVersion) {
        const sV = XEUtils.toNumber(vRest[2]);
        return pV >= pVersion && sV >= sVersion;
      }
      return pV >= pVersion;
    }
  }
  return false;
}
const VxeUI = Object.assign(VxeCore, {
  renderEmptyElement,
  setTheme,
  getTheme,
  setConfig,
  getConfig,
  setIcon,
  getIcon,
  renderGlobalIcon,
  renderCustomIcon,
  setLanguage,
  hasLanguage,
  getLanguage,
  setI18n,
  getI18n,
  globalEvents,
  GLOBAL_EVENT_KEYS,
  createEvent,
  globalResize,
  renderer,
  validators,
  menus,
  formats,
  commands,
  interceptor,
  clipboard,
  log,
  permission,
  globalStore,
  hooks,
  component,
  getComponent,
  hasComponent,
  useFns,
  getSlotVNs,
  checkVersion,
  use
});
setTheme();
export {
  GLOBAL_EVENT_KEYS,
  VxeCore,
  VxeUI,
  checkVersion,
  clipboard,
  commands,
  component,
  coreVersion,
  createEvent,
  VxeUI as default,
  formats,
  getComponent,
  getConfig,
  getI18n,
  getIcon,
  getLanguage,
  getSlotVNs,
  getTheme,
  globalEvents,
  globalResize,
  globalStore,
  handleCheckInfo,
  hasComponent,
  hasLanguage,
  hooks,
  interceptor,
  log,
  menus,
  permission,
  renderCustomIcon,
  renderEmptyElement,
  renderGlobalIcon,
  renderer,
  setConfig,
  setI18n,
  setIcon,
  setLanguage,
  setTheme,
  use,
  useFns,
  usePermission,
  useSize,
  validators
};
