"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 _hoisted_1 = { class: "local-screen-info" };
const _hoisted_2 = { class: "text" };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "LocalScreenViewUI",
  setup(__props) {
    const { t } = uikitBaseComponentVue3.useUIKit();
    const { stopScreenShare } = room.useDeviceState();
    const localScreenContainerRef = vue.ref();
    const isMiniRegion = vue.ref(false);
    function handleStopSharing() {
      uikitBaseComponentVue3.TUIMessageBox.confirm({
        title: t("ScreenShare.EndSharing"),
        content: t("ScreenShare.StopSharingConfirm"),
        callback: async (action) => {
          if (action === "confirm") {
            await stopScreenShare();
          }
        }
      });
    }
    const resizeObserver = new ResizeObserver(() => {
      var _a;
      isMiniRegion.value = ((_a = localScreenContainerRef.value) == null ? void 0 : _a.offsetHeight) <= 200;
    });
    vue.onMounted(() => {
      resizeObserver.observe(localScreenContainerRef.value);
    });
    vue.onBeforeUnmount(() => {
      resizeObserver.unobserve(localScreenContainerRef.value);
      resizeObserver.disconnect();
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", {
        ref_key: "localScreenContainerRef",
        ref: localScreenContainerRef,
        class: "local-screen-container"
      }, [
        vue.createElementVNode("div", {
          class: vue.normalizeClass(["local-screen-control-container", { mini: isMiniRegion.value }])
        }, [
          vue.createElementVNode("div", _hoisted_1, [
            vue.createVNode(vue.unref(uikitBaseComponentVue3.IconScreenSharing), { size: "44" }),
            vue.createElementVNode("span", _hoisted_2, vue.toDisplayString(vue.unref(t)("RoomView.YouAreSharingTheScreen")), 1)
          ]),
          vue.createVNode(vue.unref(uikitBaseComponentVue3.TUIButton), {
            color: "red",
            type: "primary",
            onClick: handleStopSharing
          }, {
            default: vue.withCtx(() => [
              vue.createTextVNode(vue.toDisplayString(vue.unref(t)("RoomView.EndSharing")), 1)
            ]),
            _: 1
          })
        ], 2)
      ], 512);
    };
  }
});
exports.default = _sfc_main;
