
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import i18n from "./i18n/index.js";
import "@/assets/style/reset.css";
import "@/assets/style/index.scss";
import "@/assets/style/common.scss";


// SVG sprite 虚拟模块（必须引入才能注入 symbol）
import "virtual:svg-icons-register";

import SvgIcon from "@/components/SvgIcon/index.vue";

const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
const app = createApp(App);

// 注册全局 SVG 图标组件
app.component("SvgIcon", SvgIcon);

app.use(i18n);
app.use(pinia);
app.use(router);
app.use(ElementPlus);
app.mount("#app");

// 初始化主题
import { useThemeStore } from "./stores/theme";
const themeStore = useThemeStore();

// 应用保存的主题到 html
themeStore.applyTheme(themeStore.themeValue);
