import { ref, computed } from 'vue';
import { isClient } from '@vueuse/core';
import { useGlobalConfig } from '../use-global-config/index.mjs';

const zIndex = ref(0);
let PopupManager = void 0;
const useZIndex = () => {
  if (isClient) {
    PopupManager = window.PopupManager;
  }
  const initialZIndex = useGlobalConfig("zIndex", PopupManager ? PopupManager.zIndex : 2e3);
  const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  const nextZIndex = () => {
    zIndex.value++;
    if (PopupManager) {
      return PopupManager.nextZIndex();
    }
    return currentZIndex.value;
  };
  return {
    initialZIndex,
    currentZIndex,
    nextZIndex
  };
};

export { useZIndex };
//# sourceMappingURL=index.mjs.map
