"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 _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "index",
  setup(__props) {
    const { isFrontCamera, switchCamera, localMirrorType, switchMirror } = room.useDeviceState();
    let lastLocalFrontCameraMirror = isFrontCamera.value ? localMirrorType.value : room.MirrorType.Auto;
    const handleSwitchCamera = async () => {
      await switchCamera({ isFrontCamera: !isFrontCamera.value });
      const newIsFrontCamera = isFrontCamera.value;
      if (newIsFrontCamera) {
        await switchMirror({ mirror: lastLocalFrontCameraMirror });
      } else {
        lastLocalFrontCameraMirror = localMirrorType.value;
        await switchMirror({ mirror: room.MirrorType.Disable });
      }
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.unref(uikitBaseComponentVue3.IconCameraSwitch), {
        size: "20",
        onClick: handleSwitchCamera
      });
    };
  }
});
exports.default = _sfc_main;
