import App from './App.svelte';

import apiConfig from './api/config'
import helpers from './libs/helpers'

var lang = helpers.getBrowserLang();
var query = window.location.hash.split('?')[1]
var config = helpers.getUrlParameter(query, 'config', 'config/config.json')
apiConfig.getConfig(config).then((data) => {
    const app = new App({
        target: document.body,
        props: {
            lang: lang || data.app.lang,
            config: data
        }
    });
}, (error) => {
    console.log('Error: Can\'t load config file.')
    console.log(error)
})

export default app;