// Dynamically loads libraries and bootstraps the application
(async ()=>{
    // Add a loader here if any
    const root = document.getElementById('root')
    if(root) root.innerHTML= `<div style="align-self: center">My app has loaded!!</div>`;

    try {
        // Load app
        const [
            appModule,
        ] = await Promise.all([
            import("./app.tsx"),
        ]);

        console.log("Bootstrapped, ready to go!");

        // Wait for DOM to be ready
        if(document.readyState === 'loading') {
            await new Promise((resolve)=>document.addEventListener('DOMContentLoaded', resolve));
        }

        // Start the app!
        await appModule.start({root});
    }catch(err){
        console.error(err);
    }
})()
