import React, { useState, useEffect, useCallback, useRef, Suspense, lazy } from "react"; import { STORAGE_KEY, NAV_ITEMS, defaultData } from "./constants.js"; import { migrateDashboardLayout, verifyPassword, withHashedPassword, stripCredentials } from "./utils.js"; import Login from "./views/Login.jsx"; import Setup from "./views/Setup.jsx"; import MigrationScreen from "./views/MigrationScreen.jsx"; import UpdateNotifier from "./components/UpdateNotifier.jsx"; // Code-split: each view loads on demand to keep the initial bundle small. const Dashboard = lazy(() => import("./views/Dashboard.jsx")); const Projects = lazy(() => import("./views/Projects.jsx").then(m => ({ default: m.Projects }))); const ProjectDetail = lazy(() => import("./views/Projects.jsx").then(m => ({ default: m.ProjectDetail }))); const Time = lazy(() => import("./views/Time.jsx")); const Expenses = lazy(() => import("./views/Expenses.jsx").then(m => ({ default: m.Expenses }))); const InternalExpenses = lazy(() => import("./views/Expenses.jsx").then(m => ({ default: m.InternalExpenses }))); const Protocols = lazy(() => import("./views/Protocols.jsx")); const DeliveryNotes = lazy(() => import("./views/DeliveryNotes.jsx")); const Accounting = lazy(() => import("./views/Accounting.jsx")); const Invoices = lazy(() => import("./views/Invoices.jsx")); const Quotes = lazy(() => import("./views/Quotes.jsx")); const Persons = lazy(() => import("./views/Persons.jsx")); const Letters = lazy(() => import("./views/Letters.jsx")); const Settings = lazy(() => import("./views/Settings.jsx")); const StudioBudget = lazy(() => import("./views/StudioBudget.jsx")); const Payroll = lazy(() => import("./views/Payroll.jsx")); const Employees = lazy(() => import("./views/Employees.jsx")); const Pinboard = lazy(() => import("./views/Pinboard.jsx")); const Documents = lazy(() => import("./views/Documents.jsx")); const PrintView = lazy(() => import("./print/PrintComponents.jsx").then(m => ({ default: m.PrintView }))); function ViewFallback() { return (