import { defineComponent as T, createElementBlock as o, openBlock as i, unref as t, normalizeClass as f, createCommentVNode as n, createElementVNode as a, normalizeStyle as _, createVNode as r, withCtx as p, createTextVNode as h, toDisplayString as x, Transition as w, createBlock as S } from "vue";
import { useMessageActions as V } from "../../../hooks/messages/useMessageActions.js";
import "../../../node_modules/linkifyjs/dist/linkify.js";
import "../../../node_modules/linkify-string/dist/linkify-string.js";
import "../../../functions/parseMarkdown.js";
import { getMessageClass as I } from "../../../functions/getMessageClass.js";
import { useSubtextTooltip as N } from "../../../hooks/messages/useSubtextTooltip.js";
import B from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
import D from "../../1_atoms/Tooltip/Tooltip.vue.js";
import O from "./icons/MissedCallIcon.vue.js";
const j = ["messageId"], q = ["src"], z = {
  key: 1,
  class: "missed-call-message__subtext"
}, A = { class: "missed-call-message__main-content" }, E = { class: "missed-call-message__icon-wrapper" }, F = { class: "missed-call-message__info-container" }, R = { class: "missed-call-message__time" }, X = /* @__PURE__ */ T({
  __name: "MissedCallMessage",
  props: {
    message: {
      type: Object,
      required: !0
    },
    applyStyle: {
      type: Function,
      default: () => null
    },
    subtextTooltipData: {
      type: Object,
      required: !1,
      default: () => ({})
    }
  },
  emits: ["action", "reply"],
  setup(e, { emit: y }) {
    const b = y, m = e, {
      isOpenMenu: c,
      buttonMenuVisible: C,
      showMenu: u,
      hideMenu: d,
      clickAction: M
    } = V(m.message, b), k = N(() => m.message, () => m.subtextTooltipData);
    function v(g) {
      return I(g.position, "missed-call-message");
    }
    return (g, s) => (i(), o("div", {
      class: f([
        v(e.message),
        e.applyStyle(e.message)
      ]),
      messageId: e.message.messageId,
      onMouseenter: s[1] || (s[1] = //@ts-ignore
      (...l) => t(u) && t(u)(...l)),
      onMouseleave: s[2] || (s[2] = //@ts-ignore
      (...l) => t(d) && t(d)(...l))
    }, [
      e.message.avatar ? (i(), o("img", {
        key: 0,
        class: "missed-call-message__avatar",
        src: e.message.avatar,
        height: "32",
        width: "32",
        style: _({ gridRow: e.message.subText ? "2" : "1" })
      }, null, 12, q)) : n("", !0),
      e.message.subText ? (i(), o("p", z, [
        r(D, {
          text: t(k),
          position: "right",
          offset: 8
        }, {
          default: p(() => [
            h(x(e.message.subText), 1)
          ]),
          _: 1
        }, 8, ["text"])
      ])) : n("", !0),
      a("div", {
        class: f(["missed-call-message__content", { "is-first": !0 }])
      }, [
        a("div", A, [
          a("div", E, [
            r(O, { class: "missed-call-message__icon" })
          ]),
          s[3] || (s[3] = a("p", { class: "missed-call-message__text" }, " Пропущенный звонок ", -1))
        ]),
        a("div", F, [
          a("span", R, x(e.message.time), 1)
        ]),
        t(C) && e.message.actions ? (i(), o("button", {
          key: 0,
          class: "missed-call-message__menu-button",
          onClick: s[0] || (s[0] = (l) => c.value = !t(c))
        }, [...s[4] || (s[4] = [
          a("span", { class: "pi pi-ellipsis-h" }, null, -1)
        ])])) : n("", !0),
        r(w, null, {
          default: p(() => [
            t(c) && e.message.actions ? (i(), S(B, {
              key: 0,
              class: "missed-call-message__context-menu",
              actions: e.message.actions,
              onClick: t(M)
            }, null, 8, ["actions", "onClick"])) : n("", !0)
          ]),
          _: 1
        })
      ])
    ], 42, j));
  }
});
export {
  X as default
};
