import "@/assets/theme.editor.scss";
import ClickOutSide from "./utils/fns/ClickOutSide";
import Components from "./global_components";
import { createApp } from "vue";
import store from "./store";
import App from "./app.vue";
import browser from "@/utils/browser";
import i18n, { getLocale, setI18nLanguage, loadLocaleMessages } from './i18n'

if (!window.location.search) {
  window.location.href = "/index.html?m=eur-KJ-z5ZEV22AeU&pose=pano:408,qua:-0.006,0.6299,0.0049,0.7766";
} else if (!browser.hasURLParam("pose") && browser.getURLParam("m") == "eur-KJ-z5ZEV22AeU") {
  let url = window.location.href + `&pose=pano:408,qua:-0.006,0.6299,0.0049,0.7766`;
  window.location.href = url;
} else {


  const local = getLocale()
  loadLocaleMessages(i18n, local).then(() => {
    setI18nLanguage(i18n, local)
    const app = createApp(App);
    app.use(i18n);
    app.use(store);
    app.use(Components);
    app.directive("click-outside", ClickOutSide);
    app.mount("#app");
  })


}
