import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import LuckyCanvas from '@lucky-canvas/vue'

import './style/index.css'

import 'virtual:uno.css'
// 注册svg
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/common/SvgIcon/svgIcon.vue'

// 注册notivue
import { createNotivue } from 'notivue'
import 'notivue/notification.css'
import 'notivue/animations.css'

import { vParseComment } from '@/directives'

if (import.meta.env.MODE === 'production') {
  import('@/utils/version').then(({ loopGetVersion }) => loopGetVersion())
}

const notivue = createNotivue({
  notifications: {
    global: {
      duration: 2500,
    },
  },
})

const app = createApp(App)
app.use(notivue)
app.use(createPinia())
app.use(router)
app.use(LuckyCanvas)

// 全局指令挂载
app.directive('parse-comment', vParseComment)
// 全局组件挂载
app.component('SvgIcon', SvgIcon)
app.mount('#app')
