"use strict";
const common_vendor = require("../../common/vendor.js");
require("../adapter-vue.js");
const TUIKit_utils_env = require("../utils/env.js");
const TUIKit_components_TUIChat_config = require("./TUIChat/config.js");
const TUIKit_components_TUIChat_entryChatOnly = require("./TUIChat/entry-chat-only.js");
const TUIKit_components_TUIChat_utils_utils = require("./TUIChat/utils/utils.js");
const TUIKit_components_TUIChat_offlinePushInfoManager_index = require("./TUIChat/offlinePushInfoManager/index.js");
const stores_counter = require("../../stores/counter.js");
const components_request = require("../../components/request.js");
const components_generateMsgId = require("../../components/generateMsgId.js");
const TUIKit_components_TUIChat_server = require("./TUIChat/server.js");
const TUIKit_components_TUIConversation_server = require("./TUIConversation/server.js");
const TUIKit_components_TUISearch_searchTypeList = require("./TUISearch/search-type-list.js");
const TUIKit_components_TUISearch_searchTimeList = require("./TUISearch/search-time-list.js");
const TUIKit_components_TUISearch_server = require("./TUISearch/server.js");
const TUIKit_components_TUIContact_server = require("./TUIContact/server.js");
const TUIKit_components_TUIGroup_server = require("./TUIGroup/server.js");
require("./TUIConversation/entry.js");
if (!Math) {
  (ChatHeader + Forward + MessageList + MultipleSelectPanel + MessageInputToolbar + MessageInput)();
}
const ChatHeader = () => "./TUIChat/chat-header/index.js";
const MessageList = () => "./TUIChat/message-list/index.js";
const MessageInput = () => "./TUIChat/message-input/index.js";
const MultipleSelectPanel = () => "./TUIChat/mulitple-select-panel/index.js";
const Forward = () => "./TUIChat/forward/index.js";
const MessageInputToolbar = () => "./TUIChat/message-input-toolbar/index.js";
const _sfc_main$4 = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  emits: ["closeChat"],
  setup(__props, { emit: __emit }) {
    const counter = stores_counter.useCounterStore();
    let myitem = common_vendor.ref();
    let youritem = common_vendor.ref();
    common_vendor.onLoad((options) => {
      TUIKit_components_TUIChat_entryChatOnly.initChat(options);
      try {
        myitem.value = JSON.parse(options.myitem);
        youritem.value = JSON.parse(options.youritem);
        counter.$patch({ youritem: youritem.value });
        setTimeout(() => {
          sendCustomMessage(myitem.value, youritem.value);
        }, 1e3);
      } catch (e) {
      }
    });
    common_vendor.onUnload(() => {
      TUIKit_components_TUIChat_entryChatOnly.logout(false).then(() => {
      }).catch(() => {
      });
    });
    const groupID = common_vendor.ref(void 0);
    const isGroup = common_vendor.ref(false);
    const isNotInGroup = common_vendor.ref(false);
    const notInGroupReason = common_vendor.ref();
    const currentConversationID = common_vendor.ref();
    const isMultipleSelectMode = common_vendor.ref(false);
    const inputToolbarDisplayType = common_vendor.ref("none");
    const messageInputRef = common_vendor.ref();
    const messageListRef = common_vendor.ref();
    const headerExtensionList = common_vendor.ref([]);
    const featureConfig = TUIKit_components_TUIChat_config.ChatConfig.getFeatureConfig();
    common_vendor.ref("0px");
    common_vendor.onMounted(() => {
      common_vendor.Jt.watch(common_vendor.o.CONV, {
        currentConversation: onCurrentConversationUpdate
      });
    });
    common_vendor.onUnmounted(() => {
      common_vendor.Jt.unwatch(common_vendor.o.CONV, {
        currentConversation: onCurrentConversationUpdate
      });
      reset();
    });
    let currentConversation = common_vendor.ref();
    common_vendor.Jt.watch(common_vendor.o.CONV, {
      currentConversation: (conversation) => {
        currentConversation.value = conversation;
      }
    });
    function sendCustomMessage(myitem2, youritem2) {
      components_request.request({
        url: "pk/createPkRecord",
        method: "POST",
        data: {
          pkIdA: youritem2.id,
          pkIdB: myitem2.id,
          userIdA: youritem2.senderId,
          userIdB: myitem2.senderId,
          pkTime: youritem2.pkTime,
          pkNumber: youritem2.pkNumber,
          anchorIdA: youritem2.anchorId,
          anchorIdB: myitem2.anchorId,
          anchorIconA: youritem2.anchorIcon,
          anchorIconB: myitem2.anchorIcon,
          piIdA: youritem2.id,
          piIdB: myitem2.id
        },
        userInfo: true
      }).then((res) => {
        var _a, _b, _c, _d, _e;
        if (res.code === 200) {
          const keyid = components_generateMsgId.generateMsgId();
          const payload = {
            data: JSON.stringify({
              businessID: "pk",
              keyid,
              myitem: counter.myitem.id,
              pkIdA: youritem2.id,
              pkIdB: myitem2.id,
              userIdA: youritem2.senderId,
              userIdB: myitem2.senderId,
              pkTime: youritem2.pkTime,
              pkNumber: youritem2.pkNumber,
              id: res.data.id,
              link: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pk.png",
              btnDisplay: true
            }),
            description: "邀请参加PK",
            extension: "邀请参加PK"
          };
          const options = {
            to: ((_b = (_a = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _a.groupProfile) == null ? void 0 : _b.groupID) || ((_d = (_c = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _c.userProfile) == null ? void 0 : _d.userID),
            conversationType: (_e = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _e.type,
            payload,
            needReadReceipt: TUIKit_components_TUIChat_utils_utils.isEnabledMessageReadReceiptGlobal()
          };
          const offlinePushInfoCreateParams = {
            conversation: currentConversation.value,
            payload: options.payload,
            messageType: common_vendor.qt.TYPES.MSG_CUSTOM
          };
          const sendMessageOptions = {
            offlinePushInfo: TUIKit_components_TUIChat_offlinePushInfoManager_index.OfflinePushInfoManager.create(offlinePushInfoCreateParams)
          };
          common_vendor.Qt.sendCustomMessage(options, sendMessageOptions).then((res2) => {
            components_request.request({
              url: "chat/add",
              method: "POST",
              data: {
                messageInfo: JSON.stringify(res2.data.message),
                keyId: keyid
              },
              userInfo: true
            });
          });
          myitem2.value = null;
          youritem2.value = null;
          currentConversation.value = null;
        } else {
          common_vendor.index.showToast({
            title: res.msg,
            icon: "none",
            duration: 3e3
          });
        }
      });
    }
    const isInputToolbarShow = common_vendor.computed(() => {
      return TUIKit_utils_env.isUniFrameWork ? inputToolbarDisplayType.value !== "none" : true;
    });
    const leaveGroupReasonText = common_vendor.computed(() => {
      let text = "";
      switch (notInGroupReason.value) {
        case 4:
          text = common_vendor.Wt.t("TUIChat.您已被管理员移出群聊");
          break;
        case 5:
          text = common_vendor.Wt.t("TUIChat.该群聊已被解散");
          break;
        case 8:
          text = common_vendor.Wt.t("TUIChat.您已退出该群聊");
          break;
        default:
          text = common_vendor.Wt.t("TUIChat.您已退出该群聊");
          break;
      }
      return text;
    });
    const reset = () => {
      common_vendor.Xt.switchConversation("");
    };
    const insertEmoji = (emojiObj) => {
      var _a;
      (_a = messageInputRef.value) == null ? void 0 : _a.insertEmoji(emojiObj);
    };
    const handleEditor = (message, type) => {
      var _a, _b, _c;
      if (!message || !type)
        return;
      switch (type) {
        case "reference":
          break;
        case "reply":
          break;
        case "reedit":
          if ((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.text) {
            (_c = messageInputRef == null ? void 0 : messageInputRef.value) == null ? void 0 : _c.reEdit((_b = message == null ? void 0 : message.payload) == null ? void 0 : _b.text);
          }
          break;
      }
    };
    const handleGroup = () => {
      headerExtensionList.value[0].listener.onClicked({ groupID: groupID.value });
    };
    function changeToolbarDisplayType(type) {
      inputToolbarDisplayType.value = inputToolbarDisplayType.value === type ? "none" : type;
      if (inputToolbarDisplayType.value !== "none" && TUIKit_utils_env.isUniFrameWork) {
        common_vendor.index.$emit("scroll-to-bottom");
      }
    }
    function scrollToLatestMessage() {
      var _a;
      (_a = messageListRef.value) == null ? void 0 : _a.scrollToLatestMessage();
    }
    function toggleMultipleSelectMode(visible) {
      isMultipleSelectMode.value = visible === void 0 ? !isMultipleSelectMode.value : visible;
    }
    function mergeForwardMessage() {
      var _a;
      (_a = messageListRef.value) == null ? void 0 : _a.mergeForwardMessage();
    }
    function oneByOneForwardMessage() {
      var _a;
      (_a = messageListRef.value) == null ? void 0 : _a.oneByOneForwardMessage();
    }
    function updateUIUserNotInGroup(conversation) {
      if ((conversation == null ? void 0 : conversation.operationType) > 0) {
        headerExtensionList.value = [];
        isNotInGroup.value = true;
        notInGroupReason.value = conversation == null ? void 0 : conversation.operationType;
      } else {
        isNotInGroup.value = false;
        notInGroupReason.value = void 0;
      }
    }
    function onCurrentConversationUpdate(conversation) {
      updateUIUserNotInGroup(conversation);
      if (!conversation) {
        return;
      }
      if (currentConversationID.value === (conversation == null ? void 0 : conversation.conversationID)) {
        return;
      }
      isGroup.value = false;
      let conversationType = common_vendor.qt.TYPES.CONV_C2C;
      const conversationID = conversation.conversationID;
      if (conversationID.startsWith(common_vendor.qt.TYPES.CONV_GROUP)) {
        conversationType = common_vendor.qt.TYPES.CONV_GROUP;
        isGroup.value = true;
        groupID.value = conversationID.replace(common_vendor.qt.TYPES.CONV_GROUP, "");
      }
      headerExtensionList.value = [];
      isMultipleSelectMode.value = false;
      TUIKit_components_TUIChat_config.ChatConfig.setChatType(conversationType);
      common_vendor.R.notifyEvent(
        common_vendor.E.TUIChat.EVENT.CHAT_STATE_CHANGED,
        common_vendor.E.TUIChat.EVENT_SUB_KEY.CHAT_OPENED,
        { groupID: groupID.value }
      );
      common_vendor.R.callService({
        serviceName: common_vendor.E.TUICustomerServicePlugin.SERVICE.NAME,
        method: common_vendor.E.TUICustomerServicePlugin.SERVICE.METHOD.ACTIVE_CONVERSATION,
        params: { conversationID }
      });
      if (TUIKit_components_TUIChat_config.ChatConfig.getChatType() === common_vendor.E.TUIChat.TYPE.ROOM) {
        if (TUIKit_components_TUIChat_config.ChatConfig.getFeatureConfig(common_vendor.E.TUIChat.FEATURE.InputVoice) === true) {
          TUIKit_components_TUIChat_config.ChatConfig.setTheme("light");
          currentConversationID.value = "";
          return;
        }
      }
      if (TUIKit_components_TUIChat_config.ChatConfig.getChatType() === common_vendor.E.TUIChat.TYPE.GROUP) {
        headerExtensionList.value = common_vendor.R.getExtensionList(
          common_vendor.E.TUIChat.EXTENSION.CHAT_HEADER.EXT_ID
        );
      }
      common_vendor.Jt.update(common_vendor.o.CUSTOM, "activeConversation", conversationID);
      currentConversationID.value = conversationID;
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: !common_vendor.unref(currentConversationID)
      }, !common_vendor.unref(currentConversationID) ? {
        b: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-default")
      } : {}, {
        c: common_vendor.unref(currentConversationID)
      }, common_vendor.unref(currentConversationID) ? common_vendor.e({
        d: common_vendor.o$1(toggleMultipleSelectMode),
        e: common_vendor.sr(messageListRef, "04dfedea-2", {
          "k": "messageListRef"
        }),
        f: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-message-list"),
        g: common_vendor.o$1(handleEditor),
        h: common_vendor.o$1(() => changeToolbarDisplayType("none")),
        i: common_vendor.o$1(toggleMultipleSelectMode),
        j: common_vendor.p({
          isGroup: common_vendor.unref(isGroup),
          groupID: common_vendor.unref(groupID),
          isNotInGroup: common_vendor.unref(isNotInGroup),
          isMultipleSelectMode: common_vendor.unref(isMultipleSelectMode)
        }),
        k: common_vendor.unref(isNotInGroup)
      }, common_vendor.unref(isNotInGroup) ? {
        l: common_vendor.t(common_vendor.unref(leaveGroupReasonText)),
        m: common_vendor.unref(TUIKit_utils_env.isMobile) ? 1 : ""
      } : common_vendor.unref(isMultipleSelectMode) ? {
        o: common_vendor.o$1(oneByOneForwardMessage),
        p: common_vendor.o$1(mergeForwardMessage),
        q: common_vendor.o$1(toggleMultipleSelectMode)
      } : common_vendor.e({
        r: common_vendor.unref(isInputToolbarShow)
      }, common_vendor.unref(isInputToolbarShow) ? {
        s: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-message-input-toolbar"),
        t: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && "tui-chat-uni-message-input-toolbar"),
        v: common_vendor.o$1(insertEmoji),
        w: common_vendor.o$1(changeToolbarDisplayType),
        x: common_vendor.o$1(scrollToLatestMessage),
        y: common_vendor.p({
          displayType: common_vendor.unref(inputToolbarDisplayType)
        })
      } : {}, {
        z: common_vendor.sr(messageInputRef, "04dfedea-5", {
          "k": "messageInputRef"
        }),
        A: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-message-input"),
        B: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && "tui-chat-uni-message-input"),
        C: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isWeChat) && "tui-chat-wx-message-input"),
        D: common_vendor.o$1(changeToolbarDisplayType),
        E: common_vendor.p({
          enableAt: common_vendor.unref(featureConfig).InputMention,
          isMuted: false,
          muteText: common_vendor.unref(common_vendor.Wt).t("TUIChat.您已被管理员禁言"),
          placeholder: common_vendor.unref(common_vendor.Wt).t("TUIChat.请输入消息"),
          inputToolbarDisplayType: common_vendor.unref(inputToolbarDisplayType)
        })
      }), {
        n: common_vendor.unref(isMultipleSelectMode),
        F: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5")
      }) : {}, {
        G: !common_vendor.unref(isNotInGroup) && !common_vendor.unref(TUIKit_utils_env.isApp) && common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && common_vendor.unref(isGroup) && common_vendor.unref(headerExtensionList).length > 0
      }, !common_vendor.unref(isNotInGroup) && !common_vendor.unref(TUIKit_utils_env.isApp) && common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && common_vendor.unref(isGroup) && common_vendor.unref(headerExtensionList).length > 0 ? {
        H: common_vendor.t(common_vendor.unref(headerExtensionList)[0].text),
        I: common_vendor.o$1(handleGroup)
      } : {}, {
        J: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5")
      });
    };
  }
});
const MiniProgramPage$4 = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main$4, [["__scopeId", "data-v-04dfedea"]]);
new TUIKit_components_TUIChat_server.TUIChatServer();
new TUIKit_components_TUIConversation_server.TUIConversationServer();
if (!Math) {
  (SearchInput + SearchResult + SearchContainer)();
}
const SearchInput = () => "./TUISearch/search-input/index.js";
const SearchContainer = () => "./TUISearch/search-container/index.js";
const SearchResult = () => "./TUISearch/search-result/index.js";
const _sfc_main$3 = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  props: {
    searchType: { default: () => {
      return TUIKit_utils_env.isUniFrameWork ? "conversation" : "global";
    } }
  },
  setup(__props) {
    const props = __props;
    const globalSearchRef = common_vendor.ref();
    const currentConversationID = common_vendor.ref("");
    const searchingStatus = common_vendor.ref(false);
    const isShowInConversationSearch = common_vendor.ref(TUIKit_utils_env.isUniFrameWork);
    const isFullScreen = common_vendor.computed(
      () => !TUIKit_utils_env.isPC && (props.searchType === "global" && searchingStatus.value || props.searchType === "conversation" && isShowInConversationSearch.value)
    );
    const initSearchValue = (searchType) => {
      common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchInputValue", {
        value: "",
        searchType
      });
      common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchMessageType", {
        value: TUIKit_components_TUISearch_searchTypeList.searchMessageTypeDefault[searchType],
        searchType
      });
      common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchMessageTime", {
        value: TUIKit_components_TUISearch_searchTimeList.searchMessageTimeDefault,
        searchType
      });
    };
    function onCurrentConversationIDUpdate(conversationID) {
      if (!TUIKit_utils_env.isUniFrameWork && currentConversationID.value !== conversationID) {
        closeInConversationSearch();
      }
      currentConversationID.value = conversationID;
    }
    function onCurrentSearchingStatusChange(value) {
      var _a, _b, _c, _d;
      if ((value == null ? void 0 : value.searchType) === props.searchType) {
        searchingStatus.value = value == null ? void 0 : value.isSearching;
        if ((value == null ? void 0 : value.searchType) === "global" && globalSearchRef.value) {
          if (TUIKit_utils_env.isPC && value.isSearching) {
            common_vendor.O.listen({
              domRefs: globalSearchRef.value,
              handler: closeGlobalSearch
            });
          }
        }
        if ((value == null ? void 0 : value.searchType) === "global" && TUIKit_utils_env.isUniFrameWork) {
          value.isSearching ? (_b = (_a = common_vendor.i) == null ? void 0 : _a.hideTabBar()) == null ? void 0 : _b.catch(() => {
          }) : (_d = (_c = common_vendor.i) == null ? void 0 : _c.showTabBar()) == null ? void 0 : _d.catch(() => {
          });
        }
      }
    }
    function onIsShowInConversationSearchChange(value) {
      isShowInConversationSearch.value = value ? true : false;
      isShowInConversationSearch.value && initSearchValue(props.searchType);
    }
    common_vendor.onMounted(() => {
      ["global", "conversation"].forEach((type) => {
        initSearchValue(type);
      });
      common_vendor.Jt.watch(common_vendor.o.CONV, {
        currentConversationID: onCurrentConversationIDUpdate
      });
      common_vendor.Jt.watch(common_vendor.o.SEARCH, {
        currentSearchingStatus: onCurrentSearchingStatusChange,
        isShowInConversationSearch: onIsShowInConversationSearchChange
      });
    });
    common_vendor.onUnmounted(() => {
      common_vendor.Jt.unwatch(common_vendor.o.CONV, {
        currentConversationID: onCurrentConversationIDUpdate
      });
      common_vendor.Jt.unwatch(common_vendor.o.SEARCH, {
        currentSearchingStatus: onCurrentSearchingStatusChange,
        isShowInConversationSearch: onIsShowInConversationSearchChange
      });
    });
    function closeGlobalSearch() {
      common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchingStatus", {
        isSearching: false,
        searchType: props.searchType
      });
    }
    function closeInConversationSearch() {
      common_vendor.Jt.update(common_vendor.o.SEARCH, "isShowInConversationSearch", false);
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: _ctx.searchType === "global" || (_ctx.searchType === "conversation" || !_ctx.searchType && common_vendor.unref(TUIKit_utils_env.isUniFrameWork)) && common_vendor.unref(isShowInConversationSearch)
      }, _ctx.searchType === "global" || (_ctx.searchType === "conversation" || !_ctx.searchType && common_vendor.unref(TUIKit_utils_env.isUniFrameWork)) && common_vendor.unref(isShowInConversationSearch) ? common_vendor.e({
        b: _ctx.searchType === "global"
      }, _ctx.searchType === "global" ? common_vendor.e({
        c: common_vendor.p({
          searchType: _ctx.searchType
        }),
        d: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5-global-header"),
        e: common_vendor.unref(searchingStatus)
      }, common_vendor.unref(searchingStatus) ? {
        f: common_vendor.p({
          searchType: _ctx.searchType
        }),
        g: common_vendor.p({
          popupPosition: "bottom",
          searchType: _ctx.searchType
        })
      } : {}, {
        h: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5-global")
      }) : _ctx.searchType === "conversation" && common_vendor.unref(isShowInConversationSearch) || common_vendor.unref(TUIKit_utils_env.isUniFrameWork) ? {
        j: common_vendor.p({
          searchType: _ctx.searchType ? _ctx.searchType : "conversation"
        }),
        k: common_vendor.p({
          searchType: _ctx.searchType ? _ctx.searchType : "conversation"
        }),
        l: common_vendor.o$1(closeInConversationSearch),
        m: common_vendor.p({
          popupPosition: "aside",
          searchType: _ctx.searchType ? _ctx.searchType : "conversation"
        }),
        n: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5-conversation")
      } : {}, {
        i: _ctx.searchType === "conversation" && common_vendor.unref(isShowInConversationSearch) || common_vendor.unref(TUIKit_utils_env.isUniFrameWork),
        o: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5"),
        p: common_vendor.n(`tui-search-main-${_ctx.searchType ? _ctx.searchType : "conversation"}`),
        q: common_vendor.n(common_vendor.unref(isFullScreen) && "tui-search-h5-full-screen")
      }) : {});
    };
  }
});
const MiniProgramPage$3 = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main$3, [["__scopeId", "data-v-fdde69b1"]]);
new TUIKit_components_TUISearch_server.TUISearchServer();
if (!Math) {
  (SelectFriend + ContactSearch + ContactList + ContactInfo)();
}
const SelectFriend = () => "./TUIContact/select-friend/index.js";
const ContactSearch = () => "./TUIContact/contact-search/index.js";
const ContactList = () => "./TUIContact/contact-list/index.js";
const ContactInfo = () => "./TUIContact/contact-info/index.js";
const _sfc_main$2 = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  props: {
    // web/h5 single page application display format, uniapp please ignore
    displayType: {
      type: String,
      default: "contactList",
      // "contactList" /  "selectFriend"
      require: false
    }
  },
  emits: ["switchConversation"],
  setup(__props, { emit: __emit }) {
    const emits = __emit;
    const props = __props;
    const displayTypeRef = common_vendor.ref(props.displayType || "contactList");
    const isShowSelectFriend = common_vendor.ref(false);
    const isShowContactList = common_vendor.ref(true);
    const isShowContactInfo = common_vendor.ref(true);
    common_vendor.watchEffect(() => {
      isShowContactList.value = (props == null ? void 0 : props.displayType) !== "selectFriend";
    });
    common_vendor.Jt.watch(common_vendor.o.CUSTOM, {
      isShowSelectFriendComponent: (data) => {
        var _a, _b, _c;
        if (!TUIKit_utils_env.isUniFrameWork && (props == null ? void 0 : props.displayType) === "selectFriend") {
          isShowSelectFriend.value = data;
          isShowContactList.value = false;
          return;
        }
        if (data) {
          isShowSelectFriend.value = true;
          if (TUIKit_utils_env.isUniFrameWork) {
            displayTypeRef.value = "selectFriend";
            (_a = common_vendor.i) == null ? void 0 : _a.hideTabBar();
          }
        } else {
          isShowSelectFriend.value = false;
          if (TUIKit_utils_env.isUniFrameWork) {
            displayTypeRef.value = props.displayType;
            (_c = (_b = common_vendor.i) == null ? void 0 : _b.showTabBar()) == null ? void 0 : _c.catch(() => {
            });
          }
        }
      },
      currentContactInfo: (contactInfo) => {
        var _a;
        isShowContactInfo.value = TUIKit_utils_env.isPC || contactInfo && typeof contactInfo === "object" && ((_a = Object.keys(contactInfo)) == null ? void 0 : _a.length) > 0;
      }
    });
    const switchConversation = (data) => {
      var _a;
      TUIKit_utils_env.isUniFrameWork && ((_a = common_vendor.i) == null ? void 0 : _a.navigateTo({
        url: "/TUIKit/components/TUIChat/index"
      }));
      emits("switchConversation", data);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(isShowSelectFriend)
      }, common_vendor.unref(isShowSelectFriend) ? {} : common_vendor.unref(isShowContactList) ? common_vendor.e({
        c: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-contact-h5-left-list"),
        d: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-contact-h5-left"),
        e: common_vendor.unref(isShowContactInfo)
      }, common_vendor.unref(isShowContactInfo) ? {
        f: common_vendor.o$1(switchConversation),
        g: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-contact-h5-right")
      } : {}, {
        h: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-contact-h5")
      }) : {}, {
        b: common_vendor.unref(isShowContactList)
      });
    };
  }
});
const MiniProgramPage$2 = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main$2, [["__scopeId", "data-v-32d81a7d"]]);
TUIKit_components_TUIContact_server.TUIContactServer.getInstance();
if (!Math) {
  (CreateGroup + ManageGroup + SelectMember)();
}
const CreateGroup = () => "./TUIGroup/create-group/index.js";
const ManageGroup = () => "./TUIGroup/manage-group/index.js";
const SelectMember = () => "./TUIGroup/select-member/index.js";
const _sfc_main$1 = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const isShowCreateGroup = common_vendor.ref(false);
    const isShowManageGroup = common_vendor.ref(false);
    const isShowSelectMember = common_vendor.ref(false);
    common_vendor.Jt.watch(common_vendor.o.GRP, {
      isShowCreateComponent: (data) => {
        if (data) {
          isShowCreateGroup.value = true;
        } else {
          isShowCreateGroup.value = false;
        }
      },
      isShowManageComponent: (data) => {
        if (data) {
          isShowManageGroup.value = true;
        } else {
          isShowManageGroup.value = false;
        }
      },
      isShowSelectComponent: (data) => {
        if (data) {
          isShowSelectMember.value = true;
        } else {
          isShowSelectMember.value = false;
        }
      }
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(isShowCreateGroup)
      }, common_vendor.unref(isShowCreateGroup) ? {} : {}, {
        b: common_vendor.unref(isShowManageGroup)
      }, common_vendor.unref(isShowManageGroup) ? {} : {}, {
        c: common_vendor.unref(isShowSelectMember)
      }, common_vendor.unref(isShowSelectMember) ? {} : {}, {
        d: common_vendor.n((common_vendor.unref(isShowCreateGroup) || common_vendor.unref(isShowManageGroup) || common_vendor.unref(isShowSelectMember)) && "tui-group")
      });
    };
  }
});
const MiniProgramPage$1 = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main$1, [["__scopeId", "data-v-61238656"]]);
TUIKit_components_TUIGroup_server.TUIGroupServer.getInstance();
if (!Math) {
  (TUISearch + ConversationHeader + ConversationNetwork + ConversationList + tabBar)();
}
const TUISearch = () => "./TUISearch/index.js";
const ConversationList = () => "./TUIConversation/conversation-list/index.js";
const ConversationHeader = () => "./TUIConversation/conversation-header/index.js";
const ConversationNetwork = () => "./TUIConversation/conversation-network/index.js";
const tabBar = () => "../../components/tabBar/tabBar.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  emits: ["handleSwitchConversation"],
  setup(__props, { emit: __emit }) {
    const emits = __emit;
    const totalUnreadCount = common_vendor.ref(0);
    const headerRef = common_vendor.ref();
    const conversationListDomRef = common_vendor.ref();
    const touchX = common_vendor.ref(0);
    const touchY = common_vendor.ref(0);
    const isShowConversationHeader = common_vendor.ref(true);
    common_vendor.Jt.watch(common_vendor.o.CONV, {
      totalUnreadCount: (count) => {
        totalUnreadCount.value = count;
      }
    });
    common_vendor.Jt.watch(common_vendor.o.CUSTOM, {
      isShowConversationHeader: (showStatus) => {
        isShowConversationHeader.value = showStatus !== false;
      }
    });
    const handleSwitchConversation = (conversationID) => {
      var _a;
      (_a = common_vendor.i) == null ? void 0 : _a.navigateTo({
        url: "/TUIKit/components/TUIChat/index"
      });
      emits("handleSwitchConversation", conversationID);
    };
    const closeChildren = () => {
      var _a, _b;
      (_a = headerRef == null ? void 0 : headerRef.value) == null ? void 0 : _a.closeChildren();
      (_b = conversationListDomRef == null ? void 0 : conversationListDomRef.value) == null ? void 0 : _b.closeChildren();
    };
    const handleClickConv = () => {
      closeChildren();
    };
    common_vendor.onHide(closeChildren);
    const handleTouchStart = (e) => {
      touchX.value = e.changedTouches[0].clientX;
      touchY.value = e.changedTouches[0].clientY;
    };
    const handleTouchEnd = (e) => {
      const x = e.changedTouches[0].clientX;
      const y = e.changedTouches[0].clientY;
      let turn = "";
      if (x - touchX.value > 50 && Math.abs(y - touchY.value) < 50) {
        turn = "right";
      } else if (x - touchX.value < -50 && Math.abs(y - touchY.value) < 50) {
        turn = "left";
      }
      if (y - touchY.value > 50 && Math.abs(x - touchX.value) < 50) {
        turn = "down";
      } else if (y - touchY.value < -50 && Math.abs(x - touchX.value) < 50) {
        turn = "up";
      }
      if (turn === "down" || turn === "up") {
        closeChildren();
      }
    };
    const getPassingRef = (ref2) => {
      ref2.value = conversationListDomRef.value;
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          searchType: "global"
        }),
        b: common_vendor.unref(isShowConversationHeader)
      }, common_vendor.unref(isShowConversationHeader) ? {
        c: common_vendor.sr(headerRef, "40b33296-1", {
          "k": "headerRef"
        })
      } : {}, {
        d: common_vendor.sr(conversationListDomRef, "40b33296-3", {
          "k": "conversationListDomRef"
        }),
        e: common_vendor.o$1(handleSwitchConversation),
        f: common_vendor.o$1(getPassingRef),
        g: common_vendor.o$1(handleClickConv),
        h: common_vendor.o$1(handleTouchStart),
        i: common_vendor.o$1(handleTouchEnd),
        j: common_vendor.p({
          tabIndex: 3
        })
      });
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-40b33296"]]);
exports.MiniProgramPage = MiniProgramPage;
exports.MiniProgramPage$1 = MiniProgramPage$4;
exports.MiniProgramPage$2 = MiniProgramPage$2;
exports.MiniProgramPage$3 = MiniProgramPage$1;
exports.MiniProgramPage$4 = MiniProgramPage$3;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/TUIKit/components/index.js.map
