import '@das-fed/ui/packages/components/tooltip/style.css';
import { defineComponent as S, useCssVars as E, computed as c, ref as m, onMounted as N, onBeforeMount as L, createBlock as V, openBlock as s, unref as x, mergeProps as _, withCtx as u, renderSlot as b, createElementBlock as p, createCommentVNode as k, normalizeStyle as D, normalizeClass as T, toDisplayString as $, createVNode as P, createElementVNode as z, Fragment as I, createTextVNode as W, nextTick as q } from "vue";
import { setThemeRule as F } from "@das-fed/web/packages/theme/index";
import { setI18nRule as X, t as Y } from "@das-fed/web/packages/i18n/index";
import { withInstall as O } from "@das-fed/utils/with-install/index";
import { DasScrollbar as j } from "@das-fed/ui/packages/components/scrollbar/index";
import { ElTooltip as A } from "element-plus";
import "element-plus/es/components/tooltip/style/css";
import "@das-fed/ui/packages/global/theme";
const G = ["innerHTML"], J = { key: 1 }, K = /* @__PURE__ */ S({
  __name: "index",
  props: {
    selfPopperClass: { default: "" },
    effect: { default: "light" },
    placement: { default: "top" },
    customClass: { default: "" },
    content: { default: "" },
    disabled: { type: Boolean, default: void 0 },
    text: { default: "" },
    row: { default: 1 },
    textWidth: { default: "100%" },
    textHtml: { type: Boolean, default: !1 },
    isMaxheight: { type: Boolean, default: !0 }
  },
  emits: ["show", "hide"],
  setup(n, { expose: d, emit: i }) {
    E((e) => ({
      "4fb23ab9": M.value
    }));
    const o = n, a = i, h = m(), w = m(!1), M = c(() => Number(o.row)), B = c(() => o.disabled ?? (o.text ? !w.value : !1)), g = c(() => o.content || o.text), H = (e) => {
      w.value = e.target.scrollHeight > e.target.clientHeight;
    }, R = (e) => {
      a("show", e), window.addEventListener("wheel", f);
    }, v = (e) => {
      a("hide", e), window.removeEventListener("wheel", f);
    }, f = (e) => {
      const l = document.querySelector('[id^="el-popper-container"]');
      if (!l) return;
      const t = l.querySelector(".das-ui-tooltip-popper");
      if (!t) return;
      const y = e.clientX, C = e.clientY, r = t == null ? void 0 : t.getBoundingClientRect();
      t && y >= r.left && y <= r.right && C >= r.top && C <= r.bottom || (t.style.display = "none", t.style.opacity = "0", q(() => {
        v();
      }));
    };
    return N(() => {
    }), L(() => {
      window.removeEventListener("wheel", f);
    }), d({
      $tooltipRef: h
    }), (e, l) => (s(), V(x(A), _({
      ref_key: "$tooltipRef",
      ref: h,
      class: "das-ui-tooltip",
      disabled: B.value,
      effect: e.effect,
      placement: e.placement,
      "popper-class": `das-ui-tooltip-popper ${e.isMaxheight ? "max-height" : ""} ${e.selfPopperClass}`,
      "hide-after": 100,
      "show-after": 100
    }, e.$attrs, {
      onShow: R,
      onHide: v
    }), {
      content: u(() => [
        P(x(j), null, {
          default: u(() => [
            z(
              "div",
              {
                class: T({ "max-height": e.isMaxheight, "das-popper-content": !0 })
              },
              [
                b(e.$slots, "content", {}, void 0, !0),
                g.value && !e.$slots.content ? (s(), p(
                  I,
                  { key: 0 },
                  [
                    W(
                      $(g.value),
                      1
                      /* TEXT */
                    )
                  ],
                  64
                  /* STABLE_FRAGMENT */
                )) : k("v-if", !0)
              ],
              2
              /* CLASS */
            )
          ]),
          _: 3
          /* FORWARDED */
        })
      ]),
      default: u(() => [
        b(e.$slots, "default", {}, () => [
          e.text ? (s(), p(
            "div",
            {
              key: 0,
              onMouseenter: l[0] || (l[0] = (t) => H(t)),
              class: T(`das-tooltip-text-wrap ${e.customClass}`),
              style: D({ width: o.textWidth })
            },
            [
              e.textHtml ? (s(), p("div", {
                key: 0,
                innerHTML: e.text
              }, null, 8, G)) : (s(), p(
                "div",
                J,
                $(e.text),
                1
                /* TEXT */
              ))
            ],
            38
            /* CLASS, STYLE, NEED_HYDRATION */
          )) : k("v-if", !0)
        ], !0)
      ]),
      _: 3
      /* FORWARDED */
    }, 16, ["disabled", "effect", "placement", "popper-class"]));
  }
}), Q = (n, d) => {
  const i = n.__vccOpts || n;
  for (const [o, a] of d)
    i[o] = a;
  return i;
}, U = /* @__PURE__ */ Q(K, [["__scopeId", "data-v-87cfa282"]]), Z = {
  "--das-ui-tooltip-font-normal": "#212121",
  "--das-ui-tooltip-font-light": "#fff",
  "--das-ui-tooltip-bgff-color": "#fff"
}, ee = { 文字提示: { "zh-CN": "文字提示", en: "Text Prompt", _appCode: "framework" } };
X(ee);
F(Z);
const pe = () => m(null), de = O(U), fe = { name: `Tooltip ${Y("文字提示")}` };
export {
  de as DasTooltip,
  pe as DasTooltipRef,
  fe as default
};
