import { defineComponent, computed, unref, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, Fragment, renderList, normalizeClass, createBlock, createCommentVNode } from "vue";
import SvgIcon from "../common/base/SvgIcon.vue.mjs";
import AudioSettingTab from "../common/AudioSettingTab.vue.mjs";
import VideoSettingTab from "../common/VideoSettingTab.vue.mjs";
import { useBasicStore } from "../../stores/basic.mjs";
import { storeToRefs } from "pinia";
import { SettingMode } from "../../constants/render.mjs";
import { useI18n } from "../../locales/index.mjs";
import CloseIcon from "../common/icons/CloseIcon.vue.mjs";
const _hoisted_1 = { class: "setting-container" };
const _hoisted_2 = { class: "setting-header" };
const _hoisted_3 = { class: "setting-title" };
const _hoisted_4 = { class: "setting-body" };
const _hoisted_5 = { class: "setting-tabs" };
const _hoisted_6 = ["onClick"];
const _hoisted_7 = { class: "setting-content" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  setup(__props) {
    const { t } = useI18n();
    const basicStore = useBasicStore();
    const { showSettingDialog, activeSettingTab } = storeToRefs(basicStore);
    const settingTabsTitleList = computed(() => [
      { label: t("Audio settings"), value: "audio" },
      { label: t("Camera settings"), value: "video" }
    ]);
    function handleUpdateActiveTab(tabTitle) {
      basicStore.setActiveSettingTab(tabTitle);
    }
    function handleCloseSettingDialog() {
      basicStore.setShowSettingDialog(false);
    }
    function handleOverlayClick(event) {
      if (event.target !== event.currentTarget) {
        return;
      }
      handleCloseSettingDialog();
    }
    return (_ctx, _cache) => {
      return unref(showSettingDialog) ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: "overlay-container overlay",
        onClick: handleOverlayClick
      }, [
        createElementVNode("div", _hoisted_1, [
          createElementVNode("div", _hoisted_2, [
            createElementVNode("span", _hoisted_3, toDisplayString(unref(t)("Settings")), 1),
            createVNode(SvgIcon, {
              class: "close-icon",
              icon: CloseIcon,
              onClick: handleCloseSettingDialog
            })
          ]),
          createElementVNode("div", _hoisted_4, [
            createElementVNode("div", _hoisted_5, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(settingTabsTitleList.value, (item, index) => {
                return openBlock(), createElementBlock("div", {
                  key: index,
                  class: normalizeClass([
                    "tabs-title",
                    `${unref(activeSettingTab) === item.value ? "active" : ""}`
                  ]),
                  onClick: ($event) => handleUpdateActiveTab(item.value)
                }, toDisplayString(item.label), 11, _hoisted_6);
              }), 128))
            ]),
            _cache[0] || (_cache[0] = createElementVNode("div", { class: "divide-line" }, null, -1)),
            createElementVNode("div", _hoisted_7, [
              unref(activeSettingTab) === "audio" ? (openBlock(), createBlock(AudioSettingTab, {
                key: 0,
                class: "setting-tab",
                mode: unref(SettingMode).DETAIL,
                theme: "white"
              }, null, 8, ["mode"])) : unref(activeSettingTab) === "video" ? (openBlock(), createBlock(VideoSettingTab, {
                key: 1,
                class: "setting-tab",
                "with-preview": true,
                theme: "white"
              })) : createCommentVNode("", true)
            ])
          ])
        ])
      ])) : createCommentVNode("", true);
    };
  }
});
export {
  _sfc_main as default
};
