import { createApp } from "vue";
import { createI18n } from "vue-i18n";
import pinia from "@/plugins/store.js";
import heroicons from "./plugins/heroicons";
import VueNumberFormat from "vue-number-format";
import MoneyFormat from "@/components/MoneyFormat.vue";
import TimeFormat from "@/components/TimeFormat.vue";

import "@/assets/admin-app.css";

const i18n = createI18n({
  locale: "en",
  messages: window.gcargo.strings,
  legacy: false,
});

export default function init(App) {
  let app = createApp(App)
    .use(pinia)
    .use(i18n)
    .use(VueNumberFormat, { prefix: "", decimal: ".", thousand: "," })
    .component("MoneyFormat", MoneyFormat)
    .component("TimeFormat", TimeFormat);
  app = heroicons(app);
  app.mount("#gcargo-app");
}
