// #ifndef VUE3
import Vue from 'vue'
import App from '@/App'
import store from '@/store'
import appSettings from '@/core/config/app-settings'
import mpShareMixin from '@/platform/mp-share'
import Base64Codec from '@/core/infra/codec-base64'
import { registerHttpInterceptors, createHttpFacade } from '@/core/http'
import * as businessApi from '@/core/api'
import { buildRuntimeToolkit } from '@/core/kit/runtime-toolkit'
import { installGlobalShortcuts } from '@/features/global-shortcuts'
import { createAppI18n } from '@/bootstrap/i18n-factory'

// #ifdef H5
import { runningInsideWeChat } from '@/platform/h5-wechat'
// #endif

Vue.mixin(mpShareMixin)
Vue.config.productionTip = !!appSettings.debug

const i18n = createAppI18n(Vue)
const sink = Vue.prototype
sink.$store = store
sink.$base64 = new Base64Codec()
// #ifdef H5
sink.$jssdk = { isWechat: runningInsideWeChat }
// #endif
sink.$appKit = buildRuntimeToolkit(i18n)
sink.$http = createHttpFacade()
sink.$api = businessApi
installGlobalShortcuts(sink)
registerHttpInterceptors(i18n)

App.mpType = 'app'
const app = new Vue({
	i18n,
	store,
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { bootstrapVue3App } from '@/bootstrap/launcher'

export function createApp() {
	return bootstrapVue3App()
}
// #endif
