import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import i18n from "./i18n";
import "./styles/global.css";
import "./styles/ai-md.css";
import "./styles/components.css";
import "./components/settings/settings.css"; // UX 重构阶段1:设置统一组件库全局

const app = createApp(App);

// 全局错误兜底:捕获 Vue runtime 未处理错误(组件渲染/生命周期/事件回调抛错),
// 仅记录不中断,防止整页白屏。组件级降级 UI 由 ErrorBoundary.vue 负责。
app.config.errorHandler = (err, instance, info) => {
  const tag = instance?.$options?.name || instance?.$options?.__name || "unknown";
  console.error(`[Vue error] <${tag}> ${info}:`, err);
};

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