import { createApp } from 'vue';
import { NModal } from 'naive-ui';
import './plugins/assets';
import { setupAppVersionNotification, setupDayjs, setupIconifyOffline, setupLoading, setupNProgress } from './plugins';
import { setupStore } from './store';
import { setupRouter } from './router';
import { setupI18n } from './locales';
import { setupDirective } from './directive';
import App from './App.vue';

// 配置NModal全局属性
NModal.props.maskClosable.default = false;

if (import.meta.env.MODE !== 'test') {
  console.log = () => {};
}

async function setupApp() {
  setupLoading();

  setupNProgress();

  setupIconifyOffline();

  setupDayjs();

  const app = createApp(App);

  setupStore(app);

  setupDirective(app);

  await setupRouter(app);

  setupI18n(app);

  setupAppVersionNotification();

  app.mount('#app');
}

setupApp();
