import { defineComponent, computed, createElementBlock, openBlock, createVNode, unref, mergeProps } from "vue";
import { Message } from "tuikit-atomicx-vue3/chat";
import { useRoomParticipantState } from "tuikit-atomicx-vue3/room";
const _hoisted_1 = { class: "custom-message-container" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "CustomMessage",
  props: {
    message: {}
  },
  setup(__props) {
    const props = __props;
    const { participantList } = useRoomParticipantState();
    const userName = computed(() => {
      const participant = participantList.value.find(
        (p) => p.userId === props.message.from
      );
      return (participant == null ? void 0 : participant.nameCard) || (participant == null ? void 0 : participant.userName) || (participant == null ? void 0 : participant.userId) || props.message.nick || props.message.from;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(unref(Message), mergeProps(_ctx.$attrs, {
          nick: userName.value,
          message: __props.message,
          "is-hidden-message-avatar": true,
          "is-hidden-message-meta": props.message.flow !== "out"
        }), null, 16, ["nick", "message", "is-hidden-message-meta"])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
