import { createApp } from "vue";
import "./styles.css";
//import App from "./AppHyperSpectral.vue";
import App from "./App.vue";
import { appWindow } from "@tauri-apps/api/window";
import { LogicalSize } from "@tauri-apps/api/window";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { createBootstrap } from "bootstrap-vue-next";

//
// // Add the necessary CSS
import "bootstrap/dist/css/bootstrap.css";
import "bootstrap-vue-next/dist/bootstrap-vue-next.css";
import ArcoVue from "@arco-design/web-vue";

import "@arco-design/web-vue/dist/arco.css";
import {
  Draggable,
  DraggablePlugin,
  DraggableDirective,
} from "@braks/revue-draggable";
import KonamiCode from "vue3-konami-code";
import EventBus from "./eventBus.js";
import tauriApi from "./utils/tauriApi.js";
import { reactive } from 'vue';
async function setWindowSize() {
  // const primaryMonitor = await screen.primaryMonitor();
  // const screenSize = primaryMonitor.size;

  const newSize = new LogicalSize(800, 600);
  await appWindow.setSize(newSize);
  // appWindow.setSize(new Size(1000, 1000));
}
var app = createApp(App);
app.use(ElementPlus, {
  locale: zhCn,
});
app.use(
  createBootstrap({
    components: true,
    directives: true,
    plugins: true,
    icons: true,
  })
);
app.use(ArcoVue);
app.use(DraggablePlugin);
app.use(KonamiCode, {
  onKonamiCodeEntered: () => {
    // 用户输入Konami Code后执行的代码
    console.log("Konami Code 已输入!");
    EventBus.emit("konamiactive");
  },
});
// or
app.directive("draggable", DraggableDirective);
app.component("Draggable", Draggable);

// 注册全局 API
app.config.globalProperties.$tauriApi = tauriApi;

// 创建响应式全局状态
const globalState = reactive({
  isDevOpen: false,
  // 其他全局状态
});
//设置全局变量 
app.config.globalProperties.$globalState = globalState;

// app.use(BootstrapVueIcons);
app.mount("#app");
