import { defineComponent, computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, toDisplayString, unref, createVNode } from "vue";
import { useUIKit, IconCopy } from "@tencentcloud/uikit-base-component-vue3";
import { useRoomState } from "tuikit-atomicx-vue3/room";
import { useCopy } from "../../hooks/useCopy.mjs";
import { generateRoomLink } from "../../utils/utils.mjs";
const _hoisted_1 = { class: "room-info" };
const _hoisted_2 = { class: "room-info-item" };
const _hoisted_3 = { class: "room-info-title" };
const _hoisted_4 = { class: "room-info-item" };
const _hoisted_5 = { class: "room-info-label" };
const _hoisted_6 = { class: "room-info-value" };
const _hoisted_7 = { class: "room-info-item" };
const _hoisted_8 = { class: "room-info-label" };
const _hoisted_9 = { class: "room-info-value" };
const _hoisted_10 = {
  key: 0,
  class: "room-info-item"
};
const _hoisted_11 = { class: "room-info-label" };
const _hoisted_12 = { class: "room-info-value" };
const _hoisted_13 = { class: "room-info-item" };
const _hoisted_14 = { class: "room-info-label" };
const _hoisted_15 = { class: "room-info-value" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "CurrentRoomInfo",
  setup(__props) {
    const { t } = useUIKit();
    const { currentRoom } = useRoomState();
    const { copy } = useCopy();
    const roomLink = computed(() => {
      var _a;
      if (!((_a = currentRoom.value) == null ? void 0 : _a.roomId)) {
        return "";
      }
      return generateRoomLink(currentRoom.value.roomId, currentRoom.value.password, currentRoom.value.roomType);
    });
    return (_ctx, _cache) => {
      var _a, _b, _c, _d, _e, _f, _g;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", _hoisted_2, [
          createElementVNode("div", _hoisted_3, toDisplayString(((_a = unref(currentRoom)) == null ? void 0 : _a.roomName) || ((_b = unref(currentRoom)) == null ? void 0 : _b.roomId)), 1)
        ]),
        createElementVNode("div", _hoisted_4, [
          createElementVNode("div", _hoisted_5, toDisplayString(unref(t)("CurrentRoomInfo.Host")), 1),
          createElementVNode("div", _hoisted_6, toDisplayString(((_c = unref(currentRoom)) == null ? void 0 : _c.roomOwner.userName) || ((_d = unref(currentRoom)) == null ? void 0 : _d.roomOwner.userId)), 1)
        ]),
        createElementVNode("div", _hoisted_7, [
          createElementVNode("div", _hoisted_8, toDisplayString(unref(t)("CurrentRoomInfo.RoomId")), 1),
          createElementVNode("div", _hoisted_9, toDisplayString((_e = unref(currentRoom)) == null ? void 0 : _e.roomId), 1),
          createElementVNode("div", {
            class: "room-info-copy",
            onClick: _cache[0] || (_cache[0] = () => {
              var _a2;
              return unref(copy)(((_a2 = unref(currentRoom)) == null ? void 0 : _a2.roomId) || "");
            })
          }, [
            createVNode(unref(IconCopy), { class: "copy-icon" }),
            createElementVNode("span", null, toDisplayString(unref(t)("CurrentRoomInfo.Copy")), 1)
          ])
        ]),
        ((_f = unref(currentRoom)) == null ? void 0 : _f.password) ? (openBlock(), createElementBlock("div", _hoisted_10, [
          createElementVNode("div", _hoisted_11, toDisplayString(unref(t)("CurrentRoomInfo.PasswordH5")), 1),
          createElementVNode("div", _hoisted_12, toDisplayString((_g = unref(currentRoom)) == null ? void 0 : _g.password), 1),
          createElementVNode("div", {
            class: "room-info-copy",
            onClick: _cache[1] || (_cache[1] = () => {
              var _a2;
              return unref(copy)(((_a2 = unref(currentRoom)) == null ? void 0 : _a2.password) || "");
            })
          }, [
            createVNode(unref(IconCopy), { class: "copy-icon" }),
            createElementVNode("span", null, toDisplayString(unref(t)("CurrentRoomInfo.Copy")), 1)
          ])
        ])) : createCommentVNode("", true),
        createElementVNode("div", _hoisted_13, [
          createElementVNode("div", _hoisted_14, toDisplayString(unref(t)("CurrentRoomInfo.RoomLink")), 1),
          createElementVNode("div", _hoisted_15, toDisplayString(roomLink.value), 1),
          createElementVNode("div", {
            class: "room-info-copy",
            onClick: _cache[2] || (_cache[2] = () => unref(copy)(roomLink.value))
          }, [
            createVNode(unref(IconCopy), { class: "copy-icon" }),
            createElementVNode("span", null, toDisplayString(unref(t)("CurrentRoomInfo.Copy")), 1)
          ])
        ])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
