import { defineComponent as h, computed as i, resolveComponent as a, createBlock as m, openBlock as _, withCtx as u, createElementVNode as k, createVNode as I, createTextVNode as V, toDisplayString as N, createCommentVNode as T } from "vue";
import { E as s } from "./engineCallFileType-yaadA7-2.js";
import { _ as b } from "./install-DJFUeaKV.js";
const E = { class: "wt-call-media-action__option" }, O = /* @__PURE__ */ h({
  __name: "wt-call-media-action",
  props: {
    files: {},
    playingFileId: { default: "" }
  },
  emits: ["play", "stop"],
  setup(p, { emit: v }) {
    const t = p, d = v, n = i(() => [
      ...t.files[s.FileTypeAudio] || [],
      ...t.files[s.FileTypeVideo] || []
    ]), w = i(
      () => t.files[s.FileTypeVideo] ? "preview-tag-video" : "play"
    ), f = i(
      () => n.value.some((e) => e.id === t.playingFileId)
    ), y = i(
      () => n.value.map(({ name: e, id: r, mimeType: o, type: c }) => ({
        text: e,
        id: r,
        mimeType: o,
        type: c,
        icon: o === "video/mp4" ? "preview-tag-video" : "preview-tag-audio"
      }))
    ), g = ({ option: e }) => {
      t.playingFileId === e.id ? d("stop") : d("play", e);
    };
    return (e, r) => {
      const o = a("wt-icon-btn"), c = a("wt-icon"), x = a("wt-context-menu");
      return _(), m(x, {
        class: "wt-call-media-action",
        options: y.value,
        "max-width": "400px",
        onClick: g
      }, {
        activator: u(({ toggle: l }) => [
          n.value.length ? (_(), m(o, {
            key: 0,
            icon: f.value ? "stop" : w.value,
            onClick: l
          }, null, 8, ["icon", "onClick"])) : T("", !0)
        ]),
        option: u(({ text: l, id: F, icon: C }) => [
          k("div", E, [
            I(c, {
              icon: F === p.playingFileId ? "stop" : C
            }, null, 8, ["icon"]),
            V(" " + N(l), 1)
          ])
        ]),
        _: 1
      }, 8, ["options"]);
    };
  }
}), D = /* @__PURE__ */ b(O, [["__scopeId", "data-v-a6f7b638"]]);
export {
  D as default
};
