import '@crami/ui/dist/CramiUI.less';
import '@crami/bui/dist/CramiBui.less';
import '@wangeditor/editor/dist/css/style.css';

import CramiUI from '@crami/ui';
import CramiBui, { setupCramiBui } from '@crami/bui';
import { usePlatformConfig } from '@crami/bui-platform';

import { http } from '@/utils/request';
import { createRouterGuard } from './guard';
import { registerPermission } from '@remote/icpx-platform/utils';

// import { ConfigProvider } from 'ant-design-vue';
import 'virtual:svg-icons-register';

import '@crami/icons/load';
import { useIcons } from '@/icons';

import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import updateLocale from 'dayjs/plugin/updateLocale';

// 模块联邦: 替换成远程引入
import Create from '@remote/icpx-platform/Create';
import Edit from '@remote/icpx-platform/Edit';
import View from '@remote/icpx-platform/View';

import { createApp } from 'vue';
import './style.css';
import './app.less';
import App from './App.vue';
import router from './router';

// dayjs.extend(updateLocale);
// dayjs.extend(relativeTime);

const app = createApp(App);
// 添加权限自定义指令
registerPermission(app);

setupCramiBui(app as any, { useProTable: true });
usePlatformConfig({ useProTable: true });

app.component(Create.name, Create);
app.component(Edit.name, Edit);
app.component(View.name, View);

app
  .use(http)
  // .use(ConfigProvider as any)
  .use(router as any)
  .use(CramiUI as any)
  .use(CramiBui as any);

useIcons(app);

// 添加路由守卫
createRouterGuard(router, app);

app.mount('#app');
