import { createApp } from 'vue'
import './assets/style/main.scss'
import App from './App.vue'
import router from './router/index.js'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import api from '@/api/index.js'
import elementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import bus from 'vue3-eventbus'
import * as echarts from 'echarts'
import china from 'echarts/map/json/china.json'

import ArcoVue from '@arco-design/web-vue'
import '@arco-design/web-vue/dist/arco.css'

echarts.registerMap('china', china)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

const myApp = createApp(App)
myApp.config.globalProperties.$api = api
myApp.config.globalProperties.$bus = bus
myApp.config.globalProperties.$echarts = echarts

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  myApp.component(key, component)
}
myApp
  .use(elementPlus, { locale, size: 'default', zIndex: 300 })
  .use(pinia)
  .use(router)
  .use(ArcoVue)
  .mount('#app')
