import { inject, ref, computed, unref, watch, onMounted } from "vue";
import { POPPER_INJECTION_KEY as o } from "../constants.mjs";
import { buildPopperOptions as u, unwrapMeasurableEl as c } from "../utils.mjs";
import { usePopper as P } from "../../../../hooks/use-popper/index.mjs";
import n from "../../../../../../lodash-es/isUndefined.mjs";
const A = 0, B = (r) => {
  const { popperInstanceRef: d, contentRef: s, triggerRef: l, role: m } = inject(o, void 0), i = ref(), R = ref(), v = computed(() => ({
    name: "eventListeners",
    enabled: !!r.visible
  })), E = computed(() => {
    var e;
    const f = unref(i), g = (e = unref(R)) != null ? e : A;
    return {
      name: "arrow",
      enabled: !n(f),
      options: {
        element: f,
        padding: g
      }
    };
  }), w = computed(() => ({
    onFirstUpdate: () => {
      o$1();
    },
    ...u(r, [
      unref(E),
      unref(v)
    ])
  })), a = computed(() => c(r.referenceEl) || unref(l)), { attributes: b, state: O, styles: P$1, update: o$1, forceUpdate: _, instanceRef: c$1 } = P(a, s, w);
  return watch(c$1, (e) => d.value = e), onMounted(() => {
    watch(() => {
      var e;
      return (e = unref(a)) == null ? void 0 : e.getBoundingClientRect();
    }, () => {
      o$1();
    });
  }), {
    attributes: b,
    arrowRef: i,
    contentRef: s,
    instanceRef: c$1,
    state: O,
    styles: P$1,
    role: m,
    forceUpdate: _,
    update: o$1
  };
};
export {
  B as usePopperContent
};
