"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const uikitBaseComponentVue3 = require("@tencentcloud/uikit-base-component-vue3");
const room = require("tuikit-atomicx-vue3/room");
const RoomInviteSuccessDialog = require("./RoomInviteSuccessDialog.vue2.js");
const _hoisted_1 = { class: "room-button" };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "index",
  setup(__props) {
    const { t } = uikitBaseComponentVue3.useUIKit();
    const { loginUserInfo } = room.useLoginState();
    const showSchedulePanel = vue.ref(false);
    const showSuccessDialog = vue.ref(false);
    const scheduledRoomId = vue.ref("");
    const scheduledPassword = vue.ref("");
    const scheduledRoomType = vue.ref(room.RoomType.Standard);
    const handleScheduleRoom = () => {
      var _a;
      if (!((_a = loginUserInfo.value) == null ? void 0 : _a.userId)) {
        uikitBaseComponentVue3.TUIToast.error({ message: t("Button.PleaseLoginFirst") });
        return;
      }
      showSchedulePanel.value = true;
    };
    const handleCancel = () => {
      showSchedulePanel.value = false;
    };
    const handleConfirm = async (roomId, scheduleOptions) => {
      showSchedulePanel.value = false;
      scheduledRoomId.value = roomId;
      scheduledPassword.value = scheduleOptions.password || "";
      showSuccessDialog.value = true;
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
        vue.createVNode(vue.unref(uikitBaseComponentVue3.TUIButton), {
          class: "button",
          size: "large",
          type: "primary",
          icon: vue.unref(uikitBaseComponentVue3.IconScheduleRoom),
          onClick: handleScheduleRoom
        }, {
          default: vue.withCtx(() => [
            vue.createTextVNode(vue.toDisplayString(vue.unref(t)("Button.ScheduleRoom")), 1)
          ]),
          _: 1
        }, 8, ["icon"]),
        vue.createVNode(vue.unref(uikitBaseComponentVue3.TUIDialog), {
          visible: showSchedulePanel.value,
          "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => showSchedulePanel.value = $event),
          title: vue.unref(t)("Button.ScheduleMeeting")
        }, {
          footer: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
            vue.createElementVNode("div", null, null, -1)
          ])]),
          default: vue.withCtx(() => [
            vue.createVNode(vue.unref(room.ScheduleRoomPanel), {
              onCancel: handleCancel,
              onConfirm: handleConfirm
            })
          ]),
          _: 1
        }, 8, ["visible", "title"]),
        vue.createVNode(RoomInviteSuccessDialog.default, {
          visible: showSuccessDialog.value,
          "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => showSuccessDialog.value = $event),
          "room-id": scheduledRoomId.value,
          password: scheduledPassword.value,
          "room-type": scheduledRoomType.value
        }, null, 8, ["visible", "room-id", "password", "room-type"])
      ]);
    };
  }
});
exports.default = _sfc_main;
