import App from './App.vue';
import { createApp } from 'vue';
import { initAppConfigStore } from '/@/logics/initAppConfig';
import { router, setupRouter } from '/@/router';
import { setupRouterGuard } from '/@/router/guard';
import { setupStore } from '/@/store';
import { setupGlobDirectives } from '/@/directives';
import { registerGlobComp } from '/@/components/registerGlobComp';
// Register icon sprite
import 'virtual:svg-icons-register';

// 引入重置样式
import '/@/design/reset.css';
// 导入公共样式
import '/@/design/index.less';
// 一定要在main.ts中导入tailwind.css，防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
import '/@/design/tailwind.css';
// 导入 ant 样式
import 'ant-design-vue/dist/antd.variable.min.css';

// 导入字体图标
import './assets/iconfont/iconfont.js';
import './assets/iconfont/iconfont.css';

import 'animate.css';

async function bootstrap() {
  const app = createApp(App);
  // Configure store
  setupStore(app);

  // Initialize internal system configuration
  initAppConfigStore();

  // Register global components
  registerGlobComp(app);

  // Configure routing
  setupRouter(app);

  // router-guard
  setupRouterGuard(router);

  // Register global directive
  setupGlobDirectives(app);

  // https://next.router.vuejs.org/api/#isready
  // await router.isReady();

  app.mount('#app');
}

bootstrap();
