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

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

import { NpcsEditorApp } from './NpcsEditorApp';

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

createRoot(rootEl).render(
  <React.StrictMode>
    <WindowErrorBoundary title="НПС">
      <EditorI18nProvider>
        <NpcsEditorApp />
      </EditorI18nProvider>
    </WindowErrorBoundary>
  </React.StrictMode>,
);
