import { createApp } from 'vue'

import App from './App.vue'
import router from './router'
import './styles/index.scss'
import './styles/tailwindcss.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import 'virtual:svg-icons-register'
import { initService } from '@/utils/request.ts'
import { setupStore, useConfigStore } from '@/stores'
import { setupDirective } from '@/ directive'

async function init() {
  const configStore = useConfigStore()
  await configStore.initConfig()
  const app = createApp(App)
  setupStore(app)
  setupDirective(app)
  initService()
  document.title = configStore.config.centerTitle
  app.use(router)
  app.mount('#app')
}

void init()
