import { createApp } from 'vue';

import * as Sentry from '@sentry/vue';
import { VueQueryPlugin } from '@tanstack/vue-query';
import * as VtjCharts from '@vtj/charts';
import { IconsPlugin } from '@vtj/icons';
import * as VtjUI from '@vtj/ui';
import Antd from 'ant-design-vue';
import ElementPlus from 'element-plus';

import App from './App.vue';

import 'element-plus/dist/index.css';
import '@vtj/ui/dist/style.css';
import './style.css';

const app = createApp(App);

Sentry.init({
  app,
  dsn: 'https://44939af86b1f2bb9890579556f01204e@o4509037014482944.ingest.de.sentry.io/4509037067173968',
  integrations: [
    // 异常路径回放
    Sentry.replayIntegration(),
    // 异常端信息追踪
    Sentry.browserTracingIntegration(),
  ],
  // Session Replay
  replaysSessionSampleRate: 0.1, // This 1sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
  replaysOnErrorSampleRate: 1, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});

// 批量注册组件
Object.entries(VtjUI).forEach(([name, component]) => {
  app.component(name, component);
});
Object.entries(VtjCharts).forEach(([name, component]) => {
  app.component(name, component);
});

app
  .use(Antd)
  .use(ElementPlus)
  .use(IconsPlugin)
  .use(VueQueryPlugin)
  .mount('#y-code-renderer');
