import { defineComponent, openBlock, createElementBlock, withDirectives, createVNode, unref } from "vue";
import useDeviceManager from "../../../hooks/useDeviceManager.mjs";
import SvgIcon from "../../common/base/SvgIcon.vue.mjs";
import { storeToRefs } from "pinia";
import CameraSwitchIcon from "../../common/icons/CameraSwitchIcon.vue.mjs";
import { useBasicStore } from "../../../stores/basic.mjs";
import vTap from "../../../directives/vTap.mjs";
const _hoisted_1 = { class: "camera-icon" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "SwitchCamera",
  setup(__props) {
    const basicStore = useBasicStore();
    const { isFrontCamera } = storeToRefs(basicStore);
    const { deviceManager } = useDeviceManager();
    async function handleSwitchCamera() {
      var _a;
      await ((_a = deviceManager.instance) == null ? void 0 : _a.switchCamera({
        isFrontCamera: !isFrontCamera.value
      }));
      basicStore.setIsFrontCamera(!isFrontCamera.value);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        withDirectives(createVNode(SvgIcon, { icon: CameraSwitchIcon }, null, 512), [
          [unref(vTap), handleSwitchCamera]
        ])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
