import { Suspense, lazy } from 'react' import { Navigate } from 'react-router-dom' import { BrowserRouter as Router, Routes, Route, Outlet } from 'react-router-dom' import { Toaster } from 'react-hot-toast' import Layout from './components/Layout' import { ToastContainer } from './components/Toast' import { SetupGuard } from './components/SetupGuard' import { LoadingOverlay } from './components/LoadingStates' import RequireAuth from './components/RequireAuth' import { AuthProvider } from './context/AuthContext' // Lazy load pages for code splitting const Dashboard = lazy(() => import('./pages/Dashboard')) const ProxyHosts = lazy(() => import('./pages/ProxyHosts')) const RemoteServers = lazy(() => import('./pages/RemoteServers')) const DNS = lazy(() => import('./pages/DNS')) const ImportCaddy = lazy(() => import('./pages/ImportCaddy')) const ImportCrowdSec = lazy(() => import('./pages/ImportCrowdSec')) const ImportNPM = lazy(() => import('./pages/ImportNPM')) const ImportJSON = lazy(() => import('./pages/ImportJSON')) const Certificates = lazy(() => import('./pages/Certificates')) const DNSProviders = lazy(() => import('./pages/DNSProviders')) const SystemSettings = lazy(() => import('./pages/SystemSettings')) const SMTPSettings = lazy(() => import('./pages/SMTPSettings')) const CrowdSecConfig = lazy(() => import('./pages/CrowdSecConfig')) const Account = lazy(() => import('./pages/Account')) const Settings = lazy(() => import('./pages/Settings')) const Backups = lazy(() => import('./pages/Backups')) const Tasks = lazy(() => import('./pages/Tasks')) const Logs = lazy(() => import('./pages/Logs')) const Domains = lazy(() => import('./pages/Domains')) const Security = lazy(() => import('./pages/Security')) const AccessLists = lazy(() => import('./pages/AccessLists')) const WafConfig = lazy(() => import('./pages/WafConfig')) const RateLimiting = lazy(() => import('./pages/RateLimiting')) const Uptime = lazy(() => import('./pages/Uptime')) const Notifications = lazy(() => import('./pages/Notifications')) const UsersPage = lazy(() => import('./pages/UsersPage')) const SecurityHeaders = lazy(() => import('./pages/SecurityHeaders')) const AuditLogs = lazy(() => import('./pages/AuditLogs')) const EncryptionManagement = lazy(() => import('./pages/EncryptionManagement')) const Plugins = lazy(() => import('./pages/Plugins')) const Login = lazy(() => import('./pages/Login')) const Setup = lazy(() => import('./pages/Setup')) const AcceptInvite = lazy(() => import('./pages/AcceptInvite')) export default function App() { return ( }> } /> } /> } /> }> } /> } /> } /> } /> } /> {/* DNS Routes */} }> } /> } /> } /> {/* Legacy redirect for old bookmarks */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Settings Routes */} }> } /> } /> } /> } /> } /> } /> } /> {/* Tasks Routes */} }> } /> } /> } /> } /> } /> } /> } /> ) }