/*
 * @Author: sjl
 * @Date: 2023-04-08 11:51:03
 * @Descripttion:
 */
import '/@/design/index.less';
// Register windi
import 'virtual:windi.css';
import './main.less';
// Register icon sprite
import 'virtual:svg-icons-register';
import App from './App.vue';
import { createApp } from 'vue';
import { initAppConfigStore } from '/@/logics/initAppConfig';
import { setupErrorHandle } from '/@/logics/error-handle';
import { router, setupRouter } from '/@/router';
import { setupRouterGuard } from '/@/router/guard';
import { setupStore } from '/@/store';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
import '/@/assets/iconfont/iconfont';
import { useWebSecurityPolicy } from './hooks/web/useWebSecurityPolicy';
import 'core-js/es/array/at';
// import '/@/utils/screen/screenAdapt.js'
import '/@/utils/screen/drag.js'
import {drag} from '/@/utils/drag.js'
import * as echarts from 'echarts';
// import TimelineSliderVue from 'timeline-slider-vue';
// import 'timeline-slider-vue/lib/timeline-slider-vue.css';
import 'ant-design-vue/dist/antd.less';
import eventBus from '/@/utils/eventBus';
import TFMC from '/@/utils/TFMC.js';
window.TFMC = TFMC;
window.eventBus = eventBus;
eventBus.on('minapp', (e) => {
  console.log('minapp', e);
});
if (import.meta.env.DEV) {
  import('ant-design-vue/dist/antd.less');
}
async function bootstrap() {
  useWebSecurityPolicy();

  const app = createApp(App);
  
  app.directive('drag', drag)
  app.config.globalProperties.$echarts = echarts;
  // app.use(TimelineSliderVue);
  // Configure store
  setupStore(app);
  
  // Initialize internal system configuration
  initAppConfigStore();

  // Register global components
  registerGlobComp(app);

  // Multilingual configuration
  await setupI18n(app);

  // Configure routing
  setupRouter(app);

  // router-guard
  setupRouterGuard(router);

  // Register global directive
  setupGlobDirectives(app);

  // Configure global error handling
  setupErrorHandle(app);

  // Mount when the route is ready
  // https://next.router.vuejs.org/api/#isready
  await router.isReady();

  app.mount('#app', true);
}

void bootstrap();
