import { defineComponent, renderSlot, createBlock, openBlock, unref, withCtx, createElementVNode, normalizeProps, guardReactiveProps } from "vue";
import { OPopup } from "../popup/index.mjs";
import { popoverProps } from "./types.mjs";
import { mergeClass } from "../_utils/dom.mjs";
const __default__ = {
  inheritAttrs: false
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  __name: "OPopover",
  props: popoverProps,
  emits: ["update:visible"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const updateVisible = (val) => {
      emits("update:visible", val);
    };
    return (_ctx, _cache) => {
      return props.disabled ? renderSlot(_ctx.$slots, "target", { key: 0 }) : (openBlock(), createBlock(unref(OPopup), {
        key: 1,
        class: "o-popover",
        offset: props.offset,
        "edge-offset": props.edgeOffset,
        visible: props.visible,
        position: props.position,
        trigger: props.trigger,
        target: props.target,
        wrapper: props.wrapper,
        "wrap-class": unref(mergeClass)("o-popover-wrap", props.wrapClass),
        "anchor-class": props.anchor ? unref(mergeClass)("o-popover-anchor", props.anchorClass) : "",
        "unmount-on-hide": props.unmountOnHide,
        "auto-hide": props.autoHide,
        disabled: props.disabled,
        transition: props.transition,
        "adjust-width": props.adjustWidth,
        adaptive: props.adaptive,
        "adjust-min-width": props.adjustMinWidth,
        "hide-when-target-invisible": props.hideWhenTargetInvisible,
        "hover-delay": props.hoverDelay,
        "before-hide": props.beforeHide,
        "before-show": props.beforeShow,
        "onUpdate:visible": updateVisible
      }, {
        target: withCtx(() => [
          renderSlot(_ctx.$slots, "target")
        ]),
        default: withCtx(() => [
          createElementVNode(
            "div",
            normalizeProps(guardReactiveProps(_ctx.$attrs)),
            [
              renderSlot(_ctx.$slots, "default")
            ],
            16
            /* FULL_PROPS */
          )
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["offset", "edge-offset", "visible", "position", "trigger", "target", "wrapper", "wrap-class", "anchor-class", "unmount-on-hide", "auto-hide", "disabled", "transition", "adjust-width", "adaptive", "adjust-min-width", "hide-when-target-invisible", "hover-delay", "before-hide", "before-show"]));
    };
  }
});
export {
  _sfc_main as default
};
