import { r as e } from "./rolldown-runtime-BEcgMyyN.js";
import { createElementBlock as t, createVNode as n, defineComponent as r, guardReactiveProps as i, mergeProps as a, normalizeProps as o, onBeforeUnmount as s, onMounted as c, openBlock as l, renderSlot as u, resolveComponent as d, toHandlers as f, unref as p, useAttrs as m, useTemplateRef as h, withCtx as g } from "vue";
//#region src/components/wt-popover/_internals/composables/usePopoverOverlayFix.ts
var _ = (e, t) => {
	let n = (n) => {
		let r = n.target;
		if (r?.closest(".p-select-overlay, .p-multiselect-overlay, .p-datepicker-panel")) {
			let t = e.value?.outsideClickListener;
			if (!t) return;
			document.removeEventListener("click", t), document.addEventListener("click", () => {
				setTimeout(() => {
					let t = e.value?.outsideClickListener;
					t && document.addEventListener("click", t);
				}, 0);
			}, {
				once: !0,
				capture: !0
			});
			return;
		}
		e.value?.visible && e.value.container && (e.value.container.contains(r) || t.value?.contains(r) || e.value.hide?.());
	};
	c(() => document.addEventListener("pointerdown", n, !0)), s(() => document.removeEventListener("pointerdown", n, !0));
}, v = /*@__PURE__*/ r({
	__name: "wt-popover",
	props: {
		disabled: {
			type: Boolean,
			default: !1
		},
		dismissable: { type: Boolean },
		appendTo: { default: "body" },
		baseZIndex: { default: 0 },
		autoZIndex: {
			type: Boolean,
			default: !0
		},
		breakpoints: { default: null },
		dt: { default: null },
		pt: { default: null },
		ptOptions: { default: null },
		unstyled: {
			type: Boolean,
			default: !1
		},
		closeOnEscape: {
			type: Boolean,
			default: !0
		}
	},
	emits: ["show", "hide"],
	setup(e, { expose: r }) {
		let s = m(), c = h("innerPopover"), v = h("wrapper"), y = e;
		_(c, v);
		let b = (e, t) => {
			y.disabled || c.value?.toggle(e, t ?? void 0);
		}, x = (e, t) => {
			y.disabled || c.value?.show(e, t ?? void 0);
		}, S = (e) => {
			c.value?.hide(e);
		};
		return r({
			toggle: b,
			show: x,
			hide: S
		}), (r, m) => {
			let h = d("p-popover");
			return l(), t("div", {
				ref_key: "wrapper",
				ref: v
			}, [u(r.$slots, "activator", o(i({
				show: x,
				toggle: b,
				hide: S
			}))), n(h, a(p(s), {
				ref_key: "innerPopover",
				ref: c
			}, {
				"append-to": e.appendTo,
				"base-z-index": e.baseZIndex,
				"auto-z-index": e.autoZIndex,
				breakpoints: e.breakpoints,
				dt: e.dt,
				pt: e.pt,
				"pt-options": e.ptOptions,
				"close-on-escape": e.closeOnEscape,
				unstyled: e.unstyled
			}, f(p(s))), {
				default: g(() => [u(r.$slots, "default", o(i({
					hide: S,
					toggle: b
				})))], void 0, !0),
				_: 3
			}, 16, [
				"append-to",
				"base-z-index",
				"auto-z-index",
				"breakpoints",
				"dt",
				"pt",
				"pt-options",
				"close-on-escape",
				"unstyled"
			])], 512);
		};
	}
}), y = /* @__PURE__ */ e({ default: () => b }), b = v;
//#endregion
export { y as n, b as t };
