import { defineComponent, computed, createBlock, openBlock, unref, withCtx, createElementVNode, createElementBlock, createCommentVNode, toDisplayString, createTextVNode, createVNode } from "vue";
import { useUIKit, TUIDialog, IconCopy, TUIButton, TUIToast } from "@tencentcloud/uikit-base-component-vue3";
import { useCopy } from "../../hooks/useCopy.mjs";
import { generateRoomLink } from "../../utils/utils.mjs";
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__ */ defineComponent({
  __name: "RoomInviteSuccessDialog",
  props: {
    visible: { type: Boolean },
    roomId: {},
    password: {},
    roomType: {}
  },
  emits: ["update:visible"],
  setup(__props, { emit: __emit }) {
    const { t } = useUIKit();
    const { copy } = useCopy();
    const props = __props;
    const emit = __emit;
    const visible = computed({
      get: () => props.visible,
      set: (value) => emit("update:visible", value)
    });
    const roomLink = computed(() => {
      if (!props.roomId) {
        return "";
      }
      return generateRoomLink(props.roomId, props.password, props.roomType);
    });
    const copyRoomIdAndLink = async () => {
      if (!props.roomId) {
        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 openBlock(), createBlock(unref(TUIDialog), {
        visible: visible.value,
        "onUpdate:visible": _cache[3] || (_cache[3] = ($event) => visible.value = $event),
        title: unref(t)("RoomShare.BookingSuccess")
      }, {
        footer: withCtx(() => [..._cache[4] || (_cache[4] = [
          createElementVNode("div", null, null, -1)
        ])]),
        default: withCtx(() => [
          createElementVNode("div", _hoisted_1, [
            createElementVNode("div", _hoisted_2, [
              createElementVNode("div", _hoisted_3, toDisplayString(unref(t)("RoomShare.RoomId")), 1),
              createElementVNode("div", _hoisted_4, [
                createTextVNode(toDisplayString(__props.roomId) + " ", 1),
                createVNode(unref(IconCopy), {
                  class: "copy-icon",
                  onClick: _cache[0] || (_cache[0] = () => unref(copy)(__props.roomId))
                })
              ])
            ]),
            __props.password ? (openBlock(), createElementBlock("div", _hoisted_5, [
              createElementVNode("div", _hoisted_6, toDisplayString(unref(t)("RoomShare.Password")), 1),
              createElementVNode("div", _hoisted_7, [
                createTextVNode(toDisplayString(__props.password) + " ", 1),
                createVNode(unref(IconCopy), {
                  class: "copy-icon",
                  onClick: _cache[1] || (_cache[1] = () => unref(copy)(__props.password || ""))
                })
              ])
            ])) : createCommentVNode("", true),
            createElementVNode("div", _hoisted_8, [
              createElementVNode("div", _hoisted_9, toDisplayString(unref(t)("RoomShare.RoomLink")), 1),
              createElementVNode("div", _hoisted_10, [
                createElementVNode("span", _hoisted_11, toDisplayString(roomLink.value), 1),
                createVNode(unref(IconCopy), {
                  class: "copy-icon",
                  onClick: _cache[2] || (_cache[2] = () => unref(copy)(roomLink.value))
                })
              ])
            ]),
            createElementVNode("div", _hoisted_12, [
              createVNode(unref(TUIButton), {
                type: "primary",
                size: "large",
                class: "copy-button",
                onClick: copyRoomIdAndLink
              }, {
                default: withCtx(() => [
                  createTextVNode(toDisplayString(unref(t)("RoomShare.CopyMeetingIdAndLink")), 1)
                ]),
                _: 1
              })
            ])
          ])
        ]),
        _: 1
      }, 8, ["visible", "title"]);
    };
  }
});
export {
  _sfc_main as default
};
