import { QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import Internationalization from 'components/internaltionalization';
import { GlobalSpin } from 'components/spin';
import { queryClient } from 'queries';
import { Suspense } from 'react';
import { createRoot } from 'react-dom/client';
import AppRoutes from 'routes';
import { Worker } from '@react-pdf-viewer/core';

import 'antd/dist/reset.css';
import './theme/compose.scss';

function App() {
  return (
    <Suspense fallback={<GlobalSpin />}>
      <QueryClientProvider client={queryClient}>
        <Internationalization>
          {/* <AbilityContext.Provider value={appAbilitiy}> */}
          <Worker workerUrl="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js">
          <AppRoutes />
          </Worker>
          {/* </AbilityContext.Provider> */}
        </Internationalization>
        <ReactQueryDevtools initialIsOpen={false} />
      </QueryClientProvider>
    </Suspense>
  );
}

const container = document.getElementById('root')!;
const root = createRoot(container);
root.render(<App />);
