import { $n as e, D as t, Lt as n, On as r, Zn as i, et as a, g as o, jt as s, mt as c, qt as l, v as u, wn as d, xt as f, y as p, z as m } from "./runtime-core.esm-bundler-Ci9kEgM7.js";
import { K as h, S as g, X as _, b as v, m as y, x as b } from "./Button-CzGEASGR.js";
import { A as x } from "./dist-D5YmEqpM.js";
import { i as S } from "./Tooltip-CmrGYuQV.js";
import { a as C, o as w } from "./namespaced-DmrIZId-.js";
import { t as T } from "./overlay-DR-nxSLa.js";
var E = { slots: { content: `bg-default shadow-lg rounded-md ring ring-default data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto`, arrow: `fill-bg stroke-default` } }, D = { __name: `Popover`, props: { mode: { type: null, required: false, default: `click` }, content: { type: Object, required: false }, arrow: { type: [Boolean, Object], required: false }, portal: { type: [Boolean, String], required: false, skipCheck: true, default: true }, reference: { type: null, required: false }, dismissible: { type: Boolean, required: false, default: true }, class: { type: null, required: false }, ui: { type: null, required: false }, defaultOpen: { type: Boolean, required: false }, open: { type: Boolean, required: false }, modal: { type: Boolean, required: false }, openDelay: { type: Number, required: false, default: 0 }, closeDelay: { type: Number, required: false, default: 0 } }, emits: [`close:prevent`, `update:open`], setup(D2, { emit: O }) {
  let k = D2, A = O, j = n(), M = g(`popover`, k), N = _(), P = b(M.mode === `hover` ? x(M, `defaultOpen`, `open`, `openDelay`, `closeDelay`) : x(M, `defaultOpen`, `open`, `modal`), A), F = S(d(() => M.portal)), I = d(() => h(M.content, { side: `bottom`, sideOffset: 8, collisionPadding: 8 })), L = o(() => M.dismissible ? { pointerDownOutside: T } : [`interactOutside`, `escapeKeyDown`].reduce((e2, t2) => (e2[t2] = (e3) => {
    e3.preventDefault(), A(`close:prevent`);
  }, e2), {})), R = d(() => h(M.arrow, { rounded: true })), z = o(() => v({ extend: v(E), ...N.ui?.popover || {} })({ side: I.value.side })), B = o(() => M.mode === `hover` ? C : w);
  return (n2, o2) => (c(), u(r(B).Root, e(m(r(P))), { default: l(({ open: o3, close: d2 }) => [j.default ? (c(), u(r(B).Trigger, { key: 0, "as-child": ``, class: i(r(M).class) }, { default: l(() => [f(n2.$slots, `default`, { open: o3 })]), _: 2 }, 1032, [`class`])) : p(``, true), `Anchor` in B.value && j.anchor ? (c(), u(r(B).Anchor, { key: 1, "as-child": `` }, { default: l(() => [f(n2.$slots, `anchor`, e(m(d2 ? { close: d2 } : {})))]), _: 2 }, 1024)) : p(``, true), t(r(B).Portal, e(m(r(F))), { default: l(() => [t(r(y), null, { default: l(() => [t(r(B).Content, a(I.value, { reference: r(M).reference ?? r(M).content?.reference, "data-slot": `content`, class: z.value.content({ class: [!j.default && r(M).class, r(M).ui?.content] }) }, s(L.value)), { default: l(() => [f(n2.$slots, `content`, e(m(d2 ? { close: d2 } : {}))), r(M).arrow ? (c(), u(r(B).Arrow, a({ key: 0 }, R.value, { "data-slot": `arrow`, class: z.value.arrow({ class: r(M).ui?.arrow }) }), null, 16, [`class`])) : p(``, true)]), _: 2 }, 1040, [`reference`, `class`])]), _: 2 }, 1024)]), _: 2 }, 1040)]), _: 3 }, 16));
} };
export {
  D as t
};
