import React from 'react';
import { createRoot } from 'react-dom/client';

import '../shared/ui/globals.css';
import { WindowErrorBoundary } from '../shared/ui/WindowErrorBoundary';
import { EditorApp } from './EditorApp';
import { EditorI18nProvider } from './i18n/EditorI18nContext';

const rootEl = document.getElementById('root');
if (!rootEl) {
  throw new Error('Missing #root element');
}

createRoot(rootEl).render(
  <React.StrictMode>
    <WindowErrorBoundary title="Редактор">
      <EditorI18nProvider>
        <EditorApp />
      </EditorI18nProvider>
    </WindowErrorBoundary>
  </React.StrictMode>,
);
