import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
import { logPerformanceMetrics } from './utils/performance';
import './index.css';

const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Root element not found');


document.addEventListener('DOMContentLoaded', () => {
    const metaTag = document.createElement('meta');
    metaTag.httpEquiv = 'Content-Security-Policy';
    metaTag.content = "connect-src 'self' https://api.openai.com https://vvekqifqtgwytknxovoy.supabase.co https://vvekqifqtgwytknxovoy.supabase.co/auth/v1/token";
    document.head.appendChild(metaTag);
});

createRoot(rootElement).render(
  <StrictMode>
    <App />
  </StrictMode>
);

// Monitor performance metrics
logPerformanceMetrics();