import { createApp } from 'vue';
import App from './App.vue';
import { createPinia } from 'pinia';
import { i18n } from '@/i18n/i18n.js';

window.appInstance = null;

const app = createApp(App);
app.use(i18n);
app.use(createPinia());
if (import.meta.env.DEV) {
  app.config.devtools = true;
  app.config.performance = true;
}
const mountApp = () => {
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', () => app.mount('#app'));
  } else {
    app.mount('#app');
  }
};

if (window.kanban_card_template_promise) {
  window.kanban_card_template_promise.then(mountApp).catch(mountApp);
} else {
  mountApp();
}
