"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const IconButton = require("../../common/base/IconButton.vue.js");
const useMoreControlHooks = require("./useMoreControlHooks.js");
const ChatControl_vue_vue_type_script_setup_true_lang = require("../ChatControl.vue.js");
const InviteControl = require("../InviteControl.vue.js");
const ContactControl = require("../ContactControl.vue.js");
const room = require("../../../stores/room.js");
const ExtensionIcon = require("../../common/icons/ExtensionIcon.vue.js");
const useMitt = require("../../../hooks/useMitt.js");
const vTap = require("../../../directives/vTap.js");
require("../../../services/main.js");
const roomService = require("../../../services/roomService.js");
require("../../../locales/index.js");
require("@tencentcloud/tuiroom-engine-js");
require("mitt");
require("../../../services/manager/roomActionManager.js");
require("@tencentcloud/tui-core");
const _hoisted_1 = {
  key: 0,
  class: "more-control-container"
};
const _hoisted_2 = { class: "control-compent" };
const _hoisted_3 = { class: "close" };
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
  __name: "MoreControlH5",
  setup(__props) {
    const moreControlConfig = roomService.roomService.getComponentConfig("MoreControl");
    const showMoreContent = Vue.ref(false);
    const moreContentRef = Vue.ref();
    const { t, sidebarName } = useMoreControlHooks.default();
    const roomStore = room.useRoomStore();
    function showMore() {
      showMoreContent.value = true;
    }
    function handleCancelControl() {
      showMoreContent.value = false;
    }
    function handleControlClick(name) {
      useMitt.default.emit("experience-communication", name);
    }
    function handleDocumentClick(event) {
      if (showMoreContent.value && !moreContentRef.value.contains(event.target)) {
        showMoreContent.value = false;
      }
    }
    Vue.onMounted(() => {
      document == null ? void 0 : document.addEventListener("click", handleDocumentClick, true);
    });
    Vue.onUnmounted(() => {
      document == null ? void 0 : document.removeEventListener("click", handleDocumentClick, true);
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", null, [
        Vue.unref(moreControlConfig).visible ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
          Vue.withDirectives(Vue.createVNode(IconButton.default, {
            "is-active": Vue.unref(sidebarName) === "more",
            title: Vue.unref(t)("More"),
            icon: ExtensionIcon.default
          }, null, 8, ["is-active", "title"]), [
            [Vue.unref(vTap.default), showMore]
          ])
        ])) : Vue.createCommentVNode("", true),
        showMoreContent.value ? (Vue.openBlock(), Vue.createElementBlock("div", {
          key: 1,
          ref_key: "moreContentRef",
          ref: moreContentRef,
          class: "show-more-content"
        }, [
          Vue.createElementVNode("div", _hoisted_2, [
            Vue.unref(roomStore).isSpeakAfterTakingSeatMode ? (Vue.openBlock(), Vue.createBlock(ChatControl_vue_vue_type_script_setup_true_lang.default, {
              key: 0,
              onClick: _cache[0] || (_cache[0] = ($event) => handleControlClick("chatControl"))
            })) : Vue.createCommentVNode("", true),
            Vue.createVNode(ContactControl.default, {
              onClick: _cache[1] || (_cache[1] = ($event) => handleControlClick("contactControl"))
            }),
            Vue.createVNode(InviteControl.default, {
              onClick: _cache[2] || (_cache[2] = ($event) => handleControlClick("inviteControl"))
            })
          ]),
          Vue.withDirectives((Vue.openBlock(), Vue.createElementBlock("div", _hoisted_3, [
            Vue.createTextVNode(Vue.toDisplayString(Vue.unref(t)("Cancel")), 1)
          ])), [
            [Vue.unref(vTap.default), handleCancelControl]
          ])
        ], 512)) : Vue.createCommentVNode("", true)
      ]);
    };
  }
});
exports.default = _sfc_main;
