import '@das-fed/ui/packages/components/popover/style.css';
import { defineComponent as _, useAttrs as g, ref as C, computed as D, createBlock as O, openBlock as s, unref as t, mergeProps as P, withCtx as r, withDirectives as b, createElementBlock as p, createCommentVNode as d, renderSlot as m, toDisplayString as n, createElementVNode as R, createTextVNode as a, createVNode as u } from "vue";
import { withInstall as V } from "@das-fed/utils/with-install/index";
import { i18n as f, setI18nRule as E } from "@das-fed/web/packages/i18n/index";
import { ElPopover as I, ClickOutside as z } from "element-plus";
import { DasButton as v } from "@das-fed/ui/packages/components/button/index";
import "element-plus/es/components/popover/style/css";
import "@das-fed/ui/packages/global/theme";
const S = { class: "das-ui-popover-container" }, T = {
  key: 0,
  class: "das-ui-popover-title"
}, A = { class: "das-ui-popover-content" }, K = {
  key: 0,
  class: "btn-groups"
}, j = /* @__PURE__ */ _({
  __name: "Index",
  props: {
    title: {},
    width: { default: "240px" },
    content: {},
    popperClass: {},
    showBtns: { type: Boolean, default: !1 },
    placement: { default: "bottom-start" }
  },
  emits: ["cancel", "confirm", "clickOutside"],
  setup(k, { expose: h, emit: w }) {
    const l = k, i = w, $ = g(), c = C(null), y = D(() => {
      let e = "das-ui-popover-over-container";
      return l.popperClass && (e = `${e} ${l.popperClass}`), e;
    }), N = () => {
      console.log("tttttttttt"), $.visible !== void 0 && i("clickOutside");
    };
    return h({ $popoverRef: c }), (e, o) => (s(), O(t(I), P({
      ref_key: "$popoverRef",
      ref: c,
      class: "das-ui-popover",
      placement: e.placement,
      width: e.width,
      "popper-class": y.value
    }, e.$attrs), {
      reference: r(() => [
        m(e.$slots, "reference")
      ]),
      default: r(() => [
        b((s(), p("div", S, [
          e.title ? (s(), p(
            "div",
            T,
            n(e.title),
            1
            /* TEXT */
          )) : d("v-if", !0),
          m(e.$slots, "default", {}, () => [
            R("div", A, [
              a(
                n(e.content) + " ",
                1
                /* TEXT */
              ),
              e.showBtns ? (s(), p("div", K, [
                u(t(v), {
                  onClick: o[0] || (o[0] = (B) => i("cancel"))
                }, {
                  default: r(() => [
                    a(
                      n(t(f)("das-ui-popover-cancel").value),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                }),
                u(t(v), {
                  btnType: "primary",
                  onClick: o[1] || (o[1] = (B) => i("confirm")),
                  style: { "margin-left": "12px" }
                }, {
                  default: r(() => [
                    a(
                      n(t(f)("das-ui-popover-confirm").value),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                })
              ])) : d("v-if", !0)
            ])
          ])
        ])), [
          [t(z), N]
        ])
      ]),
      _: 3
      /* FORWARDED */
    }, 16, ["placement", "width", "popper-class"]));
  }
}), q = {
  "das-ui-popover-confirm": { "zh-CN": "确定", en: "OK", _appCode: "framework" },
  "das-ui-popover-cancel": { "zh-CN": "取消", en: "Cancel", _appCode: "framework" }
};
E(q);
const Q = () => C(null), U = V(j), W = { title: "Popover 气泡卡片" };
export {
  U as DasPopover,
  Q as DasPopoverRef,
  W as default
};
