import { createApp, defineComponent, h } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/iconfont/iconfont.css";
import "./assets/iconfont/iconfont.js";
import "./assets/iconfont2/iconfont.css";
import flexible from "./tool/flexible.js";
import "ant-design-vue/dist/antd.css";
import Antd from "ant-design-vue";
import "./assets/style/style.less";
import VueLazyload from "vue-lazyload";
import i18n from "./lang/index";
import { getBrowserInfo, murmur } from "./tool/util";
import "../node_modules/@flaticon/flaticon-uicons/css/all/all.css";
// import { Https } from "@/tool/https";
import "swiper/css";
import "swiper/css/pagination";
import SvgIcon from "@/component/Canvas/SvgIcon/index.vue";
import "virtual:svg-icons-register";

// import "@/tool/color-thief.js";
// import "@/tool/fabric.brushes.js";
// import "@/tool/fabric.min.js";
const app = createApp(App);
flexible();
// alert(window.innerWidth)
import { getCookie, setCookie } from "@/tool/cookie";
import loadingGif from "./assets/images/homePage/loading.gif";

document.addEventListener("touchstart", function (event) {
  event.preventDefault(); // 阻止长按选中
});

document.addEventListener('keydown', function(event) {
    if (event.key === "Tab") {
        event.preventDefault();
    }
});

//全局事件
//下拉菜单全部关掉事件
// 创建全局事件系统
const dropdownEvents = {
	listeners: new Set(),
	
	closeAll() {
	  this.listeners.forEach(listener => {
		// console.log(listener)
		listener()
	  })
	},
	
	onClose(listener) {
	  this.listeners.add(listener)
	},
	
	offClose(listener) {
	  this.listeners.delete(listener)
	}
}
document.addEventListener('click', () => {
	dropdownEvents.closeAll()
})
app.config.globalProperties.$dropdownEvents = dropdownEvents

let loadingParam = {
  loading: loadingGif,
  attempt: 1,
};
app
  .use(store)
  .use(router)
  .use(Antd)
  .use(VueLazyload, loadingParam)
  .component("SvgIcon", SvgIcon)
  .use(i18n)
  .mount("#app");
