import { mergeProps, withCtx, createVNode, toDisplayString, useId, toRef, ref, computed, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrInterpolate } from 'vue/server-renderer';
import { g as useScopeId, i as VOverlay, j as makeVOverlayProps } from './VOverlay-DatVsI3B.mjs';
import { f as forwardRefs } from './forwardRefs-C3iWxc5z.mjs';
import { b as VBtn, g as genericComponent, f as useProxiedModel, a as useRender, p as propsFactory, o as omit } from './server.mjs';

const makeVTooltipProps = propsFactory({
  id: String,
  interactive: Boolean,
  text: String,
  ...omit(makeVOverlayProps({
    closeOnBack: false,
    location: "end",
    locationStrategy: "connected",
    eager: true,
    minWidth: 0,
    offset: 10,
    openOnClick: false,
    openOnHover: true,
    origin: "auto",
    scrim: false,
    scrollStrategy: "reposition",
    transition: null
  }), ["absolute", "retainFocus", "captureFocus", "disableInitialFocus"])
}, "VTooltip");
const VTooltip = genericComponent()({
  name: "VTooltip",
  props: makeVTooltipProps(),
  emits: {
    "update:modelValue": (value) => true
  },
  setup(props, _ref) {
    let {
      slots
    } = _ref;
    const isActive = useProxiedModel(props, "modelValue");
    const {
      scopeId
    } = useScopeId();
    const uid = useId();
    const id = toRef(() => props.id || `v-tooltip-${uid}`);
    const overlay = ref();
    const location = computed(() => {
      return props.location.split(" ").length > 1 ? props.location : props.location + " center";
    });
    const origin = computed(() => {
      return props.origin === "auto" || props.origin === "overlap" || props.origin.split(" ").length > 1 || props.location.split(" ").length > 1 ? props.origin : props.origin + " center";
    });
    const transition = toRef(() => {
      if (props.transition != null) return props.transition;
      return isActive.value ? "scale-transition" : "fade-transition";
    });
    const activatorProps = computed(() => mergeProps({
      "aria-describedby": id.value
    }, props.activatorProps));
    useRender(() => {
      const overlayProps = VOverlay.filterProps(props);
      return createVNode(VOverlay, mergeProps({
        "ref": overlay,
        "class": ["v-tooltip", {
          "v-tooltip--interactive": props.interactive
        }, props.class],
        "style": props.style,
        "id": id.value
      }, overlayProps, {
        "modelValue": isActive.value,
        "onUpdate:modelValue": ($event) => isActive.value = $event,
        "transition": transition.value,
        "absolute": true,
        "location": location.value,
        "origin": origin.value,
        "role": "tooltip",
        "activatorProps": activatorProps.value,
        "_disableGlobalStack": true
      }, scopeId), {
        activator: slots.activator,
        default: function() {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
          return slots.default?.(...args) ?? props.text;
        }
      });
    });
    return forwardRefs({}, overlay);
  }
});
const _sfc_main = {
  __name: "TBtn",
  __ssrInlineRender: true,
  props: {
    tooltip: { type: String, default: "" },
    color: { type: String, default: "" },
    to: { type: String, default: "" },
    icon: { type: String, default: "" },
    density: { type: String, default: "comfortable" },
    size: { type: String, default: "large" },
    variant: { type: String, default: "plain" }
  },
  emits: ["click"],
  setup(__props) {
    return (_ctx, _push, _parent, _attrs) => {
      _push(ssrRenderComponent(VTooltip, mergeProps({ location: "top" }, _attrs), {
        activator: withCtx(({ props }, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(ssrRenderComponent(VBtn, mergeProps(props, {
              color: __props.color,
              icon: __props.icon,
              variant: __props.variant,
              size: __props.size,
              density: __props.density,
              to: __props.to,
              onClick: ($event) => _ctx.$emit("click")
            }), null, _parent2, _scopeId));
          } else {
            return [
              createVNode(VBtn, mergeProps(props, {
                color: __props.color,
                icon: __props.icon,
                variant: __props.variant,
                size: __props.size,
                density: __props.density,
                to: __props.to,
                onClick: ($event) => _ctx.$emit("click")
              }), null, 16, ["color", "icon", "variant", "size", "density", "to", "onClick"])
            ];
          }
        }),
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$t(__props.tooltip))}</span>`);
          } else {
            return [
              createVNode("span", null, toDisplayString(_ctx.$t(__props.tooltip)), 1)
            ];
          }
        }),
        _: 1
      }, _parent));
    };
  }
};
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/TBtn.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const __nuxt_component_0 = Object.assign(_sfc_main, { __name: "TBtn" });

export { __nuxt_component_0 as _ };
