import App from '@/App.vue';
import { installRouter } from '@/router';
import { initPageLoader } from '@/utils/pageLoader'; // ✅ Import loader init
import { registerPlugins } from '@core/utils/plugins';
import { createApp } from 'vue';

import '@core-scss/template/index.scss';
import '@layouts/styles/index.scss';
import '@styles/styles.scss';

// Initialize page loader BEFORE app mounts
// This checks localStorage and shows loader if needed
initPageLoader()

const app = createApp(App)

registerPlugins(app)

installRouter(app)

// Preload the loader GIF to cache it early
const _preloadedLoader = new Image();
_preloadedLoader.src = '/images/loader.gif';

// Mount the app
app.mount('#app')
