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=KJ-eur-MBJF95ae80&pose=pano:58,qua:0,-0.7979,0,0.6028&lang=zh_HK";
} else if (!browser.hasURLParam("pose") && browser.getURLParam("m") == "KJ-eur-MBJF95ae80") {
  let url = window.location.href + `&pose=pano:58,qua:0,-0.7979,0,0.6028&lang=zh_HK`;
  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");
  })


}
