// 🛡️ Katman 1: StorageGuard must be imported FIRST before any other module runs
import './services/storageGuard';
import './services/afaZeroDefaultEngine';

import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import './index.css';
import { initGlobalErrorMonitoring } from './services/errorMonitoring';
import { initTranslationLeakDetector } from './utils/translationLeakDetector';
import { ErrorBoundary } from './components/ErrorBoundary';

// Initialize Day-One Sentry-like crash monitoring
initGlobalErrorMonitoring();

// Initialize automatic Translation Leak Detector (scans components & logs hardcoded strings to console)
initTranslationLeakDetector({ runOnStartup: true, delayMs: 1000 });

async function initSupernovaBootloader(): Promise<void> {
  if (typeof window === 'undefined') return;
  console.log('[Bootloader] 🛑 AUTO-HYDRATION DISABLED: Only manual imports allowed.');
}

initSupernovaBootloader().then(() => {
  createRoot(document.getElementById('root')!).render(
    <StrictMode>
      <ErrorBoundary>
        <App />
      </ErrorBoundary>
    </StrictMode>,
  );
});
