"use strict";
const common_vendor = require("../../../common/vendor.js");
require("../../adapter-vue.js");
const TUIKit_plugins_pluginComponents_messageCustomer_index = require("./message-customer/index.js");
const TUIKit_plugins_pluginComponents_index = require("./index.js");
const TUIKit_tuiCustomerServicePlugin_utils_index = require("../../tui-customer-service-plugin/utils/index.js");
if (!Math) {
  (MessageCallGroup + MessageCallC2C + MessageCustomerService + MessageRoom + MessagePluginLayout)();
}
const MessagePluginLayout = () => "./message-plugin-layout.js";
const MessageCallGroup = () => "./message-call/message-call-group.js";
const MessageCallC2C = () => "./message-call/message-call-c2c.js";
const MessageCustomerService = () => "./message-customer/message-customer-service.js";
const MessageRoom = () => "./message-room/message-room-default.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "message-plugin",
  props: {
    message: { default: () => ({}) },
    blinkMessageIDList: { default: () => [] }
  },
  emits: ["resendMessage", "handleToggleMessageItem", "handleH5LongPress"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const messageModel = common_vendor.computed(() => common_vendor.Jt.getMessageModel(props.message.ID));
    const messageSignalingInfo = common_vendor.computed(() => {
      var _a;
      return (_a = messageModel == null ? void 0 : messageModel.value) == null ? void 0 : _a.getSignalingInfo();
    });
    const messageCustomContent = common_vendor.computed(() => {
      var _a;
      return (_a = messageModel == null ? void 0 : messageModel.value) == null ? void 0 : _a.getMessageContent();
    });
    const pluginMessageType = common_vendor.computed(() => {
      var _a;
      let typeObj = { pluginType: "", showStyle: "" };
      if (TUIKit_plugins_pluginComponents_index.isCallMessage(messageModel.value)) {
        typeObj = {
          pluginType: "call",
          showStyle: ((_a = messageModel.value) == null ? void 0 : _a.conversationType) === common_vendor.qt.TYPES.CONV_GROUP ? "tip" : "bubble"
        };
      } else if (TUIKit_plugins_pluginComponents_index.isRoomCardMessage(messageModel.value)) {
        typeObj = {
          pluginType: "room",
          showStyle: "bubble"
        };
      } else if (TUIKit_plugins_pluginComponents_messageCustomer_index.isCustomerServicePluginMessage(messageModel.value)) {
        typeObj = {
          pluginType: "customer",
          showStyle: TUIKit_tuiCustomerServicePlugin_utils_index.isMessageInvisible(messageModel.value) ? "" : "bubble"
        };
      }
      return typeObj;
    });
    const resendMessage = (message) => {
      emits("resendMessage", message);
    };
    const handleToggleMessageItem = (e, message, isLongpress = false) => {
      emits("handleToggleMessageItem", e, message, isLongpress);
    };
    const handleH5LongPress = (e, message, type) => {
      emits("handleH5LongPress", e, message, type);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          message: props.message,
          signalingInfo: common_vendor.unref(messageSignalingInfo),
          customContent: common_vendor.unref(messageCustomContent),
          blinkMessageIDList: props.blinkMessageIDList
        }),
        b: common_vendor.unref(pluginMessageType).pluginType === "call"
      }, common_vendor.unref(pluginMessageType).pluginType === "call" ? {
        c: common_vendor.p({
          message: props.message,
          signalingInfo: common_vendor.unref(messageSignalingInfo),
          customContent: common_vendor.unref(messageCustomContent)
        })
      } : {}, {
        d: common_vendor.unref(pluginMessageType).pluginType === "customer"
      }, common_vendor.unref(pluginMessageType).pluginType === "customer" ? {
        e: common_vendor.p({
          message: props.message
        })
      } : {}, {
        f: common_vendor.unref(pluginMessageType).pluginType === "room"
      }, common_vendor.unref(pluginMessageType).pluginType === "room" ? {
        g: common_vendor.p({
          message: props.message
        })
      } : {}, {
        h: common_vendor.o$1(resendMessage),
        i: common_vendor.o$1(handleToggleMessageItem),
        j: common_vendor.o$1(handleH5LongPress),
        k: common_vendor.p({
          message: props.message,
          showStyle: common_vendor.unref(pluginMessageType).showStyle,
          bubbleClassNameList: [common_vendor.unref(pluginMessageType).pluginType === "room" ? "message-bubble-room" : ""]
        })
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f303f15f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/TUIKit/plugins/plugin-components/message-plugin.js.map
