// import 'default-passive-events';
import App from "./App";
import store from "./store/index";

import { Provider } from "react-redux";
import { createRoot } from "react-dom/client";

import { ConfigProvider } from "antd";

// 兼容360浏览器
import {
  StyleProvider,
  legacyLogicalPropertiesTransformer,
} from "@ant-design/cssinjs";

import "dayjs/locale/zh-cn";
import locale from "antd/locale/zh_CN";
import { isMobileFu } from "./utils/history";
// import AppM from "./AppM";

const container = document.getElementById("root") as HTMLElement;
const root = createRoot(container);

// 静态资源地址
// @ts-ignore
export const baseUrl = baseUrlTemp;

// 数据存到仓库
// @ts-ignore
store.dispatch({ type: "layout/setDataAll", payload: staticDataTemp });

if (isMobileFu()) {
  root.render(
    <ConfigProvider
      locale={locale}
      theme={{
        token: {
          colorPrimary: "#FCE9AC",
        },
      }}
    >
      <Provider store={store}>
        <StyleProvider
          hashPriority="high"
          transformers={[legacyLogicalPropertiesTransformer]}
        >
          {/* <AppM /> */}
          <App />
        </StyleProvider>
      </Provider>
    </ConfigProvider>
  );
} else {
  root.render(
    <ConfigProvider
      locale={locale}
      theme={{
        token: {
          colorPrimary: "#FCE9AC",
        },
      }}
    >
      <Provider store={store}>
        <StyleProvider
          hashPriority="high"
          transformers={[legacyLogicalPropertiesTransformer]}
        >
          <App />
        </StyleProvider>
      </Provider>
    </ConfigProvider>
  );
}
