"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 _hoisted_1 = { class: "room-button" };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "index",
  emits: ["join-room"],
  setup(__props, { emit: __emit }) {
    const { t } = uikitBaseComponentVue3.useUIKit();
    const emit = __emit;
    const inputVisible = vue.ref(false);
    const roomId = vue.ref("");
    const showInput = () => {
      inputVisible.value = true;
    };
    const handleJoinRoom = () => {
      emit("join-room", roomId.value);
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
        !inputVisible.value ? (vue.openBlock(), vue.createBlock(vue.unref(uikitBaseComponentVue3.TUIButton), {
          key: 0,
          class: "button",
          type: "primary",
          size: "large",
          icon: vue.unref(uikitBaseComponentVue3.IconEnterRoom),
          onClick: showInput
        }, {
          default: vue.withCtx(() => [
            vue.createTextVNode(vue.toDisplayString(vue.unref(t)("Button.JoinRoom")), 1)
          ]),
          _: 1
        }, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(vue.unref(uikitBaseComponentVue3.TUIInput), {
          key: 1,
          modelValue: roomId.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => roomId.value = $event),
          size: "large",
          placeholder: vue.unref(t)("Button.EnterRoomId"),
          class: "input",
          border: false,
          onDone: handleJoinRoom
        }, {
          suffix: vue.withCtx(() => [
            vue.createVNode(vue.unref(uikitBaseComponentVue3.IconEnterRoom), {
              size: "24",
              class: "icon-button",
              onClick: handleJoinRoom
            })
          ]),
          _: 1
        }, 8, ["modelValue", "placeholder"]))
      ]);
    };
  }
});
exports.default = _sfc_main;
