import { jsxs as O, jsx as s } from "react/jsx-runtime";
import h, { forwardRef as u, useState as E, useEffect as M, isValidElement as A } from "react";
import { PLACEMENT as t } from "../../values/Placement.js";
const w = {
  AUTO: t.AUTO,
  TOP: t.TOP,
  RIGHT: t.RIGHT,
  BOTTOM: t.BOTTOM,
  LEFT: t.LEFT
}, a = ({ className: e = "", children: o }) => /* @__PURE__ */ s("div", { className: `popover-header popover-title ${e}`, children: o }), n = ({ className: e = "", children: o }) => /* @__PURE__ */ s("div", { className: `popover-content popover-body ${e}`, children: o }), x = (e) => A(e) && (e.type === a || e.type === n), c = u((e, o) => {
  const {
    placement: l = "bottom",
    arrowProps: p,
    title: i,
    titleClassName: m = "",
    contentClassName: T = "",
    children: r,
    className: d = "",
    ...v
  } = e, N = !!i, P = h.Children.toArray(r).some(x), [f, C] = E(!1);
  return M(() => C(!0), []), /* @__PURE__ */ O(
    "div",
    {
      ...v,
      role: "tooltip",
      "x-placement": l,
      ref: o,
      className: `popover fade ${f ? "show" : ""} ${d}`,
      children: [
        /* @__PURE__ */ s("div", { className: "arrow", ...p }),
        N && /* @__PURE__ */ s(a, { className: m, children: i }),
        P ? r : /* @__PURE__ */ s(n, { className: T, children: r })
      ]
    }
  );
});
c.Title = a;
c.Content = n;
Object.assign(c, w);
export {
  w as PLACEMENT_MAP,
  c as default
};
//# sourceMappingURL=Popover.js.map
