import { createSSRApp } from 'vue'
import * as Pinia from 'pinia'

import 'uno.css'
import App from './App.vue'
import { setupAppConfig } from '@/config/app'
import { setupStore } from '@/store'
import { setupI18n } from '@/locales'
import FuiConfig from '@/components/firstui/fui-config'

export function createApp() {
    const app = createSSRApp(App)

    // 注册 APP 配置
    setupAppConfig(app)

    // 配置 store
    setupStore(app)

    // 配置 i18n
    setupI18n(app)

    // 全局组件配置
    // @ts-expect-error
    uni.$fui = FuiConfig

    return {
        app,
        Pinia,
    }
}
