"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 useCopy = require("../../hooks/useCopy.js");
const utils = require("../../utils/utils.js");
const _hoisted_1 = { class: "room-invite-content" };
const _hoisted_2 = { class: "invite-item" };
const _hoisted_3 = { class: "invite-label" };
const _hoisted_4 = { class: "invite-value" };
const _hoisted_5 = {
  key: 0,
  class: "invite-item"
};
const _hoisted_6 = { class: "invite-label" };
const _hoisted_7 = { class: "invite-value" };
const _hoisted_8 = { class: "invite-item" };
const _hoisted_9 = { class: "invite-label" };
const _hoisted_10 = { class: "invite-value room-link" };
const _hoisted_11 = { class: "room-link-text" };
const _hoisted_12 = { class: "invite-actions" };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "RoomInviteSuccessDialog",
  props: {
    visible: { type: Boolean },
    roomId: {},
    password: {},
    roomType: {}
  },
  emits: ["update:visible"],
  setup(__props, { emit: __emit }) {
    const { t } = uikitBaseComponentVue3.useUIKit();
    const { copy } = useCopy.useCopy();
    const props = __props;
    const emit = __emit;
    const visible = vue.computed({
      get: () => props.visible,
      set: (value) => emit("update:visible", value)
    });
    const roomLink = vue.computed(() => {
      if (!props.roomId) {
        return "";
      }
      return utils.generateRoomLink(props.roomId, props.password, props.roomType);
    });
    const copyRoomIdAndLink = async () => {
      if (!props.roomId) {
        uikitBaseComponentVue3.TUIToast.error({ message: t("RoomShare.NoRoomInfo") });
        return;
      }
      const roomInfoLines = [
        `${t("RoomShare.RoomId")}: ${props.roomId}`,
        props.password ? `${t("RoomShare.Password")}: ${props.password}` : null,
        `${t("RoomShare.RoomLink")}: ${roomLink.value}`
      ].filter(Boolean);
      const roomInfoText = roomInfoLines.join("\n");
      await copy(roomInfoText);
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.unref(uikitBaseComponentVue3.TUIDialog), {
        visible: visible.value,
        "onUpdate:visible": _cache[3] || (_cache[3] = ($event) => visible.value = $event),
        title: vue.unref(t)("RoomShare.BookingSuccess")
      }, {
        footer: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
          vue.createElementVNode("div", null, null, -1)
        ])]),
        default: vue.withCtx(() => [
          vue.createElementVNode("div", _hoisted_1, [
            vue.createElementVNode("div", _hoisted_2, [
              vue.createElementVNode("div", _hoisted_3, vue.toDisplayString(vue.unref(t)("RoomShare.RoomId")), 1),
              vue.createElementVNode("div", _hoisted_4, [
                vue.createTextVNode(vue.toDisplayString(__props.roomId) + " ", 1),
                vue.createVNode(vue.unref(uikitBaseComponentVue3.IconCopy), {
                  class: "copy-icon",
                  onClick: _cache[0] || (_cache[0] = () => vue.unref(copy)(__props.roomId))
                })
              ])
            ]),
            __props.password ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
              vue.createElementVNode("div", _hoisted_6, vue.toDisplayString(vue.unref(t)("RoomShare.Password")), 1),
              vue.createElementVNode("div", _hoisted_7, [
                vue.createTextVNode(vue.toDisplayString(__props.password) + " ", 1),
                vue.createVNode(vue.unref(uikitBaseComponentVue3.IconCopy), {
                  class: "copy-icon",
                  onClick: _cache[1] || (_cache[1] = () => vue.unref(copy)(__props.password || ""))
                })
              ])
            ])) : vue.createCommentVNode("", true),
            vue.createElementVNode("div", _hoisted_8, [
              vue.createElementVNode("div", _hoisted_9, vue.toDisplayString(vue.unref(t)("RoomShare.RoomLink")), 1),
              vue.createElementVNode("div", _hoisted_10, [
                vue.createElementVNode("span", _hoisted_11, vue.toDisplayString(roomLink.value), 1),
                vue.createVNode(vue.unref(uikitBaseComponentVue3.IconCopy), {
                  class: "copy-icon",
                  onClick: _cache[2] || (_cache[2] = () => vue.unref(copy)(roomLink.value))
                })
              ])
            ]),
            vue.createElementVNode("div", _hoisted_12, [
              vue.createVNode(vue.unref(uikitBaseComponentVue3.TUIButton), {
                type: "primary",
                size: "large",
                class: "copy-button",
                onClick: copyRoomIdAndLink
              }, {
                default: vue.withCtx(() => [
                  vue.createTextVNode(vue.toDisplayString(vue.unref(t)("RoomShare.CopyMeetingIdAndLink")), 1)
                ]),
                _: 1
              })
            ])
          ])
        ]),
        _: 1
      }, 8, ["visible", "title"]);
    };
  }
});
exports.default = _sfc_main;
