import { inject as f, ref as C, createElementBlock as a, createCommentVNode as l, unref as c, openBlock as s, normalizeClass as o, createVNode as g, createElementVNode as i, toDisplayString as r, withCtx as v } from "vue";
import y from "../../1_atoms/ButtonContextMenu/ButtonContextMenu.vue.js";
import { t as b } from "../../../locale/useLocale.js";
import { useMessageDraft as k } from "../../../hooks/useMessageDraft.js";
import "../../../hooks/useSearchModel.js";
import "../../../hooks/useTheme.js";
/* empty css                              */
import S from "../../../_virtual/_plugin-vue_export-helper.js";
/* empty css                                              */
import "../../../node_modules/linkifyjs/dist/linkify.js";
import "../../../node_modules/linkify-string/dist/linkify-string.js";
import "../../../functions/parseMarkdown.js";
/* empty css                     */
const x = {
  key: 0,
  class: "channels__selected"
}, D = ["src"], A = { class: "channels__title" }, B = {
  key: 1,
  class: "channels__selected channels__title"
}, I = {
  __name: "ChannelSelector",
  props: {
    channels: {
      type: Array,
      required: !1,
      default: () => []
    },
    mode: {
      type: String,
      required: !1,
      default: "hover"
    },
    state: {
      type: String,
      default: "active"
    }
  },
  emits: ["selectChannel"],
  setup(e, { emit: d }) {
    const m = e, h = f("chatAppId"), { getMessage: u } = k(h), p = d, t = C(m.channels.find((n) => n.type === "default")), _ = (n) => {
      t.value = n, p("selectChannel", t.value);
    };
    return (n, N) => c(u)().isRecording ? l("", !0) : (s(), a("div", {
      key: 0,
      class: o(["channels__container", { "channels__container-disabled": e.state == "disabled" }])
    }, [
      t.value ? (s(), a("div", x, [
        t.value.icon ? (s(), a("img", {
          key: 0,
          src: t.value.icon,
          class: "channels__icon"
        }, null, 8, D)) : l("", !0),
        i("span", A, r(t.value.title), 1)
      ])) : (s(), a("span", B, r(c(b)("component.ChannelSelector.Placeholder")), 1)),
      g(y, {
        actions: e.channels,
        mode: e.mode,
        "menu-side": "top",
        disabled: e.state == "disabled",
        onClick: _
      }, {
        default: v(() => [
          i("span", {
            class: o(["pi pi-list channels__trigger", { channels__disabled: e.state == "disabled" }])
          }, null, 2)
        ]),
        _: 1
      }, 8, ["actions", "mode", "disabled"])
    ], 2));
  }
}, L = /* @__PURE__ */ S(I, [["__scopeId", "data-v-d5653eb5"]]);
export {
  L as default
};
