import { resolveComponent as i, resolveDirective as $, createBlock as r, openBlock as t, mergeProps as x, withCtx as c, createVNode as f, createTextVNode as a, toDisplayString as s, unref as w, createElementVNode as h, renderSlot as k, createElementBlock as d, Fragment as z, renderList as D, normalizeClass as E, createCommentVNode as p, withDirectives as I } from "vue";
import { _ as O, B as P } from "./install-BuMO14Rb.js";
const j = { class: "wt-selection-popup__options" }, A = ["onClick"], F = { class: "wt-selection-popup__item-header typo-subtitle-2" }, L = {
  key: 1,
  class: "popup-options__item-text"
}, T = {
  __name: "wt-selection-popup",
  props: {
    /**
     * Popup title
     */
    title: {
      type: String
    },
    /**
     * Selected value. The scheme repeats attribute `option` from `options`
     */
    selected: {
      type: Object
    },
    /**
     * All displayed values. Should have following schema: `{ value: '', title: '', description: '', icon: ''}`
     */
    options: {
      type: Array,
      default: () => []
    }
  },
  emits: [
    "change",
    "add",
    "close"
  ],
  setup(o, { emit: v }) {
    const y = o, l = v, { t: u } = P();
    function b() {
      l("add", y.selected);
    }
    function _() {
      l("close");
    }
    function C(n) {
      l("change", n);
    }
    return (n, q) => {
      const g = i("wt-icon"), B = i("wt-icon-btn"), m = i("wt-button"), N = i("wt-popup"), S = $("tooltip");
      return t(), r(N, x(n.$attrs, {
        class: "wt-selection-popup",
        overflow: "",
        size: "sm"
      }, { onClose: _ }), {
        title: c(() => [
          a(s(o.title), 1)
        ]),
        main: c(() => [
          h("ul", j, [
            (t(!0), d(z, null, D(o.options, (e, V) => (t(), d("li", {
              key: V,
              class: E([{ active: e.value === o.selected.value }, "wt-selection-popup__item-wrapper"]),
              onClick: (G) => C(e)
            }, [
              k(n.$slots, "option", { option: e }, () => [
                e.icon ? (t(), r(g, {
                  key: 0,
                  icon: e.icon,
                  size: "sm"
                }, null, 8, ["icon"])) : p("", !0),
                h("h4", F, s(e.title), 1),
                e.description ? (t(), d("p", L, s(e.description), 1)) : p("", !0),
                e.description ? I((t(), r(B, {
                  key: 2,
                  color: "info",
                  icon: "rounded-info"
                }, null, 512)), [
                  [S, e.description]
                ]) : p("", !0)
              ], !0)
            ], 10, A))), 128))
          ]),
          k(n.$slots, "after-section", {}, void 0, !0)
        ]),
        actions: c(() => [
          f(m, {
            disabled: !o.selected,
            onClick: b
          }, {
            default: c(() => [
              a(s(w(u)("reusable.create")), 1)
            ], void 0, !0),
            _: 1
          }, 8, ["disabled"]),
          f(m, {
            color: "secondary",
            onClick: _
          }, {
            default: c(() => [
              a(s(w(u)("reusable.close")), 1)
            ], void 0, !0),
            _: 1
          })
        ]),
        _: 3
      }, 16);
    };
  }
}, K = /* @__PURE__ */ O(T, [["__scopeId", "data-v-d7ed7032"]]);
export {
  K as default
};
