"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.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_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 }) {
    common_vendor.onLoad((options) => {
      TUIKit_components_TUIChat_entryChatOnly.initChat(options);
    });
    common_vendor.onUnload(() => {
      TUIKit_components_TUIChat_entryChatOnly.logout(false).then(() => {
      }).catch(() => {
      });
    });
    const emits = __emit;
    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.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();
    });
    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 closeChat = (conversationID) => {
      emits("closeChat", conversationID);
      reset();
    };
    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 Returnfunc() {
      common_vendor.index.navigateBack({
        delta: 1
      });
    }
    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_assets._imports_0,
        b: common_vendor.o$1(Returnfunc),
        c: common_assets._imports_1,
        d: !common_vendor.unref(currentConversationID)
      }, !common_vendor.unref(currentConversationID) ? {
        e: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-default")
      } : {}, {
        f: common_vendor.unref(currentConversationID)
      }, common_vendor.unref(currentConversationID) ? common_vendor.e({
        g: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-H5-header"),
        h: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && "tui-chat-uniapp-header"),
        i: common_vendor.o$1(closeChat),
        j: common_vendor.o$1(handleGroup),
        k: common_vendor.p({
          isGroup: common_vendor.unref(isGroup),
          headerExtensionList: common_vendor.unref(headerExtensionList)
        }),
        l: common_vendor.o$1(toggleMultipleSelectMode),
        m: common_vendor.sr(messageListRef, "04dfedea-2", {
          "k": "messageListRef"
        }),
        n: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-message-list"),
        o: common_vendor.o$1(handleEditor),
        p: common_vendor.o$1(() => changeToolbarDisplayType("none")),
        q: common_vendor.o$1(toggleMultipleSelectMode),
        r: common_vendor.p({
          isGroup: common_vendor.unref(isGroup),
          groupID: common_vendor.unref(groupID),
          isNotInGroup: common_vendor.unref(isNotInGroup),
          isMultipleSelectMode: common_vendor.unref(isMultipleSelectMode)
        }),
        s: common_vendor.unref(isNotInGroup)
      }, common_vendor.unref(isNotInGroup) ? {
        t: common_vendor.t(common_vendor.unref(leaveGroupReasonText)),
        v: common_vendor.unref(TUIKit_utils_env.isMobile) ? 1 : ""
      } : common_vendor.unref(isMultipleSelectMode) ? {
        x: common_vendor.o$1(oneByOneForwardMessage),
        y: common_vendor.o$1(mergeForwardMessage),
        z: common_vendor.o$1(toggleMultipleSelectMode)
      } : common_vendor.e({
        A: common_vendor.unref(isInputToolbarShow)
      }, common_vendor.unref(isInputToolbarShow) ? {
        B: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-message-input-toolbar"),
        C: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && "tui-chat-uni-message-input-toolbar"),
        D: common_vendor.o$1(insertEmoji),
        E: common_vendor.o$1(changeToolbarDisplayType),
        F: common_vendor.o$1(scrollToLatestMessage),
        G: common_vendor.p({
          displayType: common_vendor.unref(inputToolbarDisplayType)
        })
      } : {}, {
        H: common_vendor.sr(messageInputRef, "04dfedea-5", {
          "k": "messageInputRef"
        }),
        I: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5-message-input"),
        J: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && "tui-chat-uni-message-input"),
        K: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isWeChat) && "tui-chat-wx-message-input"),
        L: common_vendor.o$1(changeToolbarDisplayType),
        M: 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)
        })
      }), {
        w: common_vendor.unref(isMultipleSelectMode),
        N: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-chat-h5")
      }) : {}, {
        O: !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 ? {
        P: common_vendor.t(common_vendor.unref(headerExtensionList)[0].text),
        Q: common_vendor.o$1(handleGroup)
      } : {}, {
        R: 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 + SearchMore + SearchResult + SearchContainer)();
}
const SearchInput = () => "./TUISearch/search-input/index.js";
const SearchContainer = () => "./TUISearch/search-container/index.js";
const SearchResult = () => "./TUISearch/search-result/index.js";
const SearchMore = () => "./TUISearch/search-more/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.unref(TUIKit_utils_env.isPC) || !common_vendor.unref(searchingStatus)
      }, common_vendor.unref(TUIKit_utils_env.isPC) || !common_vendor.unref(searchingStatus) ? {
        e: common_vendor.p({
          searchType: _ctx.searchType
        })
      } : {}, {
        f: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5-global-header"),
        g: common_vendor.unref(searchingStatus)
      }, common_vendor.unref(searchingStatus) ? {
        h: common_vendor.p({
          searchType: _ctx.searchType
        }),
        i: common_vendor.p({
          popupPosition: "bottom",
          searchType: _ctx.searchType
        })
      } : {}, {
        j: 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) ? {
        l: common_vendor.p({
          searchType: _ctx.searchType ? _ctx.searchType : "conversation"
        }),
        m: common_vendor.p({
          searchType: _ctx.searchType ? _ctx.searchType : "conversation"
        }),
        n: common_vendor.o$1(closeInConversationSearch),
        o: common_vendor.p({
          popupPosition: "aside",
          searchType: _ctx.searchType ? _ctx.searchType : "conversation"
        }),
        p: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5-conversation")
      } : {}, {
        k: _ctx.searchType === "conversation" && common_vendor.unref(isShowInConversationSearch) || common_vendor.unref(TUIKit_utils_env.isUniFrameWork),
        q: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-h5"),
        r: common_vendor.n(`tui-search-main-${_ctx.searchType ? _ctx.searchType : "conversation"}`),
        s: 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_assets._imports_0,
        b: common_vendor.p({
          searchType: "global"
        }),
        c: common_vendor.unref(isShowConversationHeader)
      }, common_vendor.unref(isShowConversationHeader) ? {
        d: common_vendor.sr(headerRef, "40b33296-1", {
          "k": "headerRef"
        })
      } : {}, {
        e: common_vendor.sr(conversationListDomRef, "40b33296-3", {
          "k": "conversationListDomRef"
        }),
        f: common_vendor.o$1(handleSwitchConversation),
        g: common_vendor.o$1(getPassingRef),
        h: common_vendor.o$1(handleClickConv),
        i: common_vendor.o$1(handleTouchStart),
        j: common_vendor.o$1(handleTouchEnd)
      });
    };
  }
});
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
