import { createApp, type Component } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from './router'
import './assets/styles/index.css'
import App from './App.vue'

// 全局注册 Lucide 图标
import * as iconModule from 'lucide-vue-next'

const app = createApp(App)

// 注册所有图标为全局组件（过滤非组件）
for (const [name, icon] of Object.entries(iconModule)) {
  if (typeof icon === 'object' && icon !== null && 'render' in icon) {
    app.component(name, icon as Component)
  }
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus)

app.mount('#app')
