import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; import { ExportProvider } from './contexts/ExportContext'; import './index.css'; /** * Error Boundary for graceful error handling. */ class ErrorBoundary extends React.Component< { children: React.ReactNode }, { hasError: boolean; error?: Error } > { constructor(props: { children: React.ReactNode }) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error: Error) { return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { console.error('GetMD Error:', error, errorInfo); } render() { if (this.state.hasError) { return (

Something went wrong

{this.state.error?.message || 'An unexpected error occurred while loading the GetMD plugin.'}

); } return this.props.children; } } /** * Initialize the React application. */ const initApp = () => { const root = document.getElementById('summix-getmd-export-root'); if (root) { ReactDOM.createRoot(root).render( ); } else { console.error('GetMD: Mount point #summix-getmd-export-root not found'); } }; // Initialize after DOM is ready to prevent race conditions if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initApp); } else { initApp(); }