"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 InviteIcon = require("../common/icons/InviteIcon.vue.js");
const basic = require("../../stores/basic.js");
const pinia = require("pinia");
const index = require("../../locales/index.js");
const environment = require("../../utils/environment.js");
const index$1 = require("../RoomInvite/index.js");
require("../../services/main.js");
const roomService = require("../../services/roomService.js");
require("@tencentcloud/tuiroom-engine-js");
require("mitt");
require("../../services/manager/roomActionManager.js");
require("@tencentcloud/tui-core");
const vClickOutside = require("../../directives/vClickOutside.js");
const _hoisted_1 = {
  key: 0,
  class: "invite-control-container"
};
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
  __name: "InviteControl",
  setup(__props) {
    const basicStore = basic.useBasicStore();
    const { sidebarName } = pinia.storeToRefs(basicStore);
    const { t } = index.useI18n();
    const isShowInviteTab = Vue.ref(false);
    const inviteRef = Vue.ref();
    const inviteControlConfig = roomService.roomService.getComponentConfig("InviteControl");
    function toggleInviteSidebar() {
      isShowInviteTab.value = !isShowInviteTab.value;
      if (environment.isMobile) {
        if (basicStore.sidebarName === "invite") {
          basicStore.setSidebarName("");
          return;
        }
        basicStore.setSidebarName("invite");
      }
    }
    function handleCloseInvite() {
      isShowInviteTab.value = false;
    }
    function handleClickOutSide() {
      if (isShowInviteTab.value) {
        isShowInviteTab.value = false;
      }
    }
    return (_ctx, _cache) => {
      return Vue.unref(inviteControlConfig).visible ? Vue.withDirectives((Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createVNode(IconButton.default, {
          class: "invite",
          "is-active": Vue.unref(sidebarName) === "invite",
          title: Vue.unref(t)("Invite"),
          icon: InviteIcon.default,
          onClickIcon: toggleInviteSidebar
        }, null, 8, ["is-active", "title"]),
        isShowInviteTab.value ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.default), {
          key: 0,
          ref_key: "inviteRef",
          ref: inviteRef,
          onOnCloseInvite: handleCloseInvite
        }, null, 512)) : Vue.createCommentVNode("", true)
      ])), [
        [Vue.unref(vClickOutside.default), handleClickOutSide]
      ]) : Vue.createCommentVNode("", true);
    };
  }
});
exports.default = _sfc_main;
